mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-11-24 22:32:29 +01:00
SA: Fix nitrous recharging faster when reversing the car
By Wesser
This commit is contained in:
parent
1c4a08ea92
commit
3218612792
@ -3142,6 +3142,50 @@ namespace TextRectPaddingScalingFixes
|
||||
}
|
||||
|
||||
|
||||
// ============= Fix nitrous recharging faster when reversing the car =============
|
||||
// By Wesser
|
||||
namespace NitrousReverseRechargeFix
|
||||
{
|
||||
void __declspec(naked) NitrousControl_DontRechargeWhenReversing()
|
||||
{
|
||||
// x = 1.0f; \ if m_fGasPedal >= 0.0f x -= m_fGasPedal;
|
||||
_asm
|
||||
{
|
||||
fld [esi+49Ch]
|
||||
fldz
|
||||
fcomp st(1)
|
||||
fnstsw ax
|
||||
test ah, 41h
|
||||
jnz BiggerOrEqual
|
||||
fstp st
|
||||
retn
|
||||
|
||||
BiggerOrEqual:
|
||||
fsubp st(1), st
|
||||
retn
|
||||
}
|
||||
}
|
||||
|
||||
void __declspec(naked) NitrousControl_DontRechargeWhenReversing_NewBinaries()
|
||||
{
|
||||
_asm
|
||||
{
|
||||
fld [esi+49Ch]
|
||||
fldz
|
||||
fcomp st(1)
|
||||
fnstsw ax
|
||||
test ah, 41h
|
||||
jnz BiggerOrEqual
|
||||
fstp st
|
||||
fldz
|
||||
|
||||
BiggerOrEqual:
|
||||
retn
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ============= LS-RP Mode stuff =============
|
||||
namespace LSRPMode
|
||||
{
|
||||
@ -6235,6 +6279,16 @@ void Patch_SA_10(HINSTANCE hInstance)
|
||||
}
|
||||
|
||||
|
||||
// Fix nitrous recharging faster when reversing the car
|
||||
// By Wesser
|
||||
{
|
||||
using namespace NitrousReverseRechargeFix;
|
||||
|
||||
Nop(0x6A407B, 1);
|
||||
InjectHook(0x6A407B + 1, &NitrousControl_DontRechargeWhenReversing, HookType::Call);
|
||||
}
|
||||
|
||||
|
||||
#if FULL_PRECISION_D3D
|
||||
// Test - full precision D3D device
|
||||
Patch<uint8_t>( 0x7F672B+1, *(uint8_t*)(0x7F672B+1) | D3DCREATE_FPU_PRESERVE );
|
||||
@ -8443,6 +8497,19 @@ void Patch_SA_NewBinaries_Common(HINSTANCE hInstance)
|
||||
InterceptCall(processCurrentString, orgProcessCurrentString, ProcessCurrentString_Scale_NewBinaries<paddingYSizes.size()>);
|
||||
}
|
||||
TXN_CATCH();
|
||||
|
||||
|
||||
// Fix nitrous recharging faster when reversing the car
|
||||
// By Wesser
|
||||
try
|
||||
{
|
||||
using namespace NitrousReverseRechargeFix;
|
||||
|
||||
auto getGasPedal = pattern("D9 86 9C 04 00 00 D9 E8 D9 C0").get_one();
|
||||
Nop(getGasPedal.get<void>(), 1);
|
||||
InjectHook(getGasPedal.get<void>(1), &NitrousControl_DontRechargeWhenReversing_NewBinaries, HookType::Call);
|
||||
}
|
||||
TXN_CATCH();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user