Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion TextmodeTF2/TextmodeTF2.vcxproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
Expand Down Expand Up @@ -226,11 +226,22 @@
<ClCompile Include="src\Core\Core.cpp" />
<ClCompile Include="src\DllMain.cpp" />
<ClCompile Include="src\Hooks\Con_DebugLog.cpp" />
<ClCompile Include="src\Hooks\CDebugOverlay_AddBoxOverlay.cpp" />
<ClCompile Include="src\Hooks\CDebugOverlay_AddLineOverlay.cpp" />
<ClCompile Include="src\Hooks\CModelLoader_GetModelForName.cpp" />
<ClCompile Include="src\Hooks\CModelRender_DrawModelExecute.cpp" />
<ClCompile Include="src\Hooks\CParticleCollection_Simulate.cpp" />
<ClCompile Include="src\Hooks\IMDLCache_ProcessDataIntoCache.cpp" />
<ClCompile Include="src\Hooks\CParticleSystemMgr_DrawRenderCache.cpp" />
<ClCompile Include="src\Hooks\CParticleSystemMgr_ReadParticleConfigFile.cpp" />
<ClCompile Include="src\Hooks\CStaticPropMgr_DrawStaticProps.cpp" />
<ClCompile Include="src\Hooks\CStaticPropMgr_UnserializeStaticProps.cpp" />
<ClCompile Include="src\Hooks\CVideoModeCommon_SetupStartupGraphic.cpp" />
<ClCompile Include="src\Hooks\Host_IsSecureServerAllowed.cpp" />
<ClCompile Include="src\Hooks\IBaseFileSystem_Hooks.cpp" />
<ClCompile Include="src\Hooks\IFileSystem_Hooks.cpp" />
<ClCompile Include="src\Hooks\IMaterialSystem_Hooks.cpp" />
<ClCompile Include="src\Hooks\S_PrecacheSound.cpp" />
<ClCompile Include="src\SDK\SDK.cpp" />
<ClCompile Include="src\Utils\CrashLog\CrashLog.cpp" />
<ClCompile Include="src\Utils\Hooks\Hooks.cpp" />
Expand All @@ -249,6 +260,7 @@
<ClInclude Include="include\MinHook\trampoline.h" />
<ClInclude Include="src\BytePatches\BytePatches.h" />
<ClInclude Include="src\SDK\Definitions\Interfaces\IMaterialSystem.h" />
<ClInclude Include="src\SDK\Definitions\Interfaces\IMDLCache.h" />
<ClInclude Include="src\SDK\Definitions\Interfaces\Interface.h" />
<ClInclude Include="src\Core\Core.h" />
<ClInclude Include="src\SDK\Definitions\Definitions.h" />
Expand Down
2 changes: 2 additions & 0 deletions TextmodeTF2/TextmodeTF2.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<ClCompile Include="src\Hooks\IFileSystem_Hooks.cpp" />
<ClCompile Include="src\Hooks\IBaseFileSystem_Hooks.cpp" />
<ClCompile Include="src\Hooks\IMaterialSystem_Hooks.cpp" />
<ClCompile Include="src\Hooks\IMDLCache_ProcessDataIntoCache.cpp" />
<ClCompile Include="src\Hooks\CVideoModeCommon_SetupStartupGraphic.cpp" />
<ClCompile Include="src\Hooks\Host_IsSecureServerAllowed.cpp" />
<ClCompile Include="src\Hooks\Con_DebugLog.cpp" />
Expand Down Expand Up @@ -46,6 +47,7 @@
<ClInclude Include="src\BytePatches\BytePatches.h" />
<ClInclude Include="src\SDK\Definitions\Interfaces\Interface.h" />
<ClInclude Include="src\SDK\Definitions\Interfaces\IMaterialSystem.h" />
<ClInclude Include="src\SDK\Definitions\Interfaces\IMDLCache.h" />
<ClInclude Include="src\Utils\Feature\Feature.h" />
</ItemGroup>
</Project>
4 changes: 3 additions & 1 deletion TextmodeTF2/src/BytePatches/BytePatches.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ bool BytePatch::Initialize()
m_pAddress = LPVOID(U::Memory.FindSignature(m_sModule, m_sSignature));
if (!m_pAddress)
{
SDK::Output("BytePatches", std::format("Failed to find signature for bytepatch: {} in {}", m_sSignature, m_sModule).c_str());
U::Core.AppendFailText(std::format("BytePatch::Initialize() failed to initialize:\n {}\n {}", m_sModule, m_sSignature).c_str());
return false;
}
Expand All @@ -43,7 +44,8 @@ bool BytePatch::Initialize()

