Skip to content

Remove vehicle framerate fixes again #2787

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 1 addition & 49 deletions Client/multiplayer_sa/CMultiplayerSA_FrameRateFixes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,44 +162,6 @@ static void _declspec(naked) HOOK_CFallingGlassPane__Update_C()
}
}

#define HOOKPOS_CPhysical__ApplyAirResistance 0x544D29
#define HOOKSIZE_CPhysical__ApplyAirResistance 5
static const unsigned int RETURN_CPhysical__ApplyAirResistance = 0x544D4D;
static void _declspec(naked) HOOK_CPhysical__ApplyAirResistance()
{
_asm {
fld ds:[0x862CD0] // 0.99000001f
fld ds:[0xB7CB5C] // CTimer::ms_fTimeStep
fdiv kOriginalTimeStep // 1.666f
mov eax, 0x822130 // powf
call eax

fld st(0)
fmul [esi+0x50]
fstp [esi+0x50]

fld st(0)
fmul [esi+0x54]
fstp [esi+0x54]

fmul [esi+0x58]
fstp [esi+0x58]
jmp RETURN_CPhysical__ApplyAirResistance
}
}

template <unsigned int returnAddress>
static void _declspec(naked) HOOK_VehicleRapidStopFix()
{
static unsigned int RETURN_VehicleRapidStopFix = returnAddress;
_asm {
fld ds:[0xC2B9CC] // mod_HandlingManager.m_fWheelFriction
fmul ds:[0xB7CB5C] // CTimer::ms_fTimeStep
fdiv kOriginalTimeStep // 1.666f
jmp RETURN_VehicleRapidStopFix
}
}

#define HOOKPOS_CTimer__Update 0x561C5D
#define HOOKSIZE_CTimer__Update 0xE
static void _declspec(naked) HOOK_CTimer__Update()
Expand Down Expand Up @@ -600,17 +562,7 @@ void CMultiplayerSA::InitHooks_FrameRateFixes()
EZHookInstall(CFallingGlassPane__Update_A);
EZHookInstall(CFallingGlassPane__Update_B);
EZHookInstall(CFallingGlassPane__Update_C);
EZHookInstall(CPhysical__ApplyAirResistance);

// CVehicle::ProcessWheel
HookInstall(0x6D6E69, (DWORD)HOOK_VehicleRapidStopFix<0x6D6E6F>, 6);
HookInstall(0x6D6EA8, (DWORD)HOOK_VehicleRapidStopFix<0x6D6EAE>, 6);

// CVehicle::ProcessBikeWheel
HookInstall(0x6D767F, (DWORD)HOOK_VehicleRapidStopFix<0x6D7685>, 6);
HookInstall(0x6D76AB, (DWORD)HOOK_VehicleRapidStopFix<0x6D76B1>, 6);
HookInstall(0x6D76CD, (DWORD)HOOK_VehicleRapidStopFix<0x6D76D3>, 6);


// CCam::Process_FollowCar_SA
MemSet((void*)0x524FD7, 0x90, 0x1B);

Expand Down