mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
CShaderGlue changes and RTech implementation.
* Added RTech::LoadShaderSet for the asset load routine * Grabbing CShaderGlue::SetupShader and CShaderGlue::m_pVTable dynamically now * Everything verified for every season, cross-compatible!
This commit is contained in:
parent
fb0795c789
commit
1b2c0cecd0
@ -6,7 +6,6 @@
|
|||||||
#include "core/stdafx.h"
|
#include "core/stdafx.h"
|
||||||
#include "materialsystem/cmaterialglue.h"
|
#include "materialsystem/cmaterialglue.h"
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
void CMaterialGlue_Attach()
|
void CMaterialGlue_Attach()
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,10 @@
|
|||||||
#include "core/stdafx.h"
|
#include "core/stdafx.h"
|
||||||
#include "materialsystem/cshaderglue.h"
|
#include "materialsystem/cshaderglue.h"
|
||||||
|
|
||||||
|
int CShaderGlue::SetupShader(uint64_t nCount, uint64_t a3, void* pRawMaterialGlueWithoutVTable)
|
||||||
|
{
|
||||||
|
return CShaderGlue_SetupShader(this, nCount, a3, pRawMaterialGlueWithoutVTable);
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
void CShaderGlue_Attach()
|
void CShaderGlue_Attach()
|
||||||
|
@ -4,12 +4,9 @@
|
|||||||
class CShaderGlue // Most of these found in CShaderGlue::SetupShader
|
class CShaderGlue // Most of these found in CShaderGlue::SetupShader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual uint64_t TryBlockMap_getpDC() = 0;
|
int SetupShader(uint64_t nCount, uint64_t a3, void* pRawMaterialGlueWithoutVTable);
|
||||||
virtual uint64_t nullsub() = 0;
|
|
||||||
virtual void* sub_1403B3710() = 0;
|
|
||||||
virtual uint64_t nullsub1() = 0;
|
|
||||||
virtual int SetupShader(uint64_t nCount, uint64_t a3, void* pRawMaterialGlueWithoutVTable) = 0;
|
|
||||||
|
|
||||||
|
void* m_pVTable; //0x0000
|
||||||
char pad_0008[8]; //0x0008 Dispatcher Context, Some SEH try and catch thing.
|
char pad_0008[8]; //0x0008 Dispatcher Context, Some SEH try and catch thing.
|
||||||
uint64_t m_nUnknown1; //0x0010
|
uint64_t m_nUnknown1; //0x0010
|
||||||
uint16_t m_nCount1; //0x0018
|
uint16_t m_nCount1; //0x0018
|
||||||
@ -34,6 +31,10 @@ static_assert(sizeof(CShaderGlue) == 0x40); // [ PIXIE ]: All vars have proper d
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* ==== CSHADERGLUE ================================================================================================================================================== */
|
/* ==== CSHADERGLUE ================================================================================================================================================== */
|
||||||
|
inline auto CShaderGlue_SetupShader = CMemory().RCast<int(*)(CShaderGlue* thisptr, uint64_t nCount, uint64_t a3, void* pRawMaterialGlueWithoutVTable)>();
|
||||||
|
|
||||||
|
inline CMemory CShaderGlue_VTable;
|
||||||
|
inline void* g_pCShaderGlue_VTable = nullptr;
|
||||||
|
|
||||||
void CShaderGlue_Attach();
|
void CShaderGlue_Attach();
|
||||||
void CShaderGlue_Detach();
|
void CShaderGlue_Detach();
|
||||||
@ -41,7 +42,14 @@ void CShaderGlue_Detach();
|
|||||||
class VShaderGlue : public IDetour
|
class VShaderGlue : public IDetour
|
||||||
{
|
{
|
||||||
virtual void GetAdr(void) const { }
|
virtual void GetAdr(void) const { }
|
||||||
virtual void GetFun(void) const { }
|
virtual void GetFun(void) const
|
||||||
|
{
|
||||||
|
// We get it here in GetFun because we grab other functions with it, it's more efficient.
|
||||||
|
CShaderGlue_VTable = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x48\x8D\x05\x00\x00\x00\x00\x48\x89\x01\xC3\xCC\xCC\xCC\xCC\xCC\x48\x85\xD2"), "xxx????xxxxxxxxxxxx").ResolveRelativeAddressSelf(0x3, 0x7);
|
||||||
|
g_pCShaderGlue_VTable = CShaderGlue_VTable.RCast<void*>(); /*48 8D 05 ? ? ? ? 48 89 01 C3 CC CC CC CC CC 48 85 D2*/
|
||||||
|
|
||||||
|
CShaderGlue_SetupShader = CShaderGlue_VTable.WalkVTable(4).RCast<int(*)(CShaderGlue*, uint64_t, uint64_t, void*)>();
|
||||||
|
}
|
||||||
virtual void GetVar(void) const { }
|
virtual void GetVar(void) const { }
|
||||||
virtual void GetCon(void) const { }
|
virtual void GetCon(void) const { }
|
||||||
virtual void Attach(void) const { }
|
virtual void Attach(void) const { }
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include "rtech/rtech_utils.h"
|
#include "rtech/rtech_utils.h"
|
||||||
#ifndef DEDICATED
|
#ifndef DEDICATED
|
||||||
#include "windows/id3dx.h"
|
#include "windows/id3dx.h"
|
||||||
|
#include "materialsystem/cshaderglue.h"
|
||||||
#endif // !DEDICATED
|
#endif // !DEDICATED
|
||||||
|
|
||||||
|
|
||||||
@ -643,6 +644,14 @@ void RTech::CreateDXTexture(RPakTextureHeader_t* textureHeader, int64_t imageDat
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef DEDICATED
|
||||||
|
void** RTech::LoadShaderSet(void** VTablePtr)
|
||||||
|
{
|
||||||
|
*VTablePtr = &g_pCShaderGlue_VTable;
|
||||||
|
return &g_pCShaderGlue_VTable;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: gets information about loaded pak file via pak ID
|
// Purpose: gets information about loaded pak file via pak ID
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -342,6 +342,10 @@ public:
|
|||||||
#if not defined DEDICATED && defined (GAMEDLL_S3)
|
#if not defined DEDICATED && defined (GAMEDLL_S3)
|
||||||
static void __fastcall CreateDXTexture(RPakTextureHeader_t* textureHeader, int64_t cpuArg);
|
static void __fastcall CreateDXTexture(RPakTextureHeader_t* textureHeader, int64_t cpuArg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef DEDICATED
|
||||||
|
void** LoadShaderSet(void** VTablePtr);
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
void RTech_Utils_Attach();
|
void RTech_Utils_Attach();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user