Fix dedicated server compile errors

Huge cleanup for dedicated. All patches in 'opcodes.cpp' are now directly applied to the executable, and kept as reference in the source file. The patch logic is commented. Any other patches for the dedicated server executable should be documented in the patch file found in 'r5dev/resource/patch'.
This commit is contained in:
Kawe Mazidjatari 2023-01-26 02:59:50 +01:00
parent 1e24e34519
commit f47fb63e5f
13 changed files with 585 additions and 597 deletions

View File

@ -16,6 +16,7 @@
#include "vpc/keyvalues.h"
/*****************************************************************************/
#ifndef DEDICATED
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
@ -33,6 +34,7 @@ ClientClass* CHLClient::GetAllClasses()
{
return CHLClient_GetAllClasses();
}
#endif // !DEDICATED
///////////////////////////////////////////////////////////////////////////////
void VDll_Engine_Int::Attach() const

View File

@ -46,13 +46,13 @@ public:
#ifndef DEDICATED
inline CMemory p_CHLClient_PostInit;
inline auto CHLClient_PostInit = p_CHLClient_PostInit.RCast<void*(*)(void)>();
#endif // !DEDICATED
inline CMemory p_CHLClient_LevelShutdown;
inline auto CHLClient_LevelShutdown = p_CHLClient_LevelShutdown.RCast<void* (*)(CHLClient* thisptr)>();
inline CMemory p_CHLClient_HudProcessInput;
inline auto CHLClient_HudProcessInput = p_CHLClient_HudProcessInput.RCast<void(*)(CHLClient* thisptr, bool bActive)>();
#ifndef DEDICATED
inline CMemory p_CHLClient_FrameStageNotify;
inline auto CHLClient_FrameStageNotify = p_CHLClient_FrameStageNotify.RCast<void(*)(CHLClient* thisptr, ClientFrameStage_t frameStage)>();
@ -70,10 +70,8 @@ class VDll_Engine_Int : public IDetour
{
#ifndef DEDICATED
LogFunAdr("CHLClient::PostInit", p_CHLClient_PostInit.GetPtr());
#endif // !DEDICATED
LogFunAdr("CHLClient::LevelShutdown", p_CHLClient_LevelShutdown.GetPtr());
LogFunAdr("CHLClient::HudProcessInput", p_CHLClient_HudProcessInput.GetPtr());
#ifndef DEDICATED
LogFunAdr("CHLClient::FrameStageNotify", p_CHLClient_FrameStageNotify.GetPtr());
LogFunAdr("CHLClient::GetAllClasses", p_CHLClient_GetAllClasses.GetPtr());
#endif // !DEDICATED
@ -90,15 +88,15 @@ class VDll_Engine_Int : public IDetour
p_CHLClient_GetAllClasses = g_GameDll.FindPatternSIMD("48 8B 05 ?? ?? ?? ?? C3 CC CC CC CC CC CC CC CC 48 89 74 24 ??");
#endif // !DEDICATED
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
p_CHLClient_LevelShutdown = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 48 8B F9 48 8D 0D ?? ?? ?? ??");
#ifndef DEDICATED
p_CHLClient_LevelShutdown = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 48 8B F9 48 8D 0D ?? ?? ?? ??");
p_CHLClient_PostInit = g_GameDll.FindPatternSIMD("48 83 EC 28 48 83 3D ?? ?? ?? ?? ?? 48 8D 05 ?? ?? ?? ??");
p_CHLClient_FrameStageNotify = g_GameDll.FindPatternSIMD("48 83 EC 28 89 15 ?? ?? ?? ??");
p_CHLClient_GetAllClasses = g_GameDll.FindPatternSIMD("48 8B 05 ?? ?? ?? ?? C3 CC CC CC CC CC CC CC CC 48 8B 05 ?? ?? ?? ?? 48 8D 0D ?? ?? ?? ??");
#endif // !DEDICATED
#endif
p_CHLClient_HudProcessInput = g_GameDll.FindPatternSIMD("48 83 EC 28 0F B6 0D ?? ?? ?? ?? 88 15 ?? ?? ?? ??");
#ifndef DEDICATED
p_CHLClient_HudProcessInput = g_GameDll.FindPatternSIMD("48 83 EC 28 0F B6 0D ?? ?? ?? ?? 88 15 ?? ?? ?? ??");
CHLClient_LevelShutdown = p_CHLClient_LevelShutdown.RCast<void*(*)(CHLClient*)>(); /*48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 48 8B F9 48 8D 0D ?? ?? ?? ??*/
CHLClient_PostInit = p_CHLClient_PostInit.RCast<void*(*)(void)>(); /*48 83 EC 28 48 83 3D ?? ?? ?? ?? ?? 48 8D 05 ?? ?? ?? ??*/
CHLClient_FrameStageNotify = p_CHLClient_FrameStageNotify.RCast<void(*)(CHLClient*, ClientFrameStage_t)>(); /*48 83 EC 28 89 15 ?? ?? ?? ??*/

View File

@ -5,32 +5,32 @@
#include "core/stdafx.h"
#include "launcher/IApplication.h"
#include "common/opcodes.h"
#include "common/netmessages.h"
#include "engine/cmodel_bsp.h"
#include "engine/host.h"
#include "engine/host_cmd.h"
#include "engine/gl_screen.h"
#include "engine/gl_matsysiface.h"
#include "engine/matsys_interface.h"
#include "engine/modelloader.h"
//#include "common/netmessages.h"
//#include "engine/cmodel_bsp.h"
//#include "engine/host.h"
//#include "engine/host_cmd.h"
//#include "engine/gl_screen.h"
//#include "engine/gl_matsysiface.h"
//#include "engine/matsys_interface.h"
//#include "engine/modelloader.h"
#include "engine/server/sv_main.h"
#include "engine/client/cl_main.h"
#include "engine/client/client.h"
#include "engine/client/clientstate.h"
#include "engine/sys_getmodes.h"
//#include "engine/client/cl_main.h"
//#include "engine/client/client.h"
//#include "engine/client/clientstate.h"
//#include "engine/sys_getmodes.h"
#ifndef CLIENT_DLL
#include "game/server/ai_networkmanager.h"
#include "game/server/fairfight_impl.h"
#include "game/server/detour_impl.h"
#endif // !CLIENT_DLL
#include "rtech/rtech_game.h"
#include "rtech/rui/rui.h"
#include "client/cdll_engine_int.h"
#include "materialsystem/cmaterialsystem.h"
#include "studiorender/studiorendercontext.h"
//#include "rtech/rui/rui.h"
//#include "client/cdll_engine_int.h"
//#include "materialsystem/cmaterialsystem.h"
//#include "studiorender/studiorendercontext.h"
#include "squirrel/sqvm.h"
#include "bsplib/bsplib.h"
#include "ebisusdk/EbisuSDK.h"
//#include "bsplib/bsplib.h"
//#include "ebisusdk/EbisuSDK.h"
#ifndef DEDICATED
#include "codecs/miles/radshal_wasapi.h"
#endif // !DEDICATED
@ -42,303 +42,303 @@
void Dedicated_Init()
{
*s_bDedicated = true;
//-------------------------------------------------------------------------
// CGAME
//-------------------------------------------------------------------------
{
p_CVideoMode_Common__CreateGameWindow.Offset(0x2C).Patch({ 0xE9, 0x9A, 0x00, 0x00, 0x00 }); // PUS --> XOR | Prevent ShowWindow and CreateGameWindow from being initialized (STGS RPak data type is registered here).
p_CVideoMode_Common__CreateWindowClass.Offset(0x0).Patch({ 0xB8, 0x01, 0x00, 0x00, 0x00, 0xC3 }); // FUN --> RET | Prevent CreateWindowClass from being initialized (returned true to satisfy condition that checks window handle).
}
//-------------------------------------------------------------------------
// CHLCLIENT
//-------------------------------------------------------------------------
{
p_CHLClient_LevelShutdown.Patch({ 0xB8, 0x00, 0x00, 0x00, 0x00, 0xC3 }); // FUN --> RET | Return early in 'CHLClient::LevelShutdown()' during DLL shutdown.
p_CHLClient_HudProcessInput.Patch({ 0xC3 }); // FUN --> RET | Return early in 'CHLClient::HudProcessInput()' to prevent infinite loop.
g_GameDll.FindPatternSIMD("41 85 C8 0F 84").Offset(0x40).Patch({ 0xEB, 0x23 }); // MOV --> JMP | Skip virtual call during settings layout parsing (S0/S1/S2/S3).
}
//-------------------------------------------------------------------------
// CCLIENTSTATE
//-------------------------------------------------------------------------
{
/*MOV EAX, 0*/
p_CClientState__RunFrame.Patch({ 0xB8, 0x00, 0x00, 0x00, 0x00, 0xC3 }); // FUN --> RET | Always return false for pending client snapshots (inline CClientState call in '_Host_RunFrame()')
p_CClientState__Disconnect.Patch({ 0xB8, 0x00, 0x00, 0x00, 0x00, 0xC3 }); // FUN --> RET | Always return false for keeping client persistent data after disconnect (CLIENT ONLY).
}
//-------------------------------------------------------------------------
// CSOURCEAPPSYSTEMGROUP
//-------------------------------------------------------------------------
{
p_CSourceAppSystemGroup__Create.Offset(0x248).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | inputSystem->Connect().
p_CSourceAppSystemGroup__Create.Offset(0x267).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | materials->Connect().
//p_CSourceAppSystemGroup__Create.Offset(0x286).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | mdlCache->Connect().
p_CSourceAppSystemGroup__Create.Offset(0x2A5).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | studioRender->Connect().
p_CSourceAppSystemGroup__Create.Offset(0x2C4).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | avi->Connect().
p_CSourceAppSystemGroup__Create.Offset(0x2E3).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | engineAPI->Connect().
//p_CSourceAppSystemGroup__Create.Offset(0x302).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | dataCache->Connect().
p_CSourceAppSystemGroup__Create.Offset(0x321).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | matSystemSurface->Connect().
p_CSourceAppSystemGroup__Create.Offset(0x340).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | vgui->Connect().
p_CSourceAppSystemGroup__Create.Offset(0x35D).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | inputSystem->Init().
p_CSourceAppSystemGroup__Create.Offset(0x384).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | studioRender->Init().
p_CSourceAppSystemGroup__Create.Offset(0x391).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | avi->Init().
p_CSourceAppSystemGroup__Create.Offset(0x39E).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | bik->Init().
p_CSourceAppSystemGroup__Create.Offset(0x3AB).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | engineAPI->Init().
p_CSourceAppSystemGroup__Create.Offset(0x3F6).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | vgui->Init().
p_CSourceAppSystemGroup__Create.Offset(0x3E9).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | matEmbeddedPanel->Init().
p_CSourceAppSystemGroup__Create.Offset(0x3F9).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | EAC_ClientInterface_Init().
}
//-------------------------------------------------------------------------
// CMATERIALSYSTEM
//-------------------------------------------------------------------------
{
//gCMaterialSystem__MatsysMode_Init.Offset(0x22).Patch({ 0xEB, 0x66 }); // JE --> JMP | Matsys mode init (CMaterialSystem). // TODO: Needed?
p_CMaterialSystem__Init.Offset(0x406).Patch({ 0xE9, 0x55, 0x05, 0x00, 0x00 }); // MOV --> JMP | Jump over material KeyValue definitions and 'CMatRenderContextBase::sm_RenderData([x])'.
p_InitMaterialSystem.Patch({ 0xC3 }); // FUN --> RET | Return early to prevent 'InitDebugMaterials' from being executed. // RESEARCH NEEDED.
}
//-------------------------------------------------------------------------
// CSHADERSYSTEM
//-------------------------------------------------------------------------
{
CShaderSystem__Init.Patch({ 0xC3 }); // FUN --> RET | Return early in 'CShaderSystem::Init()' to prevent initialization.
}
//-------------------------------------------------------------------------
// CSTUDIORENDERCONTEXT
//-------------------------------------------------------------------------
{
// Note: The registers here seems to contains pointers to material data and 'CMaterial' class methods when the shader system is initialized.
CStudioRenderContext__LoadModel.Offset(0x17D).Patch({ 0x90, 0x90, 0x90, 0x90 }); // MOV --> NOP | RAX + RCX are both nullptr.
CStudioRenderContext__LoadModel.Offset(0x181).Patch({ 0x90, 0x90, 0x90 }); // MOV --> NOP | RCX is nullptr when trying to dereference.
CStudioRenderContext__LoadModel.Offset(0x184).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | RAX is nullptr during virtual call resulting in exception 'C0000005'.
CStudioRenderContext__LoadMaterials.Offset(0x28).Patch({ 0xE9, 0x80, 0x04, 0x00, 0x00 }); // FUN --> RET | 'CStudioRenderContext::LoadMaterials' is called virtually by the 'RMDL' streaming job.
}
//-------------------------------------------------------------------------
// CMODELLOADER
//-------------------------------------------------------------------------
{
p_CModelLoader__LoadModel.Offset(0x462).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | Prevent call to 'CStudioRenderContext::LoadMaterials'.
p_CModelLoader__UnloadModel.Offset(0x129).Patch({ 0x90, 0x90, 0x90 }); // MOV --> NOP | Virtual call to 'CShaderSystem' class method fails as RCX is nullptr.
p_CModelLoader__UnloadModel.Offset(0x12C).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | Virtual call to 'CTexture' class member in RAX + 0x78 fails. Previous instruction could not dereference.
p_CModelLoader__Studio_LoadModel.Offset(0x325).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | Virtual call to 'CMaterialSystem::FindMaterialEx' fails as RAX is nullptr.
p_CModelLoader__Studio_LoadModel.Offset(0x33D).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | Virtual call to 'CMaterialGlue' class method fails as RAX is nullptr.
p_CModelLoader__Studio_LoadModel.Offset(0x359).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | Virtual call to 'CMaterialGlue' class method fails as RAX is nullptr.
p_CModelLoader__Studio_LoadModel.Offset(0x374).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | Virtual call to 'CMaterialGlue' class method fails as RAX is nullptr.
p_CModelLoader__Studio_LoadModel.Offset(0x38D).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | Virtual call to 'ReturnZero' fails as RAX is nullptr.
p_CModelLoader__Studio_LoadModel.Offset(0x3A4).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | Virtual call to 'CMaterialGlue' class method fails as RAX is nullptr.
p_CModelLoader__Map_LoadModelGuts.Offset(0x41).Patch({ 0xE9, 0x4F, 0x04, 0x00, 0x00 }); // JNE --> NOP | SKYLIGHTS.
p_CModelLoader__Map_LoadModelGuts.Offset(0x974).Patch({ 0x90, 0x90 }); // JE --> NOP | VERTNORMALS.
p_CModelLoader__Map_LoadModelGuts.Offset(0xA55).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | MATERIALSORTS.
p_CModelLoader__Map_LoadModelGuts.Offset(0xA62).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | MESHBOUNDS.
p_CModelLoader__Map_LoadModelGuts.Offset(0xA83).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | MESHVERTS.
p_CModelLoader__Map_LoadModelGuts.Offset(0xAC0).Patch({ 0x90, 0x90 }); // JE --> NOP | INDICES.
p_CModelLoader__Map_LoadModelGuts.Offset(0xBF2).Patch({ 0x90, 0x90 }); // JE --> NOP | WORLDLIGHTS.
p_CModelLoader__Map_LoadModelGuts.Offset(0xDA9).Patch({ 0x90, 0x90 }); // JE --> NOP | TWEAKLIGHTS.
p_CModelLoader__Map_LoadModelGuts.Offset(0xEEB).Patch({ 0xE9, 0x3D, 0x01, 0x00, 0x00 }); // JLE --> JMP | Exception 0x57 in while trying to dereference [R15 + R14 *8 + 0x10].
p_CModelLoader__Map_LoadModelGuts.Offset(0x61B).Patch({ 0xE9, 0xE2, 0x02, 0x00, 0x00 }); // JZ --> JMP | Prevent call to 'CMod_LoadTextures()'.
p_CModelLoader__Map_LoadModelGuts.Offset(0x1045).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | Prevent call to 'Mod_LoadCubemapSamples()'.
p_BuildSpriteLoadName.Patch({ 0xC3 }); // FUN --> RET | Return early in 'BuildSpriteLoadName()'.
p_GetSpriteInfo.Patch({ 0xC3 }); // FUN --> RET | Return early in 'GetSpriteInfo()'.
}
//-------------------------------------------------------------------------
// CGAMESERVER
//-------------------------------------------------------------------------
{
p_CGameServer__SpawnServer.Offset(0x43).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | Prevent call to unknown material/shader code.
p_CGameServer__SpawnServer.Offset(0x48).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | TODO: Research 'CIVDebugOverlay'.
}
//-------------------------------------------------------------------------
// CVGUI
//-------------------------------------------------------------------------
{
/*MOV EAX, 0*/
CVGui__RunFrame.Patch({ 0xB8, 0x00, 0x00, 0x00, 0x00, 0xC3 }); // FUN --> RET | 'CVGui::RunFrame()' gets called on DLL shutdown.
}
//-------------------------------------------------------------------------
// CRUI
//-------------------------------------------------------------------------
{
/*MOV EAX, 0*/
p_Rui_LoadAsset.Patch({ 0xB8, 0x00, 0x00, 0x00, 0x00, 0xC3 }); // FUN --> RET | Return early in RuiLoadAsset() to prevent error while attempting to load RUI assets after applying player settings.
}
//-------------------------------------------------------------------------
// CENGINEVGUI
//-------------------------------------------------------------------------
{
CEngineVGui__Shutdown.Patch({ 0xB8, 0x00, 0x00, 0x00, 0x00, 0xC3 }); // FUN --> RET | Cannot shutdown CEngineVGui if its never initialized.
CEngineVGui__ActivateGameUI.FindPatternSelf("74 08", CMemory::Direction::DOWN).Patch({ 0x90, 0x90 }); // JZ --> NOP | Remove condition to return early when engine attempts to activate UI on the server.
}
//-------------------------------------------------------------------------
// CENGINEVGUI
//-------------------------------------------------------------------------
{
CInputSystem__RunFrameIME.Patch({ 0xB8, 0x00, 0x00, 0x00, 0x00, 0xC3 }); // FUN --> RET | Return early in 'CInputSystem::RunFrameIME()'.
}
//-------------------------------------------------------------------------
// MM_HEARTBEAT
//-------------------------------------------------------------------------
{
MM_Heartbeat__ToString.Offset(0xF).Patch({ 0xE9, 0x22, 0x01, 0x00, 0x00 }); // JS --> JMP | Skip ListenServer HeartBeat.
}
//-------------------------------------------------------------------------
// RUNTIME: SYS_INITGAME
//-------------------------------------------------------------------------
{
Sys_InitGame.Offset(0x70).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); // STZNZ --> NOP | Prevent 'bDedicated' from being set to false.
}
//-------------------------------------------------------------------------
// RUNTIME: HOST_INIT
//-------------------------------------------------------------------------
{
p_Host_Init.Offset(0xC2).Patch({ 0xEB, 0x34 }); // CAL --> NOP | Disable 'vpk/client_common.bsp' loading.
p_Host_Init.Offset(0x182).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> JMP | Disable UI material asset initialization.
p_Host_Init.Offset(0x859).Patch({ 0xE9, 0x19, 0x04, 0x00, 0x00 }); // LEA --> RET | Disable 'client.dll' library initialization.
p_Host_Init.Offset(0xC77).Patch({ 0xE8, 0x44, 0xCF, 0xFF, 0xFF }); // CAL --> CAL | Disable user config loading and call entitlements.rson initialization instead.
gHost_Init_1.Offset(0x564).Patch({ 0xEB }); // JNZ --> JMP | Skip chat room and discord presence thread creation [!TODO: set global boolean instead].
gHost_Init_1.Offset(0x609).Patch({ 0xEB, 0x2B }); // JE --> JMP | Skip client.dll 'Init_PostVideo()' validation code.
gHost_Init_1.Offset(0x621).Patch({ 0xEB, 0x0C }); // JNE --> JMP | Skip client.dll 'Init_PostVideo()' validation code.
gHost_Init_1.Offset(0x658).Patch({ 0xE9, 0x8C, 0x00, 0x00, 0x00 }); // JE --> JMP | Skip NULL call as client is never initialized.
gHost_Init_1.Offset(0x6E9).Patch({ 0xE9, 0xB0, 0x00, 0x00, 0x00 }); // JNE --> JMP | Skip shader preloading as cvar can't be checked due to client being NULL.
gHost_Init_2.Offset(0x26F).Patch({ 0xE9, 0x4D, 0x05, 0x00, 0x00 }); // JNE --> JMP | client.dll systems initialization.
}
//-------------------------------------------------------------------------
// RUNTIME: HOST_SHUTDOWN
//-------------------------------------------------------------------------
{
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
Host_Shutdown.Offset(0x1F0).FindPatternSelf("7E", CMemory::Direction::DOWN).Patch({ 0xE9, 0x01, 0x08, 0x00, 0x00 }); // JNE --> JMP | Jump over inline 'Host_ShutdownClient()' ('Host_ShutdownServer' in now inline with 'Host_Shutdown()')
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
Host_Shutdown.Offset(0x1F0).FindPatternSelf("7E", CMemory::Direction::DOWN).Patch({ 0xE9, 0xF9, 0x04, 0x00, 0x00 }); // JNE --> JMP | Jump over inline 'Host_ShutdownClient()' ('Host_ShutdownServer' in now inline with 'Host_Shutdown()')
#endif // 0x700
}
//-------------------------------------------------------------------------
// RUNTIME: HOST_NEWGAME
//-------------------------------------------------------------------------
{
p_Host_NewGame.Offset(0x50).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | Invalid CHLClient virtual call 'g_pHLClient->nullsub()'.
p_Host_NewGame.Offset(0x4E0).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | Matsys 'JT_HelpWithAnything()'.
}
//-------------------------------------------------------------------------
// RUNTIME: HOST_CHANGELEVEL
//-------------------------------------------------------------------------
{
p_Host_ChangeLevel.Offset(0x5D).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | Invalid CHLClient virtual call 'g_pHLClient->nullsub()'.
}
//-------------------------------------------------------------------------
// RUNTIME: _HOST_RUNFRAME
//-------------------------------------------------------------------------
{
p_Host_RunFrame.Offset(0xB85).Patch({ 0xEB, 0x6F }); // CMP --> JMP | Jump over inline '_Host_RunFrame_Client()'
p_Host_RunFrame_Render.Patch({ 0xC3 }); // FUN --> RET | Extraneous function for Dedicated.
p_VCR_EnterPausedState.Patch({ 0xC3 }); // FUN --> RET | Extraneous function for Dedicated.
}
//-------------------------------------------------------------------------
// RUNTIME: HOST_DISCONNECT
//-------------------------------------------------------------------------
{
#if defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
Host_Disconnect.Offset(0x4A).FindPatternSelf("FF 90 80", CMemory::Direction::DOWN, 300).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, }); // CAL --> RET | This seems to call 'CEngineVGui::GetGameUIInputContext()'.
#endif
}
//-------------------------------------------------------------------------
// RUNTIME: RTECH_GAME
//-------------------------------------------------------------------------
{
#if defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
p_CPakFile_LoadPak.Offset(0x890).FindPatternSelf("75", CMemory::Direction::DOWN, 200).Patch({ 0xEB }); // JNZ --> JMP | Disable error handling for missing streaming files on the server. The server does not need streamed data from the starpak files.
#endif
}
//-------------------------------------------------------------------------
// RUNTIME: EBISUSDK
//-------------------------------------------------------------------------
{
p_EbisuSDK_SetState.Offset(0x0).FindPatternSelf("0F 84", CMemory::Direction::DOWN).Patch({ 0x0F, 0x85 }); // JE --> JNZ | Prevent EbisuSDK from initializing on the engine and server.
}
//-------------------------------------------------------------------------
// RUNTIME: FAIRFIGHT
//-------------------------------------------------------------------------
{
FairFight_Init.Offset(0x0).FindPatternSelf("0F 87", CMemory::Direction::DOWN, 200).Patch({ 0x0F, 0x85 }); // JA --> JNZ | Prevent 'FairFight' anti-cheat from initializing on the server by comparing RAX against 0x0 instead. Init will crash since the plugins aren't shipped.
}
//-------------------------------------------------------------------------
// RUNTIME: PROP_STATIC
//-------------------------------------------------------------------------
{
// Note: At [14028F3B0 + 0x5C7] RSP seems to contain a block of pointers to data for the static prop rmdl in question. [RSP + 0x70] is a pointer to (what seems to be) shader/material data. The pointer will be NULL without a shader system.
p_BuildPropStaticFrustumCullMap.Offset(0x5E0).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 }); // MOV --> NOP | RSP + 0x70 is a nullptr which gets moved to R13, R13 gets used here resulting in exception 'C0000005'.
p_BuildPropStaticFrustumCullMap.Offset(0x5EB).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | RAX is nullptr during virtual call resulting in exception 'C0000005'.
}
//-------------------------------------------------------------------------
// RUNTIME: GL_SCREEN
//-------------------------------------------------------------------------
{
SCR_BeginLoadingPlaque.Patch({ 0xC3 }); // FUN --> RET | Return early to prevent execution of 'SCR_BeginLoadingPlaque()'.
}
//-------------------------------------------------------------------------
// RUNTIME: CL_CLEARSTATE
//-------------------------------------------------------------------------
#if defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
{
p_CL_ClearState.Offset(0x0).Patch({ 0xC3 }); // FUN --> RET | Invalid 'CL_ClearState()' call from Host_Shutdown causing segfault.
}
#endif
//-------------------------------------------------------------------------
// RUNTIME: GAME_CFG
//-------------------------------------------------------------------------
p_UpdateMaterialSystemConfig.Offset(0x0).Patch({ 0xB8, 0x00, 0x00, 0x00, 0x00, 0xC3 });// FUN --> RET | Return early to prevent the server from updating material system configurations.
p_UpdateCurrentVideoConfig.Offset(0x0).Patch({ 0xB8, 0x01, 0x00, 0x00, 0x00, 0xC3 }); // FUN --> RET | Return early to prevent the server from writing a videoconfig.txt file to the disk (overwriting the existing one).
p_HandleConfigFile.Offset(0x0).Patch({ 0xB8, 0x01, 0x00, 0x00, 0x00, 0xC3 }); // FUN --> RET | Return early to prevent the server from writing various input and ConVar config files to the disk (overwriting the existing one).
p_ResetPreviousGameState.Offset(0x0).Patch({ 0xC3 }); // FUN --> RET | Return early to prevent the server from writing a previousgamestate.txt file to the disk (overwriting the existing one).
p_LoadPlayerConfig.Offset(0x0).Patch({ 0xC3 }); // FUN --> RET | Return early to prevent the server from executing 'config_default_pc.cfg' (execPlayerConfig) and (only for >S3) running 'chat_wheel' code.
//-------------------------------------------------------------------------
// RUNTIME: COMMUNITIES
//-------------------------------------------------------------------------
{
//GetEngineClientThread.Offset(0x0).Patch({ 0xB8, 0x00, 0x00, 0x00, 0x00, 0xC3 }); // FUN --> RET | Return nullptr for mp_gamemode thread assignment during registration callback.
}
//-------------------------------------------------------------------------
// RUNTIME: MATCHMAKING
//-------------------------------------------------------------------------
{
MatchMaking_Frame.Patch({ 0xB8, 0x00, 0x00, 0x00, 0x00, 0xC3 }); // FUN --> RET | Return early for 'MatchMaking_Frame()'.
}
{
CWin32Surface_initStaticData.Patch({ 0xC3 }); // FUN --> RET | Prevent 'CWin32Surface::initStaticData()' from being ran in CInit.
#if !defined (GAMEDLL_S0) || !defined (GAMEDLL_S1)
KeyboardLayout_Init.Patch({ 0xC3 }); // FUN --> RET | Prevent keyboard layout initialization for IME in CInit.
#endif
}
// //-------------------------------------------------------------------------
// // CGAME
// //-------------------------------------------------------------------------
// {
// p_CVideoMode_Common__CreateGameWindow.Offset(0x2C).Patch({ 0xE9, 0x9A, 0x00, 0x00, 0x00 }); // PUS --> XOR | Prevent ShowWindow and CreateGameWindow from being initialized (STGS RPak data type is registered here).
// p_CVideoMode_Common__CreateWindowClass.Offset(0x0).Patch({ 0xB8, 0x01, 0x00, 0x00, 0x00, 0xC3 }); // FUN --> RET | Prevent CreateWindowClass from being initialized (returned true to satisfy condition that checks window handle).
// }
//
// //-------------------------------------------------------------------------
// // CHLCLIENT
// //-------------------------------------------------------------------------
// {
// p_CHLClient_LevelShutdown.Patch({ 0xB8, 0x00, 0x00, 0x00, 0x00, 0xC3 }); // FUN --> RET | Return early in 'CHLClient::LevelShutdown()' during DLL shutdown.
// p_CHLClient_HudProcessInput.Patch({ 0xC3 }); // FUN --> RET | Return early in 'CHLClient::HudProcessInput()' to prevent infinite loop.
//
// g_GameDll.FindPatternSIMD("41 85 C8 0F 84").Offset(0x40).Patch({ 0xEB, 0x23 }); // MOV --> JMP | Skip virtual call during settings layout parsing (S0/S1/S2/S3).
// }
//
// //-------------------------------------------------------------------------
// // CCLIENTSTATE
// //-------------------------------------------------------------------------
// {
// /*MOV EAX, 0*/
// p_CClientState__RunFrame.Patch({ 0xB8, 0x00, 0x00, 0x00, 0x00, 0xC3 }); // FUN --> RET | Always return false for pending client snapshots (inline CClientState call in '_Host_RunFrame()')
// p_CClientState__Disconnect.Patch({ 0xB8, 0x00, 0x00, 0x00, 0x00, 0xC3 }); // FUN --> RET | Always return false for keeping client persistent data after disconnect (CLIENT ONLY).
// }
//
// //-------------------------------------------------------------------------
// // CSOURCEAPPSYSTEMGROUP
// //-------------------------------------------------------------------------
// {
// p_CSourceAppSystemGroup__Create.Offset(0x248).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | inputSystem->Connect().
// p_CSourceAppSystemGroup__Create.Offset(0x267).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | materials->Connect().
// //p_CSourceAppSystemGroup__Create.Offset(0x286).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | mdlCache->Connect().
// p_CSourceAppSystemGroup__Create.Offset(0x2A5).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | studioRender->Connect().
// p_CSourceAppSystemGroup__Create.Offset(0x2C4).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | avi->Connect().
// p_CSourceAppSystemGroup__Create.Offset(0x2E3).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | engineAPI->Connect().
// //p_CSourceAppSystemGroup__Create.Offset(0x302).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | dataCache->Connect().
// p_CSourceAppSystemGroup__Create.Offset(0x321).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | matSystemSurface->Connect().
// p_CSourceAppSystemGroup__Create.Offset(0x340).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | vgui->Connect().
// p_CSourceAppSystemGroup__Create.Offset(0x35D).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | inputSystem->Init().
// p_CSourceAppSystemGroup__Create.Offset(0x384).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | studioRender->Init().
// p_CSourceAppSystemGroup__Create.Offset(0x391).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | avi->Init().
// p_CSourceAppSystemGroup__Create.Offset(0x39E).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | bik->Init().
// p_CSourceAppSystemGroup__Create.Offset(0x3AB).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | engineAPI->Init().
// p_CSourceAppSystemGroup__Create.Offset(0x3F6).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | vgui->Init().
// p_CSourceAppSystemGroup__Create.Offset(0x3E9).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | matEmbeddedPanel->Init().
// p_CSourceAppSystemGroup__Create.Offset(0x3F9).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | EAC_ClientInterface_Init().
// }
//
// //-------------------------------------------------------------------------
// // CMATERIALSYSTEM
// //-------------------------------------------------------------------------
// {
// //gCMaterialSystem__MatsysMode_Init.Offset(0x22).Patch({ 0xEB, 0x66 }); // JE --> JMP | Matsys mode init (CMaterialSystem). // TODO: Needed?
// p_CMaterialSystem__Init.Offset(0x406).Patch({ 0xE9, 0x55, 0x05, 0x00, 0x00 }); // MOV --> JMP | Jump over material KeyValue definitions and 'CMatRenderContextBase::sm_RenderData([x])'.
// p_InitMaterialSystem.Patch({ 0xC3 }); // FUN --> RET | Return early to prevent 'InitDebugMaterials' from being executed. // RESEARCH NEEDED.
// }
//
// //-------------------------------------------------------------------------
// // CSHADERSYSTEM
// //-------------------------------------------------------------------------
// {
// CShaderSystem__Init.Patch({ 0xC3 }); // FUN --> RET | Return early in 'CShaderSystem::Init()' to prevent initialization.
// }
//
// //-------------------------------------------------------------------------
// // CSTUDIORENDERCONTEXT
// //-------------------------------------------------------------------------
// {
// // Note: The registers here seems to contains pointers to material data and 'CMaterial' class methods when the shader system is initialized.
// CStudioRenderContext__LoadModel.Offset(0x17D).Patch({ 0x90, 0x90, 0x90, 0x90 }); // MOV --> NOP | RAX + RCX are both nullptr.
// CStudioRenderContext__LoadModel.Offset(0x181).Patch({ 0x90, 0x90, 0x90 }); // MOV --> NOP | RCX is nullptr when trying to dereference.
// CStudioRenderContext__LoadModel.Offset(0x184).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | RAX is nullptr during virtual call resulting in exception 'C0000005'.
// CStudioRenderContext__LoadMaterials.Offset(0x28).Patch({ 0xE9, 0x80, 0x04, 0x00, 0x00 }); // FUN --> RET | 'CStudioRenderContext::LoadMaterials' is called virtually by the 'RMDL' streaming job.
// }
//
// //-------------------------------------------------------------------------
// // CMODELLOADER
// //-------------------------------------------------------------------------
// {
// p_CModelLoader__LoadModel.Offset(0x462).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | Prevent call to 'CStudioRenderContext::LoadMaterials'.
// p_CModelLoader__UnloadModel.Offset(0x129).Patch({ 0x90, 0x90, 0x90 }); // MOV --> NOP | Virtual call to 'CShaderSystem' class method fails as RCX is nullptr.
// p_CModelLoader__UnloadModel.Offset(0x12C).Patch({ 0x90, 0x90, 0x90 }); // CAL --> NOP | Virtual call to 'CTexture' class member in RAX + 0x78 fails. Previous instruction could not dereference.
// p_CModelLoader__Studio_LoadModel.Offset(0x325).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | Virtual call to 'CMaterialSystem::FindMaterialEx' fails as RAX is nullptr.
// p_CModelLoader__Studio_LoadModel.Offset(0x33D).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | Virtual call to 'CMaterialGlue' class method fails as RAX is nullptr.
// p_CModelLoader__Studio_LoadModel.Offset(0x359).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | Virtual call to 'CMaterialGlue' class method fails as RAX is nullptr.
// p_CModelLoader__Studio_LoadModel.Offset(0x374).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | Virtual call to 'CMaterialGlue' class method fails as RAX is nullptr.
// p_CModelLoader__Studio_LoadModel.Offset(0x38D).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | Virtual call to 'ReturnZero' fails as RAX is nullptr.
// p_CModelLoader__Studio_LoadModel.Offset(0x3A4).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | Virtual call to 'CMaterialGlue' class method fails as RAX is nullptr.
//
// p_CModelLoader__Map_LoadModelGuts.Offset(0x41).Patch({ 0xE9, 0x4F, 0x04, 0x00, 0x00 }); // JNE --> NOP | SKYLIGHTS.
// p_CModelLoader__Map_LoadModelGuts.Offset(0x974).Patch({ 0x90, 0x90 }); // JE --> NOP | VERTNORMALS.
// p_CModelLoader__Map_LoadModelGuts.Offset(0xA55).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | MATERIALSORTS.
// p_CModelLoader__Map_LoadModelGuts.Offset(0xA62).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | MESHBOUNDS.
// p_CModelLoader__Map_LoadModelGuts.Offset(0xA83).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | MESHVERTS.
// p_CModelLoader__Map_LoadModelGuts.Offset(0xAC0).Patch({ 0x90, 0x90 }); // JE --> NOP | INDICES.
// p_CModelLoader__Map_LoadModelGuts.Offset(0xBF2).Patch({ 0x90, 0x90 }); // JE --> NOP | WORLDLIGHTS.
// p_CModelLoader__Map_LoadModelGuts.Offset(0xDA9).Patch({ 0x90, 0x90 }); // JE --> NOP | TWEAKLIGHTS.
// p_CModelLoader__Map_LoadModelGuts.Offset(0xEEB).Patch({ 0xE9, 0x3D, 0x01, 0x00, 0x00 }); // JLE --> JMP | Exception 0x57 in while trying to dereference [R15 + R14 *8 + 0x10].
// p_CModelLoader__Map_LoadModelGuts.Offset(0x61B).Patch({ 0xE9, 0xE2, 0x02, 0x00, 0x00 }); // JZ --> JMP | Prevent call to 'CMod_LoadTextures()'.
// p_CModelLoader__Map_LoadModelGuts.Offset(0x1045).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | Prevent call to 'Mod_LoadCubemapSamples()'.
//
// p_BuildSpriteLoadName.Patch({ 0xC3 }); // FUN --> RET | Return early in 'BuildSpriteLoadName()'.
// p_GetSpriteInfo.Patch({ 0xC3 }); // FUN --> RET | Return early in 'GetSpriteInfo()'.
// }
//
// //-------------------------------------------------------------------------
// // CGAMESERVER
// //-------------------------------------------------------------------------
// {
// p_CGameServer__SpawnServer.Offset(0x43).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | Prevent call to unknown material/shader code.
// p_CGameServer__SpawnServer.Offset(0x48).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | TODO: Research 'CIVDebugOverlay'.
// }
//
// //-------------------------------------------------------------------------
// // CVGUI
// //-------------------------------------------------------------------------
// {
// /*MOV EAX, 0*/
// CVGui__RunFrame.Patch({ 0xB8, 0x00, 0x00, 0x00, 0x00, 0xC3 }); // FUN --> RET | 'CVGui::RunFrame()' gets called on DLL shutdown.
// }
// //-------------------------------------------------------------------------
// // CRUI
// //-------------------------------------------------------------------------
// {
// /*MOV EAX, 0*/
// p_Rui_LoadAsset.Patch({ 0xB8, 0x00, 0x00, 0x00, 0x00, 0xC3 }); // FUN --> RET | Return early in RuiLoadAsset() to prevent error while attempting to load RUI assets after applying player settings.
// }
//
// //-------------------------------------------------------------------------
// // CENGINEVGUI
// //-------------------------------------------------------------------------
// {
// CEngineVGui__Shutdown.Patch({ 0xB8, 0x00, 0x00, 0x00, 0x00, 0xC3 }); // FUN --> RET | Cannot shutdown CEngineVGui if its never initialized.
// CEngineVGui__ActivateGameUI.FindPatternSelf("74 08", CMemory::Direction::DOWN).Patch({ 0x90, 0x90 }); // JZ --> NOP | Remove condition to return early when engine attempts to activate UI on the server.
// }
//
// //-------------------------------------------------------------------------
// // CENGINEVGUI
// //-------------------------------------------------------------------------
// {
// CInputSystem__RunFrameIME.Patch({ 0xB8, 0x00, 0x00, 0x00, 0x00, 0xC3 }); // FUN --> RET | Return early in 'CInputSystem::RunFrameIME()'.
// }
//
// //-------------------------------------------------------------------------
// // MM_HEARTBEAT
// //-------------------------------------------------------------------------
// {
// MM_Heartbeat__ToString.Offset(0xF).Patch({ 0xE9, 0x22, 0x01, 0x00, 0x00 }); // JS --> JMP | Skip ListenServer HeartBeat.
// }
//
// //-------------------------------------------------------------------------
// // RUNTIME: SYS_INITGAME
// //-------------------------------------------------------------------------
// {
// Sys_InitGame.Offset(0x70).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); // STZNZ --> NOP | Prevent 'bDedicated' from being set to false.
// }
//
// //-------------------------------------------------------------------------
// // RUNTIME: HOST_INIT
// //-------------------------------------------------------------------------
// {
// p_Host_Init.Offset(0xC2).Patch({ 0xEB, 0x34 }); // CAL --> NOP | Disable 'vpk/client_common.bsp' loading.
// p_Host_Init.Offset(0x182).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> JMP | Disable UI material asset initialization.
// p_Host_Init.Offset(0x859).Patch({ 0xE9, 0x19, 0x04, 0x00, 0x00 }); // LEA --> RET | Disable 'client.dll' library initialization.
// p_Host_Init.Offset(0xC77).Patch({ 0xE8, 0x44, 0xCF, 0xFF, 0xFF }); // CAL --> CAL | Disable user config loading and call entitlements.rson initialization instead.
//
// gHost_Init_1.Offset(0x564).Patch({ 0xEB }); // JNZ --> JMP | Skip chat room and discord presence thread creation [!TODO: set global boolean instead].
// gHost_Init_1.Offset(0x609).Patch({ 0xEB, 0x2B }); // JE --> JMP | Skip client.dll 'Init_PostVideo()' validation code.
// gHost_Init_1.Offset(0x621).Patch({ 0xEB, 0x0C }); // JNE --> JMP | Skip client.dll 'Init_PostVideo()' validation code.
// gHost_Init_1.Offset(0x658).Patch({ 0xE9, 0x8C, 0x00, 0x00, 0x00 }); // JE --> JMP | Skip NULL call as client is never initialized.
// gHost_Init_1.Offset(0x6E9).Patch({ 0xE9, 0xB0, 0x00, 0x00, 0x00 }); // JNE --> JMP | Skip shader preloading as cvar can't be checked due to client being NULL.
//
// gHost_Init_2.Offset(0x26F).Patch({ 0xE9, 0x4D, 0x05, 0x00, 0x00 }); // JNE --> JMP | client.dll systems initialization.
// }
//
// //-------------------------------------------------------------------------
// // RUNTIME: HOST_SHUTDOWN
// //-------------------------------------------------------------------------
// {
//#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
// Host_Shutdown.Offset(0x1F0).FindPatternSelf("7E", CMemory::Direction::DOWN).Patch({ 0xE9, 0x01, 0x08, 0x00, 0x00 }); // JNE --> JMP | Jump over inline 'Host_ShutdownClient()' ('Host_ShutdownServer' in now inline with 'Host_Shutdown()')
//#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
// Host_Shutdown.Offset(0x1F0).FindPatternSelf("7E", CMemory::Direction::DOWN).Patch({ 0xE9, 0xF9, 0x04, 0x00, 0x00 }); // JNE --> JMP | Jump over inline 'Host_ShutdownClient()' ('Host_ShutdownServer' in now inline with 'Host_Shutdown()')
//#endif // 0x700
// }
//
// //-------------------------------------------------------------------------
// // RUNTIME: HOST_NEWGAME
// //-------------------------------------------------------------------------
// {
// p_Host_NewGame.Offset(0x50).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | Invalid CHLClient virtual call 'g_pHLClient->nullsub()'.
// p_Host_NewGame.Offset(0x4E0).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | Matsys 'JT_HelpWithAnything()'.
// }
//
// //-------------------------------------------------------------------------
// // RUNTIME: HOST_CHANGELEVEL
// //-------------------------------------------------------------------------
// {
// p_Host_ChangeLevel.Offset(0x5D).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | Invalid CHLClient virtual call 'g_pHLClient->nullsub()'.
// }
//
// //-------------------------------------------------------------------------
// // RUNTIME: _HOST_RUNFRAME
// //-------------------------------------------------------------------------
// {
// p_Host_RunFrame.Offset(0xB85).Patch({ 0xEB, 0x6F }); // CMP --> JMP | Jump over inline '_Host_RunFrame_Client()'
// p_Host_RunFrame_Render.Patch({ 0xC3 }); // FUN --> RET | Extraneous function for Dedicated.
// p_VCR_EnterPausedState.Patch({ 0xC3 }); // FUN --> RET | Extraneous function for Dedicated.
// }
//
// //-------------------------------------------------------------------------
// // RUNTIME: HOST_DISCONNECT
// //-------------------------------------------------------------------------
// {
//#if defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
// Host_Disconnect.Offset(0x4A).FindPatternSelf("FF 90 80", CMemory::Direction::DOWN, 300).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, }); // CAL --> RET | This seems to call 'CEngineVGui::GetGameUIInputContext()'.
//#endif
// }
//
// //-------------------------------------------------------------------------
// // RUNTIME: RTECH_GAME
// //-------------------------------------------------------------------------
// {
//#if defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
// p_CPakFile_LoadPak.Offset(0x890).FindPatternSelf("75", CMemory::Direction::DOWN, 200).Patch({ 0xEB }); // JNZ --> JMP | Disable error handling for missing streaming files on the server. The server does not need streamed data from the starpak files.
//#endif
// }
//
// //-------------------------------------------------------------------------
// // RUNTIME: EBISUSDK
// //-------------------------------------------------------------------------
// {
// p_EbisuSDK_SetState.Offset(0x0).FindPatternSelf("0F 84", CMemory::Direction::DOWN).Patch({ 0x0F, 0x85 }); // JE --> JNZ | Prevent EbisuSDK from initializing on the engine and server.
// }
//
// //-------------------------------------------------------------------------
// // RUNTIME: FAIRFIGHT
// //-------------------------------------------------------------------------
// {
// FairFight_Init.Offset(0x0).FindPatternSelf("0F 87", CMemory::Direction::DOWN, 200).Patch({ 0x0F, 0x85 }); // JA --> JNZ | Prevent 'FairFight' anti-cheat from initializing on the server by comparing RAX against 0x0 instead. Init will crash since the plugins aren't shipped.
// }
//
// //-------------------------------------------------------------------------
// // RUNTIME: PROP_STATIC
// //-------------------------------------------------------------------------
// {
// // Note: At [14028F3B0 + 0x5C7] RSP seems to contain a block of pointers to data for the static prop rmdl in question. [RSP + 0x70] is a pointer to (what seems to be) shader/material data. The pointer will be NULL without a shader system.
// p_BuildPropStaticFrustumCullMap.Offset(0x5E0).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 }); // MOV --> NOP | RSP + 0x70 is a nullptr which gets moved to R13, R13 gets used here resulting in exception 'C0000005'.
// p_BuildPropStaticFrustumCullMap.Offset(0x5EB).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | RAX is nullptr during virtual call resulting in exception 'C0000005'.
// }
//
// //-------------------------------------------------------------------------
// // RUNTIME: GL_SCREEN
// //-------------------------------------------------------------------------
// {
// SCR_BeginLoadingPlaque.Patch({ 0xC3 }); // FUN --> RET | Return early to prevent execution of 'SCR_BeginLoadingPlaque()'.
// }
//
// //-------------------------------------------------------------------------
// // RUNTIME: CL_CLEARSTATE
// //-------------------------------------------------------------------------
//#if defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
// {
// p_CL_ClearState.Offset(0x0).Patch({ 0xC3 }); // FUN --> RET | Invalid 'CL_ClearState()' call from Host_Shutdown causing segfault.
// }
//#endif
// //-------------------------------------------------------------------------
// // RUNTIME: GAME_CFG
// //-------------------------------------------------------------------------
// p_UpdateMaterialSystemConfig.Offset(0x0).Patch({ 0xB8, 0x00, 0x00, 0x00, 0x00, 0xC3 });// FUN --> RET | Return early to prevent the server from updating material system configurations.
// p_UpdateCurrentVideoConfig.Offset(0x0).Patch({ 0xB8, 0x01, 0x00, 0x00, 0x00, 0xC3 }); // FUN --> RET | Return early to prevent the server from writing a videoconfig.txt file to the disk (overwriting the existing one).
// p_HandleConfigFile.Offset(0x0).Patch({ 0xB8, 0x01, 0x00, 0x00, 0x00, 0xC3 }); // FUN --> RET | Return early to prevent the server from writing various input and ConVar config files to the disk (overwriting the existing one).
// p_ResetPreviousGameState.Offset(0x0).Patch({ 0xC3 }); // FUN --> RET | Return early to prevent the server from writing a previousgamestate.txt file to the disk (overwriting the existing one).
// p_LoadPlayerConfig.Offset(0x0).Patch({ 0xC3 }); // FUN --> RET | Return early to prevent the server from executing 'config_default_pc.cfg' (execPlayerConfig) and (only for >S3) running 'chat_wheel' code.
//
// //-------------------------------------------------------------------------
// // RUNTIME: COMMUNITIES
// //-------------------------------------------------------------------------
// {
// //GetEngineClientThread.Offset(0x0).Patch({ 0xB8, 0x00, 0x00, 0x00, 0x00, 0xC3 }); // FUN --> RET | Return nullptr for mp_gamemode thread assignment during registration callback.
// }
//
// //-------------------------------------------------------------------------
// // RUNTIME: MATCHMAKING
// //-------------------------------------------------------------------------
// {
// MatchMaking_Frame.Patch({ 0xB8, 0x00, 0x00, 0x00, 0x00, 0xC3 }); // FUN --> RET | Return early for 'MatchMaking_Frame()'.
// }
//
// {
// CWin32Surface_initStaticData.Patch({ 0xC3 }); // FUN --> RET | Prevent 'CWin32Surface::initStaticData()' from being ran in CInit.
//#if !defined (GAMEDLL_S0) || !defined (GAMEDLL_S1)
// KeyboardLayout_Init.Patch({ 0xC3 }); // FUN --> RET | Prevent keyboard layout initialization for IME in CInit.
//#endif
// }
}
#endif // DEDICATED
@ -362,6 +362,7 @@ void RuntimePtc_Init() /* .TEXT */
#endif // !CLIENT_DLL
#endif
#ifndef CLIENT_DLL
// !!!TODO!!! HACK: this needs to be removed asap! fix the entitlements file formatting on git itself.
Server_S2C_CONNECT_1.Offset(0x7).Patch({ 0xEB }); // JZ --> JMP | Prevent entitlement check to kick player from server on S2C_CONNECT Packet if it does not match the servers one.
#endif // !CLIENT_DLL

