X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2FCart.c;h=6eb7fc7ad4d7ce1942c47215780b5cd0cf88901d;hb=145650410c2a6a4b0277067e8237537bb57063af;hp=7c3f36d49e52d4d6c53403744287b8405b898fae;hpb=f8ef8ff7100baa0ac0ecfcacb47aea3a9e24bc38;p=picodrive.git diff --git a/Pico/Cart.c b/Pico/Cart.c index 7c3f36d..6eb7fc7 100644 --- a/Pico/Cart.c +++ b/Pico/Cart.c @@ -15,6 +15,8 @@ static char *rom_exts[] = { "bin", "gen", "smd", "iso" }; +void (*PicoCartUnloadHook)(void) = NULL; + void (*PicoCartLoadProgressCB)(int percent) = NULL; void (*PicoCDLoadProgressCB)(int percent) = NULL; // handled in Pico/cd/cd_file.c @@ -493,14 +495,24 @@ int PicoCartInsert(unsigned char *rom,unsigned int romsize) Pico.rom=rom; Pico.romsize=romsize; + if (PicoCartUnloadHook != NULL) { + PicoCartUnloadHook(); + PicoCartUnloadHook = NULL; + } + PicoMemResetHooks(); PicoDmaHook = NULL; PicoResetHook = NULL; + PicoLineHook = NULL; + carthw_chunks = NULL; + + PicoMemReset(); if (!(PicoMCD & 1)) PicoCartDetect(); // setup correct memory map for loaded ROM + // call PicoMemReset again due to possible memmap change if (PicoMCD & 1) PicoMemSetupCD(); else PicoMemSetup(); @@ -628,19 +640,29 @@ void PicoCartDetect(void) SRam.eeprom_bit_out= 7; } + // SVP detection + else if (name_cmp("Virtua Racing") == 0 || + name_cmp("VIRTUA RACING") == 0) + { + 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)) + { + carthw_12in1_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) + { memset(SRam.data, 0xff, sram_size); + } // Unusual region 'code' if (rom_strcmp(0x1f0, "EUROPE") == 0) *(int *) (Pico.rom+0x1f0) = 0x20204520; - - // SVP detection - if (name_cmp("Virtua Racing") == 0) - { - PicoSVPInit(); - } }