X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2FCart.c;h=7c3f36d49e52d4d6c53403744287b8405b898fae;hb=f8ef8ff7100baa0ac0ecfcacb47aea3a9e24bc38;hp=a19dcc86b91c72d63c16f677cfce3282a191a735;hpb=ca61ee42d9298aeb5a5c97d9addaa1832af41d67;p=picodrive.git diff --git a/Pico/Cart.c b/Pico/Cart.c index a19dcc8..7c3f36d 100644 --- a/Pico/Cart.c +++ b/Pico/Cart.c @@ -481,7 +481,7 @@ int PicoCartLoad(pm_file *f,unsigned char **prom,unsigned int *psize) return 0; } -// Insert/remove a cartridge: +// Insert a cartridge: int PicoCartInsert(unsigned char *rom,unsigned int romsize) { // notaz: add a 68k "jump one op back" opcode to the end of ROM. @@ -493,15 +493,19 @@ int PicoCartInsert(unsigned char *rom,unsigned int romsize) Pico.rom=rom; Pico.romsize=romsize; + PicoMemResetHooks(); + PicoDmaHook = NULL; + PicoResetHook = NULL; + + if (!(PicoMCD & 1)) + PicoCartDetect(); + // setup correct memory map for loaded ROM if (PicoMCD & 1) PicoMemSetupCD(); else PicoMemSetup(); PicoMemReset(); - if (!(PicoMCD & 1)) - PicoCartDetect(); - return PicoReset(1); } @@ -546,10 +550,12 @@ void PicoCartDetect(void) Pico.m.sram_reg |= 4; } else { // normal SRAM - SRam.start = PicoRead32(0x1B4) & 0xFFFF00; + SRam.start = PicoRead32(0x1B4) & ~0xff; SRam.end = PicoRead32(0x1B8) | 1; sram_size = SRam.end - SRam.start + 1; } + SRam.start &= ~0xff000000; + SRam.end &= ~0xff000000; Pico.m.sram_reg |= 0x10; // SRAM was detected } if (sram_size <= 0) @@ -630,5 +636,11 @@ void PicoCartDetect(void) // Unusual region 'code' if (rom_strcmp(0x1f0, "EUROPE") == 0) *(int *) (Pico.rom+0x1f0) = 0x20204520; + + // SVP detection + if (name_cmp("Virtua Racing") == 0) + { + PicoSVPInit(); + } }