mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2025-01-31 06:57:28 +05:00
Merge branch 'master' into 'master'
Fixed autopilot timer bug in III and VC See merge request !1
This commit is contained in:
commit
6c30863136
2 changed files with 61 additions and 0 deletions
|
@ -314,6 +314,28 @@ void CarCtrlReInit_SilentPatch()
|
||||||
|
|
||||||
static char aNoDesktopMode[64];
|
static char aNoDesktopMode[64];
|
||||||
|
|
||||||
|
unsigned int __cdecl AutoPilotTimerCalculation_III(unsigned int nTimer, int nScaleFactor, float fScaleCoef)
|
||||||
|
{
|
||||||
|
return nTimer - static_cast<unsigned int>(nScaleFactor * fScaleCoef);
|
||||||
|
}
|
||||||
|
|
||||||
|
void __declspec(naked) AutoPilotTimerFix_III()
|
||||||
|
{
|
||||||
|
_asm {
|
||||||
|
push dword ptr[esp + 0x4]
|
||||||
|
push dword ptr[ebx + 0x10]
|
||||||
|
push eax
|
||||||
|
call AutoPilotTimerCalculation_III
|
||||||
|
add esp, 0xC
|
||||||
|
mov [ebx + 0xC], eax
|
||||||
|
add esp, 0x28
|
||||||
|
pop ebp
|
||||||
|
pop esi
|
||||||
|
pop ebx
|
||||||
|
retn 4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Patch_III_10(const RECT& desktop)
|
void Patch_III_10(const RECT& desktop)
|
||||||
{
|
{
|
||||||
using namespace Memory;
|
using namespace Memory;
|
||||||
|
@ -483,6 +505,9 @@ void Patch_III_10(const RECT& desktop)
|
||||||
Nop(0x581C52, 6);
|
Nop(0x581C52, 6);
|
||||||
Patch<const char*>(0x566A3D, "");
|
Patch<const char*>(0x566A3D, "");
|
||||||
|
|
||||||
|
// Fixed crash related to autopilot timing calculations
|
||||||
|
InjectHook(0x4139B2, AutoPilotTimerFix_III, PATCH_JUMP);
|
||||||
|
|
||||||
|
|
||||||
// Adblocker
|
// Adblocker
|
||||||
#if DISABLE_FLA_DONATION_WINDOW
|
#if DISABLE_FLA_DONATION_WINDOW
|
||||||
|
@ -651,6 +676,9 @@ void Patch_III_11(const RECT& desktop)
|
||||||
Nop(0x581F84, 2);
|
Nop(0x581F84, 2);
|
||||||
Nop(0x581F92, 6);
|
Nop(0x581F92, 6);
|
||||||
Patch<const char*>(0x566B7D, "");
|
Patch<const char*>(0x566B7D, "");
|
||||||
|
|
||||||
|
// Fixed crash related to autopilot timing calculations
|
||||||
|
InjectHook(0x4139B2, AutoPilotTimerFix_III, PATCH_JUMP);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Patch_III_Steam(const RECT& desktop)
|
void Patch_III_Steam(const RECT& desktop)
|
||||||
|
@ -798,6 +826,9 @@ void Patch_III_Steam(const RECT& desktop)
|
||||||
// Radar blips bounds check
|
// Radar blips bounds check
|
||||||
InjectHook(0x4A5632, RadarBoundsCheckCoordBlip, PATCH_JUMP);
|
InjectHook(0x4A5632, RadarBoundsCheckCoordBlip, PATCH_JUMP);
|
||||||
InjectHook(0x4A56D8, RadarBoundsCheckEntityBlip, PATCH_JUMP);
|
InjectHook(0x4A56D8, RadarBoundsCheckEntityBlip, PATCH_JUMP);
|
||||||
|
|
||||||
|
// Fixed crash related to autopilot timing calculations
|
||||||
|
InjectHook(0x4139B2, AutoPilotTimerFix_III, PATCH_JUMP);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||||
|
|
|
@ -192,6 +192,27 @@ void GaragesInit_SilentPatch()
|
||||||
|
|
||||||
static char aNoDesktopMode[64];
|
static char aNoDesktopMode[64];
|
||||||
|
|
||||||
|
unsigned int __cdecl AutoPilotTimerCalculation_VC(unsigned int nTimer, int nScaleFactor, float fScaleCoef)
|
||||||
|
{
|
||||||
|
return nTimer - static_cast<unsigned int>(nScaleFactor * fScaleCoef);
|
||||||
|
}
|
||||||
|
|
||||||
|
void __declspec(naked) AutoPilotTimerFix_VC()
|
||||||
|
{
|
||||||
|
_asm {
|
||||||
|
push dword ptr[esp + 0xC]
|
||||||
|
push dword ptr[ebx + 0x10]
|
||||||
|
push eax
|
||||||
|
call AutoPilotTimerCalculation_VC
|
||||||
|
add esp, 0xC
|
||||||
|
mov [ebx + 0xC], eax
|
||||||
|
add esp, 0x30
|
||||||
|
pop ebp
|
||||||
|
pop ebx
|
||||||
|
retn 4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Patch_VC_10(const RECT& desktop)
|
void Patch_VC_10(const RECT& desktop)
|
||||||
{
|
{
|
||||||
using namespace Memory;
|
using namespace Memory;
|
||||||
|
@ -329,6 +350,9 @@ void Patch_VC_10(const RECT& desktop)
|
||||||
Patch<BYTE>(0x4AED14+1, 1); // katana
|
Patch<BYTE>(0x4AED14+1, 1); // katana
|
||||||
Patch<BYTE>(0x4AEB74+1, 1); // chainsaw
|
Patch<BYTE>(0x4AEB74+1, 1); // chainsaw
|
||||||
|
|
||||||
|
// Fixed crash related to autopilot timing calculations
|
||||||
|
InjectHook(0x418FAE, AutoPilotTimerFix_VC, PATCH_JUMP);
|
||||||
|
|
||||||
|
|
||||||
// Adblocker
|
// Adblocker
|
||||||
#if DISABLE_FLA_DONATION_WINDOW
|
#if DISABLE_FLA_DONATION_WINDOW
|
||||||
|
@ -477,6 +501,9 @@ void Patch_VC_11(const RECT& desktop)
|
||||||
// Fixed ammo for melee weapons in cheats
|
// Fixed ammo for melee weapons in cheats
|
||||||
Patch<BYTE>(0x4AED34+1, 1); // katana
|
Patch<BYTE>(0x4AED34+1, 1); // katana
|
||||||
Patch<BYTE>(0x4AEB94+1, 1); // chainsaw
|
Patch<BYTE>(0x4AEB94+1, 1); // chainsaw
|
||||||
|
|
||||||
|
// Fixed crash related to autopilot timing calculations
|
||||||
|
InjectHook(0x418FAE, AutoPilotTimerFix_VC, PATCH_JUMP);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Patch_VC_Steam(const RECT& desktop)
|
void Patch_VC_Steam(const RECT& desktop)
|
||||||
|
@ -615,6 +642,9 @@ void Patch_VC_Steam(const RECT& desktop)
|
||||||
// Fixed ammo for melee weapons in cheats
|
// Fixed ammo for melee weapons in cheats
|
||||||
Patch<BYTE>(0x4AEA44+1, 1); // katana
|
Patch<BYTE>(0x4AEA44+1, 1); // katana
|
||||||
Patch<BYTE>(0x4AEBE4+1, 1); // chainsaw
|
Patch<BYTE>(0x4AEBE4+1, 1); // chainsaw
|
||||||
|
|
||||||
|
// Fixed crash related to autopilot timing calculations
|
||||||
|
InjectHook(0x418FAE, AutoPilotTimerFix_VC, PATCH_JUMP);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Patch_VC_JP()
|
void Patch_VC_JP()
|
||||||
|
|
Loading…
Reference in a new issue