X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2FCart.c;h=25bb96106b2559325a7b7330c06bb2428b788c04;hb=7b802576b284e113c637324e583a3a44e0e8e871;hp=6eb7fc7ad4d7ce1942c47215780b5cd0cf88901d;hpb=757f8dae1a2e71eb299cfb82269a1b1507da63bf;p=picodrive.git diff --git a/Pico/Cart.c b/Pico/Cart.c index 6eb7fc7..25bb961 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 - else if ((name_cmp("ROBOCOP 3") && Pico.romsize == 0x200000) || - (rom_strcmp(0x160, "FLICKY") && Pico.romsize == 0x200000)) + // Detect 12-in-1 mapper + else if ((name_cmp("ROBOCOP 3") == 0 && Pico.romsize == 0x200000) || + (rom_strcmp(0x160, "FLICKY") == 0 && Pico.romsize >= 0x200000)) { carthw_12in1_startup(); } + // Realtec mapper + else if (Pico.romsize == 512*1024 && ( + rom_strcmp(0x94, "THE EARTH DEFEND") == 0 || + rom_strcmp(0xfe, "WISEGAME 11-03-1993") == 0 || // Funny World + rom_strcmp(0x95, "MALLET LEGEND ") == 0)) // 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)