mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Add 'CMaterialDeviceMgr' singleton to SDK
Manager class for display adapters.
This commit is contained in:
parent
d0887da27a
commit
a639a4befd
@ -1,6 +1,7 @@
|
||||
#ifndef MATERIALSYSTEM_H
|
||||
#define MATERIALSYSTEM_H
|
||||
#include "cmaterialglue.h"
|
||||
#include "public/imaterialsystem.h"
|
||||
|
||||
#define STREAM_DB_EXT "stbsp"
|
||||
|
||||
@ -14,11 +15,47 @@ public:
|
||||
#endif // !MATERIALSYSTEM_NODX
|
||||
};
|
||||
|
||||
#ifndef MATERIALSYSTEM_NODX
|
||||
class CMaterialDeviceMgr
|
||||
{
|
||||
public:
|
||||
inline const MaterialAdapterInfo_t& GetAdapterInfo(int nIndex) const
|
||||
{
|
||||
Assert(nIndex >= 0 && nIndex < SDK_ARRAYSIZE(m_AdapterInfo));
|
||||
return m_AdapterInfo[nIndex];
|
||||
}
|
||||
inline const MaterialAdapterInfo_t& GetAdapterInfo() const
|
||||
{
|
||||
// Retrieve info of the selected adapter.
|
||||
return GetAdapterInfo(m_SelectedAdapter);
|
||||
}
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
MAX_ADAPTER_COUNT = 4
|
||||
};
|
||||
|
||||
IDXGIAdapter* m_Adapters[MAX_ADAPTER_COUNT];
|
||||
void* m_pUnknown1[MAX_ADAPTER_COUNT];
|
||||
MaterialAdapterInfo_t m_AdapterInfo[MAX_ADAPTER_COUNT];
|
||||
size_t m_AdapterMemorySize[MAX_ADAPTER_COUNT];
|
||||
int m_NumDisplayAdaptersProcessed;
|
||||
int m_SelectedAdapter;
|
||||
int m_NumDisplayAdapters;
|
||||
};
|
||||
|
||||
inline CMaterialDeviceMgr* g_pMaterialAdapterMgr = nullptr;
|
||||
#endif // !MATERIALSYSTEM_NODX
|
||||
|
||||
/* ==== MATERIALSYSTEM ================================================================================================================================================== */
|
||||
inline CMemory p_CMaterialSystem__Init;
|
||||
inline InitReturnVal_t(*CMaterialSystem__Init)(CMaterialSystem* thisptr);
|
||||
|
||||
inline void* g_pMaterialSystem = nullptr;
|
||||
inline CMemory p_CMaterialSystem__Disconnect;
|
||||
inline void(*CMaterialSystem__Disconnect)(void);
|
||||
|
||||
inline CMaterialSystem* g_pMaterialSystem = nullptr;
|
||||
inline void* g_pMaterialVFTable = nullptr;
|
||||
#ifndef MATERIALSYSTEM_NODX
|
||||
inline CMemory p_CMaterialSystem__FindMaterialEx;
|
||||
@ -54,6 +91,7 @@ class VMaterialSystem : public IDetour
|
||||
{
|
||||
LogConAdr("CMaterial::`vftable'", reinterpret_cast<uintptr_t>(g_pMaterialVFTable));
|
||||
LogFunAdr("CMaterialSystem::Init", p_CMaterialSystem__Init.GetPtr());
|
||||
LogFunAdr("CMaterialSystem::Disconnect", p_CMaterialSystem__Disconnect.GetPtr());
|
||||
#ifndef MATERIALSYSTEM_NODX
|
||||
LogFunAdr("CMaterialSystem::FindMaterialEx", p_CMaterialSystem__FindMaterialEx.GetPtr());
|
||||
LogFunAdr("CMaterialSystem::GetScreenSize", p_CMaterialSystem_GetScreenSize.GetPtr());
|
||||
@ -64,6 +102,7 @@ class VMaterialSystem : public IDetour
|
||||
LogVarAdr("g_nUnfreeStreamingTextureMemory", reinterpret_cast<uintptr_t>(g_nUnfreeStreamingTextureMemory));
|
||||
LogVarAdr("g_nUnusableStreamingTextureMemory", reinterpret_cast<uintptr_t>(g_nUnusableStreamingTextureMemory));
|
||||
LogVarAdr("s_pRenderContext", s_pRenderContext.GetPtr());
|
||||
LogVarAdr("g_MaterialAdapterMgr", reinterpret_cast<uintptr_t>(g_pMaterialAdapterMgr));
|
||||
#endif // !MATERIALSYSTEM_NODX
|
||||
LogVarAdr("g_pMaterialSystem", reinterpret_cast<uintptr_t>(g_pMaterialSystem));
|
||||
}
|
||||
@ -71,6 +110,9 @@ class VMaterialSystem : public IDetour
|
||||
{
|
||||
p_CMaterialSystem__Init = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 55 56 57 41 54 41 55 41 56 41 57 48 83 EC 70 48 83 3D ?? ?? ?? ?? ??");
|
||||
CMaterialSystem__Init = p_CMaterialSystem__Init.RCast<InitReturnVal_t(*)(CMaterialSystem*)>(); /*48 89 5C 24 ?? 55 56 57 41 54 41 55 41 56 41 57 48 83 EC 70 48 83 3D ?? ?? ?? ?? ??*/
|
||||
|
||||
p_CMaterialSystem__Disconnect = g_GameDll.FindPatternSIMD("48 83 EC 28 8B 0D ?? ?? ?? ?? 48 89 6C 24 ??");
|
||||
CMaterialSystem__Disconnect = p_CMaterialSystem__Disconnect.RCast<void(*)(void)>();
|
||||
#ifndef MATERIALSYSTEM_NODX
|
||||
p_CMaterialSystem__FindMaterialEx = g_GameDll.FindPatternSIMD("44 89 4C 24 ?? 44 88 44 24 ?? 48 89 4C 24 ??");
|
||||
CMaterialSystem__FindMaterialEx = p_CMaterialSystem__FindMaterialEx.RCast<CMaterialGlue*(*)(CMaterialSystem*, const char*, uint8_t, int, bool)>(); /*44 89 4C 24 ?? 44 88 44 24 ?? 48 89 4C 24 ??*/
|
||||
@ -99,8 +141,9 @@ class VMaterialSystem : public IDetour
|
||||
g_nUnusableStreamingTextureMemory = p_DrawStreamOverlay.Offset(0x50).FindPatternSelf("48 8B 05", CMemory::Direction::DOWN).ResolveRelativeAddressSelf(0x3, 0x7).RCast<int*>();
|
||||
|
||||
s_pRenderContext = p_DispatchDrawCall.FindPattern("48 8B ?? ?? ?? ?? 01").ResolveRelativeAddressSelf(0x3, 0x7);
|
||||
g_pMaterialAdapterMgr = p_CMaterialSystem__Disconnect.FindPattern("48 8D").ResolveRelativeAddressSelf(0x3, 0x7).RCast<CMaterialDeviceMgr*>();
|
||||
#endif // !MATERIALSYSTEM_NODX
|
||||
g_pMaterialSystem = g_GameDll.FindPatternSIMD("48 8B 0D ?? ?? ?? ?? 48 85 C9 74 11 48 8B 01 48 8D 15 ?? ?? ?? ??").ResolveRelativeAddressSelf(0x3, 0x7).RCast<void*>();
|
||||
g_pMaterialSystem = g_GameDll.FindPatternSIMD("48 8B 0D ?? ?? ?? ?? 48 85 C9 74 11 48 8B 01 48 8D 15 ?? ?? ?? ??").ResolveRelativeAddressSelf(0x3, 0x7).RCast<CMaterialSystem*>();
|
||||
}
|
||||
virtual void GetCon(void) const
|
||||
{
|
||||
|
@ -1,6 +1,30 @@
|
||||
#ifndef IMATERIALSYSTEM_H
|
||||
#define IMATERIALSYSTEM_H
|
||||
|
||||
#define NVIDIA_VENDOR_ID 0x10DE
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Material adapter info..
|
||||
//-----------------------------------------------------------------------------
|
||||
struct MaterialAdapterInfo_t
|
||||
{
|
||||
enum
|
||||
{
|
||||
MATERIAL_ADAPTER_NAME_LENGTH = 512
|
||||
};
|
||||
|
||||
char m_pDriverName[MATERIAL_ADAPTER_NAME_LENGTH];
|
||||
unsigned int m_VendorID;
|
||||
unsigned int m_DeviceID;
|
||||
unsigned int m_SubSysID;
|
||||
unsigned int m_Revision;
|
||||
int m_nDXSupportLevel; // This is the *preferred* dx support level
|
||||
int m_nMinDXSupportLevel;
|
||||
int m_nMaxDXSupportLevel;
|
||||
unsigned int m_nDriverVersionHigh;
|
||||
unsigned int m_nDriverVersionLow;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Video mode info..
|
||||
//-----------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user