GetMaterialAtCrossHair changes, CMaterialGlue changes.

CShaderGlue still needs to be reverse engineered.
CMaterialGlue still needs verification for S0-S2 to see if the struct matches.

Patterscanning GetMaterialAtCrossHair now.
This commit is contained in:
PixieCore 2022-03-18 18:34:27 +01:00
parent 627b25c120
commit 0c9e184e3f
2 changed files with 81 additions and 30 deletions

View File

@ -1,45 +1,34 @@
#pragma once
class TXTGuidMap // [ PIXIE ]: Couldn't figure out the other GUID's yet!
{
public:
void* m_pAlbedoTextureGUID; //0x0000
void* m_pNormalTextureGUID; //0x0008
void* m_pSpecTextureGUID; //0x0010
void* m_pLayerBlendTextureGUID; //0x0018
void* m_pLightMapTextureRealTimeLightIDGUID; //0x0020
void* m_pUnknownGUID1; //0x0028
void* m_pUnknownGUID2; //0x0030
void* m_pUnknownGUID3; //0x0038
void* m_pUnknownGUID4; //0x0040
}; //Size: 0x0048
// [ 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.
class CMaterialGlue // [ PIXIE ]: Class seems mostly right, a few members are still missing though.
{
public:
void* m_pVTable; //0x0000
char pad_0008[8]; //0x0008
uint64_t m_GUID; //0x0010
std::uint64_t m_GUID; //0x0010
char* m_pszName; //0x0018
char* m_pszSurfaceName1; //0x0020
char* m_pszSurfaceName2; //0x0028
void* m_pDepthShadow; //0x0030
void* m_pDepthPrepass; //0x0038
void* m_pDepthVSM; //0x0040
void* m_pDepthShadowTight; //0x0048
void* m_pColPass; //0x0050
void* m_pShaderGlue; //0x0058
TXTGuidMap* m_pTextureGUID; //0x0060
TXTGuidMap* m_pTextureGUID2; //0x0068
CMaterialGlue* m_pDepthShadow; //0x0030
CMaterialGlue* m_pDepthPrepass; //0x0038
CMaterialGlue* m_pDepthVSM; //0x0040
CMaterialGlue* m_pDepthShadowTight; //0x0048
CMaterialGlue* m_pColPass; //0x0050
void* m_pShaderGlue; //0x0058 // [ PIXIE ] TODO: Reverse CShaderGlue.
void* m_pTextureGUID1; //0x0060
void* m_pTextureGUID2; //0x0068
char pad_0070[4]; //0x0070
int32_t m_iTextureRes; //0x0074
int32_t m_iMaterialRes; //0x0074
char pad_0078[184]; //0x0078
}; //Size: 0x0130
namespace
{
/* ==== CMATERIALGLUE ================================================================================================================================================== */
ADDRESS p_GetMaterialAtCrossHair = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x8B\xC4\x48\x83\xEC\x58\x48\x83\x3D\x00\x00\x00\x00\x00", "xxxxxxxxxx?????");
CMaterialGlue* (*GetMaterialAtCrossHair)(void) = (CMaterialGlue*(*)(void))p_GetMaterialAtCrossHair.GetPtr(); /*48 8B C4 48 83 EC 58 48 83 3D ? ? ? ? ?*/
}
void CMaterialGlue_Attach();

View File

