X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2FCart.c;h=4b94b47816030e5adc69fea353391512fbb5c108;hb=c46ffd310f86522e2557e4d19945de5a40350ffc;hp=6eb7fc7ad4d7ce1942c47215780b5cd0cf88901d;hpb=757f8dae1a2e71eb299cfb82269a1b1507da63bf;p=picodrive.git diff --git a/Pico/Cart.c b/Pico/Cart.c index 6eb7fc7..4b94b47 100644 --- a/Pico/Cart.c +++ b/Pico/Cart.c @@ -504,6 +504,7 @@ int PicoCartInsert(unsigned char *rom,unsigned int romsize) PicoDmaHook = NULL; PicoResetHook = NULL; PicoLineHook = NULL; + PicoLoadStateHook = NULL; carthw_chunks = NULL; PicoMemReset(); @@ -521,9 +522,12 @@ int PicoCartInsert(unsigned char *rom,unsigned int romsize) return PicoReset(1); } -int PicoUnloadCart(unsigned char* romdata) +int PicoCartUnload(void) { - free(romdata); + if (Pico.rom != NULL) { + free(Pico.rom); + Pico.rom=NULL; + } return 0; } @@ -542,7 +546,10 @@ static int name_cmp(const char *name) return rom_strcmp(0x150, name); } -/* various cart-specific things, which can't be handled by generic code */ +/* + * various cart-specific things, which can't be handled by generic code + * (maybe I should start using CRC for this stuff?) + */ void PicoCartDetect(void) { int sram_size = 0, csum; @@ -647,13 +654,22 @@ void PicoCartDetect(void) PicoSVPStartup(); } - // Detect 4-in-1 and 12-in-1 + // Detect 12-in-1 mapper else if ((name_cmp("ROBOCOP 3") && Pico.romsize == 0x200000) || - (rom_strcmp(0x160, "FLICKY") && Pico.romsize == 0x200000)) + (rom_strcmp(0x160, "FLICKY") && Pico.romsize >= 0x200000)) { carthw_12in1_startup(); } + // Realtec mapper + else if (Pico.romsize == 512*1024 && ( + rom_strcmp(0x94, "THE EARTH DEFEND") || + rom_strcmp(0xfe, "WISEGAME 11-03-1993") || // Funny World + rom_strcmp(0x95, "MALLET LEGEND "))) // Whac-A-Critter + { + carthw_realtec_startup(); + } + // Some games malfunction if SRAM is not filled with 0xff if (name_cmp("DINO DINI'S SOCCER") == 0 || name_cmp("MICRO MACHINES II") == 0)