X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Flibretro%2Flibretro.c;h=a1cf22c88dae1e0d194bc1856af36bfebc9c981b;hb=fa55ee51c9c1d86311fbd90f055a575e4991ac70;hp=a4bc0a1bbf44caa49993de1d8e738c0189c8e9a6;hpb=e5326b1a0e5fe59e95db275c52acffd4bd50e7da;p=picodrive.git diff --git a/platform/libretro/libretro.c b/platform/libretro/libretro.c index a4bc0a1..a1cf22c 100644 --- a/platform/libretro/libretro.c +++ b/platform/libretro/libretro.c @@ -696,6 +696,7 @@ typedef struct patch { unsigned int addr; unsigned short data; + unsigned char comp; } patch; extern void decode(char *buff, patch *dest); @@ -728,20 +729,13 @@ void retro_cheat_set(unsigned index, bool enabled, const char *code) int array_len = PicoPatchCount; char codeCopy[256]; char *buff; - bool multiline=0; + if (code=='\0') return; strcpy(codeCopy,code); - - if (strstr(code,"+")){ - multiline=1; - buff = strtok(codeCopy,"+"); - } else { - buff=codeCopy; - } + buff = strtok(codeCopy,"+"); while (buff != NULL) { - log_cb(RETRO_LOG_INFO,"Buff: %s\n",buff); decode(buff, &pt); if (pt.addr == (uint32_t) -1 || pt.data == (uint16_t) -1) { @@ -767,14 +761,13 @@ void retro_cheat_set(unsigned index, bool enabled, const char *code) PicoPatches[PicoPatchCount].active = enabled; PicoPatches[PicoPatchCount].addr = pt.addr; PicoPatches[PicoPatchCount].data = pt.data; + PicoPatches[PicoPatchCount].comp = pt.comp; if (PicoPatches[PicoPatchCount].addr < Pico.romsize) PicoPatches[PicoPatchCount].data_old = *(uint16_t *)(Pico.rom + PicoPatches[PicoPatchCount].addr); else PicoPatches[PicoPatchCount].data_old = (uint16_t) m68k_read16(PicoPatches[PicoPatchCount].addr); PicoPatchCount++; - if (!multiline) - break; buff = strtok(NULL,"+"); } }