2021-12-25 22:36:38 +01:00
|
|
|
|
//=============================================================================//
|
|
|
|
|
//
|
|
|
|
|
// Purpose: Main systems initialization file
|
|
|
|
|
//
|
|
|
|
|
//=============================================================================//
|
|
|
|
|
|
|
|
|
|
#include "core/stdafx.h"
|
|
|
|
|
#include "core/init.h"
|
2022-04-18 03:46:26 +02:00
|
|
|
|
#include "tier0/jobthread.h"
|
2022-04-15 04:02:33 +02:00
|
|
|
|
#include "tier0/tslist.h"
|
2022-04-11 01:51:50 +02:00
|
|
|
|
#include "tier0/fasttimer.h"
|
2022-04-11 01:44:30 +02:00
|
|
|
|
#include "tier0/cpu.h"
|
2022-01-10 01:20:44 +01:00
|
|
|
|
#include "tier0/commandline.h"
|
2022-04-09 16:16:40 +02:00
|
|
|
|
#include "tier1/cmd.h"
|
|
|
|
|
#include "tier1/IConVar.h"
|
|
|
|
|
#include "tier1/cvar.h"
|
2021-12-25 22:36:38 +01:00
|
|
|
|
#include "vpc/IAppSystem.h"
|
|
|
|
|
#include "vpc/keyvalues.h"
|
2022-01-18 01:21:24 +01:00
|
|
|
|
#include "vpc/interfaces.h"
|
2022-04-14 19:18:59 +02:00
|
|
|
|
#include "vstdlib/callback.h"
|
2022-04-09 16:16:40 +02:00
|
|
|
|
#include "vstdlib/completion.h"
|
|
|
|
|
#include "vstdlib/keyvaluessystem.h"
|
2022-01-04 12:11:59 +01:00
|
|
|
|
#include "common/opcodes.h"
|
2022-02-19 16:42:40 +01:00
|
|
|
|
#include "common/netmessages.h"
|
2022-02-18 14:00:58 +01:00
|
|
|
|
#include "launcher/prx.h"
|
2022-04-16 00:30:46 +02:00
|
|
|
|
#include "launcher/launcher.h"
|
|
|
|
|
#include "launcher/IApplication.h"
|
2022-04-09 00:59:42 +02:00
|
|
|
|
#include "filesystem/basefilesystem.h"
|
|
|
|
|
#include "filesystem/filesystem.h"
|
2021-12-25 22:36:38 +01:00
|
|
|
|
#include "ebisusdk/EbisuSDK.h"
|
2022-01-05 22:56:49 +01:00
|
|
|
|
#ifndef DEDICATED
|
|
|
|
|
#include "milessdk/win64_rrthreads.h"
|
|
|
|
|
#endif // !DEDICATED
|
2021-12-25 22:36:38 +01:00
|
|
|
|
#include "vphysics/QHull.h"
|
|
|
|
|
#include "bsplib/bsplib.h"
|
2022-03-26 01:04:20 +01:00
|
|
|
|
#include "materialsystem/cmaterialsystem.h"
|
2022-04-18 03:46:26 +02:00
|
|
|
|
#ifndef DEDICATED
|
2022-03-26 01:04:20 +01:00
|
|
|
|
#include "materialsystem/cmaterialglue.h"
|
2022-02-19 02:31:16 +01:00
|
|
|
|
#include "vgui/vgui_baseui_interface.h"
|
|
|
|
|
#include "vgui/vgui_debugpanel.h"
|
2021-12-25 22:36:38 +01:00
|
|
|
|
#include "vgui/vgui_fpspanel.h"
|
|
|
|
|
#include "vguimatsurface/MatSystemSurface.h"
|
|
|
|
|
#endif // !DEDICATED
|
2022-04-14 19:18:59 +02:00
|
|
|
|
#include "client/client.h"
|
|
|
|
|
#include "client/cdll_engine_int.h"
|
2022-04-02 12:27:35 +02:00
|
|
|
|
#include "client/vengineclient_impl.h"
|
2022-03-27 22:17:30 +02:00
|
|
|
|
#ifndef CLIENT_DLL
|
2021-12-25 22:36:38 +01:00
|
|
|
|
#include "server/server.h"
|
2022-04-02 12:27:35 +02:00
|
|
|
|
#include "server/vengineserver_impl.h"
|
2022-03-27 22:17:30 +02:00
|
|
|
|
#endif // !CLIENT_DLL
|
2021-12-25 22:36:38 +01:00
|
|
|
|
#include "squirrel/sqinit.h"
|
|
|
|
|
#include "squirrel/sqapi.h"
|
|
|
|
|
#include "squirrel/sqvm.h"
|
2022-02-19 16:42:40 +01:00
|
|
|
|
#include "studiorender/studiorendercontext.h"
|
2021-12-27 16:53:35 +01:00
|
|
|
|
#include "rtech/rtech_game.h"
|
2022-03-23 23:28:12 +01:00
|
|
|
|
#include "rtech/stryder/stryder.h"
|
|
|
|
|
#ifndef DEDICATED
|
|
|
|
|
#include "rtech/rui/rui.h"
|
|
|
|
|
#endif // !DEDICATED
|
2021-12-25 22:36:38 +01:00
|
|
|
|
#include "engine/baseclient.h"
|
2022-04-18 03:46:26 +02:00
|
|
|
|
#include "engine/baseclientstate.h"
|
2022-03-27 22:17:30 +02:00
|
|
|
|
#ifndef CLIENT_DLL
|
2022-03-26 00:24:13 +01:00
|
|
|
|
#include "engine/baseserver.h"
|
2022-03-27 22:17:30 +02:00
|
|
|
|
#endif // !CLIENT_DLL
|
2022-02-19 02:31:16 +01:00
|
|
|
|
#include "engine/common.h"
|
|
|
|
|
#include "engine/cmodel_bsp.h"
|
2022-04-12 02:48:46 +02:00
|
|
|
|
#include "engine/host.h"
|
2021-12-27 16:53:35 +01:00
|
|
|
|
#include "engine/host_cmd.h"
|
2021-12-25 22:36:38 +01:00
|
|
|
|
#include "engine/host_state.h"
|
2022-02-19 02:31:16 +01:00
|
|
|
|
#include "engine/modelloader.h"
|
2022-02-14 02:33:13 +01:00
|
|
|
|
#include "engine/net.h"
|
2021-12-25 22:36:38 +01:00
|
|
|
|
#include "engine/net_chan.h"
|
2022-02-19 16:42:40 +01:00
|
|
|
|
#include "engine/cl_main.h"
|
2022-03-27 22:17:30 +02:00
|
|
|
|
#ifndef CLIENT_DLL
|
2022-01-26 23:43:16 +01:00
|
|
|
|
#include "engine/sv_main.h"
|
2022-03-27 22:17:30 +02:00
|
|
|
|
#endif // !CLIENT_DLL
|
2021-12-25 22:36:38 +01:00
|
|
|
|
#include "engine/sys_dll.h"
|
|
|
|
|
#include "engine/sys_dll2.h"
|
2022-01-26 23:43:16 +01:00
|
|
|
|
#include "engine/sys_engine.h"
|
2021-12-25 22:36:38 +01:00
|
|
|
|
#include "engine/sys_utils.h"
|
2022-02-19 16:42:40 +01:00
|
|
|
|
#include "engine/sys_getmodes.h"
|
2022-03-02 01:16:35 +01:00
|
|
|
|
#include "engine/gl_matsysiface.h"
|
2022-02-19 02:31:16 +01:00
|
|
|
|
#include "engine/gl_screen.h"
|
2022-03-02 01:16:35 +01:00
|
|
|
|
#ifndef DEDICATED
|
2022-01-04 12:11:59 +01:00
|
|
|
|
#include "engine/debugoverlay.h"
|
2022-02-19 16:42:40 +01:00
|
|
|
|
#endif // !DEDICATED
|
2022-03-27 22:17:30 +02:00
|
|
|
|
#ifndef CLIENT_DLL
|
2022-02-27 03:15:00 +01:00
|
|
|
|
#include "game/server/ai_node.h"
|
|
|
|
|
#include "game/server/ai_network.h"
|
|
|
|
|
#include "game/server/ai_networkmanager.h"
|
2022-03-18 03:14:07 +01:00
|
|
|
|
#include "game/server/ai_utility.h"
|
|
|
|
|
#include "game/server/detour_impl.h"
|
2022-02-19 16:42:40 +01:00
|
|
|
|
#include "game/server/fairfight_impl.h"
|
2022-02-24 01:51:11 +01:00
|
|
|
|
#include "game/server/gameinterface.h"
|
2022-02-27 03:15:00 +01:00
|
|
|
|
#include "public/include/edict.h"
|
2022-03-27 22:17:30 +02:00
|
|
|
|
#endif // !CLIENT_DLL
|
2022-02-19 16:42:40 +01:00
|
|
|
|
#ifndef DEDICATED
|
2021-12-25 22:36:38 +01:00
|
|
|
|
#include "inputsystem/inputsystem.h"
|
|
|
|
|
#include "windows/id3dx.h"
|
|
|
|
|
#endif // !DEDICATED
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// ██╗███╗ ██╗██╗████████╗██╗ █████╗ ██╗ ██╗███████╗ █████╗ ████████╗██╗ ██████╗ ███╗ ██╗
|
|
|
|
|
// ██║████╗ ██║██║╚══██╔══╝██║██╔══██╗██║ ██║╚══███╔╝██╔══██╗╚══██╔══╝██║██╔═══██╗████╗ ██║
|
|
|
|
|
// ██║██╔██╗ ██║██║ ██║ ██║███████║██║ ██║ ███╔╝ ███████║ ██║ ██║██║ ██║██╔██╗ ██║
|
|
|
|
|
// ██║██║╚██╗██║██║ ██║ ██║██╔══██║██║ ██║ ███╔╝ ██╔══██║ ██║ ██║██║ ██║██║╚██╗██║
|
|
|
|
|
// ██║██║ ╚████║██║ ██║ ██║██║ ██║███████╗██║███████╗██║ ██║ ██║ ██║╚██████╔╝██║ ╚████║
|
|
|
|
|
// ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
void Systems_Init()
|
|
|
|
|
{
|
2022-04-18 03:46:26 +02:00
|
|
|
|
spdlog::info("+-------------------------------------------------------------+\n");
|
2022-04-18 16:45:26 +02:00
|
|
|
|
QuerySystemInfo();
|
2022-04-18 03:46:26 +02:00
|
|
|
|
CFastTimer initTimer;
|
2022-04-12 02:48:46 +02:00
|
|
|
|
|
2022-04-18 03:46:26 +02:00
|
|
|
|
initTimer.Start();
|
|
|
|
|
for (IDetour* pDetour : vDetour)
|
2022-02-06 15:44:39 +01:00
|
|
|
|
{
|
2022-04-18 03:46:26 +02:00
|
|
|
|
pDetour->GetFun();
|
|
|
|
|
pDetour->GetVar();
|
|
|
|
|
pDetour->GetCon();
|
2022-02-06 15:44:39 +01:00
|
|
|
|
}
|
2022-04-18 03:46:26 +02:00
|
|
|
|
initTimer.End();
|
|
|
|
|
spdlog::info("+-------------------------------------------------------------+\n");
|
|
|
|
|
spdlog::info("Detour->Init() '{:03.6f}' seconds ('{:12d}' clocks)\n", initTimer.GetDuration().GetSeconds(), initTimer.GetDuration().GetCycles());
|
2022-04-12 02:48:46 +02:00
|
|
|
|
|
2022-04-18 03:46:26 +02:00
|
|
|
|
initTimer.Start();
|
2022-04-11 01:44:30 +02:00
|
|
|
|
|
|
|
|
|
// Initialize WinSock system.
|
|
|
|
|
WS_Init();
|
|
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
|
// Begin the detour transaction to hook the the process
|
|
|
|
|
DetourTransactionBegin();
|
|
|
|
|
DetourUpdateThread(GetCurrentThread());
|
|
|
|
|
|
|
|
|
|
// Hook functions
|
2022-04-16 00:30:46 +02:00
|
|
|
|
Launcher_Attatch();
|
2021-12-25 22:36:38 +01:00
|
|
|
|
IApplication_Attach();
|
2022-02-18 14:00:58 +01:00
|
|
|
|
#ifdef DEDICATED
|
2022-02-27 19:47:29 +01:00
|
|
|
|
//PRX_Attach();
|
2022-02-18 14:00:58 +01:00
|
|
|
|
#endif // DEDICATED
|
2021-12-25 22:36:38 +01:00
|
|
|
|
CBaseClient_Attach();
|
|
|
|
|
CBaseFileSystem_Attach();
|
|
|
|
|
|
2022-03-02 01:16:35 +01:00
|
|
|
|
#ifndef DEDICATED
|
|
|
|
|
CMaterialSystem_Attach();
|
|
|
|
|
#endif // !DEDICATED
|
|
|
|
|
|
2021-12-28 01:18:08 +01:00
|
|
|
|
QHull_Attach();
|
2021-12-25 22:36:38 +01:00
|
|
|
|
//BspLib_Attach();
|
|
|
|
|
|
|
|
|
|
#ifndef DEDICATED
|
|
|
|
|
CEngineVGui_Attach();
|
|
|
|
|
CFPSPanel_Attach();
|
|
|
|
|
CHLClient_Attach();
|
|
|
|
|
#endif // !DEDICATED
|
|
|
|
|
|
2022-03-27 22:17:30 +02:00
|
|
|
|
#if !defined(CLIENT_DLL) && defined (GAMEDLL_S3)
|
2022-01-05 02:07:37 +01:00
|
|
|
|
CServer_Attach(); // S1 and S2 CServer functions require work.
|
2022-03-27 22:17:30 +02:00
|
|
|
|
#endif // !CLIENT_DLL && GAMEDLL_S3
|
2021-12-25 22:36:38 +01:00
|
|
|
|
|
2022-02-19 02:31:16 +01:00
|
|
|
|
CHostState_Attach();
|
2022-03-01 02:39:46 +01:00
|
|
|
|
//CModelLoader_Attach();
|
2021-12-25 22:36:38 +01:00
|
|
|
|
|
2022-04-02 02:48:54 +02:00
|
|
|
|
NET_Attach();
|
2021-12-25 22:36:38 +01:00
|
|
|
|
ConCommand_Attach();
|
|
|
|
|
IConVar_Attach();
|
|
|
|
|
CKeyValueSystem_Attach();
|
2022-03-23 23:05:43 +01:00
|
|
|
|
|
2022-03-27 22:17:30 +02:00
|
|
|
|
#ifndef CLIENT_DLL
|
2021-12-25 22:36:38 +01:00
|
|
|
|
IVEngineServer_Attach();
|
2022-03-27 22:17:30 +02:00
|
|
|
|
#endif // !CLIENT_DLL
|
2022-03-23 23:05:43 +01:00
|
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
|
SQAPI_Attach();
|
|
|
|
|
SQVM_Attach();
|
2021-12-27 16:53:35 +01:00
|
|
|
|
|
|
|
|
|
RTech_Game_Attach();
|
2022-03-23 23:28:12 +01:00
|
|
|
|
#ifndef DEDICATED
|
|
|
|
|
Rui_Attach();
|
|
|
|
|
#endif // !DEDICATED
|
2021-12-27 16:53:35 +01:00
|
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
|
SysDll_Attach();
|
2022-04-15 04:02:33 +02:00
|
|
|
|
SysDll2_Attach();
|
2021-12-25 22:36:38 +01:00
|
|
|
|
SysUtils_Attach();
|
|
|
|
|
|
2022-02-28 01:01:40 +01:00
|
|
|
|
#ifndef DEDICATED
|
|
|
|
|
HCVideoMode_Common_Attach();
|
2022-03-18 03:14:07 +01:00
|
|
|
|
//DebugOverlays_Attach();
|
2022-02-28 01:01:40 +01:00
|
|
|
|
#endif // !DEDICATED
|
2022-03-23 23:05:43 +01:00
|
|
|
|
|
2022-03-27 22:17:30 +02:00
|
|
|
|
#ifndef CLIENT_DLL
|
2022-03-18 03:14:07 +01:00
|
|
|
|
CAI_Utility_Attach();
|
2022-04-03 03:10:48 +02:00
|
|
|
|
CAI_Network_Attach();
|
2022-03-20 17:03:46 +01:00
|
|
|
|
CAI_NetworkManager_Attach();
|
2022-03-27 22:17:30 +02:00
|
|
|
|
#endif // !#ifndef CLIENT_DLL
|
2021-12-25 22:36:38 +01:00
|
|
|
|
// Patch instructions
|
|
|
|
|
RuntimePtc_Init();
|
|
|
|
|
|
|
|
|
|
// Commit the transaction
|
|
|
|
|
if (DetourTransactionCommit() != NO_ERROR)
|
|
|
|
|
{
|
|
|
|
|
// Failed to hook into the process, terminate
|
|
|
|
|
TerminateProcess(GetCurrentProcess(), 0xBAD0C0DE);
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-18 03:46:26 +02:00
|
|
|
|
initTimer.End();
|
|
|
|
|
spdlog::info("Detour->Attach() '{:03.6f}' seconds ('{:12d}' clocks)\n", initTimer.GetDuration().GetSeconds(), initTimer.GetDuration().GetCycles());
|
|
|
|
|
spdlog::info("+-------------------------------------------------------------+\n");
|
|
|
|
|
|
2022-01-09 16:14:17 +01:00
|
|
|
|
g_pConVar->Init();
|
2021-12-25 22:36:38 +01:00
|
|
|
|
|
|
|
|
|
#ifdef DEDICATED
|
|
|
|
|
Dedicated_Init();
|
|
|
|
|
#endif // DEDICATED
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// ███████╗██╗ ██╗██╗ ██╗████████╗██████╗ ██████╗ ██╗ ██╗███╗ ██╗
|
|
|
|
|
// ██╔════╝██║ ██║██║ ██║╚══██╔══╝██╔══██╗██╔═══██╗██║ ██║████╗ ██║
|
|
|
|
|
// ███████╗███████║██║ ██║ ██║ ██║ ██║██║ ██║██║ █╗ ██║██╔██╗ ██║
|
|
|
|
|
// ╚════██║██╔══██║██║ ██║ ██║ ██║ ██║██║ ██║██║███╗██║██║╚██╗██║
|
|
|
|
|
// ███████║██║ ██║╚██████╔╝ ██║ ██████╔╝╚██████╔╝╚███╔███╔╝██║ ╚████║
|
|
|
|
|
// ╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══╝╚══╝ ╚═╝ ╚═══╝
|
|
|
|
|
//
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
void Systems_Shutdown()
|
|
|
|
|
{
|
2022-04-18 03:46:26 +02:00
|
|
|
|
CFastTimer shutdownTimer;
|
|
|
|
|
shutdownTimer.Start();
|
|
|
|
|
|
2022-04-11 01:44:30 +02:00
|
|
|
|
// Shutdown WinSock system.
|
|
|
|
|
WS_Shutdown();
|
2022-02-06 15:44:39 +01:00
|
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
|
// Begin the detour transaction to unhook the the process
|
|
|
|
|
DetourTransactionBegin();
|
|
|
|
|
DetourUpdateThread(GetCurrentThread());
|
|
|
|
|
|
|
|
|
|
// Unhook functions
|
2022-04-16 00:30:46 +02:00
|
|
|
|
Launcher_Detatch();
|
2021-12-25 22:36:38 +01:00
|
|
|
|
IApplication_Detach();
|
2022-02-18 14:00:58 +01:00
|
|
|
|
#ifdef DEDICATED
|
2022-02-27 19:47:29 +01:00
|
|
|
|
//PRX_Detach();
|
2022-02-18 14:00:58 +01:00
|
|
|
|
#endif // DEDICATED
|
2021-12-25 22:36:38 +01:00
|
|
|
|
CBaseClient_Detach();
|
|
|
|
|
CBaseFileSystem_Detach();
|
|
|
|
|
|
2022-03-02 01:16:35 +01:00
|
|
|
|
#ifndef DEDICATED
|
|
|
|
|
CMaterialSystem_Detach();
|
|
|
|
|
#endif // !DEDICATED
|
|
|
|
|
|
2021-12-28 01:18:08 +01:00
|
|
|
|
QHull_Detach();
|
2021-12-25 22:36:38 +01:00
|
|
|
|
//BspLib_Detach();
|
|
|
|
|
|
|
|
|
|
#ifndef DEDICATED
|
|
|
|
|
CEngineVGui_Detach();
|
|
|
|
|
CFPSPanel_Detach();
|
|
|
|
|
CHLClient_Detach();
|
|
|
|
|
#endif // !DEDICATED
|
2022-01-05 02:07:37 +01:00
|
|
|
|
|
2022-03-27 22:17:30 +02:00
|
|
|
|
#if !defined(CLIENT_DLL) && defined (GAMEDLL_S3)
|
2022-01-05 02:07:37 +01:00
|
|
|
|
CServer_Detach(); // S1 and S2 CServer functions require work.
|
2022-03-27 22:17:30 +02:00
|
|
|
|
#endif // !CLIENT_DLL && GAMEDLL_S3
|
2021-12-25 22:36:38 +01:00
|
|
|
|
|
2022-04-19 00:00:45 +02:00
|
|
|
|
CHostState_Detach();
|
2022-03-01 02:39:46 +01:00
|
|
|
|
//CModelLoader_Detach();
|
2021-12-25 22:36:38 +01:00
|
|
|
|
|
2022-04-02 02:48:54 +02:00
|
|
|
|
NET_Detach();
|
2021-12-25 22:36:38 +01:00
|
|
|
|
ConCommand_Detach();
|
|
|
|
|
IConVar_Detach();
|
|
|
|
|
CKeyValueSystem_Detach();
|
2022-03-23 23:05:43 +01:00
|
|
|
|
|
2022-03-27 22:17:30 +02:00
|
|
|
|
#ifndef CLIENT_DLL
|
2021-12-25 22:36:38 +01:00
|
|
|
|
IVEngineServer_Detach();
|
2022-03-27 22:17:30 +02:00
|
|
|
|
#endif // !CLIENT_DLL
|
2021-12-25 22:36:38 +01:00
|
|
|
|
SQAPI_Detach();
|
|
|
|
|
SQVM_Detach();
|
2021-12-27 16:53:35 +01:00
|
|
|
|
|
|
|
|
|
RTech_Game_Detach();
|
2022-03-23 23:28:12 +01:00
|
|
|
|
#ifndef DEDICATED
|
|
|
|
|
Rui_Detach();
|
|
|
|
|
#endif // !DEDICATED
|
2021-12-27 16:53:35 +01:00
|
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
|
SysDll_Detach();
|
2022-04-15 04:02:33 +02:00
|
|
|
|
SysDll2_Detach();
|
2021-12-25 22:36:38 +01:00
|
|
|
|
SysUtils_Detach();
|
|
|
|
|
|
2022-02-28 01:01:40 +01:00
|
|
|
|
#ifndef DEDICATED
|
|
|
|
|
HCVideoMode_Common_Detach();
|
2022-03-18 03:14:07 +01:00
|
|
|
|
//DebugOverlays_Detach();
|
2022-02-28 01:01:40 +01:00
|
|
|
|
#endif // !DEDICATED
|
2022-03-23 23:05:43 +01:00
|
|
|
|
|
2022-03-27 22:17:30 +02:00
|
|
|
|
#ifndef CLIENT_DLL
|
2022-03-18 03:14:07 +01:00
|
|
|
|
CAI_Utility_Detach();
|
2022-04-03 03:10:48 +02:00
|
|
|
|
CAI_Network_Detach();
|
2022-03-20 17:03:46 +01:00
|
|
|
|
CAI_NetworkManager_Detach();
|
2022-03-27 22:17:30 +02:00
|
|
|
|
#endif // !CLIENT_DLL
|
2022-02-28 01:01:40 +01:00
|
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
|
// Commit the transaction
|
|
|
|
|
DetourTransactionCommit();
|
2022-04-18 03:46:26 +02:00
|
|
|
|
|
|
|
|
|
shutdownTimer.End();
|
|
|
|
|
spdlog::info("Detour->Detach() '{:03.6f}' seconds ('{:12d}' clocks)\n", shutdownTimer.GetDuration().GetSeconds(), shutdownTimer.GetDuration().GetCycles());
|
|
|
|
|
spdlog::info("+-------------------------------------------------------------+\n");
|
2021-12-25 22:36:38 +01:00
|
|
|
|
}
|
|
|
|
|
|
2022-04-11 01:44:30 +02:00
|
|
|
|
/////////////////////////////////////////////////////
|
2021-12-25 22:36:38 +01:00
|
|
|
|
//
|
2022-04-11 01:44:30 +02:00
|
|
|
|
// ██╗ ██╗████████╗██╗██╗ ██╗████████╗██╗ ██╗
|
|
|
|
|
// ██║ ██║╚══██╔══╝██║██║ ██║╚══██╔══╝╚██╗ ██╔╝
|
|
|
|
|
// ██║ ██║ ██║ ██║██║ ██║ ██║ ╚████╔╝
|
|
|
|
|
// ██║ ██║ ██║ ██║██║ ██║ ██║ ╚██╔╝
|
|
|
|
|
// ╚██████╔╝ ██║ ██║███████╗██║ ██║ ██║
|
2022-04-18 03:46:26 +02:00
|
|
|
|
// ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝
|
2021-12-25 22:36:38 +01:00
|
|
|
|
//
|
2022-04-11 01:44:30 +02:00
|
|
|
|
/////////////////////////////////////////////////////
|
2021-12-25 22:36:38 +01:00
|
|
|
|
|
2022-04-11 01:44:30 +02:00
|
|
|
|
void WS_Init()
|
|
|
|
|
{
|
|
|
|
|
WSAData wsaData{};
|
|
|
|
|
int nError = ::WSAStartup(MAKEWORD(2, 2), &wsaData);
|
|
|
|
|
if (nError != 0)
|
|
|
|
|
{
|
|
|
|
|
std::cerr << "Failed to start Winsock via WSAStartup: (" << NET_ErrorString(WSAGetLastError()) << ")" << std::endl;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void WS_Shutdown()
|
|
|
|
|
{
|
|
|
|
|
int nError = ::WSACleanup();
|
|
|
|
|
if (nError != 0)
|
|
|
|
|
{
|
|
|
|
|
std::cerr << "Failed to stop winsock via WSACleanup: (" << NET_ErrorString(WSAGetLastError()) << ")" << std::endl;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-04-18 16:45:26 +02:00
|
|
|
|
void QuerySystemInfo()
|
2022-04-11 01:44:30 +02:00
|
|
|
|
{
|
|
|
|
|
const CPUInformation& pi = GetCPUInformation();
|
|
|
|
|
|
2022-04-11 01:51:50 +02:00
|
|
|
|
if (!(pi.m_bSSE && pi.m_bSSE2))
|
2022-04-11 01:44:30 +02:00
|
|
|
|
{
|
2022-04-18 03:46:26 +02:00
|
|
|
|
if (MessageBoxA(NULL, "SSE and SSE2 are required.", "Unsupported CPU", MB_ICONERROR | MB_OK))
|
2022-04-11 01:44:30 +02:00
|
|
|
|
{
|
|
|
|
|
TerminateProcess(GetCurrentProcess(), 0xBAD0C0DE);
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-04-18 03:46:26 +02:00
|
|
|
|
|
2022-04-18 16:45:26 +02:00
|
|
|
|
spdlog::info("CPU model identifier : '{:s}'\n", pi.m_szProcessorBrand);
|
|
|
|
|
spdlog::info("CPU vendor identifier : '{:s}'\n", pi.m_szProcessorID);
|
|
|
|
|
spdlog::info("CPU core count : '{:10d}' ({:s})\n", pi.m_nPhysicalProcessors, "Physical");
|
|
|
|
|
spdlog::info("CPU core count : '{:10d}' ({:s})\n", pi.m_nLogicalProcessors, "Logical");
|
|
|
|
|
spdlog::info("L1 cache (KiB): '{:10d}'\n", pi.m_nL1CacheSizeKb);
|
|
|
|
|
spdlog::info("L1 cache (Dsc): '{:#10x}'\n" , pi.m_nL1CacheDesc);
|
|
|
|
|
spdlog::info("L2 cache (KiB): '{:10d}'\n", pi.m_nL2CacheSizeKb);
|
|
|
|
|
spdlog::info("L2 cache (Dsc): '{:#10x}'\n" , pi.m_nL2CacheDesc);
|
|
|
|
|
spdlog::info("L3 cache (KiB): '{:10d}'\n", pi.m_nL3CacheSizeKb);
|
|
|
|
|
spdlog::info("L3 cache (Dsc): '{:#10x}'\n" , pi.m_nL3CacheDesc);
|
|
|
|
|
spdlog::info("Clock speed (CPS): '{:10d}'\n", pi.m_Speed);
|
|
|
|
|
|
|
|
|
|
MEMORYSTATUSEX statex{};
|
|
|
|
|
statex.dwLength = sizeof(statex);
|
|
|
|
|
|
|
|
|
|
if (GlobalMemoryStatusEx(&statex))
|
|
|
|
|
{
|
|
|
|
|
spdlog::info("Total system memory (MiB): '{:10d}' ({:s})\n", (statex.ullTotalPhys / 1024) / 1024, "Physical");
|
|
|
|
|
spdlog::info("Avail system memory (MiB): '{:10d}' ({:s})\n", (statex.ullAvailPhys / 1024) / 1024, "Physical");
|
|
|
|
|
spdlog::info("Total system memory (MiB): '{:10d}' ({:s})\n", (statex.ullTotalVirtual / 1024) / 1024, "Virtual");
|
|
|
|
|
spdlog::info("Avail system memory (MiB): '{:10d}' ({:s})\n", (statex.ullAvailVirtual / 1024) / 1024, "Virtual");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
spdlog::error("Unable to retrieve system memory information: {:s}\n",
|
|
|
|
|
std::system_category().message(static_cast<int>(::GetLastError())));
|
|
|
|
|
}
|
2022-04-11 01:44:30 +02:00
|
|
|
|
}
|
2022-04-18 16:45:26 +02:00
|
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
|
void PrintHAddress() // Test the sigscan results
|
|
|
|
|
{
|
|
|
|
|
std::cout << "+----------------------------------------------------------------+" << std::endl;
|
2022-04-18 03:46:26 +02:00
|
|
|
|
for (IDetour* pDetour : vDetour)
|
2021-12-25 22:36:38 +01:00
|
|
|
|
{
|
2022-04-18 03:46:26 +02:00
|
|
|
|
pDetour->GetAdr();
|
2021-12-25 22:36:38 +01:00
|
|
|
|
}
|
|
|
|
|
}
|