mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-29 15:23:02 +05:00
SA: Ported new fixes to Steam/RGL:
- Reset bPenaltyForDeathApplies and bPenaltyForArrestApplies on new game - Fix lightless taxis - Allow extra6 to be picked with component rule 4 (any) - Disallow moving cam up/down with mouse when looking back/left/right in vehicle
This commit is contained in:
parent
7c79495174
commit
e797ec4f3a
2 changed files with 56 additions and 8 deletions
|
@ -17,8 +17,8 @@ bool (*CCustomCarPlateMgr::GeneratePlateText)(char* pBuf, int nLen); // Read fro
|
||||||
|
|
||||||
CBaseModelInfo** const ms_modelInfoPtrs = *AddressByVersion<CBaseModelInfo***>(0x509CB1, 0x4C0C96, 0x403DB7);
|
CBaseModelInfo** const ms_modelInfoPtrs = *AddressByVersion<CBaseModelInfo***>(0x509CB1, 0x4C0C96, 0x403DB7);
|
||||||
|
|
||||||
int8_t* CVehicleModelInfo::ms_compsUsed = *AddressByVersion<int8_t**>( 0x4C973B + 2, 0, 0 );
|
int8_t* CVehicleModelInfo::ms_compsUsed = *AddressByVersion<int8_t**>( 0x4C973B + 2, Memory::PatternAndOffset("8B CE A2 ? ? ? ? E8", 2 + 1) );
|
||||||
int8_t* CVehicleModelInfo::ms_compsToUse = *AddressByVersion<int8_t**>( 0x4C8057 + 2, 0, 0 );
|
int8_t* CVehicleModelInfo::ms_compsToUse = *AddressByVersion<int8_t**>( 0x4C8057 + 2, Memory::PatternAndOffset("0F BE C0 C6 05 ? ? ? ? FE 5E", 3 + 2) );
|
||||||
|
|
||||||
|
|
||||||
static RwTexture** const ms_aDirtTextures = *AddressByVersion<RwTexture***>( 0x5D5DCC + 3, 0, 0x5F259C + 3 );
|
static RwTexture** const ms_aDirtTextures = *AddressByVersion<RwTexture***>( 0x5D5DCC + 3, 0, 0x5F259C + 3 );
|
||||||
|
|
|
@ -1672,7 +1672,7 @@ namespace MoonphasesFix
|
||||||
// ============= Disallow moving cam up/down with mouse when looking back/left/right in vehicle =============
|
// ============= Disallow moving cam up/down with mouse when looking back/left/right in vehicle =============
|
||||||
namespace FollowCarMouseCamFix
|
namespace FollowCarMouseCamFix
|
||||||
{
|
{
|
||||||
static uint32_t& camLookDirection = **AddressByVersion<uint32_t**>( 0x525526 + 2, 0, 0 );
|
static uint32_t& camLookDirection = **AddressByVersion<uint32_t**>( 0x525526 + 2, Memory::PatternAndOffset("83 3D ? ? ? ? 03 74 06", 2) );
|
||||||
static void* (*orgGetPad)(int);
|
static void* (*orgGetPad)(int);
|
||||||
static bool* orgUseMouse3rdPerson;
|
static bool* orgUseMouse3rdPerson;
|
||||||
|
|
||||||
|
@ -5454,10 +5454,21 @@ void Patch_SA_NewBinaries_Common()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Reinit CCarCtrl fields (firetruck and ambulance generation)
|
// Reset variables on New Game
|
||||||
{
|
{
|
||||||
using namespace VariableResets;
|
using namespace VariableResets;
|
||||||
|
|
||||||
|
{
|
||||||
|
auto reinit1 = get_pattern( "E8 ? ? ? ? E8 ? ? ? ? E8 ? ? ? ? E8 ? ? ? ? 38 1D" );
|
||||||
|
auto reinit2 = get_pattern( "E8 ? ? ? ? 89 1D ? ? ? ? E8 ? ? ? ? 5E" );
|
||||||
|
|
||||||
|
ReadCall( reinit1, orgReInitGameObjectVariables );
|
||||||
|
InjectHook( reinit1, ReInitGameObjectVariables );
|
||||||
|
InjectHook( reinit2, ReInitGameObjectVariables );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Variables to reset
|
||||||
|
{
|
||||||
auto timers_init = pattern( "89 45 FC DB 45 FC C6 05 ? ? ? ? 01" ).get_one();
|
auto timers_init = pattern( "89 45 FC DB 45 FC C6 05 ? ? ? ? 01" ).get_one();
|
||||||
|
|
||||||
GameVariablesToReset.emplace_back( *timers_init.get<signed int*>(-17 + 2) );
|
GameVariablesToReset.emplace_back( *timers_init.get<signed int*>(-17 + 2) );
|
||||||
|
@ -5465,6 +5476,10 @@ void Patch_SA_NewBinaries_Common()
|
||||||
GameVariablesToReset.emplace_back( *timers_init.get<TimeNextMadDriverChaseCreated_t<float>*>(0x41 + 2) );
|
GameVariablesToReset.emplace_back( *timers_init.get<TimeNextMadDriverChaseCreated_t<float>*>(0x41 + 2) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GameVariablesToReset.emplace_back( *get_pattern<ResetToTrue_t*>( "A2 ? ? ? ? E9 ? ? ? ? 6A 01 8B CE", 1 ) ); // CGameLogic::bPenaltyForDeathApplies
|
||||||
|
GameVariablesToReset.emplace_back( *get_pattern<ResetToTrue_t*>( "88 0D ? ? ? ? E9 ? ? ? ? 6A 05", 2 ) ); // CGameLogic::bPenaltyForArrestApplies
|
||||||
|
}
|
||||||
|
|
||||||
// FuckCarCompletely not fixing panels
|
// FuckCarCompletely not fixing panels
|
||||||
{
|
{
|
||||||
void* panel_addr = get_pattern( "C6 46 04 FA 5E 5B", -3 );
|
void* panel_addr = get_pattern( "C6 46 04 FA 5E 5B", -3 );
|
||||||
|
@ -5715,6 +5730,39 @@ void Patch_SA_NewBinaries_Common()
|
||||||
ReadCall( getPipeID.get<void>( 0x1A ), orgGetExtraVertColourPtr );
|
ReadCall( getPipeID.get<void>( 0x1A ), orgGetExtraVertColourPtr );
|
||||||
InjectHook( getPipeID.get<void>( 0x1A ), GetExtraVertColourPtr_SkinCheck );
|
InjectHook( getPipeID.get<void>( 0x1A ), GetExtraVertColourPtr_SkinCheck );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Reset requested extras if created vehicle has no extras
|
||||||
|
// Fixes eg. lightless taxis
|
||||||
|
{
|
||||||
|
auto resetComps = pattern( "6A 00 68 ? ? ? ? 57 E8 ? ? ? ? 83 C4 0C 8B C7" ).get_one();
|
||||||
|
|
||||||
|
InjectHook( resetComps.get<void>( -9 ), CVehicleModelInfo::ResetCompsForNoExtras, PATCH_CALL );
|
||||||
|
Nop( resetComps.get<void>( -9 + 5 ), 4 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Allow extra6 to be picked with component rule 4 (any)
|
||||||
|
{
|
||||||
|
void* extra6 = get_pattern( "6A 00 E8 ? ? ? ? 83 C4 08 5E", -2 + 1 );
|
||||||
|
|
||||||
|
Patch<int8_t>( extra6, 6 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Disallow moving cam up/down with mouse when looking back/left/right in vehicle
|
||||||
|
{
|
||||||
|
using namespace FollowCarMouseCamFix;
|
||||||
|
|
||||||
|
bool** useMouse3rdPerson = get_pattern<bool*>( "80 3D ? ? ? ? 00 C6 45 1B 00", 2 );
|
||||||
|
auto getPad = get_pattern( "89 45 B8 E8 ? ? ? ? 89 45 FC", 3 );
|
||||||
|
|
||||||
|
orgUseMouse3rdPerson = *useMouse3rdPerson;
|
||||||
|
Patch( useMouse3rdPerson, &useMouseAndLooksForwards );
|
||||||
|
|
||||||
|
ReadCall( getPad, orgGetPad );
|
||||||
|
InjectHook( getPad, getPadAndSetFlag );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue