From e2cc3e1a33c4ce2a77afefef4e8e7f3fe0e379e1 Mon Sep 17 00:00:00 2001 From: majestic Date: Thu, 4 Jun 2020 18:19:53 -0700 Subject: [PATCH 1/3] some original VC's cheats and comparator for them --- src/core/Pad.cpp | 196 +++++++++++++++++++++++++---------------------- 1 file changed, 106 insertions(+), 90 deletions(-) diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp index 8907894c..10f679e4 100644 --- a/src/core/Pad.cpp +++ b/src/core/Pad.cpp @@ -323,6 +323,12 @@ void CloudyWeatherCheat() CWeather::ForceWeatherNow(WEATHER_CLOUDY); } +void StormyWeatherCheat() +{ + CHud::SetHelpMessage(TheText.Get("CHEAT7"), true); + CWeather::ForceWeatherNow(WEATHER_HURRICANE); +} + void RainyWeatherCheat() { CHud::SetHelpMessage(TheText.Get("CHEAT7"), true); @@ -973,163 +979,173 @@ void CPad::AddToCheatString(char c) } #endif +int CheatComp(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 (int32 i = 0; i < strlen(origCheatStr); i++) { + if (sourceStr[i] != origCheatStr[i] - cheatCodeVals[i]) { + return 1; + } + } + return 0; +} + void CPad::AddToPCCheatString(char c) { - for ( int32 i = ARRAY_SIZE(KeyBoardCheatString) - 2; i >= 0; i-- ) + for (int32 i = ARRAY_SIZE(KeyBoardCheatString) - 2; i >= 0; i--) KeyBoardCheatString[i + 1] = KeyBoardCheatString[i]; - + KeyBoardCheatString[0] = c; - - #define _CHEATCMP(str) strncmp(str, KeyBoardCheatString, sizeof(str)-1) - + +#define _CHEATCMP(str) strncmp(str, KeyBoardCheatString, sizeof(str)-1) + // "THUGSTOOLS" - if (!_CHEATCMP("SLOOTSGUHT")) + if (!CheatComp(KeyBoardCheatString, "VQVPanJ\\I_")) WeaponCheat1(); // "PROFESSIONALTOOLS" - if (!_CHEATCMP("SLOOTLANOISSEFORP")) + if (!CheatComp(KeyBoardCheatString, "VQVPagDUPT`[Lf\\Xl")) WeaponCheat2(); // "NUTTERTOOLS" - if (!_CHEATCMP("SLOOTRETTUN")) + if (!CheatComp(KeyBoardCheatString, "VQVPamH[U`[")) WeaponCheat3(); - // "IFIWEREARICHMAN" - if ( !_CHEATCMP("NAMHCIRAEREWIFI") ) - MoneyCheat(); - + // "PRECIOUSPROTECTION" + if (!CheatComp(KeyBoardCheatString, "QTPUP`WVS[`]ViPKnc")) + ArmourCheat(); + // "ASPIRINE" - if (!_CHEATCMP("ENIRIPSA")) + if (!CheatComp(KeyBoardCheatString, "HSPSVkVH")) HealthCheat(); - - // "MOREPOLICEPLEASE" - if ( !_CHEATCMP("ESAELPECILOPEROM") ) + + // "YOUWONTTAKEMEALIVE" + if (!CheatComp(KeyBoardCheatString, "H[PMN`PLLLa\\Uod[kl")) WantedLevelUpCheat(); - + // "LEAVEMEALONE" - if (!_CHEATCMP("ENOLAEMEVAEL")) + if (!CheatComp(KeyBoardCheatString, "HSVMN`PLWLRT")) WantedLevelDownCheat(); + // "APLEASANTDAY" + if (!CheatComp(KeyBoardCheatString, "\\FKU[\\VHFW]I")) + CloudyWeatherCheat(); + + // "ALOVELYDAY" + if (!CheatComp(KeyBoardCheatString, "\\FKZY`YVML")) + SunnyWeatherCheat(); + + // "ABITDRIEG" + + // "CATSANDDOGS" + if (!CheatComp(KeyBoardCheatString, "VLVEQiDZULP")) + StormyWeatherCheat(); + + // "CANTSEEATHING" + if (!CheatComp(KeyBoardCheatString, "JSPIa\\HLT_[IJ")) + FoggyWeatherCheat(); + // "PANZER" - if ( !_CHEATCMP("REZNAP") ) + if (!CheatComp(KeyBoardCheatString, "UJaONk")) VehicleCheat(true, MI_RHINO); + // "LIFEISPASSINGMEBY" + + // "BIGBANG" + if (!CheatComp(KeyBoardCheatString, "JSHCTdE")) + BlowUpCarsCheat(); + + // "STILLLIKEDRESSINGUP" + if (!CheatComp(KeyBoardCheatString, "SZNOVnVLSORSPlYReg]")) + ChangePlayerCheat(); + + // "FIGHTFIGHTFIGHT" + if (!CheatComp(KeyBoardCheatString, "WMNJSoKNJQaPNiS")) + MayhemCheat(); + + // "NOBODYLIKESME" + if (!CheatComp(KeyBoardCheatString, "HRZFXdO`EZOWU")) + EverybodyAttacksPlayerCheat(); + + // "OURGODGIVENRIGHTTOBEARARMS" + if (!CheatComp(KeyBoardCheatString, "VRYB_\\HIP_aPNi_TaiSJGTNSbj")) + WeaponsForAllCheat(); + // "TRAVELINSTYLE" - if ( !_CHEATCMP("ELYTSNILEVART") ) + if (!_CHEATCMP("ELYTSNILEVART")) VehicleCheat(true, MI_BLOODRA); // "GETTHEREQUICKLY" - if ( !_CHEATCMP("YLKCIUQEREHTTEG") ) + if (!_CHEATCMP("YLKCIUQEREHTTEG")) VehicleCheat(true, MI_BLOODRB); // "GETTHEREFAST" - if ( !_CHEATCMP("TSAFEREHTTEG") ) + if (!_CHEATCMP("TSAFEREHTTEG")) VehicleCheat(true, MI_SABRETUR); // "GETTHEREVERYFASTINDEED" - if ( !_CHEATCMP("DEEDNITSAFYREVEREHTTEG") ) + if (!_CHEATCMP("DEEDNITSAFYREVEREHTTEG")) VehicleCheat(true, MI_HOTRINA); // "GETTHEREAMAZINGLYFAST" - if ( !_CHEATCMP("TSAFYLGNIZAMAEREHTTEG") ) + if (!_CHEATCMP("TSAFYLGNIZAMAEREHTTEG")) VehicleCheat(true, MI_HOTRINB); // "THELASTRIDE" - if ( !_CHEATCMP("EDIRTSALEHT") ) + if (!_CHEATCMP("EDIRTSALEHT")) VehicleCheat(true, MI_ROMERO); // "ROCKANDROLLCAR" - if ( !_CHEATCMP("RACLLORDNAKCOR") ) + if (!_CHEATCMP("RACLLORDNAKCOR")) VehicleCheat(true, MI_LOVEFIST); // "RUBBISHCAR" - if ( !_CHEATCMP("RACHSIBBUR") ) + if (!_CHEATCMP("RACHSIBBUR")) VehicleCheat(true, MI_TRASH); // "BETTERTHANWALKING" - if ( !_CHEATCMP("GNIKLAWNAHTRETTEB") ) + if (!_CHEATCMP("GNIKLAWNAHTRETTEB")) VehicleCheat(true, MI_CADDY); - - // "BANGBANGBANG" - if ( !_CHEATCMP("GNABGNABGNAB") ) - BlowUpCarsCheat(); - - // "ILIKEDRESSINGUP" - if ( !_CHEATCMP("PUGNISSERDEKILI") ) - ChangePlayerCheat(); - - // "ITSALLGOINGMAAAD" - if ( !_CHEATCMP("DAAAMGNIOGLLASTI") ) - MayhemCheat(); - - // "NOBODYLIKESME" - if ( !_CHEATCMP("EMSEKILYDOBON") ) - EverybodyAttacksPlayerCheat(); - - // "WEAPONSFORALL" - if ( !_CHEATCMP("LLAROFSNOPAEW") ) - WeaponsForAllCheat(); - + // "TIMEFLIESWHENYOU" - if ( !_CHEATCMP("UOYNEHWSEILFEMIT") ) + if (!_CHEATCMP("UOYNEHWSEILFEMIT")) FastTimeCheat(); - + // "BOOOOORING" - if ( !_CHEATCMP("GNIROOOOOB") ) + if (!_CHEATCMP("GNIROOOOOB")) SlowTimeCheat(); - -#ifndef GTA3_1_1_PATCH - // "TURTOISE" - if ( !_CHEATCMP("ESIOTRUT") ) - ArmourCheat(); -#else - // "PRECIOUSPROTECTION" - if (!_CHEATCMP("NOITCETORPSUOICERP")) - ArmourCheat(); -#endif - - // "SKINCANCERFORME" - if ( !_CHEATCMP("EMROFRECNACNIKS") ) - SunnyWeatherCheat(); - - // "ILIKESCOTLAND" - if ( !_CHEATCMP("DNALTOCSEKILI") ) - CloudyWeatherCheat(); - + // "ILOVESCOTLAND" - if ( !_CHEATCMP("DNALTOCSEVOLI") ) + if (!_CHEATCMP("DNALTOCSEVOLI")) RainyWeatherCheat(); - - // "PEASOUP" - if ( !_CHEATCMP("PUOSAEP") ) - FoggyWeatherCheat(); - + // "MADWEATHER" - if ( !_CHEATCMP("REHTAEWDAM") ) + if (!_CHEATCMP("REHTAEWDAM")) FastWeatherCheat(); - + // "ANICESETOFWHEELS" - if ( !_CHEATCMP("SLEEHWFOTESECINA") ) + if (!_CHEATCMP("SLEEHWFOTESECINA")) OnlyRenderWheelsCheat(); - + // "CHITTYCHITTYBB" - if ( !_CHEATCMP("BBYTTIHCYTTIHC") ) + if (!_CHEATCMP("BBYTTIHCYTTIHC")) ChittyChittyBangBangCheat(); - + // "CORNERSLIKEMAD" - if ( !_CHEATCMP("DAMEKILSRENROC") ) + if (!_CHEATCMP("DAMEKILSRENROC")) StrongGripCheat(); - + // "NASTYLIMBSCHEAT" - if ( !_CHEATCMP("TAEHCSBMILYTSAN") ) + if (!_CHEATCMP("TAEHCSBMILYTSAN")) NastyLimbsCheat(); // "IWANTITPAINTEDBLACK" - if ( !_CHEATCMP("KCALBDETNIAPTITNAWI") ) + if (!_CHEATCMP("KCALBDETNIAPTITNAWI")) BlackCarsCheat(); // "AHAIRDRESSERSCAR" - if ( !_CHEATCMP("RACSRESSERDRIAHA") ) + if (!_CHEATCMP("RACSRESSERDRIAHA")) PinkCarsCheat(); #ifdef KANGAROO_CHEAT @@ -1160,7 +1176,7 @@ void CPad::AddToPCCheatString(char c) // SEABEDCHEAT if (!_CHEATCMP("TAEHCDEBAESON")) NoSeaBedCheat(); - + // WATERLAYERSCHEAT if (!_CHEATCMP("TAEHCSREYALRETAW")) RenderWaterLayersCheat(); @@ -1170,7 +1186,7 @@ void CPad::AddToPCCheatString(char c) if (!_CHEATCMP("SYAWAES")) BackToTheFuture(); - #undef _CHEATCMP +#undef _CHEATCMP } #ifdef XINPUT From 66262b14adbfe4f0dfcbb4756e7ff47d7b3023d4 Mon Sep 17 00:00:00 2001 From: majestic Date: Fri, 5 Jun 2020 14:20:29 -0700 Subject: [PATCH 2/3] Update Pad.cpp --- src/core/Pad.cpp | 89 ++++++++++++++++++++++++++++-------------------- 1 file changed, 53 insertions(+), 36 deletions(-) diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp index 10f679e4..2f9db15b 100644 --- a/src/core/Pad.cpp +++ b/src/core/Pad.cpp @@ -979,12 +979,12 @@ void CPad::AddToCheatString(char c) } #endif -int CheatComp(char* sourceStr, char* origCheatStr) +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 (int32 i = 0; i < strlen(origCheatStr); i++) { - if (sourceStr[i] != origCheatStr[i] - cheatCodeVals[i]) { + if ((sourceStr[i] != origCheatStr[i] - cheatCodeVals[i]) || i >= 28) { return 1; } } @@ -1001,77 +1001,94 @@ void CPad::AddToPCCheatString(char c) #define _CHEATCMP(str) strncmp(str, KeyBoardCheatString, sizeof(str)-1) // "THUGSTOOLS" - if (!CheatComp(KeyBoardCheatString, "VQVPanJ\\I_")) + if (!Cheat_strncmp(KeyBoardCheatString, "VQVPanJ\\I_")) { + KeyBoardCheatString[0] = ' '; WeaponCheat1(); - + } // "PROFESSIONALTOOLS" - if (!CheatComp(KeyBoardCheatString, "VQVPagDUPT`[Lf\\Xl")) + else if (!Cheat_strncmp(KeyBoardCheatString, "VQVPagDUPT`[Lf\\Xl")) { + KeyBoardCheatString[0] = ' '; WeaponCheat2(); - + } // "NUTTERTOOLS" - if (!CheatComp(KeyBoardCheatString, "VQVPamH[U`[")) + else if (!Cheat_strncmp(KeyBoardCheatString, "VQVPamH[U`[")) { + KeyBoardCheatString[0] = ' '; WeaponCheat3(); - + } // "PRECIOUSPROTECTION" - if (!CheatComp(KeyBoardCheatString, "QTPUP`WVS[`]ViPKnc")) + else if (!Cheat_strncmp(KeyBoardCheatString, "QTPUP`WVS[`]ViPKnc")) { + KeyBoardCheatString[0] = ' '; ArmourCheat(); - + } // "ASPIRINE" - if (!CheatComp(KeyBoardCheatString, "HSPSVkVH")) + else if (!Cheat_strncmp(KeyBoardCheatString, "HSPSVkVH")) { + KeyBoardCheatString[0] = ' '; HealthCheat(); - + } // "YOUWONTTAKEMEALIVE" - if (!CheatComp(KeyBoardCheatString, "H[PMN`PLLLa\\Uod[kl")) + else if (!Cheat_strncmp(KeyBoardCheatString, "H[PMN`PLLLa\\Uod[kl")) { + KeyBoardCheatString[0] = ' '; WantedLevelUpCheat(); - + } // "LEAVEMEALONE" - if (!CheatComp(KeyBoardCheatString, "HSVMN`PLWLRT")) + else if (!Cheat_strncmp(KeyBoardCheatString, "HSVMN`PLWLRT")) { + KeyBoardCheatString[0] = ' '; WantedLevelDownCheat(); - + } // "APLEASANTDAY" - if (!CheatComp(KeyBoardCheatString, "\\FKU[\\VHFW]I")) + else if (!Cheat_strncmp(KeyBoardCheatString, "\\FKU[\\VHFW]I")) { + KeyBoardCheatString[0] = ' '; CloudyWeatherCheat(); - + } // "ALOVELYDAY" - if (!CheatComp(KeyBoardCheatString, "\\FKZY`YVML")) + else if (!Cheat_strncmp(KeyBoardCheatString, "\\FKZY`YVML")) { + KeyBoardCheatString[0] = ' '; SunnyWeatherCheat(); - + } // "ABITDRIEG" // "CATSANDDOGS" - if (!CheatComp(KeyBoardCheatString, "VLVEQiDZULP")) + else if (!Cheat_strncmp(KeyBoardCheatString, "VLVEQiDZULP")) { + KeyBoardCheatString[0] = ' '; StormyWeatherCheat(); - + } // "CANTSEEATHING" - if (!CheatComp(KeyBoardCheatString, "JSPIa\\HLT_[IJ")) + else if (!Cheat_strncmp(KeyBoardCheatString, "JSPIa\\HLT_[IJ")) { + KeyBoardCheatString[0] = ' '; FoggyWeatherCheat(); - + } // "PANZER" - if (!CheatComp(KeyBoardCheatString, "UJaONk")) + else if (!Cheat_strncmp(KeyBoardCheatString, "UJaONk")) { + KeyBoardCheatString[0] = ' '; VehicleCheat(true, MI_RHINO); - + } // "LIFEISPASSINGMEBY" // "BIGBANG" - if (!CheatComp(KeyBoardCheatString, "JSHCTdE")) + else if (!Cheat_strncmp(KeyBoardCheatString, "JSHCTdE")) { + KeyBoardCheatString[0] = ' '; BlowUpCarsCheat(); - + } // "STILLLIKEDRESSINGUP" - if (!CheatComp(KeyBoardCheatString, "SZNOVnVLSORSPlYReg]")) + else if (!Cheat_strncmp(KeyBoardCheatString, "SZNOVnVLSORSPlYReg]")) { + KeyBoardCheatString[0] = ' '; ChangePlayerCheat(); - + } // "FIGHTFIGHTFIGHT" - if (!CheatComp(KeyBoardCheatString, "WMNJSoKNJQaPNiS")) + else if (!Cheat_strncmp(KeyBoardCheatString, "WMNJSoKNJQaPNiS")) { + KeyBoardCheatString[0] = ' '; MayhemCheat(); - + } // "NOBODYLIKESME" - if (!CheatComp(KeyBoardCheatString, "HRZFXdO`EZOWU")) + else if (!Cheat_strncmp(KeyBoardCheatString, "HRZFXdO`EZOWU")) { + KeyBoardCheatString[0] = ' '; EverybodyAttacksPlayerCheat(); - + } // "OURGODGIVENRIGHTTOBEARARMS" - if (!CheatComp(KeyBoardCheatString, "VRYB_\\HIP_aPNi_TaiSJGTNSbj")) + else if (!Cheat_strncmp(KeyBoardCheatString, "VRYB_\\HIP_aPNi_TaiSJGTNSbj")) { + KeyBoardCheatString[0] = ' '; WeaponsForAllCheat(); - + } // "TRAVELINSTYLE" if (!_CHEATCMP("ELYTSNILEVART")) VehicleCheat(true, MI_BLOODRA); From f014b29fc46f498b42bf94b2d94333a4989e4917 Mon Sep 17 00:00:00 2001 From: majestic Date: Fri, 5 Jun 2020 14:31:17 -0700 Subject: [PATCH 3/3] Update Pad.cpp --- src/core/Pad.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp index 2f9db15b..a475bf7b 100644 --- a/src/core/Pad.cpp +++ b/src/core/Pad.cpp @@ -984,7 +984,7 @@ 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 (int32 i = 0; i < strlen(origCheatStr); i++) { - if ((sourceStr[i] != origCheatStr[i] - cheatCodeVals[i]) || i >= 28) { + if ((sourceStr[i] != origCheatStr[i] - cheatCodeVals[i]) || i >= ARRAY_SIZE(cheatCodeVals)) { return 1; } }