idle loop detection (Cyclone only, with debug stuff)
[picodrive.git] / Pico / Cart.c
index 4dac3df..e65b509 100644 (file)
@@ -481,7 +481,10 @@ int PicoCartLoad(pm_file *f,unsigned char **prom,unsigned int *psize)
   }\r
 \r
   // Check for SMD:\r
-  if ((size&0x3fff)==0x200) { DecodeSmd(rom,size); size-=0x200; } // Decode and byteswap SMD\r
+  if (size >= 0x4200 && (size&0x3fff)==0x200 &&\r
+      ((rom[0x2280] == 'S' && rom[0x280] == 'E') || (rom[0x280] == 'S' && rom[0x2281] == 'E'))) {\r
+    DecodeSmd(rom,size); size-=0x200; // Decode and byteswap SMD\r
+  }\r
   else Byteswap(rom,size); // Just byteswap\r
 \r
   if (prom)  *prom=rom;\r
@@ -545,6 +548,7 @@ int PicoCartInsert(unsigned char *rom,unsigned int romsize)
 int PicoCartUnload(void)\r
 {\r
   if (Pico.rom != NULL) {\r
+    SekFinishIdleDet();\r
     free(Pico.rom);\r
     Pico.rom=NULL;\r
   }\r
@@ -704,6 +708,12 @@ static void PicoCartDetect(void)
     carthw_realtec_startup();\r
   }\r
 \r
+  // Radica mapper\r
+  else if (name_cmp("KID CHAMELEON") == 0 && Pico.romsize > 0x100000)\r
+  {\r
+    carthw_radica_startup();\r
+  }\r
+\r
   // Some games malfunction if SRAM is not filled with 0xff\r
   if (name_cmp("DINO DINI'S SOCCER") == 0 ||\r
       name_cmp("MICRO MACHINES II") == 0)\r