diff --git a/SilentPatchSA/GeneralSA.cpp b/SilentPatchSA/GeneralSA.cpp index 86728fc..d53d4e1 100644 --- a/SilentPatchSA/GeneralSA.cpp +++ b/SilentPatchSA/GeneralSA.cpp @@ -9,7 +9,7 @@ static void* EntityRender = AddressByVersion(0x534310, 0x5347B0, 0x545B30); WRAPPER void CEntity::Render() { VARJMP(EntityRender); } -static void* varEntityIsVisible = AddressByVersion( 0x536BC0, 0, 0 ); // TODO +static void* varEntityIsVisible = AddressByVersion( 0x536BC0, Memory::PatternAndOffset("0B F6 41 1C 80 74 05 E9", -5) ); WRAPPER bool CEntity::IsVisible() { VARJMP(varEntityIsVisible); } static void* varInvertRaster = AddressByVersion(0x705660, 0x705E90, 0x7497A0); diff --git a/SilentPatchSA/ModelInfoSA.cpp b/SilentPatchSA/ModelInfoSA.cpp index 16beb41..31fa59d 100644 --- a/SilentPatchSA/ModelInfoSA.cpp +++ b/SilentPatchSA/ModelInfoSA.cpp @@ -6,8 +6,7 @@ static void* BaseModelInfoShutdown = AddressByVersion(0x4C4D50, 0x4C4DD0, 0x4CF590); WRAPPER void CBaseModelInfo::Shutdown() { VARJMP(BaseModelInfoShutdown); } -// static unsigned char* ms_currentCol = *AddressByVersion(0x4C84C8, 0x4C86C8, 0x4D2DC8); -static void* varSetVehicleColour = AddressByVersion( 0x4C84B0, 0, 0 ); // TODO: DO +static void* varSetVehicleColour = AddressByVersion( 0x4C84B0, 0x4C86B0, 0x4D2DB0 ); WRAPPER void CVehicleModelInfo::SetVehicleColour( int32_t color1, int32_t color2, int32_t color3, int32_t color4 ) { VARJMP(varSetVehicleColour); } RwTexture* (*CCustomCarPlateMgr::CreatePlateTexture)(const char* pText, signed char nDesign) = AddressByVersion(0x6FDEA0, 0x6FE6D0, 0x736AC0); @@ -17,7 +16,6 @@ void (*CCustomCarPlateMgr::SetupMaterialPlatebackTexture)(RpMaterial* pMaterial, bool (*CCustomCarPlateMgr::GeneratePlateText)(char* pBuf, int nLen); // Read from InjectDelayedPatches CBaseModelInfo** const ms_modelInfoPtrs = *AddressByVersion(0x509CB1, 0x4C0C96, 0x403DB7); -const uint32_t m_numModelInfoPtrs = *AddressByVersion(0x4C5956+2, 0, 0); static RwTexture** const ms_aDirtTextures = *AddressByVersion( 0x5D5DCC + 3, 0, 0x5F259C + 3 ); diff --git a/SilentPatchSA/ModelInfoSA.h b/SilentPatchSA/ModelInfoSA.h index bdf6db8..5d0b68b 100644 --- a/SilentPatchSA/ModelInfoSA.h +++ b/SilentPatchSA/ModelInfoSA.h @@ -323,7 +323,6 @@ public: }; extern CBaseModelInfo** const ms_modelInfoPtrs; -extern const uint32_t m_numModelInfoPtrs; void RemapDirt( CVehicleModelInfo* modelInfo, uint32_t dirtID ); diff --git a/SilentPatchSA/PlayerInfoSA.cpp b/SilentPatchSA/PlayerInfoSA.cpp index dba6368..c452821 100644 --- a/SilentPatchSA/PlayerInfoSA.cpp +++ b/SilentPatchSA/PlayerInfoSA.cpp @@ -1,8 +1,8 @@ #include "StdAfxSA.h" #include "PlayerInfoSA.h" -uint8_t& PlayerInFocus = **AddressByVersion( 0x56E218 + 3, 0, 0 ); // TODO: DO -CPlayerInfo* const Players = *AddressByVersion( 0x56E225 + 2, 0, 0 ); +uint8_t& PlayerInFocus = **AddressByVersion( 0x56E218 + 3, Memory::PatternAndOffset("08 85 C0 79 07 0F B6 05 ? ? ? ? 69 C0 90 01 00 00 8B 80", 8) ); +CPlayerInfo* const Players = *AddressByVersion( 0x56E225 + 2, Memory::PatternAndOffset("08 85 C0 79 07 0F B6 05 ? ? ? ? 69 C0 90 01 00 00 8B 80", 20) ); CPlayerPed* FindPlayerPed( int playerID ) { diff --git a/SilentPatchSA/PoolsSA.cpp b/SilentPatchSA/PoolsSA.cpp index 17f4c27..5ad620a 100644 --- a/SilentPatchSA/PoolsSA.cpp +++ b/SilentPatchSA/PoolsSA.cpp @@ -1,4 +1,4 @@ #include "StdAfxSA.h" #include "PoolsSA.h" -CObjectPool*& CPools::ms_pObjectPool = **AddressByVersion(0x5A18B2 + 2, 0, 0); // TODO \ No newline at end of file +CObjectPool*& CPools::ms_pObjectPool = **AddressByVersion(0x5A18B2 + 2, Memory::PatternAndOffset("8B 48 08 57 33 FF 89 45 F8 89 4D FC", -4) ); \ No newline at end of file diff --git a/SilentPatchSA/SilentPatchSA.cpp b/SilentPatchSA/SilentPatchSA.cpp index bf4114f..4e994d7 100644 --- a/SilentPatchSA/SilentPatchSA.cpp +++ b/SilentPatchSA/SilentPatchSA.cpp @@ -1037,6 +1037,7 @@ bool ReadDoubleRearWheels(const wchar_t* pPath) return listedAny; } +// 1.0 ONLY! bool __stdcall CheckDoubleRWheelsList( void* modelInfo, uint8_t* handlingData ) { static void* lastModelInfo = nullptr; @@ -1045,7 +1046,8 @@ bool __stdcall CheckDoubleRWheelsList( void* modelInfo, uint8_t* handlingData ) if ( modelInfo == lastModelInfo ) return lastResult; lastModelInfo = modelInfo; - int32_t modelID = std::distance( ms_modelInfoPtrs, std::find( ms_modelInfoPtrs, ms_modelInfoPtrs+m_numModelInfoPtrs, modelInfo ) ); + const uint32_t numModelInfoPtrs = *(uint32_t*)0x4C5956+2; + int32_t modelID = std::distance( ms_modelInfoPtrs, std::find( ms_modelInfoPtrs, ms_modelInfoPtrs+numModelInfoPtrs, modelInfo ) ); auto it = std::find_if( doubleRearWheelsList.begin(), doubleRearWheelsList.end(), [modelID]( const auto& item ) { return item.first == modelID; @@ -1072,7 +1074,7 @@ CVehicleModelInfo* __fastcall VehicleModelInfoCtor(CVehicleModelInfo* me) return me; } -static void (*RemoveFromInterestingVehicleList)(CVehicle*) = AddressByVersion( 0x423ED0, 0, 0 ); // TODO: DO +static void (*RemoveFromInterestingVehicleList)(CVehicle*) = AddressByVersion( 0x423ED0, Memory::PatternAndOffset("39 10 75 06 C7 00 00 00 00 00 83 C0 04 49 75 F0 5D C3", -10) ); static void (*orgRecordVehicleDeleted)(CVehicle*); static void RecordVehicleDeleted_AndRemoveFromVehicleList( CVehicle* vehicle ) { @@ -1083,11 +1085,11 @@ static void RecordVehicleDeleted_AndRemoveFromVehicleList( CVehicle* vehicle ) static int currDisplayedSplash_ForLastSplash = 0; static void DoPCScreenChange_Mod() { - static int& currDisplayedSplash = **AddressByVersion( 0x590B22 + 1, 0, 0 ); // TODO: DO + static int& currDisplayedSplash = **AddressByVersion( 0x590B22 + 1, Memory::PatternAndOffset("8B 51 20 6A 01 6A 0C FF D2 83 C4 08 E8", 17 + 1) ); static const int numSplashes = [] () -> int { - RwTexture** begin = *AddressByVersion( 0x590CB4 + 1, 0, 0 ); // TODO: DO - RwTexture** end = *AddressByVersion( 0x590CCE + 2, 0, 0 ); // TODO: DO + RwTexture** begin = *AddressByVersion( 0x590CB4 + 1, Memory::PatternAndOffset("8D 49 00 83 3E 00 74 07 8B CE E8", -5 + 1) ); + RwTexture** end = *AddressByVersion( 0x590CCE + 2, Memory::PatternAndOffset("8D 49 00 83 3E 00 74 07 8B CE E8", 18 + 2) ); return std::distance( begin, end ); } () - 1; @@ -1107,9 +1109,9 @@ static CVector curVecToSun; static void (*orgSetLightsWithTimeOfDayColour)( RpWorld* ); static void SetLightsWithTimeOfDayColour_SilentPatch( RpWorld* world ) { - static CVector* const VectorToSun = *AddressByVersion( 0x6FC5B7 + 3, 0, 0 ); // TODO: DO - static int& CurrentStoredValue = **AddressByVersion( 0x6FC632 + 1, 0, 0 ); // TODO: DO - static CVector& vecDirnLightToSun = **AddressByVersion( 0x5BC040 + 2, 0, 0 ); // TODO: Do + static CVector* const VectorToSun = *AddressByVersion( 0x6FC5B7 + 3, Memory::PatternAndOffset("DC 0D ? ? ? ? 8D 04 40 8B 0C 85", 9 + 3) ); + static int& CurrentStoredValue = **AddressByVersion( 0x6FC632 + 1, Memory::PatternAndOffset("84 C0 0F 84 AB 01 00 00 A1", 8 + 1) ); + static CVector& vecDirnLightToSun = **AddressByVersion( 0x5BC040 + 2, Memory::PatternAndOffset("E8 ? ? ? ? D9 5D F8 D9 45 F8 D8 4D F4 D9 1D", 15 + 2) ); curVecToSun = bUseAaronSun ? VectorToSun[CurrentStoredValue] : vecDirnLightToSun; orgSetLightsWithTimeOfDayColour( world ); diff --git a/SilentPatchSA/TimerSA.cpp b/SilentPatchSA/TimerSA.cpp index 406f01f..789d1f6 100644 --- a/SilentPatchSA/TimerSA.cpp +++ b/SilentPatchSA/TimerSA.cpp @@ -2,4 +2,4 @@ #include "TimerSA.h" int& CTimer::m_snTimeInMilliseconds = **AddressByVersion(0x4242D1, 0x53F6A1, 0x406FA1); -float& CTimer::m_fTimeStep = **AddressByVersion(0x41DE4F + 2, 0, 0); \ No newline at end of file +float& CTimer::m_fTimeStep = **AddressByVersion(0x41DE4F + 2, Memory::PatternAndOffset("0F B7 86 DC 04 00 00 D9 05", 8) ); \ No newline at end of file