2022-03-18 13:47:22 +01:00
|
|
|
#pragma once
|
2022-10-13 02:41:09 +02:00
|
|
|
#ifndef DEDICATED
|
2022-07-01 22:50:22 +02:00
|
|
|
#include "materialsystem/cshaderglue.h"
|
2022-10-13 02:22:50 +02:00
|
|
|
#include "public/imaterialinternal.h"
|
|
|
|
#include "public/materialsystem/shader_vcs_version.h"
|
|
|
|
#include "public/rendersystem/schema/texture.g.h"
|
|
|
|
|
|
|
|
struct CMaterialGlue_Unknown
|
|
|
|
{
|
|
|
|
__m128i unk1;
|
|
|
|
__m128i unk2;
|
|
|
|
__m128i unk3;
|
|
|
|
};
|
2022-07-01 22:50:22 +02:00
|
|
|
|
2022-03-23 19:29:23 +01:00
|
|
|
#pragma pack(push, 1) // Without this MSVC might get the idea to align our members to completely fuck the offsets up.
|
2022-03-18 18:34:27 +01:00
|
|
|
// [ PIXIE ]: The texture GUID's aren't in a specific order, gonna leave them as ptr's so an individual can check them in any memory searcher.
|
|
|
|
// [ PIXIE ]: Verification needed for earlier seasons, if the struct is the same.
|
2022-10-13 02:22:50 +02:00
|
|
|
// [ PIXIE ]: Class seems mostly right, a few members are still missing though.
|
|
|
|
class CMaterialGlue : public IMaterialInternal
|
2022-03-18 13:47:22 +01:00
|
|
|
{
|
|
|
|
public:
|
2022-07-01 22:50:22 +02:00
|
|
|
uint8_t pad_0008[8]; //0x0008
|
|
|
|
uint64_t m_GUID; //0x0010
|
|
|
|
const char* m_pszName; //0x0018
|
2022-10-13 02:22:50 +02:00
|
|
|
const char* m_pszSurfaceProp; //0x0020
|
|
|
|
const char* m_pszSurfaceProp2; //0x0028
|
2022-03-18 18:34:27 +01:00
|
|
|
CMaterialGlue* m_pDepthShadow; //0x0030
|
|
|
|
CMaterialGlue* m_pDepthPrepass; //0x0038
|
|
|
|
CMaterialGlue* m_pDepthVSM; //0x0040
|
|
|
|
CMaterialGlue* m_pDepthShadowTight; //0x0048
|
|
|
|
CMaterialGlue* m_pColPass; //0x0050
|
2022-07-01 22:50:22 +02:00
|
|
|
CShaderGlue* m_pShaderGlue; //0x0058
|
2022-10-13 02:22:50 +02:00
|
|
|
TextureHeader_t** m_pTextureHandles; //0x0060
|
|
|
|
TextureHeader_t** m_pStreamableTextureHandles; //0x0068
|
2022-07-18 22:00:03 +01:00
|
|
|
int16_t m_nStreamableTextureCount; //0x0070
|
2022-07-01 22:50:22 +02:00
|
|
|
int16_t m_iWidth; //0x0072
|
|
|
|
int16_t m_iHeight; //0x0074
|
2022-12-03 00:34:24 +01:00
|
|
|
int16_t m_iDepth; //0x0076
|
2022-07-01 22:50:22 +02:00
|
|
|
uint32_t m_iFlags; //0x0078 [ PIXIE ]: I'm pretty sure those are VTF Image Flags, If you set them to NULL they cause Texture stretching.
|
|
|
|
int32_t m_unused2; //0x007C
|
|
|
|
uint8_t pad_0080[8]; //0x0080
|
|
|
|
uint32_t m_iUnknownFlags1; //0x0088
|
2022-10-13 02:22:50 +02:00
|
|
|
char pad_008C[4]; //0x008C
|
2022-11-02 00:28:41 +01:00
|
|
|
CMaterialGlue_Unknown m_UnkSections[2];
|
|
|
|
uint8_t bytef0;
|
|
|
|
uint8_t bytef1;
|
|
|
|
uint8_t m_iMaterialType;
|
|
|
|
uint8_t bytef3;
|
2022-10-13 02:22:50 +02:00
|
|
|
int dwordf4;
|
2022-11-02 00:28:41 +01:00
|
|
|
void* m_pTextureAnim;
|
2022-10-13 02:22:50 +02:00
|
|
|
void** m_pDXBuffer;
|
|
|
|
void** m_pID3D11BufferVTable;
|
|
|
|
void* m_pViewsBuffer;
|
2022-07-16 12:33:02 +02:00
|
|
|
uint32_t m_iUnknown3; //0x0118
|
|
|
|
uint16_t m_iUnknown4; //0x011C
|
|
|
|
uint16_t m_iUnknown5; //0x011E
|
|
|
|
uint16_t m_iUnknown6; //0x0120
|
|
|
|
uint64_t m_Unknown7; //0x0122
|
|
|
|
uint32_t m_iUnknown8; //0x012A
|
|
|
|
uint16_t m_iUnknown9; //0x012E
|
2022-03-18 21:38:57 +01:00
|
|
|
}; //Size: 0x0130 confirmed end size.
|
2022-03-23 19:29:23 +01:00
|
|
|
static_assert(sizeof(CMaterialGlue) == 0x130);
|
|
|
|
#pragma pack(pop)
|
2022-10-13 02:41:09 +02:00
|
|
|
#endif // !DEDICATED
|
2022-03-18 13:47:22 +01:00
|
|
|
|
2022-08-15 22:29:16 +02:00
|
|
|
inline void* g_pMaterialGlueVFTable = nullptr;
|
2022-05-01 05:38:51 +02:00
|
|
|
|
2022-10-13 02:41:09 +02:00
|
|
|
|
2022-04-09 02:18:57 +02:00
|
|
|
/* ==== CMATERIALGLUE ================================================================================================================================================== */
|
2022-10-13 02:41:09 +02:00
|
|
|
#ifndef DEDICATED
|
2022-04-18 03:35:08 +02:00
|
|
|
inline CMemory p_GetMaterialAtCrossHair;
|
|
|
|
inline auto GetMaterialAtCrossHair = p_GetMaterialAtCrossHair.RCast<CMaterialGlue* (*)(void)>();
|
2022-10-13 02:41:09 +02:00
|
|
|
#endif // !DEDICATED
|
2022-03-18 13:47:22 +01:00
|
|
|
|
|
|
|
void CMaterialGlue_Attach();
|
|
|
|
void CMaterialGlue_Detach();
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2022-05-13 14:53:25 +02:00
|
|
|
class VMaterialGlue : public IDetour
|
2022-03-18 13:47:22 +01:00
|
|
|
{
|
2022-04-11 01:44:30 +02:00
|
|
|
virtual void GetAdr(void) const
|
2022-03-18 13:47:22 +01:00
|
|
|
{
|
2023-01-25 11:19:53 +01:00
|
|
|
LogConAdr("CMaterialGlue::`vftable'", reinterpret_cast<uintptr_t>(g_pMaterialGlueVFTable));
|
2022-10-13 02:41:09 +02:00
|
|
|
#ifndef DEDICATED
|
2023-01-25 02:26:52 +01:00
|
|
|
LogFunAdr("CMaterialGlue::GetMaterialAtCrossHair", p_GetMaterialAtCrossHair.GetPtr());
|
2022-10-13 02:41:09 +02:00
|
|
|
#endif // !DEDICATED
|
2022-03-18 13:47:22 +01:00
|
|
|
}
|
2022-04-18 03:35:08 +02:00
|
|
|
virtual void GetFun(void) const
|
|
|
|
{
|
2022-10-13 02:41:09 +02:00
|
|
|
#ifndef DEDICATED
|
2022-12-01 22:44:55 +01:00
|
|
|
p_GetMaterialAtCrossHair = g_GameDll.FindPatternSIMD("48 8B C4 48 83 EC 58 48 83 3D ?? ?? ?? ?? ??");
|
2022-04-18 03:35:08 +02:00
|
|
|
GetMaterialAtCrossHair = p_GetMaterialAtCrossHair.RCast<CMaterialGlue* (*)(void)>(); /*48 8B C4 48 83 EC 58 48 83 3D ? ? ? ? ?*/
|
2022-10-13 02:41:09 +02:00
|
|
|
#endif // !DEDICATED
|
2022-04-18 03:35:08 +02:00
|
|
|
}
|
2022-04-11 01:44:30 +02:00
|
|
|
virtual void GetVar(void) const { }
|
2022-05-01 05:38:51 +02:00
|
|
|
virtual void GetCon(void) const
|
|
|
|
{
|
2022-08-15 22:29:16 +02:00
|
|
|
g_pMaterialGlueVFTable = g_GameDll.GetVirtualMethodTable(".?AVCMaterialGlue@@");
|
2022-05-01 05:38:51 +02:00
|
|
|
}
|
2022-04-11 01:44:30 +02:00
|
|
|
virtual void Attach(void) const { }
|
|
|
|
virtual void Detach(void) const { }
|
2022-03-18 13:47:22 +01:00
|
|
|
};
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|