diff options
author | Sergeanur <s.anureev@yandex.ua> | 2020-12-25 09:44:20 +0100 |
---|---|---|
committer | Sergeanur <s.anureev@yandex.ua> | 2020-12-25 09:44:20 +0100 |
commit | e14ed9c7dd7ac2eac7c2f4c1d1ac76b253f1aaeb (patch) | |
tree | f95f34200b3f091c1a260981a1e79f8835e2f315 /src/core/Pad.cpp | |
parent | More type fix (diff) | |
download | re3-e14ed9c7dd7ac2eac7c2f4c1d1ac76b253f1aaeb.tar re3-e14ed9c7dd7ac2eac7c2f4c1d1ac76b253f1aaeb.tar.gz re3-e14ed9c7dd7ac2eac7c2f4c1d1ac76b253f1aaeb.tar.bz2 re3-e14ed9c7dd7ac2eac7c2f4c1d1ac76b253f1aaeb.tar.lz re3-e14ed9c7dd7ac2eac7c2f4c1d1ac76b253f1aaeb.tar.xz re3-e14ed9c7dd7ac2eac7c2f4c1d1ac76b253f1aaeb.tar.zst re3-e14ed9c7dd7ac2eac7c2f4c1d1ac76b253f1aaeb.zip |
Diffstat (limited to 'src/core/Pad.cpp')
-rw-r--r-- | src/core/Pad.cpp | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp index 91e2d704..7d53009d 100644 --- a/src/core/Pad.cpp +++ b/src/core/Pad.cpp @@ -1213,14 +1213,46 @@ void CPad::AddToCheatString(char c) int Cheat_strncmp(char* sourceStr, char* origCheatStr) { - char cheatCodeVals[] = { 3,5,7,1,13,27,3,7,1,11,13,8,7,32,13,6,28,19,10,3,3,5,7,1,13,27,3,7 }; - - for (uint32 i = 0; i < strlen(origCheatStr); i++) { - if ((sourceStr[i] != origCheatStr[i] - cheatCodeVals[i]) || i >= ARRAY_SIZE(cheatCodeVals)) { - return 1; - } +#define ccmp(n) if((uint8)sourceStr[i] != (uint8)origCheatStr[i] - n) return 1; + int i = 0; + while(origCheatStr[i]) + { + switch(i) + { + case 0: ccmp(3); break; + case 1: ccmp(5); break; + case 2: ccmp(7); break; + case 3: ccmp(1); break; + case 4: ccmp(13); break; + case 5: ccmp(27); break; + case 6: ccmp(3); break; + case 7: ccmp(7); break; + case 8: ccmp(1); break; + case 9: ccmp(11); break; + case 10: ccmp(13); break; + case 11: ccmp(8); break; + case 12: ccmp(7); break; + case 13: ccmp(32); break; + case 14: ccmp(13); break; + case 15: ccmp(6); break; + case 16: ccmp(28); break; + case 17: ccmp(19); break; + case 18: ccmp(10); break; + case 19: ccmp(3); break; + case 20: ccmp(3); break; + case 21: ccmp(5); break; + case 22: ccmp(7); break; + case 23: ccmp(1); break; + case 24: ccmp(13); break; + case 25: ccmp(27); break; + case 26: ccmp(3); break; + case 27: ccmp(7); break; + default: return 1; + } + i++; } return 0; +#undef ccmp } // TODO(Miami): Mobile has changed some of the cheats to include debugging things |