View File

@ -80,110 +80,110 @@ class VOpcodes : public IDetour
{
virtual void GetAdr(void) const
{
LogFunAdr("CShaderSystem::Init", CShaderSystem__Init.GetPtr());
LogFunAdr("CVGui::RunFrame", CVGui__RunFrame.GetPtr());
LogFunAdr("CEngineVGui::Shutdown", CEngineVGui__Shutdown.GetPtr());
LogFunAdr("CEngineVGui::ActivateGameUI", CEngineVGui__ActivateGameUI.GetPtr());
LogFunAdr("CInputSystem::RunFrameIME", CInputSystem__RunFrameIME.GetPtr());
LogFunAdr("Sys_InitGame", Sys_InitGame.GetPtr());
LogFunAdr("Host_Init_1", gHost_Init_1.GetPtr());
LogFunAdr("Host_Init_2", gHost_Init_2.GetPtr());
LogFunAdr("Host_Disconnect", Host_Disconnect.GetPtr());
// LogFunAdr("CShaderSystem::Init", CShaderSystem__Init.GetPtr());
// LogFunAdr("CVGui::RunFrame", CVGui__RunFrame.GetPtr());
// LogFunAdr("CEngineVGui::Shutdown", CEngineVGui__Shutdown.GetPtr());
// LogFunAdr("CEngineVGui::ActivateGameUI", CEngineVGui__ActivateGameUI.GetPtr());
// LogFunAdr("CInputSystem::RunFrameIME", CInputSystem__RunFrameIME.GetPtr());
// LogFunAdr("Sys_InitGame", Sys_InitGame.GetPtr());
// LogFunAdr("Host_Init_1", gHost_Init_1.GetPtr());
// LogFunAdr("Host_Init_2", gHost_Init_2.GetPtr());
// LogFunAdr("Host_Disconnect", Host_Disconnect.GetPtr());
#ifndef CLIENT_DLL
LogFunAdr("Server_S2C_CONNECT_1", Server_S2C_CONNECT_1.GetPtr());
LogFunAdr("Server_S2C_CONNECT", Server_S2C_CONNECT_1.GetPtr());
#endif // !CLIENT_DLL
LogFunAdr("GetEngineClientThread", GetEngineClientThread.GetPtr());
LogFunAdr("MatchMaking_Frame", MatchMaking_Frame.GetPtr());
#if !defined (GAMEDLL_S0) || !defined (GAMEDLL_S1)
LogFunAdr("CWin32Surface::initStaticData", CWin32Surface_initStaticData.GetPtr());
#endif
LogFunAdr("KeyboardLayout_Init", KeyboardLayout_Init.GetPtr());
// LogFunAdr("GetEngineClientThread", GetEngineClientThread.GetPtr());
// LogFunAdr("MatchMaking_Frame", MatchMaking_Frame.GetPtr());
//#if !defined (GAMEDLL_S0) || !defined (GAMEDLL_S1)
// LogFunAdr("CWin32Surface::initStaticData", CWin32Surface_initStaticData.GetPtr());
//#endif
// LogFunAdr("KeyboardLayout_Init", KeyboardLayout_Init.GetPtr());
}
virtual void GetFun(void) const { }
virtual void GetVar(void) const
{
#ifdef GAMEDLL_S3
/* -------------- OTHER ------------------------------------------------------------------------------------------------------------------------------------------------- */
dst007 = /*0x14028F3B0*/ g_GameDll.FindPatternSIMD("48 8B C4 44 89 40 18 48 89 50 10 55 53 56 57 41");
dst008 = /*0x140E3E110*/ g_GameDll.FindPatternSIMD("48 83 EC 78 48 8B 84 24 ?? ?? ?? ?? 4D 8B D8 ??");
/* -------------- ------- ----------------------------------------------------------------------------------------------------------------------------------------------- */
#endif // GAMEDLL_S3
//-------------------------------------------------------------------------
CShaderSystem__Init = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 C6 41 10 ??");
// 0x1403DF870 // 48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 20 C6 41 10 00 //
//-------------------------------------------------------------------------
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
CVGui__RunFrame = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 55 56 57 48 83 EC 20 0F B6 69 5C");
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
CVGui__RunFrame = g_GameDll.FindPatternSIMD("40 57 48 83 EC 20 48 89 5C 24 ?? 48 8B F9 48 89 6C 24 ?? 0F B6 69 5C");
#endif
//-------------------------------------------------------------------------
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
CEngineVGui__Shutdown = g_GameDll.FindPatternSIMD("48 89 4C 24 ?? 57 41 54 48 83 EC 38");
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
CEngineVGui__Shutdown = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 80 3D ?? ?? ?? ?? ?? 48 8B D9");
#endif // 0x140282C90 // 48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 20 80 3D ? ? ? ? ? 48 8B D9 //
CEngineVGui__ActivateGameUI = g_GameDll.FindPatternSIMD("40 53 48 83 EC 20 F6 81 ?? ?? ?? ?? ?? 48 8B D9 74 08");
//
//-------------------------------------------------------------------------
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
CInputSystem__RunFrameIME = g_GameDll.FindPatternSIMD("48 8B C4 57 41 55");
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
CInputSystem__RunFrameIME = g_GameDll.FindPatternSIMD("40 57 41 54 41 55 48 83 EC 70");
#endif
//-------------------------------------------------------------------------
Sys_InitGame = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 57 48 81 EC ?? ?? ?? ?? 80 3D ?? ?? ?? ?? ?? 41 8B D8");
// 0x1402958D0 // 48 89 5C 24 ? 57 48 81 EC ? ? ? ? 80 3D ? ? ? ? ? 41 8B D8 //
//-------------------------------------------------------------------------
gHost_Init_1 = g_GameDll.FindPatternSIMD("48 8B C4 41 56 48 81 EC ?? ?? ?? ?? 45 33 F6"); // server Host_Init()?
// 0x140237B00 // 48 8B C4 41 56 48 81 EC ? ? ? ? 45 33 F6 //
gHost_Init_2 = g_GameDll.FindPatternSIMD("88 4C 24 08 53 55 56 57 48 83 EC 68"); // client Host_Init()?
// 0x140236640 // 88 4C 24 08 53 55 56 57 48 83 EC 68 //
//-------------------------------------------------------------------------
Host_Shutdown = g_GameDll.FindPatternSIMD("48 8B C4 48 83 EC ?? 80 3D ?? ?? ?? ?? ?? 0F 85 ?? ?? ?? ?? 8B 15 ?? ?? ?? ??");
// 0x140239620 // 48 8B C4 48 83 EC ?? 80 3D ? ? ? ? ? 0F 85 ? ? ? ? 8B 15 ? ? ? ? //
//-------------------------------------------------------------------------
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
Host_Disconnect = g_GameDll.FindPatternSIMD("48 83 EC 38 48 89 7C 24 ?? 0F B6 F9");
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
Host_Disconnect = g_GameDll.FindPatternSIMD("40 53 48 83 EC 30 0F B6 D9");
#endif // 0x14023CCA0 // 40 53 48 83 EC 30 0F B6 D9 //
//-------------------------------------------------------------------------
//#ifdef GAMEDLL_S3
// /* -------------- OTHER ------------------------------------------------------------------------------------------------------------------------------------------------- */
// dst007 = /*0x14028F3B0*/ g_GameDll.FindPatternSIMD("48 8B C4 44 89 40 18 48 89 50 10 55 53 56 57 41");
// dst008 = /*0x140E3E110*/ g_GameDll.FindPatternSIMD("48 83 EC 78 48 8B 84 24 ?? ?? ?? ?? 4D 8B D8 ??");
// /* -------------- ------- ----------------------------------------------------------------------------------------------------------------------------------------------- */
//#endif // GAMEDLL_S3
//
//
// //-------------------------------------------------------------------------
// CShaderSystem__Init = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 C6 41 10 ??");
// // 0x1403DF870 // 48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 20 C6 41 10 00 //
//
// //-------------------------------------------------------------------------
//#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
// CVGui__RunFrame = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 55 56 57 48 83 EC 20 0F B6 69 5C");
//#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
// CVGui__RunFrame = g_GameDll.FindPatternSIMD("40 57 48 83 EC 20 48 89 5C 24 ?? 48 8B F9 48 89 6C 24 ?? 0F B6 69 5C");
//#endif
//
// //-------------------------------------------------------------------------
//#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
// CEngineVGui__Shutdown = g_GameDll.FindPatternSIMD("48 89 4C 24 ?? 57 41 54 48 83 EC 38");
//#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
// CEngineVGui__Shutdown = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 80 3D ?? ?? ?? ?? ?? 48 8B D9");
//#endif // 0x140282C90 // 48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 20 80 3D ? ? ? ? ? 48 8B D9 //
// CEngineVGui__ActivateGameUI = g_GameDll.FindPatternSIMD("40 53 48 83 EC 20 F6 81 ?? ?? ?? ?? ?? 48 8B D9 74 08");
// //
//
// //-------------------------------------------------------------------------
//#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
// CInputSystem__RunFrameIME = g_GameDll.FindPatternSIMD("48 8B C4 57 41 55");
//#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
// CInputSystem__RunFrameIME = g_GameDll.FindPatternSIMD("40 57 41 54 41 55 48 83 EC 70");
//#endif
//
// //-------------------------------------------------------------------------
// Sys_InitGame = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 57 48 81 EC ?? ?? ?? ?? 80 3D ?? ?? ?? ?? ?? 41 8B D8");
// // 0x1402958D0 // 48 89 5C 24 ? 57 48 81 EC ? ? ? ? 80 3D ? ? ? ? ? 41 8B D8 //
//
// //-------------------------------------------------------------------------
// gHost_Init_1 = g_GameDll.FindPatternSIMD("48 8B C4 41 56 48 81 EC ?? ?? ?? ?? 45 33 F6"); // server Host_Init()?
// // 0x140237B00 // 48 8B C4 41 56 48 81 EC ? ? ? ? 45 33 F6 //
//
// gHost_Init_2 = g_GameDll.FindPatternSIMD("88 4C 24 08 53 55 56 57 48 83 EC 68"); // client Host_Init()?
// // 0x140236640 // 88 4C 24 08 53 55 56 57 48 83 EC 68 //
//
// //-------------------------------------------------------------------------
// Host_Shutdown = g_GameDll.FindPatternSIMD("48 8B C4 48 83 EC ?? 80 3D ?? ?? ?? ?? ?? 0F 85 ?? ?? ?? ?? 8B 15 ?? ?? ?? ??");
// // 0x140239620 // 48 8B C4 48 83 EC ?? 80 3D ? ? ? ? ? 0F 85 ? ? ? ? 8B 15 ? ? ? ? //
//
// //-------------------------------------------------------------------------
//#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
// Host_Disconnect = g_GameDll.FindPatternSIMD("48 83 EC 38 48 89 7C 24 ?? 0F B6 F9");
//#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
// Host_Disconnect = g_GameDll.FindPatternSIMD("40 53 48 83 EC 30 0F B6 D9");
//#endif // 0x14023CCA0 // 40 53 48 83 EC 30 0F B6 D9 //
//
// //-------------------------------------------------------------------------
#ifndef CLIENT_DLL
Server_S2C_CONNECT_1 = g_GameDll.FindPatternSIMD("48 3B 05 ?? ?? ?? ?? 74 0C");
#endif // !CLIENT_DLL
//-------------------------------------------------------------------------
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
GetEngineClientThread = g_GameDll.FindPatternSIMD("40 53 48 83 EC 20 65 48 8B 04 25 ?? ?? ?? ?? 48 8B D9 B9 ?? ?? ?? ?? 48 8B 10 8B 04 11 39 05 ?? ?? ?? ?? 7F 15");
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
GetEngineClientThread = g_GameDll.FindPatternSIMD("40 53 48 83 EC 20 65 48 8B 04 25 ?? ?? ?? ?? 48 8B D9 B9 ?? ?? ?? ?? 48 8B 10 8B 04 11 39 05 ?? ?? ?? ?? 7F 21");
#endif
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
MatchMaking_Frame = g_GameDll.FindPatternSIMD("40 55 56 41 54 41 55 48 8D AC 24 ?? ?? ?? ??");
#elif defined (GAMEDLL_S2)
MatchMaking_Frame = g_GameDll.FindPatternSIMD("48 89 74 24 ?? 55 41 54 41 57 48 8D AC 24 ?? ?? ?? ??");
#elif defined (GAMEDLL_S3)
MatchMaking_Frame = g_GameDll.FindPatternSIMD("48 8B C4 55 48 8D A8 ?? ?? ?? ?? 48 81 EC ?? ?? ?? ?? 48 89 78 18");
#endif
CWin32Surface_initStaticData = g_GameDll.FindPatternSIMD("48 83 EC 28 E8 ?? ?? ?? ?? 48 8D 0D ?? ?? ?? ?? 48 83 C4 28 E9 ?? ?? ?? ?? CC CC CC CC CC CC CC 33 C9");
// 48 83 EC 28 E8 ? ? ? ? 48 8D 0D ? ? ? ? 48 83 C4 28 E9 ? ? ? ? CC CC CC CC CC CC CC 33 C9
#if !defined (GAMEDLL_S0) || !defined (GAMEDLL_S1)
KeyboardLayout_Init = g_GameDll.FindPatternSIMD("48 83 EC 28 33 C9 FF 15 ?? ?? ?? ?? 48 8D 0D ?? ?? ?? ??");
#endif //48 83 EC 28 33 C9 FF 15 ? ? ? ? 48 8D 0D ? ? ? ?
//
// //-------------------------------------------------------------------------
//#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
// GetEngineClientThread = g_GameDll.FindPatternSIMD("40 53 48 83 EC 20 65 48 8B 04 25 ?? ?? ?? ?? 48 8B D9 B9 ?? ?? ?? ?? 48 8B 10 8B 04 11 39 05 ?? ?? ?? ?? 7F 15");
//#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
// GetEngineClientThread = g_GameDll.FindPatternSIMD("40 53 48 83 EC 20 65 48 8B 04 25 ?? ?? ?? ?? 48 8B D9 B9 ?? ?? ?? ?? 48 8B 10 8B 04 11 39 05 ?? ?? ?? ?? 7F 21");
//#endif
//#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
// MatchMaking_Frame = g_GameDll.FindPatternSIMD("40 55 56 41 54 41 55 48 8D AC 24 ?? ?? ?? ??");
//#elif defined (GAMEDLL_S2)
// MatchMaking_Frame = g_GameDll.FindPatternSIMD("48 89 74 24 ?? 55 41 54 41 57 48 8D AC 24 ?? ?? ?? ??");
//#elif defined (GAMEDLL_S3)
// MatchMaking_Frame = g_GameDll.FindPatternSIMD("48 8B C4 55 48 8D A8 ?? ?? ?? ?? 48 81 EC ?? ?? ?? ?? 48 89 78 18");
//#endif
//
//
// CWin32Surface_initStaticData = g_GameDll.FindPatternSIMD("48 83 EC 28 E8 ?? ?? ?? ?? 48 8D 0D ?? ?? ?? ?? 48 83 C4 28 E9 ?? ?? ?? ?? CC CC CC CC CC CC CC 33 C9");
// // 48 83 EC 28 E8 ? ? ? ? 48 8D 0D ? ? ? ? 48 83 C4 28 E9 ? ? ? ? CC CC CC CC CC CC CC 33 C9
//#if !defined (GAMEDLL_S0) || !defined (GAMEDLL_S1)
// KeyboardLayout_Init = g_GameDll.FindPatternSIMD("48 83 EC 28 33 C9 FF 15 ?? ?? ?? ?? 48 8D 0D ?? ?? ?? ??");
//#endif //48 83 EC 28 33 C9 FF 15 ? ? ? ? 48 8D 0D ? ? ? ?
}
virtual void GetCon(void) const { }
virtual void Attach(void) const { }

View File

@ -64,13 +64,15 @@
#include "rtech/rtech_game.h"
#include "rtech/rtech_utils.h"
#include "rtech/stryder/stryder.h"
#include "rtech/rui/rui.h"
#ifndef DEDICATED
#include "rtech/rui/rui.h"
#include "engine/client/cl_ents_parse.h"
#endif // !DEDICATED
#include "engine/client/cl_main.h"
#endif // !DEDICATED
#include "engine/client/client.h"
#ifndef DEDICATED
#include "engine/client/clientstate.h"
#endif // !DEDICATED
#include "engine/enginetrace.h"
#include "engine/traceinit.h"
#include "engine/common.h"
@ -90,15 +92,13 @@
#include "engine/sys_dll2.h"
#include "engine/sys_engine.h"
#include "engine/sys_utils.h"
#include "engine/sys_getmodes.h"
#ifndef DEDICATED
#include "engine/sys_getmodes.h"
#include "engine/gl_rmain.h"
#include "engine/sys_mainwind.h"
#endif // !DEDICATED
#include "engine/matsys_interface.h"
#include "engine/gl_matsysiface.h"
#include "engine/gl_screen.h"
#ifndef DEDICATED
#include "engine/gl_rsurf.h"
#include "engine/debugoverlay.h"
#endif // !DEDICATED
@ -145,6 +145,7 @@ void Systems_Init()
spdlog::info("+-------------------------------------------------------------+\n");
QuerySystemInfo();
DetourRegister();
CFastTimer initTimer;
initTimer.Start();
@ -371,186 +372,187 @@ void DetourAddress() // Test the sigscan results
}
}
// Tier0
REGISTER(VPlatform);
REGISTER(VJobThread);
REGISTER(VThreadTools);
REGISTER(VTSListBase);
REGISTER(VMemStd);
void DetourRegister() // Register detour classes to be searched and hooked.
{
// Tier0
REGISTER(VPlatform);
REGISTER(VJobThread);
REGISTER(VThreadTools);
REGISTER(VTSListBase);
REGISTER(VMemStd);
// Tier1
REGISTER(VCommandLine);
REGISTER(VConCommand);
REGISTER(VConVar);
REGISTER(VCVar);
// Tier1
REGISTER(VCommandLine);
REGISTER(VConCommand);
REGISTER(VConVar);
REGISTER(VCVar);
// VPC
REGISTER(VAppSystem);
REGISTER(VKeyValues);
REGISTER(VFactory);
// VPC
REGISTER(VAppSystem);
REGISTER(VKeyValues);
REGISTER(VFactory);
// VstdLib
REGISTER(VCallback);
REGISTER(VCompletion);
REGISTER(HKeyValuesSystem);
// VstdLib
REGISTER(VCallback);
REGISTER(VCompletion);
REGISTER(HKeyValuesSystem);
// Common
REGISTER(VOpcodes);
REGISTER(V_NetMessages);
// Common
REGISTER(VOpcodes);
REGISTER(V_NetMessages);
// Launcher
REGISTER(VPRX);
REGISTER(VLauncher);
REGISTER(VApplication);
// Launcher
REGISTER(VPRX);
REGISTER(VLauncher);
REGISTER(VApplication);
// FileSystem
REGISTER(VBaseFileSystem);
REGISTER(VFileSystem_Stdio);
// FileSystem
REGISTER(VBaseFileSystem);
REGISTER(VFileSystem_Stdio);
// DataCache
REGISTER(VMDLCache);
// DataCache
REGISTER(VMDLCache);
// Ebisu
REGISTER(VEbisuSDK);
// Ebisu
REGISTER(VEbisuSDK);
#ifndef DEDICATED
// Codecs
REGISTER(BinkCore); // REGISTER CLIENT ONLY!
REGISTER(MilesCore); // REGISTER CLIENT ONLY!
REGISTER(VRadShal);
// Codecs
REGISTER(BinkCore); // REGISTER CLIENT ONLY!
REGISTER(MilesCore); // REGISTER CLIENT ONLY!
REGISTER(VRadShal);
#endif // !DEDICATED
// VPhysics
REGISTER(VQHull);
// VPhysics
REGISTER(VQHull);
// BspLib
REGISTER(VBspLib);
// BspLib
REGISTER(VBspLib);
// MaterialSystem
REGISTER(VMaterialSystem);
REGISTER(VMaterialGlue);
// MaterialSystem
REGISTER(VMaterialSystem);
#ifndef DEDICATED
REGISTER(VShaderGlue);
REGISTER(VMaterialGlue);
REGISTER(VShaderGlue);
// VGui
REGISTER(VEngineVGui); // REGISTER CLIENT ONLY!
REGISTER(VFPSPanel); // REGISTER CLIENT ONLY!
REGISTER(VMatSystemSurface);
// VGui
REGISTER(VEngineVGui); // REGISTER CLIENT ONLY!
REGISTER(VFPSPanel); // REGISTER CLIENT ONLY!
REGISTER(VMatSystemSurface);
// Client
REGISTER(HVEngineClient);
// Client
REGISTER(HVEngineClient);
#endif // !DEDICATED
REGISTER(VDll_Engine_Int);
REGISTER(VDll_Engine_Int);
#ifndef CLIENT_DLL
// Server
REGISTER(VServer); // REGISTER SERVER ONLY!
REGISTER(VPersistence); // REGISTER SERVER ONLY!
REGISTER(HVEngineServer); // REGISTER SERVER ONLY!
// Server
REGISTER(VServer); // REGISTER SERVER ONLY!
REGISTER(VPersistence); // REGISTER SERVER ONLY!
REGISTER(HVEngineServer); // REGISTER SERVER ONLY!
#endif // !CLIENT_DLL
// Squirrel
REGISTER(VSqInit);
REGISTER(VSqapi);
REGISTER(HSQVM);
REGISTER(VSquirrelVM);
REGISTER(VSqStdAux);
// Squirrel
REGISTER(VSqInit);
REGISTER(VSqapi);
REGISTER(HSQVM);
REGISTER(VSquirrelVM);
REGISTER(VSqStdAux);
// Studio
REGISTER(VStudioRenderContext);
// Studio
REGISTER(VStudioRenderContext);
// RTech
REGISTER(V_RTechGame);
REGISTER(V_RTechUtils);
REGISTER(VStryder);
REGISTER(V_Rui); // Should this be client dll only???
// RTech
REGISTER(V_RTechGame);
REGISTER(V_RTechUtils);
REGISTER(VStryder);
#ifndef DEDICATED
REGISTER(V_CL_Ents_Parse); // REGISTER CLIENT ONLY!
REGISTER(V_Rui);
REGISTER(V_CL_Ents_Parse); // REGISTER CLIENT ONLY!
#endif // !DEDICATED
// Engine/client
REGISTER(VCL_Main);
REGISTER(VClient);
REGISTER(VClientState);
// Engine/client
REGISTER(VClient);
#ifndef DEDICATED
REGISTER(VClientState);
REGISTER(VCL_Main);
#endif // !DEDICATED
// Engine
REGISTER(VTraceInit);
REGISTER(VCommon);
REGISTER(VModel_BSP);
REGISTER(VHost);
REGISTER(VHostCmd);
REGISTER(VHostState);
REGISTER(VModelLoader);
REGISTER(VNet);
REGISTER(VNetChannel);
// Engine
REGISTER(VTraceInit);
REGISTER(VCommon);
REGISTER(VModel_BSP);
REGISTER(VHost);
REGISTER(VHostCmd);
REGISTER(VHostState);
REGISTER(VModelLoader);
REGISTER(VNet);
REGISTER(VNetChannel);
REGISTER(VSys_Dll);
REGISTER(VSys_Dll2);
REGISTER(VSys_Utils);
REGISTER(VEngine);
REGISTER(VEngineTrace);
REGISTER(VModelInfo);
REGISTER(HVideoMode_Common);
REGISTER(VSys_Dll);
REGISTER(VSys_Dll2);
REGISTER(VSys_Utils);
REGISTER(VEngine);
REGISTER(VEngineTrace);
REGISTER(VModelInfo);
#ifndef DEDICATED
REGISTER(VGL_RMain); // Client only?
REGISTER(HVideoMode_Common);
REGISTER(VGL_RMain);
REGISTER(VMatSys_Interface);
REGISTER(VGL_MatSysIFace);
REGISTER(VGL_Screen);
#endif // !DEDICATED
REGISTER(VMatSys_Interface); // Should this be client dll only???
REGISTER(VGL_MatSysIFace);
REGISTER(VGL_Screen);
// !!! SERVER DLL ONLY !!!
REGISTER(HSV_Main);
// !!! END SERVER DLL ONLY !!!
// !!! SERVER DLL ONLY !!!
REGISTER(HSV_Main);
// !!! END SERVER DLL ONLY !!!
#ifndef DEDICATED
REGISTER(VGame); // REGISTER CLIENT ONLY!
REGISTER(VGL_RSurf);
REGISTER(VGame); // REGISTER CLIENT ONLY!
REGISTER(VGL_RSurf);
REGISTER(VDebugOverlay); // !TODO: This also needs to be exposed to server dll!!!
#endif // !DEDICATED
REGISTER(VDebugOverlay); // !TODO: This also needs to be exposed to server dll!!!
// Game/shared
REGISTER(VUserCmd);
REGISTER(VAnimation);
REGISTER(VUtil_Shared);
// Game/shared
REGISTER(VUserCmd);
REGISTER(VAnimation);
REGISTER(VUtil_Shared);
#ifndef CLIENT_DLL
// Game/server
REGISTER(VAI_Network);
REGISTER(VAI_NetworkManager);
REGISTER(VRecast);
REGISTER(VFairFight);
REGISTER(VServerGameDLL);
REGISTER(VMoveHelperServer);
REGISTER(VPhysics_Main); // REGISTER SERVER ONLY
REGISTER(VBaseEntity);
REGISTER(VBaseAnimating);
REGISTER(VPlayer);
// Game/server
REGISTER(VAI_Network);
REGISTER(VAI_NetworkManager);
REGISTER(VRecast);
REGISTER(VFairFight);
REGISTER(VServerGameDLL);
REGISTER(VMoveHelperServer);
REGISTER(VPhysics_Main); // REGISTER SERVER ONLY
REGISTER(VBaseEntity);
REGISTER(VBaseAnimating);
REGISTER(VPlayer);
#endif // !CLIENT_DLL
#ifndef DEDICATED
REGISTER(V_ViewRender);
REGISTER(VMoveHelperClient);
REGISTER(V_ViewRender);
REGISTER(VMoveHelperClient);
#endif // !DEDICATED
// Public
REGISTER(VEdict);
// Public
REGISTER(VEdict);
#ifndef DEDICATED
REGISTER(VInputSystem);
REGISTER(VDXGI);
#endif // !DEDICATED
REGISTER(VInputSystem);
REGISTER(VDXGI);
#endif // !DEDICATED
}

