mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-11-22 05:22:32 +01:00
Supply Lines streaming fix (SA 1.0)
This commit is contained in:
parent
75b512764b
commit
62ed9242bc
@ -314,6 +314,15 @@ public:
|
|||||||
void RenderForShadow();
|
void RenderForShadow();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class NOVMT CPlayerPed : public CPed
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
CPed* m_pMouseLockOnRecruitPed;
|
||||||
|
int m_iMouseLockOnRecruitTimer;
|
||||||
|
};
|
||||||
|
|
||||||
static_assert(sizeof(CPed) == 0x79C, "Wrong size: CPed");
|
static_assert(sizeof(CPed) == 0x79C, "Wrong size: CPed");
|
||||||
|
static_assert(sizeof(CPlayerPed) == 0x7A4, "Wrong size: CPlayerPed");
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
40
SilentPatchSA/PlayerInfoSA.cpp
Normal file
40
SilentPatchSA/PlayerInfoSA.cpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#include "StdAfxSA.h"
|
||||||
|
#include "PlayerInfoSA.h"
|
||||||
|
|
||||||
|
uint8_t& PlayerInFocus = **AddressByVersion<uint8_t**>( 0x56E218 + 3, 0, 0 ); // TODO: DO
|
||||||
|
CPlayerInfo* const Players = *AddressByVersion<CPlayerInfo**>( 0x56E225 + 2, 0, 0 );
|
||||||
|
|
||||||
|
CPlayerPed* FindPlayerPed( int playerID )
|
||||||
|
{
|
||||||
|
return Players[ playerID < 0 ? PlayerInFocus : playerID ].GetPlayerPed();
|
||||||
|
}
|
||||||
|
|
||||||
|
CEntity* FindPlayerEntityWithRC( int playerID )
|
||||||
|
{
|
||||||
|
CPlayerInfo* player = &Players[ playerID < 0 ? PlayerInFocus : playerID ];
|
||||||
|
|
||||||
|
CPlayerPed* ped = player->GetPlayerPed();
|
||||||
|
CVehicle* remoteVehicle = player->GetControlledVehicle();
|
||||||
|
if ( remoteVehicle != nullptr ) return remoteVehicle;
|
||||||
|
if ( ped->GetPedFlags().bInVehicle )
|
||||||
|
{
|
||||||
|
CVehicle* normalVehicle = ped->GetVehiclePtr();
|
||||||
|
if ( normalVehicle != nullptr ) return normalVehicle;
|
||||||
|
}
|
||||||
|
return ped;
|
||||||
|
}
|
||||||
|
|
||||||
|
CVehicle* FindPlayerVehicle( int playerID, bool withRC )
|
||||||
|
{
|
||||||
|
CPlayerInfo* player = &Players[ playerID < 0 ? PlayerInFocus : playerID ];
|
||||||
|
|
||||||
|
CPlayerPed* ped = player->GetPlayerPed();
|
||||||
|
if ( ped == nullptr ) return nullptr;
|
||||||
|
if ( !ped->GetPedFlags().bInVehicle ) return nullptr;
|
||||||
|
CVehicle* vehicle = player->GetControlledVehicle();
|
||||||
|
if ( !withRC || vehicle == nullptr )
|
||||||
|
{
|
||||||
|
vehicle = ped->GetVehiclePtr();
|
||||||
|
}
|
||||||
|
return vehicle;
|
||||||
|
}
|
23
SilentPatchSA/PlayerInfoSA.h
Normal file
23
SilentPatchSA/PlayerInfoSA.h
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "PedSA.h"
|
||||||
|
#include "VehicleSA.h"
|
||||||
|
|
||||||
|
class CPlayerInfo
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
CPlayerPed* m_pPed;
|
||||||
|
uint8_t __pad2[0xAC];
|
||||||
|
CVehicle* m_pControlledVehicle;
|
||||||
|
uint8_t __pad[0xDC];
|
||||||
|
|
||||||
|
public:
|
||||||
|
CPlayerPed* GetPlayerPed() const { return m_pPed; }
|
||||||
|
CVehicle* GetControlledVehicle() const { return m_pControlledVehicle; }
|
||||||
|
};
|
||||||
|
|
||||||
|
CPlayerPed* FindPlayerPed( int playerID = -1 );
|
||||||
|
CEntity* FindPlayerEntityWithRC( int playerID = -1 );
|
||||||
|
CVehicle* FindPlayerVehicle( int playerID = -1, bool withRC = false );
|
||||||
|
|
||||||
|
static_assert(sizeof(CPlayerInfo) == 0x190, "Wrong size: CPlayerInfo");
|
@ -14,6 +14,7 @@
|
|||||||
#include "AudioHardwareSA.h"
|
#include "AudioHardwareSA.h"
|
||||||
#include "LinkListSA.h"
|
#include "LinkListSA.h"
|
||||||
#include "PNGFile.h"
|
#include "PNGFile.h"
|
||||||
|
#include "PlayerInfoSA.h"
|
||||||
|
|
||||||
#include "WaveDecoderSA.h"
|
#include "WaveDecoderSA.h"
|
||||||
#include "FLACDecoderSA.h"
|
#include "FLACDecoderSA.h"
|
||||||
@ -1335,6 +1336,11 @@ namespace FakeQPC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static CVehicle* FindPlayerVehicle_RCWrap( int playerID, bool )
|
||||||
|
{
|
||||||
|
return FindPlayerVehicle( playerID, true );
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MEM_VALIDATORS
|
#if MEM_VALIDATORS
|
||||||
@ -3407,6 +3413,11 @@ void Patch_SA_10()
|
|||||||
// unnamed CdStream semaphore
|
// unnamed CdStream semaphore
|
||||||
Patch( 0x406945, { 0x6A, 0x00 } ); // push 0 \ nop
|
Patch( 0x406945, { 0x6A, 0x00 } ); // push 0 \ nop
|
||||||
Nop( 0x406945 + 2, 3 );
|
Nop( 0x406945 + 2, 3 );
|
||||||
|
|
||||||
|
|
||||||
|
// Correct streaming when using RC vehicles
|
||||||
|
InjectHook( 0x55574B, FindPlayerEntityWithRC );
|
||||||
|
InjectHook( 0x5557C3, FindPlayerVehicle_RCWrap );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Patch_SA_11()
|
void Patch_SA_11()
|
||||||
|
@ -198,6 +198,7 @@ copy /y "$(TargetPath)" "D:\gry\GTA San Andreas clean\scripts\newsteam_r2_lowvio
|
|||||||
<ClCompile Include="GeneralSA.cpp" />
|
<ClCompile Include="GeneralSA.cpp" />
|
||||||
<ClCompile Include="ModelInfoSA.cpp" />
|
<ClCompile Include="ModelInfoSA.cpp" />
|
||||||
<ClCompile Include="PedSA.cpp" />
|
<ClCompile Include="PedSA.cpp" />
|
||||||
|
<ClCompile Include="PlayerInfoSA.cpp" />
|
||||||
<ClCompile Include="PNGFile.cpp" />
|
<ClCompile Include="PNGFile.cpp" />
|
||||||
<ClCompile Include="PoolsSA.cpp" />
|
<ClCompile Include="PoolsSA.cpp" />
|
||||||
<ClCompile Include="ScriptSA.cpp" />
|
<ClCompile Include="ScriptSA.cpp" />
|
||||||
@ -232,6 +233,7 @@ copy /y "$(TargetPath)" "D:\gry\GTA San Andreas clean\scripts\newsteam_r2_lowvio
|
|||||||
<ClInclude Include="Maths.h" />
|
<ClInclude Include="Maths.h" />
|
||||||
<ClInclude Include="ModelInfoSA.h" />
|
<ClInclude Include="ModelInfoSA.h" />
|
||||||
<ClInclude Include="PedSA.h" />
|
<ClInclude Include="PedSA.h" />
|
||||||
|
<ClInclude Include="PlayerInfoSA.h" />
|
||||||
<ClInclude Include="PNGFile.h" />
|
<ClInclude Include="PNGFile.h" />
|
||||||
<ClInclude Include="PoolsSA.h" />
|
<ClInclude Include="PoolsSA.h" />
|
||||||
<ClInclude Include="resource.h" />
|
<ClInclude Include="resource.h" />
|
||||||
|
@ -66,6 +66,9 @@
|
|||||||
<ClCompile Include="PoolsSA.cpp">
|
<ClCompile Include="PoolsSA.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="PlayerInfoSA.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\SilentPatch\MemoryMgr.h">
|
<ClInclude Include="..\SilentPatch\MemoryMgr.h">
|
||||||
@ -155,6 +158,9 @@
|
|||||||
<ClInclude Include="..\SilentPatch\ModuleList.hpp">
|
<ClInclude Include="..\SilentPatch\ModuleList.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="PlayerInfoSA.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="..\SilentPatch\SilentPatch.rc">
|
<ResourceCompile Include="..\SilentPatch\SilentPatch.rc">
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "TimerSA.h"
|
#include "TimerSA.h"
|
||||||
#include "PedSA.h"
|
#include "PedSA.h"
|
||||||
#include "DelimStringReader.h"
|
#include "DelimStringReader.h"
|
||||||
|
#include "PlayerInfoSA.h"
|
||||||
|
|
||||||
static constexpr float PHOENIX_FLUTTER_PERIOD = 70.0f;
|
static constexpr float PHOENIX_FLUTTER_PERIOD = 70.0f;
|
||||||
static constexpr float PHOENIX_FLUTTER_AMP = 0.13f;
|
static constexpr float PHOENIX_FLUTTER_AMP = 0.13f;
|
||||||
@ -28,8 +29,6 @@ WRAPPER void CVehicle::Render() { VARJMP(varVehicleRender); }
|
|||||||
static void* varIsLawEnforcementVehicle = AddressByVersion<void*>(0x6D2370, 0x6D2BA0, 0x70D8C0);
|
static void* varIsLawEnforcementVehicle = AddressByVersion<void*>(0x6D2370, 0x6D2BA0, 0x70D8C0);
|
||||||
WRAPPER bool CVehicle::IsLawEnforcementVehicle() { VARJMP(varIsLawEnforcementVehicle); }
|
WRAPPER bool CVehicle::IsLawEnforcementVehicle() { VARJMP(varIsLawEnforcementVehicle); }
|
||||||
|
|
||||||
auto FindPlayerPed = AddressByVersion<CPed*(*)(int)>( 0x56E210, 0, 0 ); // TODO: DO
|
|
||||||
|
|
||||||
void (CVehicle::*CVehicle::orgVehiclePreRender)();
|
void (CVehicle::*CVehicle::orgVehiclePreRender)();
|
||||||
void (CAutomobile::*CAutomobile::orgAutomobilePreRender)();
|
void (CAutomobile::*CAutomobile::orgAutomobilePreRender)();
|
||||||
void (CPlane::*CPlane::orgPlanePreRender)();
|
void (CPlane::*CPlane::orgPlanePreRender)();
|
||||||
@ -472,7 +471,7 @@ CVehicle* CStoredCar::RestoreCar_SilentPatch()
|
|||||||
if ( vehicle->GetClass() == VEHICLE_AUTOMOBILE || vehicle->GetClass() == VEHICLE_BIKE )
|
if ( vehicle->GetClass() == VEHICLE_AUTOMOBILE || vehicle->GetClass() == VEHICLE_BIKE )
|
||||||
{
|
{
|
||||||
vehicle->SetBombOnBoard( m_bombType );
|
vehicle->SetBombOnBoard( m_bombType );
|
||||||
vehicle->SetBombOwner( FindPlayerPed(-1) );
|
vehicle->SetBombOwner( FindPlayerPed() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user