X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=frontend%2Flibretro.c;h=659b3ce4c0644c3ba22bf5e81d1f07e7773f802c;hb=b816fab00204011a58f0b88f35602866ca4268f7;hp=76f0b441bb25a105f935f93afed8f2d0e8cb1f4d;hpb=59f37d7f8672d1915c834511802ea07c8ba2a3c8;p=pcsx_rearmed.git diff --git a/frontend/libretro.c b/frontend/libretro.c index 76f0b441..659b3ce4 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -39,6 +39,8 @@ #define PORTS_NUMBER 8 +#define ISHEXDEC ((buf[cursor]>='0') && (buf[cursor]<='9')) || ((buf[cursor]>='a') && (buf[cursor]<='f')) || ((buf[cursor]>='A') && (buf[cursor]<='F')) + //hack to prevent retroarch freezing when reseting in the menu but not while running with the hot key int rebootemu = 0; @@ -776,6 +778,21 @@ void retro_cheat_set(unsigned index, bool enabled, const char *code) // cheat funcs are destructive, need a copy.. strncpy(buf, code, sizeof(buf)); buf[sizeof(buf) - 1] = 0; + + //Prepare buffered cheat for PCSX's AddCheat fucntion. + int cursor=0; + int nonhexdec=0; + while (buf[cursor]){ + if (!(ISHEXDEC)){ + if (++nonhexdec%2){ + buf[cursor]=' '; + } else { + buf[cursor]='\n'; + } + } + cursor++; + } + if (index < NumCheats) ret = EditCheat(index, "", buf);