diff --git a/SilentPatchIII/SilentPatchIII.cpp b/SilentPatchIII/SilentPatchIII.cpp index 4240742..30538f8 100644 --- a/SilentPatchIII/SilentPatchIII.cpp +++ b/SilentPatchIII/SilentPatchIII.cpp @@ -630,6 +630,28 @@ namespace StatsMenuFont } } +// ============= Enable Dodo keyboard controls for all cars when the flying cars cheat is enabled ============= +namespace DodoKeyboardControls +{ + static bool* bAllDodosCheat; + + static void* (*orgFindPlayerVehicle)(); + __declspec(naked) static void FindPlayerVehicle_DodoCheck() + { + _asm + { + call [orgFindPlayerVehicle] + mov ecx, [bAllDodosCheat] + cmp byte ptr [ecx], 0 + je CheatDisabled + mov byte ptr [esp+1Ch-14h], 1 + + CheatDisabled: + retn + } + } +} + void InjectDelayedPatches_III_Common( bool bHasDebugMenu, const wchar_t* wcModulePath ) { @@ -1497,6 +1519,18 @@ void Patch_III_Common() InterceptCall(constructStatLine.get_first(), orgConstructStatLine, ConstructStatLine_SetFontStyle); } } + + + // Enable Dodo keyboard controls for all cars when the flying cars cheat is enabled + { + using namespace DodoKeyboardControls; + + auto findPlayerVehicle = get_pattern("E8 ? ? ? ? 0F BF 40 5C 83 F8 7E"); + auto allDodosCheat = *get_pattern("80 3D ? ? ? ? ? 74 5B", 2); + + bAllDodosCheat = allDodosCheat; + InterceptCall(findPlayerVehicle, orgFindPlayerVehicle, FindPlayerVehicle_DodoCheck); + } } BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)