Write(m_vPatch);

U::Core.AppendSuccessText("BytePatches", std::format("Successfully patched {:#x} ('{}', '{}')!", uintptr_t(m_pAddress) + m_iOffset, m_sModule, m_sSignature).c_str());
SDK::Output("BytePatches", std::format("Successfully patched {:#x} ('{}', '{}')!", uintptr_t(m_pAddress), m_sModule, m_sSignature).c_str());
U::Core.AppendSuccessText("BytePatches", std::format("Successfully patched {:#x} ('{}', '{}')!", uintptr_t(m_pAddress), m_sModule, m_sSignature).c_str());
return m_bIsPatched = true;
}

Expand Down
43 changes: 43 additions & 0 deletions TextmodeTF2/src/BytePatches/BytePatches.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,38 @@ class CBytePatches
BytePatch("engine.dll", "0F 85 ? ? ? ? 48 8D 15 ? ? ? ? B9", 0x0, "0F 81"),
// Force Con_DebugLog to run
BytePatch("engine.dll", "74 ? 48 8D 54 24 ? 48 8D 0D ? ? ? ? E8 ? ? ? ? 38 1D", 0x0, "90 90"),

// evil cathook's plan b implementation

// Mod_LoadLighting
// nulls out lighting data loading for maps
BytePatch("engine.dll", "40 53 48 83 EC 20 48 8B D9 48 63 09 85 C9 75 18", 0x0, "C3"),

// Sprite_LoadModel
// nulls out sprite model loading
BytePatch("engine.dll", "48 89 5C 24 08 48 89 74 24 18 57 41 56 41 57 48", 0x0, "C3"),

// Mod_LoadWorldlights
// nulls out world light loading
BytePatch("engine.dll", "48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 57", 0x0, "C3"),

// Mod_LoadTexinfo
// forces mat_loadtextures 0 logic to skip material loading
BytePatch("engine.dll", "0F 84 ? ? ? ? 48 63 7E 44", 0x0, "90 E9"),
}},
{"materialsystem",
{
// CMaterialSystem::Init
// Returns 1 (INIT_OK) to prevent material system initialization but allow engine to continue anywyay
BytePatch("materialsystem.dll", "40 53 48 83 EC 20 48 8B D9 48 8B 0D ? ? ? ? 48 8B 01 FF 90 ? ? ? ? 48 8B 0D", 0x0, "B8 01 00 00 00 C3"),

// CMaterialSystem::BeginFrame
// bye bye frame rendering!
BytePatch("materialsystem.dll", "48 8B 0D ? ? ? ? 48 8B 01 48 FF A0 ? ? ? ? CC", 0x0, "C3"),

// CMaterialSystem::FindMaterial
// returns NULL for every material lookup
BytePatch("materialsystem.dll", "48 8B F9 48 8B CA 49 8B D8 FF 10 4C 8B C0 48 8D 15 ? ? ? ? 48 8D 4C 24 20", 0x0, "31 C0 C3"),
}},
{"client",
{
Expand Down Expand Up @@ -99,6 +131,17 @@ class CBytePatches

// CBaseHudChat::ChatPrintf
BytePatch("client.dll", "4C 89 4C 24 ? 48 89 4C 24 ? 55 53", 0x0, "C3"),

// Fixes crash (CEconItemView::GetItemDefinitionIndex)
BytePatch("client.dll", "48 8B 41 08 48 85 C0 75 0A 48 8B 01 8B 80 BC 00 00 00 C3 8B 40 20 C3", 0x0, "48 8B 41 08 48 85 C0 75 0F 48 8B 01 48 85 C0 74 0B 8B 80 BC 00 00 00 C3 8B 40 20 C3 31 C0 C3"),

// Fixes crash
BytePatch("client.dll", "45 85 C0 78 3E 4C 8B 11 45 3B 82 E8 00 00 00 7D 32", 0x0, "4C 8B 11 4D 85 D2 74 3B 45 3B 82 E8 00 00 00 73 32"),
}},
{"datacache",
{
// CDataCacheSection::Unlock CRASHFIX!
BytePatch("datacache.dll", "48 89 5C 24 18 48 89 7C 24 20 41 56 48 83 EC 20 F6 81 E0 00 00 00 04", 0x41, "90 90 90 90 90"),
}}
};
};
Expand Down
83 changes: 79 additions & 4 deletions TextmodeTF2/src/Core/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ int CCore::LoadFilesystem()
"IFileSystem_AsyncReadMultiple", "IFileSystem_OpenEx",
"IFileSystem_ReadFileEx", "IFileSystem_AddFilesToFileCache",
"IBaseFileSystem_Open", "IBaseFileSystem_Precache",
"IBaseFileSystem_ReadFile"
"IBaseFileSystem_ReadFile", "IBaseFileSystem_FileExists"
};