@ -774,16 +774,78 @@ _IMaterial_GetMaterialAtCrossHair_f_CompletionFunc
*/
void _CMaterial_GetMaterialAtCrossHair_f_ComplectionFunc(const CCommand& args)
{
#if defined (GAMEDLL_S3) // [ PIXIE ]: Will do port to season 0-2 at a later date.
static auto GetMaterial = ADDRESS(0x14020B4A0).RCast<CMaterialGlue*(*)(void)>(); // [ PIXIE ]: I will sigscan this later and make it for work other seasons as well.
CMaterialGlue* material = GetMaterial();
#if defined (GAMEDLL_S3) // [ PIXIE ]: Verification needed for earlier seasons if CMaterialGlue matches.
CMaterialGlue* material = GetMaterialAtCrossHair();
if (material)
{
DevMsg(eDLL_T::CLIENT, "Current Material: %s", material->m_pszName); // [ PIXIE ]: Will add full CMaterialGlue description later.
DevMsg(eDLL_T::MS, "______________________________________________________________\n");
DevMsg(eDLL_T::MS, "] MATERIAL DETAILS -------------------------------------------\n");
DevMsg(eDLL_T::MS, "] ADDR: '%llX'\n", material);
DevMsg(eDLL_T::MS, "] GUID: '%llX'\n", material->m_GUID);
DevMsg(eDLL_T::MS, "] Material Res: '%d'\n", material->m_iMaterialRes);
std::function<void(CMaterialGlue*, const char*)> fnPrintChild = [](CMaterialGlue* material, const char* print)
{
DevMsg(eDLL_T::MS, " ]___________________________________________________________\n");
DevMsg(eDLL_T::MS, " ] CHILD DETAILS --------------------------------------------\n");
DevMsg(eDLL_T::MS, print, material);
DevMsg(eDLL_T::MS, " ] GUID: '%llX'\n", material->m_GUID);
if (material->m_pszName)
{
DevMsg(eDLL_T::MS, " ] Material Name: '%s'\n", material->m_pszName);
}
else
{
DevMsg(eDLL_T::MS, " ] Material Name: 'NULL'\n");
}
DevMsg(eDLL_T::MS, " ]___________________________________________________________\n");
};
if (material->m_pszName)
{
DevMsg(eDLL_T::MS, "] Material Name: '%s'\n", material->m_pszName);
}
else
{
DevMsg(eDLL_T::MS, "] Material Name: 'NULL'\n");
}
if (material->m_pszSurfaceName1)
{
DevMsg(eDLL_T::MS, "] Material Surface Name 1: '%s'\n", material->m_pszSurfaceName1);
}
else
{
DevMsg(eDLL_T::MS, "] Material Surface Name 1: 'NULL'\n");
}
if (material->m_pszSurfaceName2)
{
DevMsg(eDLL_T::MS, "] Material Surface Name 2: '%s'\n", material->m_pszSurfaceName2);
}
else
{
DevMsg(eDLL_T::MS, "] Material Surface Name 2: 'NULL'\n");
}
material->m_pDepthShadow ? fnPrintChild(material->m_pDepthShadow, " ] DepthShadow Addr: '%llX'\n") : DevMsg(eDLL_T::MS, "] DepthShadow Addr: 'NULL'\n");
material->m_pDepthPrepass ? fnPrintChild(material->m_pDepthPrepass, " ] DepthPrepass Addr: '%llX'\n") : DevMsg(eDLL_T::MS, "] DepthPrepass Addr: 'NULL'\n");
material->m_pDepthVSM ? fnPrintChild(material->m_pDepthVSM, " ] DepthVSM Addr: '%llX'\n") : DevMsg(eDLL_T::MS, "] DepthVSM Addr: 'NULL'\n");
material->m_pDepthShadow ? fnPrintChild(material->m_pDepthShadow, " ] DepthShadowTight Addr: '%llX'\n") : DevMsg(eDLL_T::MS, "] DepthShadowTight Addr: 'NULL'\n");
material->m_pColPass ? fnPrintChild(material->m_pColPass, " ] ColPass Addr: '%llX'\n") : DevMsg(eDLL_T::MS, "] ColPass Addr: 'NULL'\n");
DevMsg(eDLL_T::MS, " ]___________________________________________________________\n");
DevMsg(eDLL_T::MS, " ] TEXTURE GUID MAP DETAILS ---------------------------------\n");
material->m_pTextureGUID1 ? DevMsg(eDLL_T::MS, " ] TextureMap 1 Addr: '%llX'\n", material->m_pTextureGUID1) : DevMsg(eDLL_T::MS, " ] TextureMap 1 Addr: 'NULL'\n");
material->m_pTextureGUID2 ? DevMsg(eDLL_T::MS, " ] TextureMap 2 Addr: '%llX'\n", material->m_pTextureGUID2) : DevMsg(eDLL_T::MS, " ] TextureMap 2 Addr: 'NULL'\n");
DevMsg(eDLL_T::MS, " ]___________________________________________________________\n");
DevMsg(eDLL_T::MS, "--------------------------------------------------------------\n");
}
else
{
DevMsg(eDLL_T::CLIENT, "No Material found >:(");
DevMsg(eDLL_T::MS, "No Material found >:(");
}
#endif
}