From 5ad460ff40e4a3b4efe533d82bad15cef33b5d0a Mon Sep 17 00:00:00 2001 From: Silent Date: Fri, 26 Jan 2018 18:18:36 +0100 Subject: [PATCH] CPlayerInfo operator= (for SA 1.0 --- SilentPatchSA/PlayerInfoSA.cpp | 8 +++++++- SilentPatchSA/PlayerInfoSA.h | 2 ++ SilentPatchSA/SilentPatchSA.cpp | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/SilentPatchSA/PlayerInfoSA.cpp b/SilentPatchSA/PlayerInfoSA.cpp index 1b7dc79..dba6368 100644 --- a/SilentPatchSA/PlayerInfoSA.cpp +++ b/SilentPatchSA/PlayerInfoSA.cpp @@ -37,4 +37,10 @@ CVehicle* FindPlayerVehicle( int playerID, bool withRC ) vehicle = ped->GetVehiclePtr(); } return vehicle; -} \ No newline at end of file +} + +CPlayerInfo& CPlayerInfo::operator=( const CPlayerInfo& rhs ) +{ + memcpy( this, &rhs, sizeof(*this) ); + return *this; +} diff --git a/SilentPatchSA/PlayerInfoSA.h b/SilentPatchSA/PlayerInfoSA.h index dc1fb4a..482ca01 100644 --- a/SilentPatchSA/PlayerInfoSA.h +++ b/SilentPatchSA/PlayerInfoSA.h @@ -12,6 +12,8 @@ private: uint8_t __pad[0xDC]; public: + CPlayerInfo& operator=( const CPlayerInfo& rhs ); + CPlayerPed* GetPlayerPed() const { return m_pPed; } CVehicle* GetControlledVehicle() const { return m_pControlledVehicle; } }; diff --git a/SilentPatchSA/SilentPatchSA.cpp b/SilentPatchSA/SilentPatchSA.cpp index d8cb8d3..2d723c9 100644 --- a/SilentPatchSA/SilentPatchSA.cpp +++ b/SilentPatchSA/SilentPatchSA.cpp @@ -3438,6 +3438,10 @@ void Patch_SA_10() // Correct streaming when using RC vehicles InjectHook( 0x55574B, FindPlayerEntityWithRC ); InjectHook( 0x5557C3, FindPlayerVehicle_RCWrap ); + + + // Fixed CPlayerInfo assignment operator + InjectHook( 0x45DEF0, &CPlayerInfo::operator=, PATCH_JUMP ); } void Patch_SA_11()