for (auto cHook : vFilesystemHooks)
Expand Down Expand Up @@ -93,12 +93,43 @@ int CCore::LoadEngine()
}
}

static bool bRenderHooksInit{ false };
if (!bRenderHooksInit)
{
if (!G::CStaticPropMgr_DrawStaticPropsAddr)
G::CStaticPropMgr_DrawStaticPropsAddr = U::Memory.FindSignature("engine.dll", "4C 8B DC 49 89 5B 08 49 89 6B 10 49 89 73 18 57 41 54 41 55 41 56 41 57 48 83 EC 70 4C 8B 3D ? ? ? ? 33 FF");
if (!G::CStaticPropMgr_UnserializeStaticPropsAddr)
G::CStaticPropMgr_UnserializeStaticPropsAddr = U::Memory.FindSignature("engine.dll", "40 57 48 81 EC E0 00 00 00 80 B9 98 00 00 00 00");
if (!G::S_PrecacheSoundAddr)
G::S_PrecacheSoundAddr = U::Memory.FindSignature("engine.dll", "4C 8B DC 49 89 5B 08 49 89 73 18 57 48 83 EC 50");
if (!G::CModelLoader_GetModelForNameAddr)
G::CModelLoader_GetModelForNameAddr = U::Memory.FindSignature("engine.dll", "44 89 44 24 18 53 48 83 EC 20 48 8B D9 E8 ?? ?? ?? ?? 4C 8D 44 24 40");
if (!G::CModelRender_DrawModelExecuteAddr)
G::CModelRender_DrawModelExecuteAddr = U::Memory.FindSignature("engine.dll", "4C 89 4C 24 20 48 89 4C 24 08 55 53 56 57 41 54 41 56 41 57 48 8D AC 24 D0 FD FF FF 48 81 EC 30 03 00 00 41 8B 70 40");
if (!G::CDebugOverlay_AddBoxOverlayAddr)
G::CDebugOverlay_AddBoxOverlayAddr = U::Memory.FindSignature("engine.dll", "48 89 74 24 18 4C 89 74 24 20 41 57 48 81 EC 80 00 00 00 48 8D 0D ? ? ? ? 49 8B F1 4D 8B F0 4C 8B FA E8 ? ? ? ? 84 C0");
if (!G::CDebugOverlay_AddLineOverlayAddr)
G::CDebugOverlay_AddLineOverlayAddr = U::Memory.FindSignature("engine.dll", "4C 8B DC 53 55 56 57 41 56 48 81 EC 80 00 00 00 49 8D 43 30 0F 29 74 24 70 48 89 81 10 04 00 00 48 8D 69 10");

if (G::CStaticPropMgr_DrawStaticPropsAddr && G::CStaticPropMgr_UnserializeStaticPropsAddr && G::S_PrecacheSoundAddr && G::CModelLoader_GetModelForNameAddr && G::CModelRender_DrawModelExecuteAddr && G::CDebugOverlay_AddBoxOverlayAddr && G::CDebugOverlay_AddLineOverlayAddr)
{
if (!U::Hooks.Initialize("CStaticPropMgr_DrawStaticProps")) return LOAD_FAIL;
if (!U::Hooks.Initialize("CStaticPropMgr_UnserializeStaticProps")) return LOAD_FAIL;
if (!U::Hooks.Initialize("S_PrecacheSound")) return LOAD_FAIL;
if (!U::Hooks.Initialize("CModelLoader_GetModelForName")) return LOAD_FAIL;
if (!U::Hooks.Initialize("CModelRender_DrawModelExecute")) return LOAD_FAIL;
if (!U::Hooks.Initialize("CDebugOverlay_AddBoxOverlay")) return LOAD_FAIL;
if (!U::Hooks.Initialize("CDebugOverlay_AddLineOverlay")) return LOAD_FAIL;
bRenderHooksInit = true;
}
}