View File

@ -13,3 +13,4 @@ void CheckCPU();
void DetourInit();
void DetourAddress();
void DetourRegister();

View File

@ -51,8 +51,8 @@ class VEbisuSDK : public IDetour
p_EbisuSDK_CVar_Init = g_GameDll.FindPatternSIMD("40 57 48 83 EC 40 83 3D");
EbisuSDK_CVar_Init = p_EbisuSDK_CVar_Init.RCast<void(*)(void)>(); /*40 57 48 83 EC 40 83 3D*/
p_EbisuSDK_SetState = g_GameDll.FindPatternSIMD("48 81 EC ?? ?? ?? ?? 80 3D ?? ?? ?? ?? ?? 0F 84 ?? ?? ?? ?? 80 3D ?? ?? ?? ?? ?? 74 5B");
EbisuSDK_SetState = p_EbisuSDK_SetState.RCast<void(*)(void)>(); /*48 81 EC ? ? ? ? 80 3D ? ? ? ? ? 0F 84 ? ? ? ? 80 3D ? ? ? ? ? 74 5B*/
p_EbisuSDK_SetState = g_GameDll.FindPatternSIMD("48 81 EC ?? ?? ?? ?? 80 3D ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 80 3D ?? ?? ?? ?? ?? 74 5B");
EbisuSDK_SetState = p_EbisuSDK_SetState.RCast<void(*)(void)>(); /*48 81 EC ?? ?? ?? ?? 80 3D ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 80 3D ?? ?? ?? ?? ?? 74 5B*/
}
virtual void GetVar(void) const
{

View File

@ -197,10 +197,8 @@ class VClientState : public IDetour
{
LogFunAdr("CClientState::RunFrame", p_CClientState__RunFrame.GetPtr());
LogFunAdr("CClientState::Disconnect", p_CClientState__Disconnect.GetPtr());
#ifndef DEDICATED
LogVarAdr("g_pClientState", reinterpret_cast<uintptr_t>(g_pClientState));
LogVarAdr("g_pClientState_Shifted", reinterpret_cast<uintptr_t>(g_pClientState_Shifted));
#endif // DEDICATED
}
virtual void GetFun(void) const
{
@ -220,10 +218,8 @@ class VClientState : public IDetour
}
virtual void GetVar(void) const
{
#ifndef DEDICATED
g_pClientState = g_GameDll.FindPatternSIMD("0F 84 ?? ?? ?? ?? 48 8D 0D ?? ?? ?? ?? 48 83 C4 28").FindPatternSelf("48 8D").ResolveRelativeAddressSelf(0x3, 0x7).RCast<CClientState*>(); /*0F 84 ? ? ? ? 48 8D 0D ? ? ? ? 48 83 C4 28*/
g_pClientState_Shifted = g_GameDll.FindPatternSIMD("80 3D ?? ?? ?? ?? ?? 74 14 66 0F 6E 05 ?? ?? ?? ??").ResolveRelativeAddress(0x2, 0x7).RCast<CClientState**>();
#endif // DEDICATED
}
virtual void GetCon(void) const { }
virtual void Attach(void) const { }

View File

@ -3,14 +3,14 @@
inline CMemory p_Host_RunFrame;
inline auto v_Host_RunFrame = p_Host_RunFrame.RCast<void(*)(void* unused, float time)>();
inline CMemory p_Host_RunFrame_Render;
inline auto v_Host_RunFrame_Render = p_Host_RunFrame_Render.RCast<void(*)(void)>();
//inline CMemory p_Host_RunFrame_Render; // DEDICATED PATCH!
//inline auto v_Host_RunFrame_Render = p_Host_RunFrame_Render.RCast<void(*)(void)>();
inline CMemory p_Host_Error;
inline auto v_Host_Error = p_Host_Error.RCast<int(*)(const char* error, ...)>();
inline CMemory p_VCR_EnterPausedState;
inline auto v_VCR_EnterPausedState = p_VCR_EnterPausedState.RCast<void(*)(void)>();
//inline CMemory p_VCR_EnterPausedState; // DEDICATED PATCH!
//inline auto v_VCR_EnterPausedState = p_VCR_EnterPausedState.RCast<void(*)(void)>();
inline bool* g_bAbortServerSet = nullptr;
inline jmp_buf* host_abortserver = nullptr;
@ -23,9 +23,9 @@ class VHost : public IDetour
virtual void GetAdr(void) const
{
LogFunAdr("_Host_RunFrame", p_Host_RunFrame.GetPtr());
LogFunAdr("_Host_RunFrame_Render", p_Host_RunFrame_Render.GetPtr());
//LogFunAdr("_Host_RunFrame_Render", p_Host_RunFrame_Render.GetPtr());
LogFunAdr("Host_Error", p_Host_Error.GetPtr());
LogFunAdr("VCR_EnterPausedState", p_VCR_EnterPausedState.GetPtr());
//LogFunAdr("VCR_EnterPausedState", p_VCR_EnterPausedState.GetPtr());
LogVarAdr("interval_per_tick", reinterpret_cast<uintptr_t>(interval_per_tick));
LogVarAdr("host_abortserver", reinterpret_cast<uintptr_t>(host_abortserver));
LogVarAdr("g_bAbortServerSet", reinterpret_cast<uintptr_t>(g_bAbortServerSet));
@ -34,17 +34,17 @@ class VHost : public IDetour
{
p_Host_RunFrame = g_GameDll.FindPatternSIMD("48 8B C4 48 89 58 18 48 89 70 20 F3 0F 11 48 ??");
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
p_Host_RunFrame_Render = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 57 48 83 EC 20 48 8B 1D ?? ?? ?? ?? 33 FF");
//p_Host_RunFrame_Render = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 57 48 83 EC 20 48 8B 1D ?? ?? ?? ?? 33 FF");
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
p_Host_RunFrame_Render = g_GameDll.FindPatternSIMD("40 53 48 83 EC 20 48 8B 0D ?? ?? ?? ?? 48 85 C9 75 34");
//p_Host_RunFrame_Render = g_GameDll.FindPatternSIMD("40 53 48 83 EC 20 48 8B 0D ?? ?? ?? ?? 48 85 C9 75 34");
#endif
p_Host_Error = g_GameDll.FindPatternSIMD("48 89 4C 24 ?? 48 89 54 24 ?? 4C 89 44 24 ?? 4C 89 4C 24 ?? 53 57 48 81 EC ?? ?? ?? ??");
p_VCR_EnterPausedState = g_GameDll.FindPatternSIMD("40 53 48 83 EC 20 65 48 8B 04 25 ?? ?? ?? ?? BB ?? ?? ?? ?? C6 05 ?? ?? ?? ?? ??");
//p_VCR_EnterPausedState = g_GameDll.FindPatternSIMD("40 53 48 83 EC 20 65 48 8B 04 25 ?? ?? ?? ?? BB ?? ?? ?? ?? C6 05 ?? ?? ?? ?? ??");
v_Host_RunFrame = p_Host_RunFrame.RCast<void(*)(void*, float)>();
v_Host_RunFrame_Render = p_Host_Error.RCast<void(*)(void)>();
//v_Host_RunFrame_Render = p_Host_Error.RCast<void(*)(void)>();
v_Host_Error = p_Host_Error.RCast<int(*)(const char*, ...)>();
v_VCR_EnterPausedState = p_VCR_EnterPausedState.RCast<void(*)(void)>();
//v_VCR_EnterPausedState = p_VCR_EnterPausedState.RCast<void(*)(void)>();
}
virtual void GetVar(void) const
{

View File

@ -68,11 +68,11 @@ inline auto CModelLoader__Map_LoadModelGuts = p_CModelLoader__Map_LoadModelGuts.
inline CMemory p_CModelLoader__Map_IsValid;
inline auto CModelLoader__Map_IsValid = p_CModelLoader__Map_IsValid.RCast<bool(*)(CModelLoader* loader, const char* pszMapName)>();
inline CMemory p_GetSpriteInfo;
inline auto GetSpriteInfo = p_GetSpriteInfo.RCast<void* (*)(const char* pName, bool bIsAVI, bool bIsBIK, int& nWidth, int& nHeight, int& nFrameCount, void* a7)>();
//inline CMemory p_GetSpriteInfo; // DEDICATED PATCH!
//inline auto GetSpriteInfo = p_GetSpriteInfo.RCast<void* (*)(const char* pName, bool bIsAVI, bool bIsBIK, int& nWidth, int& nHeight, int& nFrameCount, void* a7)>();
inline CMemory p_BuildSpriteLoadName;
inline auto BuildSpriteLoadName = p_BuildSpriteLoadName.RCast<void* (*)(const char* pName, char* pOut, int outLen, bool& bIsAVI, bool& bIsBIK)>();
//inline CMemory p_BuildSpriteLoadName; // DEDICATED PATCH!
//inline auto BuildSpriteLoadName = p_BuildSpriteLoadName.RCast<void* (*)(const char* pName, char* pOut, int outLen, bool& bIsAVI, bool& bIsBIK)>();
inline CModelLoader* g_pModelLoader;
@ -87,8 +87,8 @@ class VModelLoader : public IDetour
LogFunAdr("CModelLoader::Map_LoadModelGuts", p_CModelLoader__Map_LoadModelGuts.GetPtr());
LogFunAdr("CModelLoader::Map_IsValid", p_CModelLoader__Map_IsValid.GetPtr());
LogFunAdr("CModelLoader::Studio_LoadModel", p_CModelLoader__Studio_LoadModel.GetPtr());
LogFunAdr("GetSpriteInfo", p_GetSpriteInfo.GetPtr());
LogFunAdr("BuildSpriteLoadName", p_BuildSpriteLoadName.GetPtr());
//LogFunAdr("GetSpriteInfo", p_GetSpriteInfo.GetPtr());
//LogFunAdr("BuildSpriteLoadName", p_BuildSpriteLoadName.GetPtr());
LogVarAdr("g_pModelLoader", reinterpret_cast<uintptr_t>(g_pModelLoader));
}
virtual void GetFun(void) const
@ -108,9 +108,9 @@ class VModelLoader : public IDetour
p_CModelLoader__Studio_LoadModel = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 55 56 57 41 54 41 57 48 81 EC ?? ?? ?? ??");
p_CModelLoader__Map_LoadModelGuts = g_GameDll.FindPatternSIMD("48 89 54 24 ?? 48 89 4C 24 ?? 55 53 56 57 41 54 41 55 41 57"); // BSP.
p_CModelLoader__Map_IsValid = g_GameDll.FindPatternSIMD("40 53 48 81 EC ?? ?? ?? ?? 48 8B DA 48 85 D2 0F 84 ?? ?? ?? ?? 80 3A ?? 0F 84 ?? ?? ?? ?? 4C 8B CA");
p_GetSpriteInfo = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 41 54 41 55 41 56 41 57 48 83 EC 30 4C 8B BC 24 ?? ?? ?? ??");
//p_GetSpriteInfo = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 41 54 41 55 41 56 41 57 48 83 EC 30 4C 8B BC 24 ?? ?? ?? ??");
#endif
p_BuildSpriteLoadName = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 48 89 7C 24 ?? 41 56 48 81 EC ?? ?? ?? ?? 4D 8B F1 48 8B F2");
//p_BuildSpriteLoadName = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 48 89 7C 24 ?? 41 56 48 81 EC ?? ?? ?? ?? 4D 8B F1 48 8B F2");
CModelLoader__FindModel = p_CModelLoader__FindModel.RCast<void* (*)(CModelLoader*, const char*)>();
CModelLoader__LoadModel = p_CModelLoader__LoadModel.RCast<void(*)(CModelLoader*, model_t*)>();
@ -118,8 +118,8 @@ class VModelLoader : public IDetour
CModelLoader__Studio_LoadModel = p_CModelLoader__Studio_LoadModel.RCast<void* (*)(CModelLoader*)>();
CModelLoader__Map_LoadModelGuts = p_CModelLoader__Map_LoadModelGuts.RCast<uint64_t(*)(CModelLoader*, model_t* mod)>();
CModelLoader__Map_IsValid = p_CModelLoader__Map_IsValid.RCast<bool(*)(CModelLoader*, const char*)>();
GetSpriteInfo = p_GetSpriteInfo.RCast<void* (*)(const char*, bool, bool, int&, int&, int&, void*)>();
BuildSpriteLoadName = p_BuildSpriteLoadName.RCast<void* (*)(const char*, char*, int, bool&, bool&)>();
//GetSpriteInfo = p_GetSpriteInfo.RCast<void* (*)(const char*, bool, bool, int&, int&, int&, void*)>();
//BuildSpriteLoadName = p_BuildSpriteLoadName.RCast<void* (*)(const char*, char*, int, bool&, bool&)>();
}
virtual void GetVar(void) const
{

View File

@ -33,13 +33,12 @@ inline std::vector<IDetour*> vDetour;
inline std::unordered_set<IDetour*> sDetour;
inline std::size_t AddDetour(IDetour* pDetour, const char* pszName)
{
#ifdef _DEBUG
IDetour* pVFTable = reinterpret_cast<IDetour**>(pDetour)[0];
auto p = sDetour.insert(pVFTable); // Only register if VFTable isn't already registered.
assert(p.second); // Code bug: duplicate registration!!! (called 'REGISTER(...)' from a header file?).
p.second ? vDetour.push_back(pDetour) : delete pDetour;
#endif // DEBUG
return vDetour.size();
}

View File

@ -147,13 +147,11 @@
<ClInclude Include="..\datacache\mdlcache.h" />
<ClInclude Include="..\ebisusdk\EbisuSDK.h" />
<ClInclude Include="..\engine\client\client.h" />
<ClInclude Include="..\engine\client\cl_main.h" />
<ClInclude Include="..\engine\clockdriftmgr.h" />
<ClInclude Include="..\engine\cmodel_bsp.h" />
<ClInclude Include="..\engine\common.h" />
<ClInclude Include="..\engine\datablock.h" />
<ClInclude Include="..\engine\framesnapshot.h" />
<ClInclude Include="..\engine\gl_matsysiface.h" />
<ClInclude Include="..\engine\gl_model_private.h" />
<ClInclude Include="..\engine\host.h" />
<ClInclude Include="..\engine\host_cmd.h" />
@ -171,7 +169,6 @@
<ClInclude Include="..\engine\sys_dll.h" />
<ClInclude Include="..\engine\sys_dll2.h" />
<ClInclude Include="..\engine\sys_engine.h" />
<ClInclude Include="..\engine\sys_getmodes.h" />
<ClInclude Include="..\engine\sys_utils.h" />
<ClInclude Include="..\engine\traceinit.h" />
<ClInclude Include="..\filesystem\basefilesystem.h" />
@ -292,7 +289,6 @@
<ClInclude Include="..\public\worldsize.h" />
<ClInclude Include="..\rtech\rtech_utils.h" />
<ClInclude Include="..\rtech\rtech_game.h" />
<ClInclude Include="..\rtech\rui\rui.h" />
<ClInclude Include="..\rtech\stryder\stryder.h" />
<ClInclude Include="..\server\persistence.h" />
<ClInclude Include="..\server\vengineserver_impl.h" />
@ -528,6 +524,8 @@
<ItemGroup>
<ClCompile Include="..\bonesetup\bone_utils.cpp" />
<ClCompile Include="..\bsplib\bsplib.cpp" />
<ClCompile Include="..\client\cdll_engine_int.cpp" />
<ClCompile Include="..\common\netmessages.cpp" />
<ClCompile Include="..\common\opcodes.cpp" />
<ClCompile Include="..\core\dllmain.cpp" />
<ClCompile Include="..\core\init.cpp" />

View File

@ -142,9 +142,6 @@
<Filter Include="sdk\vstdlib">
<UniqueIdentifier>{f6e1bcba-3548-4849-918d-9adea1603b0b}</UniqueIdentifier>
</Filter>
<Filter Include="sdk\rtech\rui">
<UniqueIdentifier>{cc54d9ba-f73a-48af-af6a-3b2064710e61}</UniqueIdentifier>
</Filter>
<Filter Include="sdk\datacache">
<UniqueIdentifier>{4573ce75-0337-41b1-a43e-e9c17773b127}</UniqueIdentifier>
</Filter>
@ -672,9 +669,6 @@
<ClInclude Include="..\studiorender\studiorendercontext.h">
<Filter>sdk\studiorender</Filter>
</ClInclude>
<ClInclude Include="..\engine\sys_getmodes.h">
<Filter>sdk\engine</Filter>
</ClInclude>
<ClInclude Include="..\game\server\fairfight_impl.h">
<Filter>sdk\game\server</Filter>
</ClInclude>
@ -792,9 +786,6 @@
<ClInclude Include="..\public\globalvars_base.h">
<Filter>sdk\public</Filter>
</ClInclude>
<ClInclude Include="..\engine\gl_matsysiface.h">
<Filter>sdk\engine</Filter>
</ClInclude>
<ClInclude Include="..\game\server\detour_impl.h">
<Filter>sdk\game\server</Filter>
</ClInclude>
@ -876,9 +867,6 @@
<ClInclude Include="..\tier0\jobthread.h">
<Filter>sdk\tier0</Filter>
</ClInclude>
<ClInclude Include="..\rtech\rui\rui.h">
<Filter>sdk\rtech\rui</Filter>
</ClInclude>
<ClInclude Include="..\public\studio.h">
<Filter>sdk\public</Filter>
</ClInclude>
@ -1062,9 +1050,6 @@
<ClInclude Include="..\engine\client\client.h">
<Filter>sdk\engine\client</Filter>
</ClInclude>
<ClInclude Include="..\engine\client\cl_main.h">
<Filter>sdk\engine\client</Filter>
</ClInclude>
<ClInclude Include="..\engine\server\server.h">
<Filter>sdk\engine\server</Filter>
</ClInclude>
@ -1775,6 +1760,12 @@
<ClCompile Include="..\game\server\baseentity.cpp">
<Filter>sdk\game\server</Filter>
</ClCompile>
<ClCompile Include="..\client\cdll_engine_int.cpp">
<Filter>sdk\client</Filter>
</ClCompile>
<ClCompile Include="..\common\netmessages.cpp">
<Filter>sdk\common</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\Dedicated.def" />