Enable Dodo keyboard controls for all cars when the flying cars cheat is enabled

This commit is contained in:
Silent 2024-03-21 19:25:30 +01:00
parent 5a99b6a4d8
commit 2eab47968c
No known key found for this signature in database
GPG Key ID: AE53149BB0C45AF1

View File

@ -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<void>(), 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<bool*>("80 3D ? ? ? ? ? 74 5B", 2);
bAllDodosCheat = allDodosCheat;
InterceptCall(findPlayerVehicle, orgFindPlayerVehicle, FindPlayerVehicle_DodoCheck);
}
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)