static bool bBytePatchesInit{ false };
if (!bBytePatchesInit && U::BytePatches.Initialize("engine"))
bBytePatchesInit = true;


if(!bStartupGraphicHookInit || !bInsecureBypassInit || !bTextmodeInit || !bCon_DebugLogInit || !bBytePatchesInit)
if(!bStartupGraphicHookInit || !bInsecureBypassInit || !bTextmodeInit || !bCon_DebugLogInit || !bBytePatchesInit || !bRenderHooksInit)
return LOAD_WAIT;

return m_bEngineLoaded = true;
Expand All @@ -115,7 +146,7 @@ int CCore::LoadMatSys()
{
"IMaterialSystem_CreateRenderTargetTexture", "IMaterialSystem_CreateNamedRenderTargetTextureEx",
"IMaterialSystem_CreateNamedRenderTargetTexture", "IMaterialSystem_CreateNamedRenderTargetTextureEx2",
"IMaterialSystem_SwapBuffers"
"IMaterialSystem_SwapBuffers", "IMaterialSystem_FindMaterial", "IMaterialSystem_FindTexture"
};

for (auto cHook : vMatSystemHooks)
Expand All @@ -133,9 +164,47 @@ int CCore::LoadClient()
return m_bClientLoaded = true;
}

int CCore::LoadParticles()
{
if (!G::CParticleSystemMgr_DrawRenderCacheAddr)
G::CParticleSystemMgr_DrawRenderCacheAddr = U::Memory.FindSignature("client.dll", "48 8B C4 88 50 10 48 89 48 08 55 57 41 55 41 57 48 8D A8 28 FD FF FF");

if (!G::CParticleCollection_SimulateAddr)
G::CParticleCollection_SimulateAddr = U::Memory.FindSignature("client.dll", "48 8B C4 44 88 40 18 57 41 56 48 81 EC 08 01 00 00");

if (!G::CParticleSystemMgr_ReadParticleConfigFileAddr)
G::CParticleSystemMgr_ReadParticleConfigFileAddr = U::Memory.FindSignature("client.dll", "48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 41 56 41 57 48 81 EC ?? ?? ?? ?? 80 3A 21 48 8D 7A 01");

if (G::CParticleSystemMgr_DrawRenderCacheAddr && G::CParticleCollection_SimulateAddr && G::CParticleSystemMgr_ReadParticleConfigFileAddr)
{
if (!U::Hooks.Initialize("CParticleSystemMgr_DrawRenderCache"))
return LOAD_FAIL;
if (!U::Hooks.Initialize("CParticleCollection_Simulate"))
return LOAD_FAIL;
if (!U::Hooks.Initialize("CParticleSystemMgr_ReadParticleConfigFile"))
return LOAD_FAIL;
m_bParticlesLoaded = true;
}

return LOAD_WAIT;
}

int CCore::LoadMDLCache()
{
G::IMDLCache = reinterpret_cast<IMDLCache*>(U::Memory.FindInterface("datacache.dll", "MDLCache004"));
if (!G::IMDLCache)
return LOAD_WAIT;

if (!U::Hooks.Initialize("IMDLCache_ProcessDataIntoCache"))
return LOAD_FAIL;

return m_bMDLCacheLoaded = true;
}

