Merge branch 'libretro' into libretro-reset
[picodrive.git] / pico / patch.c
index d2bbec4..d534a2c 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 #include "pico_int.h"
+#include "memory.h"
 #include "patch.h"
 
 struct patch
@@ -173,8 +174,8 @@ void genie_decode_ms(const char *code, struct patch *result)
   /* Correct the address */
   result->addr = ((result->addr >> 4) | (result->addr << 12 & 0xF000)) ^ 0xF000;
   /* Optional: 3 digits for comp */
-  printf("CHEAT: code[8]==%c\n",code[8]);
-  if (code[7]=='-'){
+  if (code[7]=='-')
+  {
     for(i=8;i<11;++i)
     {
       if (i==9) continue; /* 2nd character is ignored */
@@ -354,15 +355,6 @@ void decode(const char* code, struct patch* result)
   return;
 }
 
-
-
-unsigned int PicoRead16(unsigned int a);
-void PicoWrite16(unsigned int a, unsigned short d);
-extern unsigned short m68k_read16(unsigned int a);
-extern void m68k_write16(unsigned int a, unsigned short d);
-extern char PicoRead8_z80(unsigned short a);
-extern void PicoWrite8_z80(unsigned short a, char d);
-
 void PicoPatchUnload(void)
 {
    if (PicoPatches != NULL)
@@ -456,7 +448,7 @@ void PicoPatchPrepare(void)
          if(!(PicoAHW & PAHW_SMS))
             PicoPatches[i].data_old = (unsigned short) m68k_read16(addr);
          else
-            PicoPatches[i].data_old = (unsigned char) PicoRead8_z80(addr);
+            ;// wrong: PicoPatches[i].data_old = (unsigned char) PicoRead8_z80(addr);
       }
       if (strstr(PicoPatches[i].name, "AUTO"))
          PicoPatches[i].active = 1;
@@ -504,7 +496,7 @@ void PicoPatchApply(void)
             if (!(PicoAHW & PAHW_SMS))
               m68k_write16(addr,PicoPatches[i].data);
             else
-              PicoWrite8_z80(addr,PicoPatches[i].data);
+              ;// wrong: PicoWrite8_z80(addr,PicoPatches[i].data);
          }
          else
          {
@@ -513,10 +505,10 @@ void PicoPatchApply(void)
                if (PicoPatches[u].addr == addr) break;
             if (u == i)
             {
-               if (!(PicoAHW & PAHW_SMS))
-                  m68k_write16(PicoPatches[i].addr,PicoPatches[i].data_old);
+              if (!(PicoAHW & PAHW_SMS))
+                 m68k_write16(PicoPatches[i].addr,PicoPatches[i].data_old);
               else
-                PicoWrite8_z80(PicoPatches[i].addr,PicoPatches[i].data_old);
+                ;// wrong: PicoWrite8_z80(PicoPatches[i].addr,PicoPatches[i].data_old);
             }
          }
       }