X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=platform%2Flibretro%2Flibretro.c;h=934b6859f55684238137c9446b124f3d0b6a8a21;hb=d01fa2044c98b23dfb72188a7486e567ab2d3dda;hp=8e1bed35a0eb34e881c3fd0ce6d28a569aff8831;hpb=daae6156b46bd32529d9c6908600409d036b6932;p=picodrive.git diff --git a/platform/libretro/libretro.c b/platform/libretro/libretro.c index 8e1bed3..934b685 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); @@ -725,19 +726,13 @@ void retro_cheat_reset(void) void retro_cheat_set(unsigned index, bool enabled, const char *code) { patch pt; - int array_len = 0; + 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) { @@ -766,14 +761,14 @@ 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,"+"); } } @@ -1131,7 +1126,7 @@ void *retro_get_memory_data(unsigned type) break; case RETRO_MEMORY_SYSTEM_RAM: if (PicoAHW & PAHW_SMS) - data = Pico.vramb; + data = Pico.zram; else data = Pico.ram; break; @@ -1167,7 +1162,7 @@ size_t retro_get_memory_size(unsigned type) case RETRO_MEMORY_SYSTEM_RAM: if (PicoAHW & PAHW_SMS) - return sizeof(Pico.vramb); + return 0x2000; else return sizeof(Pico.ram);