diff --git a/Client/game_sa/CCameraSA.cpp b/Client/game_sa/CCameraSA.cpp index 4cd7383e3e..218a1dd3dc 100644 --- a/Client/game_sa/CCameraSA.cpp +++ b/Client/game_sa/CCameraSA.cpp @@ -15,7 +15,6 @@ extern CGameSA* pGame; -unsigned long CCameraSA::FUNC_RwFrameGetLTM; static bool bCameraClipObjects; static bool bCameraClipVehicles; @@ -358,16 +357,8 @@ float CCameraSA::GetCameraRotation() RwMatrix* CCameraSA::GetLTM() { - DWORD frame = *(DWORD*)(((DWORD)GetInterface()->m_pRwCamera) + 4); - DWORD dwReturn; - _asm - { - push frame - call FUNC_RwFrameGetLTM - add esp, 4 - mov dwReturn, eax - } - return (RwMatrix*)dwReturn; + // RwFrameGetLTM + return ((RwMatrix*(_cdecl*)(void*))0x7F0990)(GetInterface()->m_pRwCamera->object.object.parent); } CEntity* CCameraSA::GetTargetEntity() diff --git a/Client/game_sa/CCameraSA.h b/Client/game_sa/CCameraSA.h index 48c5ca0b1f..d6d757e200 100644 --- a/Client/game_sa/CCameraSA.h +++ b/Client/game_sa/CCameraSA.h @@ -308,7 +308,7 @@ class CCameraSAInterface float m_fAttachedCamAngle; // for giving the attached camera a tilt. // RenderWare camera pointer - DWORD* m_pRwCamera; // was RwCamera * + RwCamera* m_pRwCamera; /// stuff for cut scenes CEntitySAInterface* pTargetEntity; CEntitySAInterface* pAttachedEntity; @@ -426,7 +426,4 @@ class CCameraSA : public CCamera void RestoreLastGoodState(); void SetShakeForce(float fShakeForce); float GetShakeForce(); - -private: - static unsigned long FUNC_RwFrameGetLTM; }; diff --git a/Client/game_sa/CEntitySA.cpp b/Client/game_sa/CEntitySA.cpp index 5c61c38762..4466a53fe4 100644 --- a/Client/game_sa/CEntitySA.cpp +++ b/Client/game_sa/CEntitySA.cpp @@ -23,9 +23,6 @@ extern CGameSA* pGame; -unsigned long CEntitySA::FUNC_CClumpModelInfo__GetFrameFromId; -unsigned long CEntitySA::FUNC_RwFrameGetLTM; - void CEntitySAInterface::TransformFromObjectSpace(CVector& outPosn, CVector const& offset) { ((void(__thiscall*)(CEntitySAInterface*, CVector&, CVector const&))0x533560)(this, outPosn, offset); @@ -439,17 +436,8 @@ eEntityStatus CEntitySA::GetEntityStatus() RwFrame* CEntitySA::GetFrameFromId(int id) { - DWORD dwClump = (DWORD)m_pInterface->m_pRwObject; - DWORD dwReturn; - _asm - { - push id - push dwClump - call FUNC_CClumpModelInfo__GetFrameFromId - add esp, 8 - mov dwReturn, eax - } - return (RwFrame*)dwReturn; + // CClumpModelInfo::GetFrameFromId + return ((RwFrame*(_cdecl*)(RpClump*, int))0x4C53C0)(m_pInterface->m_pRwObject, id); } RpClump* CEntitySA::GetRpClump() @@ -459,16 +447,8 @@ RpClump* CEntitySA::GetRpClump() RwMatrix* CEntitySA::GetLTMFromId(int id) { - DWORD dwReturn; - RwFrame* frame = GetFrameFromId(id); - _asm - { - push frame - call FUNC_RwFrameGetLTM - add esp, 4 - mov dwReturn, eax - } - return (RwMatrix*)dwReturn; + // RwFrameGetLTM + return ((RwMatrix*(_cdecl*)(RwFrame*))0x7F0990)(GetFrameFromId(id)); } void CEntitySA::SetAlpha(DWORD dwAlpha) diff --git a/Client/game_sa/CEntitySA.h b/Client/game_sa/CEntitySA.h index bc96426a99..101b88a46a 100644 --- a/Client/game_sa/CEntitySA.h +++ b/Client/game_sa/CEntitySA.h @@ -314,9 +314,6 @@ class CEntitySA : public virtual CEntity virtual void OnChangingPosition(const CVector& vecNewPosition) {} private: - static unsigned long FUNC_CClumpModelInfo__GetFrameFromId; - static unsigned long FUNC_RwFrameGetLTM; - void* m_pStoredPointer; CVector m_LastGoodPosition; }; diff --git a/Client/game_sa/CGameSA.cpp b/Client/game_sa/CGameSA.cpp index e88d72efcd..367e47a169 100644 --- a/Client/game_sa/CGameSA.cpp +++ b/Client/game_sa/CGameSA.cpp @@ -38,7 +38,6 @@ #include "CHudSA.h" #include "CKeyGenSA.h" #include "CObjectGroupPhysicalPropertiesSA.h" -#include "COffsets.h" #include "CPadSA.h" #include "CPickupsSA.h" #include "CPlayerInfoSA.h" @@ -61,15 +60,6 @@ extern CGameSA* pGame; unsigned int& CGameSA::ClumpOffset = *(unsigned int*)0xB5F878; -unsigned long* CGameSA::VAR_SystemTime; -unsigned long* CGameSA::VAR_IsAtMenu; -bool* CGameSA::VAR_IsForegroundWindow; -unsigned long* CGameSA::VAR_SystemState; -float* CGameSA::VAR_TimeScale; -float* CGameSA::VAR_FPS; -float* CGameSA::VAR_OldTimeStep; -float* CGameSA::VAR_TimeStep; -unsigned long* CGameSA::VAR_Framelimiter; unsigned int OBJECTDYNAMICINFO_MAX = *(uint32_t*)0x59FB4C != 0x90909090 ? *(uint32_t*)0x59FB4C : 160; // default: 160 @@ -90,21 +80,6 @@ CGameSA::CGameSA() SetInitialVirtualProtect(); - // Initialize the offsets - eGameVersion version = FindGameVersion(); - switch (version) - { - case VERSION_EU_10: - COffsets::Initialize10EU(); - break; - case VERSION_US_10: - COffsets::Initialize10US(); - break; - case VERSION_11: - COffsets::Initialize11(); - break; - } - // Set the model ids for all the CModelInfoSA instances for (unsigned int i = 0; i < modelInfoMax; i++) { @@ -142,7 +117,7 @@ CGameSA::CGameSA() m_pCarEnterExit = new CCarEnterExitSA(); m_pControllerConfigManager = new CControllerConfigManagerSA(); m_pProjectileInfo = new CProjectileInfoSA(); - m_pRenderWare = new CRenderWareSA(version); + m_pRenderWare = new CRenderWareSA(); m_pHandlingManager = new CHandlingManagerSA(); m_pEventList = new CEventListSA(); m_pGarages = new CGaragesSA((CGaragesSAInterface*)CLASS_CGarages); @@ -363,12 +338,12 @@ void CGameSA::StartGame() */ void CGameSA::SetSystemState(eSystemState State) { - *VAR_SystemState = (DWORD)State; + MemPutFast(0xC8D4C0, State); // gGameState } eSystemState CGameSA::GetSystemState() { - return (eSystemState)*VAR_SystemState; + return *(eSystemState*)0xC8D4C0; // gGameState } /** @@ -503,27 +478,27 @@ eGameVersion CGameSA::FindGameVersion() float CGameSA::GetFPS() { - return *VAR_FPS; + return *(float*)0xB7CB50; // CTimer::game_FPS } float CGameSA::GetTimeStep() { - return *VAR_TimeStep; + return *(float*)0xB7CB5C; // CTimer::ms_fTimeStep } float CGameSA::GetOldTimeStep() { - return *VAR_OldTimeStep; + return *(float*)0xB7CB54; // CTimer::ms_fOldTimeStep } float CGameSA::GetTimeScale() { - return *VAR_TimeScale; + return *(float*)0xB7CB64; // CTimer::ms_fTimeScale } void CGameSA::SetTimeScale(float fTimeScale) { - *VAR_TimeScale = fTimeScale; + MemPutFast(0xB7CB64, fTimeScale); // CTimer::ms_fTimeScale } unsigned char CGameSA::GetBlurLevel() diff --git a/Client/game_sa/CGameSA.h b/Client/game_sa/CGameSA.h index 8d420422fc..e7aa9c3cfd 100644 --- a/Client/game_sa/CGameSA.h +++ b/Client/game_sa/CGameSA.h @@ -167,9 +167,9 @@ class CGameSA : public CGame int32_t GetBaseIDforSCM() { return *(int32_t*)(0x46A574 + 2); } int32_t GetCountOfAllFileIDs() { return (*(char**)(0x5B8AFA + 2) - *(char**)(0x5B8B08 + 6)) / sizeof(CStreamingInfo); } - DWORD GetSystemTime() { return *VAR_SystemTime; } + DWORD GetSystemTime() { return *(DWORD*)0xB7CB84; } // CTimer::m_snTimeInMilliseconds - bool IsAtMenu() { return *VAR_IsAtMenu != 0; } + bool IsAtMenu() { return *(unsigned long*)0xBA677B != 0; } // FrontEndMenuManager + 0x33 void StartGame(); void SetSystemState(eSystemState State); @@ -333,15 +333,6 @@ class CGameSA : public CGame bool m_isFireballDestructEnabled{true}; static unsigned int& ClumpOffset; - static unsigned long* VAR_SystemTime; - static unsigned long* VAR_IsAtMenu; - static bool* VAR_IsForegroundWindow; - static unsigned long* VAR_SystemState; - static float* VAR_TimeScale; - static float* VAR_FPS; - static float* VAR_OldTimeStep; - static float* VAR_TimeStep; - static unsigned long* VAR_Framelimiter; std::map m_Cheats; diff --git a/Client/game_sa/COffsets.cpp b/Client/game_sa/COffsets.cpp deleted file mode 100644 index 0bdeb83cb5..0000000000 --- a/Client/game_sa/COffsets.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/***************************************************************************** - * - * PROJECT: Multi Theft Auto v1.0 - * LICENSE: See LICENSE in the top level directory - * FILE: game_sa/COffsets.cpp - * PURPOSE: EXE-dependant game variable offsets - * - * Multi Theft Auto is available from http://www.multitheftauto.com/ - * - *****************************************************************************/ - -#include "StdInc.h" -#include "CCameraSA.h" -#include "CEntitySA.h" -#include "COffsets.h" -#include "CSettingsSA.h" -#include "CWeatherSA.h" -#include "CGameSA.h" - -void COffsets::Initialize10EU() -{ - InitializeCommon10(); - - CSettingsSA::FUNC_GetCurrentVideoMode = 0x7F2D60; - CSettingsSA::FUNC_GetNumVideoModes = 0x7F2D00; - CSettingsSA::FUNC_GetVideoModeInfo = 0x7F2D30; - CSettingsSA::FUNC_SetDrawDistance = 0x572ea0; - CSettingsSA::FUNC_GetNumSubSystems = 0x07F2C40; - CSettingsSA::FUNC_GetCurrentSubSystem = 0x07F2CA0; - CSettingsSA::FUNC_SetSubSystem = 0x07F2CD0; - - CEntitySA::FUNC_RwFrameGetLTM = 0x7F09D0; - CCameraSA::FUNC_RwFrameGetLTM = 0x7F09D0; -} - -void COffsets::Initialize10US() -{ - InitializeCommon10(); - - CSettingsSA::FUNC_GetCurrentVideoMode = 0x7F2D20; - CSettingsSA::FUNC_GetNumVideoModes = 0x7F2CC0; - CSettingsSA::FUNC_GetVideoModeInfo = 0x7F2CF0; - CSettingsSA::FUNC_SetDrawDistance = 0x572ea0; - CSettingsSA::FUNC_GetNumSubSystems = 0x07F2C00; - CSettingsSA::FUNC_GetCurrentSubSystem = 0x07F2C60; - CSettingsSA::FUNC_SetSubSystem = 0x07F2C90; - - CEntitySA::FUNC_RwFrameGetLTM = 0x7F0990; - CCameraSA::FUNC_RwFrameGetLTM = 0x7F0990; -} - -void COffsets::Initialize11() -{ - CGameSA::VAR_SystemTime = (unsigned long*)0xB7CB84; - CGameSA::VAR_IsAtMenu = (unsigned long*)0xBA677B; - CGameSA::VAR_IsForegroundWindow = (bool*)0x8D621C; - CGameSA::VAR_SystemState = (unsigned long*)0xC8FC80; // 1.01 - CGameSA::VAR_TimeScale = (float*)0xB7CB64; - CGameSA::VAR_FPS = (float*)0xB7CB50; - CGameSA::VAR_OldTimeStep = (float*)0xB7CB54; - CGameSA::VAR_TimeStep = (float*)0xB7CB5C; - CGameSA::VAR_Framelimiter = (unsigned long*)0xC1704C; - - CWeatherSA::VAR_CWeather__ForcedWeatherType = (unsigned char*)0xC81318; - CWeatherSA::VAR_CWeather__OldWeatherType = (unsigned char*)0xC81320; - CWeatherSA::VAR_CWeather__NewWeatherType = (unsigned char*)0xC8131C; - CWeatherSA::VAR_CWeather__Rain = (float*)0xC81324; -} - -void COffsets::InitializeCommon10() -{ - CGameSA::VAR_SystemTime = (unsigned long*)0xB7CB84; - CGameSA::VAR_IsAtMenu = (unsigned long*)0xBA677B; - CGameSA::VAR_IsForegroundWindow = (bool*)0x8D621C; - CGameSA::VAR_SystemState = (unsigned long*)0xC8D4C0; - CGameSA::VAR_TimeScale = (float*)0xB7CB64; - CGameSA::VAR_FPS = (float*)0xB7CB50; - CGameSA::VAR_OldTimeStep = (float*)0xB7CB54; - CGameSA::VAR_TimeStep = (float*)0xB7CB5C; - CGameSA::VAR_Framelimiter = (unsigned long*)0xC1704C; - - CWeatherSA::VAR_CWeather__ForcedWeatherType = (unsigned char*)0xC81318; - CWeatherSA::VAR_CWeather__OldWeatherType = (unsigned char*)0xC81320; - CWeatherSA::VAR_CWeather__NewWeatherType = (unsigned char*)0xC8131C; - CWeatherSA::VAR_CWeather__Rain = (float*)0xC81324; - - CSettingsSA::FUNC_SetCurrentVideoMode = 0x745C70; // may not be common? - - CEntitySA::FUNC_CClumpModelInfo__GetFrameFromId = 0x4C53C0; -} diff --git a/Client/game_sa/COffsets.h b/Client/game_sa/COffsets.h deleted file mode 100644 index 9ab3eaf1f0..0000000000 --- a/Client/game_sa/COffsets.h +++ /dev/null @@ -1,23 +0,0 @@ -/***************************************************************************** - * - * PROJECT: Multi Theft Auto v1.0 - * LICENSE: See LICENSE in the top level directory - * FILE: game_sa/COffsets.h - * PURPOSE: Header file for game variable offsets class - * - * Multi Theft Auto is available from http://www.multitheftauto.com/ - * - *****************************************************************************/ - -#pragma once - -class COffsets -{ -public: - static void Initialize10EU(); - static void Initialize10US(); - static void Initialize11(); - -private: - static void InitializeCommon10(); -}; diff --git a/Client/game_sa/CRenderWareSA.ShaderSupport.cpp b/Client/game_sa/CRenderWareSA.ShaderSupport.cpp index 3f5ae44bdf..e5cb96cd95 100644 --- a/Client/game_sa/CRenderWareSA.ShaderSupport.cpp +++ b/Client/game_sa/CRenderWareSA.ShaderSupport.cpp @@ -689,13 +689,9 @@ __declspec(noinline) void OnMY_RwTextureSetName(DWORD dwAddrCalledFrom, RwTextur } // Hook info -#define HOOKPOS_RwTextureSetName_US 0x7F38A0 -#define HOOKSIZE_RwTextureSetName_US 9 -#define HOOKPOS_RwTextureSetName_EU 0x7F38E0 -#define HOOKSIZE_RwTextureSetName_EU 9 -DWORD RETURN_RwTextureSetName_US = 0x7F38A9; -DWORD RETURN_RwTextureSetName_EU = 0x7F38E9; -DWORD RETURN_RwTextureSetName_BOTH = 0; +#define HOOKPOS_RwTextureSetName 0x7F38A0 +#define HOOKSIZE_RwTextureSetName 9 +DWORD RETURN_RwTextureSetName = 0x7F38A9; void _declspec(naked) HOOK_RwTextureSetName() { _asm @@ -710,7 +706,7 @@ void _declspec(naked) HOOK_RwTextureSetName() sub esp, 8 mov ecx, ds:0x0C97B24 - jmp RETURN_RwTextureSetName_BOTH + jmp RETURN_RwTextureSetName } } @@ -727,13 +723,9 @@ __declspec(noinline) void OnMY_RwTextureDestroy_Mid(RwTexture* pTexture) } // Hook info -#define HOOKPOS_RwTextureDestroy_Mid_US 0x07F3834 -#define HOOKSIZE_RwTextureDestroy_Mid_US 5 -#define HOOKPOS_RwTextureDestroy_Mid_EU 0x07F3874 -#define HOOKSIZE_RwTextureDestroy_Mid_EU 5 -DWORD RETURN_RwTextureDestroy_Mid_US = 0x07F3839; -DWORD RETURN_RwTextureDestroy_Mid_EU = 0x07F3879; -DWORD RETURN_RwTextureDestroy_Mid_BOTH = 0; +#define HOOKPOS_RwTextureDestroy_Mid 0x07F3834 +#define HOOKSIZE_RwTextureDestroy_Mid 5 +DWORD RETURN_RwTextureDestroy_Mid = 0x07F3839; void _declspec(naked) HOOK_RwTextureDestroy_Mid() { _asm @@ -745,7 +737,7 @@ void _declspec(naked) HOOK_RwTextureDestroy_Mid() popad push 0x08E23CC - jmp RETURN_RwTextureDestroy_Mid_BOTH + jmp RETURN_RwTextureDestroy_Mid } } @@ -775,13 +767,9 @@ __declspec(noinline) void OnMY_RwIm3DRenderIndexedPrimitive_Post(DWORD dwAddrCal } // Hook info -#define HOOKPOS_RwIm3DRenderIndexedPrimitive_US 0x07EF550 -#define HOOKSIZE_RwIm3DRenderIndexedPrimitive_US 5 -#define HOOKPOS_RwIm3DRenderIndexedPrimitive_EU 0x07EF590 -#define HOOKSIZE_RwIm3DRenderIndexedPrimitive_EU 5 -DWORD RETURN_RwIm3DRenderIndexedPrimitive_US = 0x07EF555; -DWORD RETURN_RwIm3DRenderIndexedPrimitive_EU = 0x07EF595; -DWORD RETURN_RwIm3DRenderIndexedPrimitive_BOTH = 0; +#define HOOKPOS_RwIm3DRenderIndexedPrimitive 0x07EF550 +#define HOOKSIZE_RwIm3DRenderIndexedPrimitive 5 +DWORD RETURN_RwIm3DRenderIndexedPrimitive = 0x07EF555; void _declspec(naked) HOOK_RwIm3DRenderIndexedPrimitive() { _asm @@ -806,7 +794,7 @@ void _declspec(naked) HOOK_RwIm3DRenderIndexedPrimitive() retn inner: mov eax, ds:0x0C9C078 - jmp RETURN_RwIm3DRenderIndexedPrimitive_BOTH + jmp RETURN_RwIm3DRenderIndexedPrimitive } } @@ -828,13 +816,9 @@ __declspec(noinline) void OnMY_RwIm3DRenderPrimitive_Post(DWORD dwAddrCalledFrom } // Hook info -#define HOOKPOS_RwIm3DRenderPrimitive_US 0x07EF6B0 -#define HOOKSIZE_RwIm3DRenderPrimitive_US 6 -#define HOOKPOS_RwIm3DRenderPrimitive_EU 0x07EF6F0 -#define HOOKSIZE_RwIm3DRenderPrimitive_EU 6 -DWORD RETURN_RwIm3DRenderPrimitive_US = 0x07EF6B6; -DWORD RETURN_RwIm3DRenderPrimitive_EU = 0x07EF6F6; -DWORD RETURN_RwIm3DRenderPrimitive_BOTH = 0; +#define HOOKPOS_RwIm3DRenderPrimitive 0x07EF6B0 +#define HOOKSIZE_RwIm3DRenderPrimitive 6 +DWORD RETURN_RwIm3DRenderPrimitive = 0x07EF6B6; void _declspec(naked) HOOK_RwIm3DRenderPrimitive() { _asm @@ -859,7 +843,7 @@ void _declspec(naked) HOOK_RwIm3DRenderPrimitive() retn inner: mov ecx, ds:0x0C97B24 - jmp RETURN_RwIm3DRenderPrimitive_BOTH + jmp RETURN_RwIm3DRenderPrimitive } } @@ -881,13 +865,9 @@ __declspec(noinline) void OnMY_RwIm2DRenderIndexedPrimitive_Post(DWORD dwAddrCal } // Hook info -#define HOOKPOS_RwIm2DRenderIndexedPrimitive_US 0x0734EA1 -#define HOOKSIZE_RwIm2DRenderIndexedPrimitive_US 5 -#define HOOKPOS_RwIm2DRenderIndexedPrimitive_EU 0x0734EA1 -#define HOOKSIZE_RwIm2DRenderIndexedPrimitive_EU 5 -DWORD RETURN_RwIm2DRenderIndexedPrimitive_US = 0x0403927; -DWORD RETURN_RwIm2DRenderIndexedPrimitive_EU = 0x0403937; -DWORD RETURN_RwIm2DRenderIndexedPrimitive_BOTH = 0; +#define HOOKPOS_RwIm2DRenderIndexedPrimitive 0x0734EA1 +#define HOOKSIZE_RwIm2DRenderIndexedPrimitive 5 +DWORD RETURN_RwIm2DRenderIndexedPrimitive = 0x0403927; void _declspec(naked) HOOK_RwIm2DRenderIndexedPrimitive() { _asm @@ -914,7 +894,7 @@ void _declspec(naked) HOOK_RwIm2DRenderIndexedPrimitive() retn inner: - jmp RETURN_RwIm2DRenderIndexedPrimitive_BOTH + jmp RETURN_RwIm2DRenderIndexedPrimitive } } diff --git a/Client/game_sa/CRenderWareSA.cpp b/Client/game_sa/CRenderWareSA.cpp index 31556739d3..56f5ce34e4 100644 --- a/Client/game_sa/CRenderWareSA.cpp +++ b/Client/game_sa/CRenderWareSA.cpp @@ -190,9 +190,9 @@ static bool LoadAtomicsCB(RpAtomic* atomic, void* pData) // // ///////////////////////////////////////////////////////////////////////////// -CRenderWareSA::CRenderWareSA(eGameVersion version) +CRenderWareSA::CRenderWareSA() { - InitRwFunctions(version); + InitRwFunctions(); InitTextureWatchHooks(); m_pMatchChannelManager = new CMatchChannelManager(); diff --git a/Client/game_sa/CRenderWareSA.h b/Client/game_sa/CRenderWareSA.h index 725c9e7a6a..6a0e64ea50 100644 --- a/Client/game_sa/CRenderWareSA.h +++ b/Client/game_sa/CRenderWareSA.h @@ -26,7 +26,7 @@ class CRenderWareSA : public CRenderWare { public: ZERO_ON_NEW - CRenderWareSA(enum eGameVersion version); + CRenderWareSA(); ~CRenderWareSA(); void Initialize(); bool ModelInfoTXDLoadTextures(SReplacementTextures* pReplacementTextures, const SString& strFilename, const SString& buffer, bool bFilteringEnabled); diff --git a/Client/game_sa/CSettingsSA.cpp b/Client/game_sa/CSettingsSA.cpp index 8fa50008bf..b1b8f0ed86 100644 --- a/Client/game_sa/CSettingsSA.cpp +++ b/Client/game_sa/CSettingsSA.cpp @@ -24,15 +24,6 @@ static const float MOUSE_SENSITIVITY_MIN = 0.000312f; static const float MOUSE_SENSITIVITY_DEFAULT = 0.0025f; static const float MOUSE_SENSITIVITY_MAX = MOUSE_SENSITIVITY_DEFAULT * 2 - MOUSE_SENSITIVITY_MIN; -unsigned long CSettingsSA::FUNC_GetNumVideoModes; -unsigned long CSettingsSA::FUNC_GetVideoModeInfo; -unsigned long CSettingsSA::FUNC_GetCurrentVideoMode; -unsigned long CSettingsSA::FUNC_SetCurrentVideoMode; -unsigned long CSettingsSA::FUNC_SetDrawDistance; -unsigned long CSettingsSA::FUNC_GetNumSubSystems; -unsigned long CSettingsSA::FUNC_GetCurrentSubSystem; -unsigned long CSettingsSA::FUNC_SetSubSystem; - #define VAR_CurVideoMode (*((uint*)(0x08D6220))) #define VAR_SavedVideoMode (*((uint*)(0x0BA6820))) #define VAR_CurAdapter (*((uint*)(0x0C920F4))) @@ -82,50 +73,27 @@ void CSettingsSA::SetWideScreenEnabled(bool bEnabled) unsigned int CSettingsSA::GetNumVideoModes() { - unsigned int uiReturn = 0; - _asm - { - call FUNC_GetNumVideoModes - mov uiReturn, eax - } - return uiReturn; + // RwEngineGetNumVideoModes + return ((unsigned int(__cdecl*)())0x7F2CC0)(); } VideoMode* CSettingsSA::GetVideoModeInfo(VideoMode* modeInfo, unsigned int modeIndex) { - VideoMode* pReturn = NULL; - _asm - { - push modeIndex - push modeInfo - call FUNC_GetVideoModeInfo - mov pReturn, eax - add esp, 8 - } - return pReturn; + // RwEngineGetVideoModeInfo + return ((VideoMode*(__cdecl*)(VideoMode*, unsigned int))0x7F2CF0)(modeInfo, modeIndex); } unsigned int CSettingsSA::GetCurrentVideoMode() { - unsigned int uiReturn = 0; - _asm - { - call FUNC_GetCurrentVideoMode - mov uiReturn, eax - } - return uiReturn; + // RwEngineGetCurrentVideoMode + return ((unsigned int(__cdecl*)())0x7F2D20)(); } void CSettingsSA::SetCurrentVideoMode(unsigned int modeIndex, bool bOnRestart) { if (!bOnRestart) { - _asm - { - push modeIndex - call FUNC_SetCurrentVideoMode - add esp, 4 - } + ((void(__cdecl*)(unsigned int))0x745C70)(modeIndex); } // Only update settings variables for fullscreen modes if (modeIndex) @@ -134,34 +102,20 @@ void CSettingsSA::SetCurrentVideoMode(unsigned int modeIndex, bool bOnRestart) uint CSettingsSA::GetNumAdapters() { - unsigned int uiReturn = 0; - _asm - { - call FUNC_GetNumSubSystems - mov uiReturn, eax - } - return uiReturn; + // RwEngineGetNumSubSystems + return ((unsigned int(__cdecl*)())0x7F2C00)(); } void CSettingsSA::SetAdapter(unsigned int uiAdapterIndex) { - _asm - { - push uiAdapterIndex - call FUNC_SetSubSystem - add esp, 4 - } + // RwEngineSetSubSystem + ((void(__cdecl*)(unsigned int))0x7F2C90)(uiAdapterIndex); } unsigned int CSettingsSA::GetCurrentAdapter() { - unsigned int uiReturn = 0; - _asm - { - call FUNC_GetCurrentSubSystem - mov uiReturn, eax - } - return uiReturn; + // RwEngineGetCurrentSubSystem + return ((unsigned int(__cdecl*)())0x7F2C60)(); } unsigned char CSettingsSA::GetRadioVolume() @@ -238,12 +192,7 @@ float CSettingsSA::GetDrawDistance() void CSettingsSA::SetDrawDistance(float fDistance) { - _asm - { - push fDistance - call FUNC_SetDrawDistance - add esp, 4 - } + MemPutFast(0x8CD800, fDistance); // CRenderer::ms_lodDistScale m_pInterface->fDrawDistance = fDistance; } diff --git a/Client/game_sa/CSettingsSA.h b/Client/game_sa/CSettingsSA.h index 7fde15381b..9bb313e566 100644 --- a/Client/game_sa/CSettingsSA.h +++ b/Client/game_sa/CSettingsSA.h @@ -185,15 +185,4 @@ class CSettingsSA : public CGameSettings uint FindVideoMode(int iResX, int iResY, int iColorBits); void SetValidVideoMode(); int OnSelectDevice(); - -private: - static unsigned long FUNC_GetNumVideoModes; - static unsigned long FUNC_GetVideoModeInfo; - static unsigned long FUNC_GetCurrentVideoMode; - static unsigned long FUNC_SetCurrentVideoMode; - static unsigned long FUNC_SetRadioVolume; - static unsigned long FUNC_SetDrawDistance; - static unsigned long FUNC_GetNumSubSystems; - static unsigned long FUNC_GetCurrentSubSystem; - static unsigned long FUNC_SetSubSystem; }; diff --git a/Client/game_sa/CWeatherSA.cpp b/Client/game_sa/CWeatherSA.cpp index 7b6364334c..7fdb856bfb 100644 --- a/Client/game_sa/CWeatherSA.cpp +++ b/Client/game_sa/CWeatherSA.cpp @@ -12,35 +12,30 @@ #include "StdInc.h" #include "CWeatherSA.h" -unsigned char* CWeatherSA::VAR_CWeather__ForcedWeatherType; -unsigned char* CWeatherSA::VAR_CWeather__OldWeatherType; -unsigned char* CWeatherSA::VAR_CWeather__NewWeatherType; -float* CWeatherSA::VAR_CWeather__Rain; - unsigned char CWeatherSA::Get() { - return (unsigned char)*VAR_CWeather__ForcedWeatherType; + return *(unsigned char*)0xC81318; // CWeather::ForcedWeatherType } void CWeatherSA::Set(unsigned char primary, unsigned char secondary) { - *VAR_CWeather__OldWeatherType = static_cast(primary); - *VAR_CWeather__NewWeatherType = static_cast(secondary); + MemPutFast(0xC81320, primary); // CWeather::OldWeatherType + MemPutFast(0xC8131C, secondary); // CWeather::NewWeatherType } void CWeatherSA::Release() { - *VAR_CWeather__ForcedWeatherType = 0xFF; + MemPutFast(0xC81318, 0xFF); // CWeather::ForcedWeatherType } float CWeatherSA::GetAmountOfRain() { - return *VAR_CWeather__Rain; + return *(float*)0xC81324; // CWeather::Rain } void CWeatherSA::SetAmountOfRain(float fAmount) { - // Nop the functions which don't like us take care of the rain + // Patch all the places inside of CWeather::Update that would overwrite CWeather::Rain MemPut(0x72C686, 0xDD); MemPut(0x72C687, 0xD8); @@ -54,7 +49,7 @@ void CWeatherSA::SetAmountOfRain(float fAmount) MemSet((void*)0x72BC72, 0x90, 5); // Set the amount of rain - *VAR_CWeather__Rain = fAmount; + MemPutFast(0xC81324, fAmount); // CWeather::Rain } void CWeatherSA::ResetAmountOfRain() diff --git a/Client/game_sa/CWeatherSA.h b/Client/game_sa/CWeatherSA.h index baf1b98e1d..32e501166c 100644 --- a/Client/game_sa/CWeatherSA.h +++ b/Client/game_sa/CWeatherSA.h @@ -26,10 +26,4 @@ class CWeatherSA : public CWeather float GetAmountOfRain(); void SetAmountOfRain(float fAmount); void ResetAmountOfRain(); - -private: - static unsigned char* VAR_CWeather__ForcedWeatherType; - static unsigned char* VAR_CWeather__OldWeatherType; - static unsigned char* VAR_CWeather__NewWeatherType; - static float* VAR_CWeather__Rain; }; diff --git a/Client/game_sa/HookSystem.h b/Client/game_sa/HookSystem.h index 16075e39e4..19f145a2b7 100644 --- a/Client/game_sa/HookSystem.h +++ b/Client/game_sa/HookSystem.h @@ -44,35 +44,7 @@ BYTE* CreateJump(DWORD dwFrom, DWORD dwTo, BYTE* ByteArray); // Auto detect requirement of US/EU hook installation #define EZHookInstall(type) \ - __if_not_exists( RETURN_##type##_US ) \ - { \ - HookInstall( HOOKPOS_##type, (DWORD)HOOK_##type, HOOKSIZE_##type ) \ - } \ - __if_exists( RETURN_##type##_US ) \ - { \ - if ( pGame->GetGameVersion () == VERSION_US_10 ) \ - { \ - EZHookInstall_HERE( type, US ) \ - } \ - else \ - { \ - EZHookInstall_HERE( type, EU ) \ - } \ - } - -// US/EU hook installation -// Includes additional return pointer copies if required -#define EZHookInstall_HERE(type,CO) \ - HookInstall( HOOKPOS_##type##_##CO##, (DWORD)HOOK_##type, HOOKSIZE_##type##_##CO## ); \ - RETURN_##type##_BOTH = RETURN_##type##_##CO##; \ - __if_exists( RETURN_##type##B_##CO## ) \ - { \ - RETURN_##type##B_BOTH = RETURN_##type##B_##CO##; \ - } \ - __if_exists( RETURN_##type##C_##CO## ) \ - { \ - RETURN_##type##C_BOTH = RETURN_##type##C_##CO##; \ - } + HookInstall(HOOKPOS_##type, (DWORD)HOOK_##type, HOOKSIZE_##type); // Structure for holding hook info struct SHookInfo diff --git a/Client/game_sa/gamesa_renderware.hpp b/Client/game_sa/gamesa_renderware.hpp index 2e5386095c..804040c802 100644 --- a/Client/game_sa/gamesa_renderware.hpp +++ b/Client/game_sa/gamesa_renderware.hpp @@ -9,203 +9,96 @@ * *****************************************************************************/ -void InitRwFunctions(eGameVersion version) +void InitRwFunctions() { - // Version dependant addresses - switch (version) - { - // VERSION 1.0 EU ADDRESSES - case VERSION_EU_10: - { - RwStreamFindChunk = (RwStreamFindChunk_t)0x007ED310; - RpClumpStreamRead = (RpClumpStreamRead_t)0x0074B470; - RwErrorGet = (RwErrorGet_t)0x008088C0; - RwStreamOpen = (RwStreamOpen_t)0x007ECF30; - RwStreamClose = (RwStreamClose_t)0x007ECE60; - RwStreamRead = (RwStreamRead_t)0x007ECA10; // check - RwStreamSkip = (RwStreamSkip_t)0x007ECD40; // check - RpClumpDestroy = (RpClumpDestroy_t)0x0074A360; - RpClumpGetNumAtomics = (RpClumpGetNumAtomics_t)0x00749930; - RwFrameTranslate = (RwFrameTranslate_t)0x007F0E70; - RpClumpForAllAtomics = (RpClumpForAllAtomics_t)0x00749BC0; - RwFrameAddChild = (RwFrameAddChild_t)0x007F0B40; - RpClumpAddAtomic = (RpClumpAddAtomic_t)0x0074A4E0; - RpAtomicSetFrame = (RpAtomicSetFrame_t)0x0074BF70; - RwTexDictionaryStreamRead = (RwTexDictionaryStreamRead_t)0x00804C70; - RwTexDictionaryGtaStreamRead = (RwTexDictionaryGtaStreamRead_t)0x00730FC0; - RwTexDictionaryGetCurrent = (RwTexDictionaryGetCurrent_t)0x007F3AD0; - RwTexDictionarySetCurrent = (RwTexDictionarySetCurrent_t)0x007F3AB0; - RwTexDictionaryForAllTextures = (RwTexDictionaryForAllTextures_t)0x007F3770; - RwTexDictionaryAddTexture = (RwTexDictionaryAddTexture_t)0x007F39C0; - RwTexDictionaryStreamWrite = (RwTexDictionaryStreamWrite_t)0x00804A30; - rwD3D9NativeTextureRead = (rwD3D9NativeTextureRead_t)0x004CD820; - RpPrtStdGlobalDataSetStreamEmbedded = (RpPrtStdGlobalDataSetStreamEmbedded_t)0x0041B350; - RpClumpRemoveAtomic = (RpClumpRemoveAtomic_t)0x0074A510; - RpAtomicClone = (RpAtomicClone_t)0x00749EB0; - RwTexDictionaryFindNamedTexture = (RwTexDictionaryFindNamedTexture_t)0x007F3A30; - RwFrameRemoveChild = (RwFrameRemoveChild_t)0x007F0D10; - RwFrameForAllObjects = (RwFrameForAllObjects_t)0x007F1240; - RpAtomicDestroy = (RpAtomicDestroy_t)0x00749E10; - RpAtomicSetGeometry = (RpAtomicSetGeometry_t)0x00749D90; - RpWorldAddAtomic = (RpWorldAddAtomic_t)0x00750FE0; - RpGeometryCreate = (RpGeometryCreate_t)0x0074CAE0; - RpGeometryTriangleSetVertexIndices = (RpGeometryTriangleSetVertexIndices_t)0x0074C6E0; - RpGeometryUnlock = (RpGeometryUnlock_t)0x0074C850; - RpGeometryLock = (RpGeometryLock_t)0x0074C820; - RpAtomicCreate = (RpAtomicCreate_t)0x00749CA0; - RwFrameCreate = (RwFrameCreate_t)0x007F0450; - RwFrameDestroy = (RwFrameDestroy_t)0x007F05E0; - RpGeometryTransform = (RpGeometryTransform_t)0x0074C030; - RwFrameSetIdentity = (RwFrameSetIdentity_t)0x007F10F0; - RwMatrixCreate = (RwMatrixCreate_t)0x007F2A90; - RwMatrixTranslate = (RwMatrixTranslate_t)0x007F2490; - RwMatrixScale = (RwMatrixScale_t)0x007F2300; - RpGeometryTriangleSetMaterial = (RpGeometryTriangleSetMaterial_t)0x0074C710; - RpMaterialCreate = (RpMaterialCreate_t)0x0074D9E0; - RpGeometryDestroy = (RpGeometryDestroy_t)0x0074CD10; - RpMaterialDestroy = (RpMaterialDestroy_t)0x0074DA70; - RwV3dNormalize = (RwV3dNormalize_t)0x007ED9F0; - RwIm3DTransform = (RwIm3DTransform_t)0x007EF490; - RwIm3DRenderIndexedPrimitive = (RwIm3DRenderIndexedPrimitive_t)0x007EF590; - RwIm3DEnd = (RwIm3DEnd_t)0x007EF560; - RwMatrixInvert = (RwMatrixInvert_t)0x007F20B0; - RpWorldAddClump = (RpWorldAddClump_t)0x00751350; - RwFrameScale = (RwFrameScale_t)0x007F0F10; - RwFrameUpdateObjects = (RwFrameUpdateObjects_t)0x7F0950; - RwV3dTransformVector = (RwV3dTransformVector_t)0x007EDE00; - RpLightCreate = (RpLightCreate_t)0x00752160; - RpClumpAddLight = (RpClumpAddLight_t)0x0074A540; - _rwObjectHasFrameSetFrame = (_rwObjectHasFrameSetFrame_t)0x00804F30; - RpLightSetRadius = (RpLightSetRadius_t)0x00751AC0; - RpWorldAddLight = (RpWorldAddLight_t)0x00751960; - RpLightSetColor = (RpLightSetColor_t)0x00751AE0; - RwCameraClone = (RwCameraClone_t)0x007EF3F0; - RpClumpClone = (RpClumpClone_t)0x00749FC0; - RwTexDictionaryDestroy = (RwTexDictionaryDestroy_t)0x007F36E0; - RwTextureDestroy = (RwTextureDestroy_t)0x007F3860; - RwRasterUnlock = (RwRasterUnlock_t)0x007FAF00; - RwRasterLock = (RwRasterLock_t)0x007FB310; - RwRasterCreate = (RwRasterCreate_t)0x007FB270; - RwTextureCreate = (RwTextureCreate_t)0x007F3800; - RpMaterialSetTexture = (RpMaterialSetTexture_t)0x0074DC10; - GetAnimHierarchyFromClump = (GetAnimHierarchyFromClump_t)0x734B10; - GetAnimHierarchyFromSkinClump = (GetAnimHierarchyFromSkinClump_t)0x734A40; - RpHAnimIDGetIndex = (RpHAnimIDGetIndex_t)0x7C51E0; - RpHAnimHierarchyGetMatrixArray = (RpHAnimHierarchyGetMatrixArray_t)0x7C5160; - RtQuatRotate = (RtQuatRotate_t)0x7EB800; - - SetTextureDict = (SetTextureDict_t)0x007319C0; - LoadClumpFile = (LoadClumpFile_t)0x005371F0; - LoadModel = (LoadModel_t)0x0040C6B0; - LoadCollisionModel = (LoadCollisionModel_t)0x00537580; - LoadCollisionModelVer2 = (LoadCollisionModelVer2_t)0x00537EE0; - LoadCollisionModelVer3 = (LoadCollisionModelVer3_t)0x00537CE0; - CTxdStore_LoadTxd = (CTxdStore_LoadTxd_t)0x00731DD0; - CTxdStore_GetTxd = (CTxdStore_GetTxd_t)0x00408340; - CTxdStore_RemoveTxd = (CTxdStore_RemoveTxd_t)0x00731E90; - CTxdStore_RemoveRef = (CTxdStore_RemoveRef_t)0x00731A30; - CTxdStore_AddRef = (CTxdStore_AddRef_t)0x00731A00; - CTxdStore_GetNumRefs = (CTxdStore_GetNumRefs_t)0x00731AA0; - CClothesBuilder_CopyTexture = (CClothesBuilder_CopyTexture_t)0x005A5730; - - break; - } - - // VERSION 1.0 US ADDRESSES - case VERSION_US_10: - { - RwStreamFindChunk = (RwStreamFindChunk_t)0x007ED2D0; - RpClumpStreamRead = (RpClumpStreamRead_t)0x0074B420; - RwErrorGet = (RwErrorGet_t)0x00808880; - RwStreamOpen = (RwStreamOpen_t)0x007ECEF0; - RwStreamClose = (RwStreamClose_t)0x007ECE20; - RwStreamRead = (RwStreamRead_t)0x007EC9D0; - RwStreamSkip = (RwStreamSkip_t)0x007ECD00; - RpClumpDestroy = (RpClumpDestroy_t)0x0074A310; - RpClumpGetNumAtomics = (RpClumpGetNumAtomics_t)0x007498E0; - RwFrameTranslate = (RwFrameTranslate_t)0x007F0E30; - RpClumpForAllAtomics = (RpClumpForAllAtomics_t)0x00749B70; - RwFrameAddChild = (RwFrameAddChild_t)0x007F0B00; - RpClumpAddAtomic = (RpClumpAddAtomic_t)0x0074A490; - RpAtomicSetFrame = (RpAtomicSetFrame_t)0x0074BF20; - RwTexDictionaryStreamRead = (RwTexDictionaryStreamRead_t)0x00804C30; - RwTexDictionaryGtaStreamRead = (RwTexDictionaryGtaStreamRead_t)0x00730FC0; - RwTexDictionaryGetCurrent = (RwTexDictionaryGetCurrent_t)0x007F3A90; - RwTexDictionarySetCurrent = (RwTexDictionarySetCurrent_t)0x007F3A70; - RwTexDictionaryForAllTextures = (RwTexDictionaryForAllTextures_t)0x007F3730; - RwTexDictionaryAddTexture = (RwTexDictionaryAddTexture_t)0x007F3980; - RwTexDictionaryStreamWrite = (RwTexDictionaryStreamWrite_t)0x008049F0; - rwD3D9NativeTextureRead = (rwD3D9NativeTextureRead_t)0x004CD820; - RpPrtStdGlobalDataSetStreamEmbedded = (RpPrtStdGlobalDataSetStreamEmbedded_t)0x0041B350; - RpClumpRemoveAtomic = (RpClumpRemoveAtomic_t)0x0074A4C0; - RpAtomicClone = (RpAtomicClone_t)0x00749E60; - RwTexDictionaryFindNamedTexture = (RwTexDictionaryFindNamedTexture_t)0x007F39F0; - RwFrameRemoveChild = (RwFrameRemoveChild_t)0x007F0CD0; - RwFrameForAllObjects = (RwFrameForAllObjects_t)0x007F1200; - RpAtomicDestroy = (RpAtomicDestroy_t)0x00749DC0; - RpAtomicSetGeometry = (RpAtomicSetGeometry_t)0x00749D40; - RpWorldAddAtomic = (RpWorldAddAtomic_t)0x00750F90; - RpGeometryCreate = (RpGeometryCreate_t)0x0074CA90; - RpGeometryTriangleSetVertexIndices = (RpGeometryTriangleSetVertexIndices_t)0x0074C690; - RpGeometryUnlock = (RpGeometryUnlock_t)0x0074C800; - RpGeometryLock = (RpGeometryLock_t)0x0074C7D0; - RpAtomicCreate = (RpAtomicCreate_t)0x00749C50; - RwFrameCreate = (RwFrameCreate_t)0x007F0410; - RwFrameDestroy = (RwFrameDestroy_t)0x007F05A0; - RpGeometryTransform = (RpGeometryTransform_t)0x0074BFE0; - RwFrameSetIdentity = (RwFrameSetIdentity_t)0x007F10B0; - RwMatrixCreate = (RwMatrixCreate_t)0x007F2A50; - RwMatrixTranslate = (RwMatrixTranslate_t)0x007F2450; - RwMatrixScale = (RwMatrixScale_t)0x007F22C0; - RpGeometryTriangleSetMaterial = (RpGeometryTriangleSetMaterial_t)0x0074C6C0; - RpMaterialCreate = (RpMaterialCreate_t)0x0074D990; - RpGeometryDestroy = (RpGeometryDestroy_t)0x0074CCC0; - RpMaterialDestroy = (RpMaterialDestroy_t)0x0074DA20; - RwV3dNormalize = (RwV3dNormalize_t)0x007ED9B0; - RwIm3DTransform = (RwIm3DTransform_t)0x007EF450; - RwIm3DRenderIndexedPrimitive = (RwIm3DRenderIndexedPrimitive_t)0x007EF550; - RwIm3DEnd = (RwIm3DEnd_t)0x007EF520; - RwMatrixInvert = (RwMatrixInvert_t)0x007F2070; - RpWorldAddClump = (RpWorldAddClump_t)0x00751300; - RwFrameScale = (RwFrameScale_t)0x007F0ED0; - RwFrameUpdateObjects = (RwFrameUpdateObjects_t)0x7F0910; - RwV3dTransformVector = (RwV3dTransformVector_t)0x007EDDC0; - RpLightCreate = (RpLightCreate_t)0x00752110; - RpClumpAddLight = (RpClumpAddLight_t)0x0074A4F0; - _rwObjectHasFrameSetFrame = (_rwObjectHasFrameSetFrame_t)0x00804EF0; - RpLightSetRadius = (RpLightSetRadius_t)0x00751A70; - RpWorldAddLight = (RpWorldAddLight_t)0x00751910; - RpLightSetColor = (RpLightSetColor_t)0x00751A90; - RwCameraClone = (RwCameraClone_t)0x007EF3B0; - RpClumpClone = (RpClumpClone_t)0x00749F70; - RwTexDictionaryDestroy = (RwTexDictionaryDestroy_t)0x007F36A0; - RwTextureDestroy = (RwTextureDestroy_t)0x007F3820; - RwRasterUnlock = (RwRasterUnlock_t)0x007FAEC0; - RwRasterLock = (RwRasterLock_t)0x007FB2D0; - RwRasterCreate = (RwRasterCreate_t)0x007FB230; - RwTextureCreate = (RwTextureCreate_t)0x007F37C0; - RpMaterialSetTexture = (RpMaterialSetTexture_t)0x0074DBC0; - GetAnimHierarchyFromClump = (GetAnimHierarchyFromClump_t)0x734B10; - GetAnimHierarchyFromSkinClump = (GetAnimHierarchyFromSkinClump_t)0x734A40; - RpHAnimIDGetIndex = (RpHAnimIDGetIndex_t)0x7C51A0; - RpHAnimHierarchyGetMatrixArray = (RpHAnimHierarchyGetMatrixArray_t)0x7C5120; - RtQuatRotate = (RtQuatRotate_t)0x7EB7C0; - - SetTextureDict = (SetTextureDict_t)0x007319C0; - LoadClumpFile = (LoadClumpFile_t)0x005371F0; - LoadModel = (LoadModel_t)0x0040C6B0; - LoadCollisionModel = (LoadCollisionModel_t)0x00537580; - LoadCollisionModelVer2 = (LoadCollisionModelVer2_t)0x00537EE0; - LoadCollisionModelVer3 = (LoadCollisionModelVer3_t)0x00537CE0; - CTxdStore_LoadTxd = (CTxdStore_LoadTxd_t)0x00731DD0; - CTxdStore_GetTxd = (CTxdStore_GetTxd_t)0x00408340; - CTxdStore_RemoveTxd = (CTxdStore_RemoveTxd_t)0x00731E90; - CTxdStore_RemoveRef = (CTxdStore_RemoveRef_t)0x00731A30; - CTxdStore_AddRef = (CTxdStore_AddRef_t)0x00731A00; - CTxdStore_GetNumRefs = (CTxdStore_GetNumRefs_t)0x00731AA0; - CClothesBuilder_CopyTexture = (CClothesBuilder_CopyTexture_t)0x005A5730; - - break; - } - } + RwStreamFindChunk = (RwStreamFindChunk_t)0x007ED2D0; + RpClumpStreamRead = (RpClumpStreamRead_t)0x0074B420; + RwErrorGet = (RwErrorGet_t)0x00808880; + RwStreamOpen = (RwStreamOpen_t)0x007ECEF0; + RwStreamClose = (RwStreamClose_t)0x007ECE20; + RwStreamRead = (RwStreamRead_t)0x007EC9D0; + RwStreamSkip = (RwStreamSkip_t)0x007ECD00; + RpClumpDestroy = (RpClumpDestroy_t)0x0074A310; + RpClumpGetNumAtomics = (RpClumpGetNumAtomics_t)0x007498E0; + RwFrameTranslate = (RwFrameTranslate_t)0x007F0E30; + RpClumpForAllAtomics = (RpClumpForAllAtomics_t)0x00749B70; + RwFrameAddChild = (RwFrameAddChild_t)0x007F0B00; + RpClumpAddAtomic = (RpClumpAddAtomic_t)0x0074A490; + RpAtomicSetFrame = (RpAtomicSetFrame_t)0x0074BF20; + RwTexDictionaryStreamRead = (RwTexDictionaryStreamRead_t)0x00804C30; + RwTexDictionaryGtaStreamRead = (RwTexDictionaryGtaStreamRead_t)0x00730FC0; + RwTexDictionaryGetCurrent = (RwTexDictionaryGetCurrent_t)0x007F3A90; + RwTexDictionarySetCurrent = (RwTexDictionarySetCurrent_t)0x007F3A70; + RwTexDictionaryForAllTextures = (RwTexDictionaryForAllTextures_t)0x007F3730; + RwTexDictionaryAddTexture = (RwTexDictionaryAddTexture_t)0x007F3980; + RwTexDictionaryStreamWrite = (RwTexDictionaryStreamWrite_t)0x008049F0; + rwD3D9NativeTextureRead = (rwD3D9NativeTextureRead_t)0x004CD820; + RpPrtStdGlobalDataSetStreamEmbedded = (RpPrtStdGlobalDataSetStreamEmbedded_t)0x0041B350; + RpClumpRemoveAtomic = (RpClumpRemoveAtomic_t)0x0074A4C0; + RpAtomicClone = (RpAtomicClone_t)0x00749E60; + RwTexDictionaryFindNamedTexture = (RwTexDictionaryFindNamedTexture_t)0x007F39F0; + RwFrameRemoveChild = (RwFrameRemoveChild_t)0x007F0CD0; + RwFrameForAllObjects = (RwFrameForAllObjects_t)0x007F1200; + RpAtomicDestroy = (RpAtomicDestroy_t)0x00749DC0; + RpAtomicSetGeometry = (RpAtomicSetGeometry_t)0x00749D40; + RpWorldAddAtomic = (RpWorldAddAtomic_t)0x00750F90; + RpGeometryCreate = (RpGeometryCreate_t)0x0074CA90; + RpGeometryTriangleSetVertexIndices = (RpGeometryTriangleSetVertexIndices_t)0x0074C690; + RpGeometryUnlock = (RpGeometryUnlock_t)0x0074C800; + RpGeometryLock = (RpGeometryLock_t)0x0074C7D0; + RpAtomicCreate = (RpAtomicCreate_t)0x00749C50; + RwFrameCreate = (RwFrameCreate_t)0x007F0410; + RwFrameDestroy = (RwFrameDestroy_t)0x007F05A0; + RpGeometryTransform = (RpGeometryTransform_t)0x0074BFE0; + RwFrameSetIdentity = (RwFrameSetIdentity_t)0x007F10B0; + RwMatrixCreate = (RwMatrixCreate_t)0x007F2A50; + RwMatrixTranslate = (RwMatrixTranslate_t)0x007F2450; + RwMatrixScale = (RwMatrixScale_t)0x007F22C0; + RpGeometryTriangleSetMaterial = (RpGeometryTriangleSetMaterial_t)0x0074C6C0; + RpMaterialCreate = (RpMaterialCreate_t)0x0074D990; + RpGeometryDestroy = (RpGeometryDestroy_t)0x0074CCC0; + RpMaterialDestroy = (RpMaterialDestroy_t)0x0074DA20; + RwV3dNormalize = (RwV3dNormalize_t)0x007ED9B0; + RwIm3DTransform = (RwIm3DTransform_t)0x007EF450; + RwIm3DRenderIndexedPrimitive = (RwIm3DRenderIndexedPrimitive_t)0x007EF550; + RwIm3DEnd = (RwIm3DEnd_t)0x007EF520; + RwMatrixInvert = (RwMatrixInvert_t)0x007F2070; + RpWorldAddClump = (RpWorldAddClump_t)0x00751300; + RwFrameScale = (RwFrameScale_t)0x007F0ED0; + RwFrameUpdateObjects = (RwFrameUpdateObjects_t)0x7F0910; + RwV3dTransformVector = (RwV3dTransformVector_t)0x007EDDC0; + RpLightCreate = (RpLightCreate_t)0x00752110; + RpClumpAddLight = (RpClumpAddLight_t)0x0074A4F0; + _rwObjectHasFrameSetFrame = (_rwObjectHasFrameSetFrame_t)0x00804EF0; + RpLightSetRadius = (RpLightSetRadius_t)0x00751A70; + RpWorldAddLight = (RpWorldAddLight_t)0x00751910; + RpLightSetColor = (RpLightSetColor_t)0x00751A90; + RwCameraClone = (RwCameraClone_t)0x007EF3B0; + RpClumpClone = (RpClumpClone_t)0x00749F70; + RwTexDictionaryDestroy = (RwTexDictionaryDestroy_t)0x007F36A0; + RwTextureDestroy = (RwTextureDestroy_t)0x007F3820; + RwRasterUnlock = (RwRasterUnlock_t)0x007FAEC0; + RwRasterLock = (RwRasterLock_t)0x007FB2D0; + RwRasterCreate = (RwRasterCreate_t)0x007FB230; + RwTextureCreate = (RwTextureCreate_t)0x007F37C0; + RpMaterialSetTexture = (RpMaterialSetTexture_t)0x0074DBC0; + GetAnimHierarchyFromClump = (GetAnimHierarchyFromClump_t)0x734B10; + GetAnimHierarchyFromSkinClump = (GetAnimHierarchyFromSkinClump_t)0x734A40; + RpHAnimIDGetIndex = (RpHAnimIDGetIndex_t)0x7C51A0; + RpHAnimHierarchyGetMatrixArray = (RpHAnimHierarchyGetMatrixArray_t)0x7C5120; + RtQuatRotate = (RtQuatRotate_t)0x7EB7C0; + + SetTextureDict = (SetTextureDict_t)0x007319C0; + LoadClumpFile = (LoadClumpFile_t)0x005371F0; + LoadModel = (LoadModel_t)0x0040C6B0; + LoadCollisionModel = (LoadCollisionModel_t)0x00537580; + LoadCollisionModelVer2 = (LoadCollisionModelVer2_t)0x00537EE0; + LoadCollisionModelVer3 = (LoadCollisionModelVer3_t)0x00537CE0; + CTxdStore_LoadTxd = (CTxdStore_LoadTxd_t)0x00731DD0; + CTxdStore_GetTxd = (CTxdStore_GetTxd_t)0x00408340; + CTxdStore_RemoveTxd = (CTxdStore_RemoveTxd_t)0x00731E90; + CTxdStore_RemoveRef = (CTxdStore_RemoveRef_t)0x00731A30; + CTxdStore_AddRef = (CTxdStore_AddRef_t)0x00731A00; + CTxdStore_GetNumRefs = (CTxdStore_GetNumRefs_t)0x00731AA0; + CClothesBuilder_CopyTexture = (CClothesBuilder_CopyTexture_t)0x005A5730; } diff --git a/Client/multiplayer_sa/CMultiplayerSA_ClothesCache.cpp b/Client/multiplayer_sa/CMultiplayerSA_ClothesCache.cpp index d09679d6b2..f4801ffae4 100644 --- a/Client/multiplayer_sa/CMultiplayerSA_ClothesCache.cpp +++ b/Client/multiplayer_sa/CMultiplayerSA_ClothesCache.cpp @@ -412,5 +412,5 @@ void CMultiplayerSA::GetClothesCacheStats(SClothesCacheStats& outStats) void CMultiplayerSA::InitHooks_ClothesCache() { EZHookInstall(CClothesBuilderCreateSkinnedClump); - InitRwFunctions(pGameInterface->GetGameVersion()); + InitRwFunctions(); }