more wip SVP code
[picodrive.git] / Pico / Cart.c
index 749d461..7c3f36d 100644 (file)
@@ -481,7 +481,7 @@ int PicoCartLoad(pm_file *f,unsigned char **prom,unsigned int *psize)
   return 0;\r
 }\r
 \r
-// Insert/remove a cartridge:\r
+// Insert a cartridge:\r
 int PicoCartInsert(unsigned char *rom,unsigned int romsize)\r
 {\r
   // notaz: add a 68k "jump one op back" opcode to the end of ROM.\r
@@ -493,15 +493,19 @@ int PicoCartInsert(unsigned char *rom,unsigned int romsize)
   Pico.rom=rom;\r
   Pico.romsize=romsize;\r
 \r
+  PicoMemResetHooks();\r
+  PicoDmaHook = NULL;\r
+  PicoResetHook = NULL;\r
+\r
+  if (!(PicoMCD & 1))\r
+    PicoCartDetect();\r
+\r
   // setup correct memory map for loaded ROM\r
   if (PicoMCD & 1)\r
        PicoMemSetupCD();\r
   else PicoMemSetup();\r
   PicoMemReset();\r
 \r
-  if (!(PicoMCD & 1))\r
-    PicoCartDetect();\r
-\r
   return PicoReset(1);\r
 }\r
 \r
@@ -632,5 +636,11 @@ void PicoCartDetect(void)
   // Unusual region 'code'\r
   if (rom_strcmp(0x1f0, "EUROPE") == 0)\r
     *(int *) (Pico.rom+0x1f0) = 0x20204520;\r
+\r
+  // SVP detection\r
+  if (name_cmp("Virtua Racing") == 0)\r
+  {\r
+    PicoSVPInit();\r
+  }\r
 }\r
 \r