From e96bd3e91ca32b43acbe88024d72be376cd57287 Mon Sep 17 00:00:00 2001 From: Silent Date: Sun, 29 May 2016 22:59:15 +0200 Subject: [PATCH] Reinit CGarages::RespraysAreFree - III/VC --- SilentPatchIII/SilentPatchIII.cpp | 34 +++++++++++++++++++++++++++++++ SilentPatchVC/SilentPatchVC.cpp | 18 ++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/SilentPatchIII/SilentPatchIII.cpp b/SilentPatchIII/SilentPatchIII.cpp index 01c5853..de952ac 100644 --- a/SilentPatchIII/SilentPatchIII.cpp +++ b/SilentPatchIII/SilentPatchIII.cpp @@ -424,6 +424,18 @@ void Patch_III_10(const RECT& desktop) InjectHook(0x48C4FB, CarCtrlReInit_SilentPatch); + // Reinit free resprays flag + // add esp, 38h + // mov CGarages::RespraysAreFree, 0 + // retn + bool* pFreeResprays = *(bool**)0x4224A4; + Patch(0x421E06, 0x38); + Patch(0x421E07, 0x05C6); + Patch(0x421E09, pFreeResprays); + Patch(0x421E0E, 0xC3); + + + // Adblocker #if DISABLE_FLA_DONATION_WINDOW if ( *(DWORD*)0x582749 != 0x006A026A ) @@ -569,6 +581,17 @@ void Patch_III_11(const RECT& desktop) int pCarCtrlReInit = 0x48C5FB; orgCarCtrlReInit = (void(*)())(*(int*)(pCarCtrlReInit+1) + pCarCtrlReInit + 5); InjectHook(0x48C5FB, CarCtrlReInit_SilentPatch); + + + // Reinit free resprays flag + // add esp, 38h + // mov CGarages::RespraysAreFree, 0 + // retn + bool* pFreeResprays = *(bool**)0x4224A4; + Patch(0x421E06, 0x38); + Patch(0x421E07, 0x05C6); + Patch(0x421E09, pFreeResprays); + Patch(0x421E0E, 0xC3); } void Patch_III_Steam(const RECT& desktop) @@ -702,6 +725,17 @@ void Patch_III_Steam(const RECT& desktop) int pCarCtrlReInit = 0x48C58B; orgCarCtrlReInit = (void(*)())(*(int*)(pCarCtrlReInit+1) + pCarCtrlReInit + 5); InjectHook(0x48C58B, CarCtrlReInit_SilentPatch); + + + // Reinit free resprays flag + // add esp, 38h + // mov CGarages::RespraysAreFree, 0 + // retn + bool* pFreeResprays = *(bool**)0x4224A4; + Patch(0x421E06, 0x38); + Patch(0x421E07, 0x05C6); + Patch(0x421E09, pFreeResprays); + Patch(0x421E0E, 0xC3); } BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) diff --git a/SilentPatchVC/SilentPatchVC.cpp b/SilentPatchVC/SilentPatchVC.cpp index 9a2f215..d288630 100644 --- a/SilentPatchVC/SilentPatchVC.cpp +++ b/SilentPatchVC/SilentPatchVC.cpp @@ -184,6 +184,12 @@ void CarCtrlReInit_SilentPatch() LastTimeAmbulanceCreated = 0; } +static bool& RespraysAreFree = **AddressByVersion(0x430D17, 0x430D17, 0x430CE7); +void GaragesInit_SilentPatch() +{ + RespraysAreFree = false; +} + static char aNoDesktopMode[64]; void Patch_VC_10(const RECT& desktop) @@ -318,6 +324,10 @@ void Patch_VC_10(const RECT& desktop) InjectHook(0x4A489B, CarCtrlReInit_SilentPatch); + // Reinit free resprays flag + InjectHook(0x4349BB, GaragesInit_SilentPatch, PATCH_JUMP); + + // Adblocker #if DISABLE_FLA_DONATION_WINDOW if ( *(DWORD*)0x5FFAE9 != 0x006A026A ) @@ -458,6 +468,10 @@ void Patch_VC_11(const RECT& desktop) int pCarCtrlReInit = 0x4A48BB; orgCarCtrlReInit = (void(*)())(*(int*)(pCarCtrlReInit+1) + pCarCtrlReInit + 5); InjectHook(0x4A48BB, CarCtrlReInit_SilentPatch); + + + // Reinit free resprays flag + InjectHook(0x4349BB, GaragesInit_SilentPatch, PATCH_JUMP); } void Patch_VC_Steam(const RECT& desktop) @@ -589,6 +603,10 @@ void Patch_VC_Steam(const RECT& desktop) int pCarCtrlReInit = 0x4A475B; orgCarCtrlReInit = (void(*)())(*(int*)(pCarCtrlReInit+1) + pCarCtrlReInit + 5); InjectHook(0x4A475B, CarCtrlReInit_SilentPatch); + + + // Reinit free resprays flag + InjectHook(0x43497B, GaragesInit_SilentPatch, PATCH_JUMP); } void Patch_VC_JP()