aboutsummaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
authormeepingsnesroms2017-01-24 15:19:59 -0800
committerGitHub2017-01-24 15:19:59 -0800
commitaf3eda9d3c7cf1a0901077dfd296966e27c2c3c8 (patch)
tree1ec24a796ad17e62a26493501d3e8ae485491c4e /frontend
parentca1cdd06d6453d9409f89a0bae09a91df6fdc21a (diff)
parent4dbb320e3d1cf3e9d99a91ef5f76255b62bed406 (diff)
downloadpcsx_rearmed-af3eda9d3c7cf1a0901077dfd296966e27c2c3c8.tar.gz
pcsx_rearmed-af3eda9d3c7cf1a0901077dfd296966e27c2c3c8.tar.bz2
pcsx_rearmed-af3eda9d3c7cf1a0901077dfd296966e27c2c3c8.zip
Merge pull request #98 from ilag11111/cheatSupport
Enable support for multiline cheats.
Diffstat (limited to 'frontend')
-rw-r--r--frontend/libretro.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/frontend/libretro.c b/frontend/libretro.c
index 76f0b44..659b3ce 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);