diff options
author | GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> | 2024-11-20 21:34:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-20 21:34:21 +0100 |
commit | b9ecae0389d09be94eb3b53a98ddcaab9b74e702 (patch) | |
tree | 9648d03f52fdfbcef7a219afa8df88247cee3da6 /primedev/engine/gl_matsysiface.cpp | |
parent | 04b7527fb0bdfce61d39c9d7de57f8c1e21ae660 (diff) | |
parent | 3e40fa3c9a589b7fc5088c43ead2b32bf68c6bbe (diff) | |
download | NorthstarLauncher-b9ecae0389d09be94eb3b53a98ddcaab9b74e702.tar.gz NorthstarLauncher-b9ecae0389d09be94eb3b53a98ddcaab9b74e702.zip |
Merge branch 'main' into feat/whitelist-safeio-file-extensions
Diffstat (limited to 'primedev/engine/gl_matsysiface.cpp')
-rw-r--r-- | primedev/engine/gl_matsysiface.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/primedev/engine/gl_matsysiface.cpp b/primedev/engine/gl_matsysiface.cpp new file mode 100644 index 00000000..075a56ac --- /dev/null +++ b/primedev/engine/gl_matsysiface.cpp @@ -0,0 +1,50 @@ +#include "materialsystem/cmaterialglue.h" + +CMaterialGlue* (*GetMaterialAtCrossHair)(); + +static void(__fastcall* o_pCC_mat_crosshair_printmaterial_f)(const CCommand& args) = nullptr; +static void __fastcall h_CC_mat_crosshair_printmaterial_f(const CCommand& args) +{ + CMaterialGlue* pMat = GetMaterialAtCrossHair(); + + if (!pMat) + { + spdlog::error("Not looking at a material!"); + return; + } + + std::function<void(CMaterialGlue * pGlue, const char* szName)> fnPrintGlue = [](CMaterialGlue* pGlue, const char* szName) + { + spdlog::info("|-----------------------------------------------"); + + if (!pGlue) + { + spdlog::info("|-- {} is NULL", szName); + return; + } + + spdlog::info("|-- Name: {}", szName); + spdlog::info("|-- GUID: {:#x}", pGlue->m_GUID); + spdlog::info("|-- Name: {}", pGlue->m_pszName); + spdlog::info("|-- Width : {}", pGlue->m_iWidth); + spdlog::info("|-- Height: {}", pGlue->m_iHeight); + }; + + spdlog::info("|- GUID: {:#x}", pMat->m_GUID); + spdlog::info("|- Name: {}", pMat->m_pszName); + spdlog::info("|- Width : {}", pMat->m_iWidth); + spdlog::info("|- Height: {}", pMat->m_iHeight); + + fnPrintGlue(pMat->m_pDepthShadow, "DepthShadow"); + fnPrintGlue(pMat->m_pDepthPrepass, "DepthPrepass"); + fnPrintGlue(pMat->m_pDepthVSM, "DepthVSM"); + fnPrintGlue(pMat->m_pColPass, "ColPass"); +} + +ON_DLL_LOAD("engine.dll", GlMatSysIFace, (CModule module)) +{ + o_pCC_mat_crosshair_printmaterial_f = module.Offset(0xB3C40).RCast<decltype(o_pCC_mat_crosshair_printmaterial_f)>(); + HookAttach(&(PVOID&)o_pCC_mat_crosshair_printmaterial_f, (PVOID)h_CC_mat_crosshair_printmaterial_f); + + GetMaterialAtCrossHair = module.Offset(0xB37D0).RCast<CMaterialGlue* (*)()>(); +} |