void CCore::Load()
{
G::CurrentPath = std::filesystem::current_path().string() + "\\TextmodeTF2";
SDK::Output("Core", "Initializing logging...");
char* cBotID = nullptr;
if (_dupenv_s(&cBotID, nullptr, "BOTID") == 0 && cBotID)
{
Expand Down Expand Up @@ -178,8 +247,14 @@ void CCore::Load()
CHECK(iMatSys, "Failed to load material system")
int iClient = m_bClientLoaded ? 1 : LoadClient();
CHECK(iClient, "Failed to load client")

int iParticles = m_bParticlesLoaded ? 1 : LoadParticles();
CHECK(iParticles, "Failed to load particle system")

int iMDLCache = m_bMDLCacheLoaded ? 1 : LoadMDLCache();
CHECK(iMDLCache, "Failed to load MDL cache")
}
while (!m_bFilesystemLoaded || !m_bEngineLoaded || !m_bMatSysLoaded || !m_bClientLoaded);
while (!m_bFilesystemLoaded || !m_bEngineLoaded || !m_bMatSysLoaded || !m_bClientLoaded || !m_bParticlesLoaded || !m_bMDLCacheLoaded);

SDK::Output("TextmodeTF2", std::format("Loaded in {} seconds", SDK::PlatFloatTime()).c_str());
}
Expand Down
4 changes: 3 additions & 1 deletion TextmodeTF2/src/Core/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ class CCore
bool m_bUnload = false;
bool m_bTimeout = false;
private:
bool m_bFilesystemLoaded = false, m_bEngineLoaded = false, m_bMatSysLoaded = false, m_bClientLoaded = false;
bool m_bFilesystemLoaded = false, m_bEngineLoaded = false, m_bMatSysLoaded = false, m_bClientLoaded = false, m_bParticlesLoaded = false, m_bMDLCacheLoaded = false;

int LoadFilesystem();
int LoadEngine();
int LoadMatSys();
int LoadClient();
int LoadParticles();
int LoadMDLCache();

std::stringstream ssFailStream;
};
Expand Down
8 changes: 8 additions & 0 deletions TextmodeTF2/src/Hooks/CDebugOverlay_AddBoxOverlay.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "../Utils/Hooks/Hooks.h"
#include "../SDK/SDK.h"

// void CDebugOverlay::AddBoxOverlay(const Vector& origin, const Vector& mins, const Vector& max, QAngle const& orientation, int r, int g, int b, int a, float duration)
MAKE_HOOK(CDebugOverlay_AddBoxOverlay, G::CDebugOverlay_AddBoxOverlayAddr, void, void* rcx, const void* origin, const void* mins, const void* max, const void* orientation, int r, int g, int b, int a, float duration)
{
return;
}
8 changes: 8 additions & 0 deletions TextmodeTF2/src/Hooks/CDebugOverlay_AddLineOverlay.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "../Utils/Hooks/Hooks.h"
#include "../SDK/SDK.h"

// void CDebugOverlay::AddLineOverlay(const Vector& origin, const Vector& dest, int r, int g, int b, bool noDepthTest, float duration)
MAKE_HOOK(CDebugOverlay_AddLineOverlay, G::CDebugOverlay_AddLineOverlayAddr, void, void* rcx, const void* origin, const void* dest, int r, int g, int b, bool noDepthTest, float duration)
{
return;
}
20 changes: 20 additions & 0 deletions TextmodeTF2/src/Hooks/CModelLoader_GetModelForName.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "../Utils/Hooks/Hooks.h"
#include "../SDK/SDK.h"

// model_t *CModelLoader::GetModelForName( const char *name, REFERENCETYPE referencetype )
MAKE_HOOK(CModelLoader_GetModelForName, G::CModelLoader_GetModelForNameAddr, void*, void* rcx, const char* name, int referencetype)
{
if (SDK::BlacklistFile(name))
{
return CALL_ORIGINAL(rcx, "models/empty.mdl", referencetype);
}

void* pModel = CALL_ORIGINAL(rcx, name, referencetype);

if (!pModel && name)
{
pModel = CALL_ORIGINAL(rcx, "models/empty.mdl", referencetype);
}

return pModel;
}
8 changes: 8 additions & 0 deletions TextmodeTF2/src/Hooks/CModelRender_DrawModelExecute.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "../Utils/Hooks/Hooks.h"
#include "../SDK/SDK.h"

