From: iLag Date: Wed, 22 Mar 2017 21:45:23 +0000 (-0700) Subject: Fix multiline support X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d4089d9b8e132e796dca0382bd237b8efeeeac3d;p=picodrive.git Fix multiline support --- diff --git a/platform/libretro/libretro.c b/platform/libretro/libretro.c index 1b914d54..0f060e6b 100644 --- a/platform/libretro/libretro.c +++ b/platform/libretro/libretro.c @@ -722,11 +722,17 @@ void retro_cheat_set(unsigned index, bool enabled, const char *code) } pt; int array_len = 0; char *buff; + bool multiline=0; //TODO: Split multi-line codes properly - buff = strtok(code,"+"); + if (strstr(code,"+")){ + multiline=1; + buff = strtok(code,"+"); + } else { + buff=code; + } - while (buff) + while (buff != NULL) { decode(buff, &pt); if (pt.addr == (unsigned int)-1 || pt.data == (unsigned short)-1) @@ -759,6 +765,9 @@ void retro_cheat_set(unsigned index, bool enabled, const char *code) else PicoPatches[PicoPatchCount].data_old = (unsigned short) m68k_read16(PicoPatches[PicoPatchCount].addr); PicoPatchCount++; + + if (!multiline) + break; } }