Skip to content

Commit

Permalink
Reinit CGarages::RespraysAreFree - III/VC
Browse files Browse the repository at this point in the history
  • Loading branch information
CookiePLMonster committed May 29, 2016
1 parent 0b2fc37 commit e96bd3e
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
34 changes: 34 additions & 0 deletions SilentPatchIII/SilentPatchIII.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<BYTE>(0x421E06, 0x38);
Patch<WORD>(0x421E07, 0x05C6);
Patch<const void*>(0x421E09, pFreeResprays);
Patch<BYTE>(0x421E0E, 0xC3);



// Adblocker
#if DISABLE_FLA_DONATION_WINDOW
if ( *(DWORD*)0x582749 != 0x006A026A )
Expand Down Expand Up @@ -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<BYTE>(0x421E06, 0x38);
Patch<WORD>(0x421E07, 0x05C6);
Patch<const void*>(0x421E09, pFreeResprays);
Patch<BYTE>(0x421E0E, 0xC3);
}

void Patch_III_Steam(const RECT& desktop)
Expand Down Expand Up @@ -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<BYTE>(0x421E06, 0x38);
Patch<WORD>(0x421E07, 0x05C6);
Patch<const void*>(0x421E09, pFreeResprays);
Patch<BYTE>(0x421E0E, 0xC3);
}

BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
Expand Down
18 changes: 18 additions & 0 deletions SilentPatchVC/SilentPatchVC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ void CarCtrlReInit_SilentPatch()
LastTimeAmbulanceCreated = 0;
}

static bool& RespraysAreFree = **AddressByVersion<bool**>(0x430D17, 0x430D17, 0x430CE7);
void GaragesInit_SilentPatch()
{
RespraysAreFree = false;
}

static char aNoDesktopMode[64];

void Patch_VC_10(const RECT& desktop)
Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit e96bd3e

Please sign in to comment.