mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-29 15:23:02 +05:00
new timers fix (only 1.0 in SA!!)
This commit is contained in:
parent
72542d521e
commit
9247b2c38d
1 changed files with 66 additions and 0 deletions
|
@ -1852,6 +1852,66 @@ DarkVehiclesFix4_MakeItDark:
|
||||||
}
|
}
|
||||||
// 1.0 ONLY ENDS HERE
|
// 1.0 ONLY ENDS HERE
|
||||||
|
|
||||||
|
static int _Timers_ftol_internal( double timer, double& remainder )
|
||||||
|
{
|
||||||
|
if ( timer >= 1.0 ) return int(timer);
|
||||||
|
|
||||||
|
double integral;
|
||||||
|
remainder = modf( timer + remainder, &integral );
|
||||||
|
return int(integral);
|
||||||
|
}
|
||||||
|
|
||||||
|
int __stdcall Timers_ftol_PauseMode( double timer )
|
||||||
|
{
|
||||||
|
static double TimersRemainder = 0.0;
|
||||||
|
return _Timers_ftol_internal( timer, TimersRemainder );
|
||||||
|
}
|
||||||
|
|
||||||
|
int __stdcall Timers_ftol_NonClipped( double timer )
|
||||||
|
{
|
||||||
|
static double TimersRemainder = 0.0;
|
||||||
|
return _Timers_ftol_internal( timer, TimersRemainder );
|
||||||
|
}
|
||||||
|
|
||||||
|
int __stdcall Timers_ftol( double timer )
|
||||||
|
{
|
||||||
|
static double TimersRemainder = 0.0;
|
||||||
|
return _Timers_ftol_internal( timer, TimersRemainder );
|
||||||
|
}
|
||||||
|
|
||||||
|
void __declspec(naked) asmTimers_ftol_PauseMode()
|
||||||
|
{
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
sub esp, 8
|
||||||
|
fstp qword ptr [esp]
|
||||||
|
call Timers_ftol_PauseMode
|
||||||
|
retn
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void __declspec(naked) asmTimers_ftol_NonClipped()
|
||||||
|
{
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
sub esp, 8
|
||||||
|
fstp qword ptr [esp]
|
||||||
|
call Timers_ftol_NonClipped
|
||||||
|
retn
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void __declspec(naked) asmTimers_ftol()
|
||||||
|
{
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
sub esp, 8
|
||||||
|
fstp qword ptr [esp]
|
||||||
|
call Timers_ftol
|
||||||
|
retn
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void __declspec(naked) GetMaxExtraDirectionals()
|
void __declspec(naked) GetMaxExtraDirectionals()
|
||||||
{
|
{
|
||||||
_asm
|
_asm
|
||||||
|
@ -3041,6 +3101,12 @@ void Patch_SA_10()
|
||||||
InjectHook( 0x73B3AE + 1, WeaponRangeMult_VehicleCheck, PATCH_CALL );
|
InjectHook( 0x73B3AE + 1, WeaponRangeMult_VehicleCheck, PATCH_CALL );
|
||||||
|
|
||||||
|
|
||||||
|
// New timers fix
|
||||||
|
InjectHook( 0x561C32, asmTimers_ftol_PauseMode );
|
||||||
|
InjectHook( 0x561902, asmTimers_ftol_NonClipped );
|
||||||
|
InjectHook( 0x56191A, asmTimers_ftol );
|
||||||
|
|
||||||
|
|
||||||
// Don't catch WM_SYSKEYDOWN and WM_SYSKEYUP (fixes Alt+F4)
|
// Don't catch WM_SYSKEYDOWN and WM_SYSKEYUP (fixes Alt+F4)
|
||||||
InjectHook( AddressByRegion_10<int>(0x748220), AddressByRegion_10<int>(0x748446), PATCH_JUMP );
|
InjectHook( AddressByRegion_10<int>(0x748220), AddressByRegion_10<int>(0x748446), PATCH_JUMP );
|
||||||
Patch<uint8_t>( AddressByRegion_10<int>(0x7481E3), 0x5C ); // esi -> ebx
|
Patch<uint8_t>( AddressByRegion_10<int>(0x7481E3), 0x5C ); // esi -> ebx
|
||||||
|
|
Loading…
Reference in a new issue