// void CModelRender::DrawModelExecute( const DrawModelState_t &state, const ModelRenderInfo_t &pInfo, matrix3x4_t *pCustomBoneToWorld )
MAKE_HOOK(CModelRender_DrawModelExecute, G::CModelRender_DrawModelExecuteAddr, void, void* rcx, void* state, void* pInfo, void* pCustomBoneToWorld)
{
return;
}
8 changes: 8 additions & 0 deletions TextmodeTF2/src/Hooks/CParticleCollection_Simulate.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "../Utils/Hooks/Hooks.h"
#include "../SDK/SDK.h"

// CParticleCollection::Simulate(float flTime)
MAKE_HOOK(CParticleCollection_Simulate, G::CParticleCollection_SimulateAddr, void, void* rcx, float flTime)
{
return;
}
8 changes: 8 additions & 0 deletions TextmodeTF2/src/Hooks/CParticleSystemMgr_DrawRenderCache.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "../Utils/Hooks/Hooks.h"
#include "../SDK/SDK.h"

// CParticleSystemMgr::DrawRenderCache(bool bInclusionMode)
MAKE_HOOK(CParticleSystemMgr_DrawRenderCache, G::CParticleSystemMgr_DrawRenderCacheAddr, void, void* rcx, bool bInclusionMode)
{
return;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "../SDK/SDK.h"

MAKE_HOOK(CParticleSystemMgr_ReadParticleConfigFile, G::CParticleSystemMgr_ReadParticleConfigFileAddr, bool,
void* rcx, const char* pFileName, bool bPrecache, bool bDecommitTempMemory)
{
if (SDK::BlacklistFile(pFileName))
return true;

return CALL_ORIGINAL(rcx, pFileName, bPrecache, bDecommitTempMemory);
}
8 changes: 8 additions & 0 deletions TextmodeTF2/src/Hooks/CStaticPropMgr_DrawStaticProps.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "../Utils/Hooks/Hooks.h"
#include "../SDK/SDK.h"

// void CStaticPropMgr::DrawStaticProps( IClientRenderable **pProps, int count, bool bShadowDepth, bool drawVCollideWireframe )
MAKE_HOOK(CStaticPropMgr_DrawStaticProps, G::CStaticPropMgr_DrawStaticPropsAddr, void, void* rcx, void* pProps, int count, bool bShadowDepth, bool drawVCollideWireframe)
{
return;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "../Utils/Hooks/Hooks.h"
#include "../SDK/SDK.h"

// void CStaticPropMgr::UnserializeStaticProps()
MAKE_HOOK(CStaticPropMgr_UnserializeStaticProps, G::CStaticPropMgr_UnserializeStaticPropsAddr, void, void* rcx)
{
return;
}
9 changes: 9 additions & 0 deletions TextmodeTF2/src/Hooks/IBaseFileSystem_Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,13 @@ MAKE_HOOK(IBaseFileSystem_ReadFile, U::Memory.GetVFunc(reinterpret_cast<void*>(G
return false;

return CALL_ORIGINAL(rcx, pFileName, pPath, buf, nMaxBytes, nStartingByte, pfnAlloc);
}

MAKE_HOOK(IBaseFileSystem_FileExists, U::Memory.GetVFunc(reinterpret_cast<void*>(G::IBaseFileSystemAddr), 10), bool,
void* rcx, const char* pFileName, const char* pPathID)
{
if (SDK::BlacklistFile(pFileName))
return false;

return CALL_ORIGINAL(rcx, pFileName, pPathID);
}
14 changes: 14 additions & 0 deletions TextmodeTF2/src/Hooks/IMDLCache_ProcessDataIntoCache.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "../SDK/SDK.h"

MAKE_HOOK(IMDLCache_ProcessDataIntoCache, U::Memory.GetVFunc(reinterpret_cast<void*>(G::IMDLCache), 33), bool,
void* rcx, MDLHandle_t handle, MDLCacheDataType_t type, void* pData, int nDataSize, bool bAsync)
{
if (type == MDLCACHE_VERTEXES)
{
const char* pszModelName = G::IMDLCache->GetModelName(handle);
if (pszModelName && SDK::BlacklistFile(pszModelName))
return true;
}

return CALL_ORIGINAL(rcx, handle, type, pData, nDataSize, bAsync);
}
Loading