2022-07-01 22:50:22 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#pragma pack(push, 1)
|
2022-07-03 21:55:35 +02:00
|
|
|
class CShaderGlue // Most of these found in CShaderGlue::SetupShader
|
2022-07-01 22:50:22 +02:00
|
|
|
{
|
|
|
|
public:
|
2022-07-04 22:52:10 +02:00
|
|
|
int SetupShader(uint64_t nCount, uint64_t a3, void* pRawMaterialGlueWithoutVTable);
|
2022-07-03 22:44:25 +02:00
|
|
|
|
2022-07-04 22:52:10 +02:00
|
|
|
void* m_pVTable; //0x0000
|
2022-07-03 22:44:25 +02:00
|
|
|
char pad_0008[8]; //0x0008 Dispatcher Context, Some SEH try and catch thing.
|
2022-07-03 21:55:35 +02:00
|
|
|
uint64_t m_nUnknown1; //0x0010
|
|
|
|
uint16_t m_nCount1; //0x0018
|
2022-07-18 22:00:03 +01:00
|
|
|
uint16_t m_nTextureInputCount; //0x001A
|
2022-07-03 21:55:35 +02:00
|
|
|
uint16_t m_nNumSamplers; //0x001C [ PIXIE ]: Used by ID3D11DeviceContext::PSSetSamplers to set NumSamplers
|
|
|
|
uint8_t m_nStartSlot; //0x001E [ PIXIE ]: Used by ID3D11DeviceContext::PSSetShaderResources to set StartSlot.
|
|
|
|
uint8_t m_nNumViews; //0x001F [ PIXIE ]: Used by ID3D11DeviceContext::PSSetShaderResources to set NumViews.
|
|
|
|
uint8_t m_nByte1; //0x0020 [ PIXIE ]: No clue tbh the only usage is an example I will show below. All of the usages are cmp also..?
|
|
|
|
uint8_t pad_0021[15]; //0x0021
|
|
|
|
void** m_ppVertexShader; //0x0030 [ PIXIE ]: Points to another structure which holds a double ptr to d3d11.dll
|
|
|
|
void** m_ppPixelShader; //0x0038 [ PIXIE ]: Points to another structure which holds a double ptr to d3d11.dll
|
2022-07-01 22:50:22 +02:00
|
|
|
}; //Size: 0x0040
|
2022-07-03 21:55:35 +02:00
|
|
|
static_assert(sizeof(CShaderGlue) == 0x40); // [ PIXIE ]: All vars have proper datatype size, paddings are unknown.
|
2022-07-01 22:50:22 +02:00
|
|
|
#pragma pack(pop)
|
|
|
|
|
2022-07-03 21:55:35 +02:00
|
|
|
/*
|
|
|
|
if ( *(_BYTE *)(v19 + a1 + 32) != byte_14171A08A ) // (v19 + a1 + 32) = m_nByte1
|
|
|
|
{
|
|
|
|
byte_14171A08A = *(_BYTE *)(v19 + a1 + 32);
|
|
|
|
qword_14171AE78 = -1i64;
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2022-07-01 22:50:22 +02:00
|
|
|
/* ==== CSHADERGLUE ================================================================================================================================================== */
|
2022-07-04 22:52:10 +02:00
|
|
|
inline auto CShaderGlue_SetupShader = CMemory().RCast<int(*)(CShaderGlue* thisptr, uint64_t nCount, uint64_t a3, void* pRawMaterialGlueWithoutVTable)>();
|
|
|
|
|
|
|
|
inline CMemory CShaderGlue_VTable;
|
2022-08-15 22:29:16 +02:00
|
|
|
inline void* g_pShaderGlueVFTable = nullptr;
|
2022-07-01 22:50:22 +02:00
|
|
|
|
|
|
|
void CShaderGlue_Attach();
|
|
|
|
void CShaderGlue_Detach();
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
class VShaderGlue : public IDetour
|
|
|
|
{
|
2022-08-15 22:29:16 +02:00
|
|
|
virtual void GetAdr(void) const
|
|
|
|
{
|
2023-01-25 02:26:52 +01:00
|
|
|
LogFunAdr("CShaderGlue::SetupShader", reinterpret_cast<uintptr_t>(CShaderGlue_SetupShader));
|
|
|
|
LogConAdr("g_pShaderGlueVFTable", reinterpret_cast<uintptr_t>(g_pShaderGlueVFTable));
|
2022-08-15 22:29:16 +02:00
|
|
|
}
|
2022-07-04 22:52:10 +02:00
|
|
|
virtual void GetFun(void) const
|
|
|
|
{
|
2022-12-02 01:33:49 +01:00
|
|
|
CShaderGlue_SetupShader = CShaderGlue_VTable.WalkVTable(4).Deref().RCast<int(*)(CShaderGlue*, uint64_t, uint64_t, void*)>();
|
2022-07-04 22:52:10 +02:00
|
|
|
}
|
2022-07-01 22:50:22 +02:00
|
|
|
virtual void GetVar(void) const { }
|
2022-08-15 22:29:16 +02:00
|
|
|
virtual void GetCon(void) const
|
|
|
|
{
|
|
|
|
CShaderGlue_VTable = g_GameDll.GetVirtualMethodTable(".?AVCShaderGlue@@");
|
|
|
|
g_pShaderGlueVFTable = CShaderGlue_VTable.RCast<void*>();
|
|
|
|
}
|
2022-07-01 22:50:22 +02:00
|
|
|
virtual void Attach(void) const { }
|
|
|
|
virtual void Detach(void) const { }
|
|
|
|
};
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|