forked from R2Northstar/NorthstarLauncher
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove uses of Autohook from
gl_matsysiface.cpp
(R2Northstar#801)
Removes AUTOHOOK macro from gl_matsysiface.cpp and replaces it with HookAttach
- Loading branch information
1 parent
6fc3111
commit 927faf5
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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* (*)()>(); | ||
} |