From 4adbd9cfa6a7e9b7a5845e0611c19e3adc5809d2 Mon Sep 17 00:00:00 2001 From: jvnipers Date: Tue, 24 Nov 2026 04:27:00 +0200 Subject: [PATCH 1/2] migrate to s2sdk --- .github/workflows/build.yml | 2 +- extension.cpp | 8 ++------ extension.h | 4 +++- premake/mm-linux.lua | 4 +++- premake/mm-windows.lua | 4 +++- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f60e05c..c9048dd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,7 +41,7 @@ jobs: - name: Checkout HL2SDK uses: actions/checkout@v7 with: - repository: alliedmodders/hl2sdk + repository: alliedmodders/s2sdk ref: cs2 path: hl2sdk-cs2 diff --git a/extension.cpp b/extension.cpp index c99c5b8..7a4661b 100644 --- a/extension.cpp +++ b/extension.cpp @@ -54,11 +54,6 @@ char dumpStoragePath[512]; std::string g_serverId; std::string g_UserId; -CGameEntitySystem *GameEntitySystem() -{ - return nullptr; -} - class GameSessionConfiguration_t { }; #if defined _LINUX KHook::Virtual gameFrameHook(&IServerGameDLL::GameFrame, &g_AcceleratorCS2, nullptr, &AcceleratorCS2::GameFrame); @@ -544,7 +539,8 @@ KHook::Return AcceleratorCS2::GameFrame(IServerGameDLL* pThis, bool simula KHook::Return AcceleratorCS2::StartupServer(INetworkServerService* pThis, const GameSessionConfiguration_t& config, ISource2WorldSession*, const char*) { - strncpy(crashMap, g_pNetworkServerService->GetIGameServer()->GetMapName(), sizeof(crashMap) - 1); + auto *server = reinterpret_cast(g_pNetworkServerService->GetIGameServer()); + strncpy(crashMap, server->GetMapName(), sizeof(crashMap) - 1); return {KHook::Action::Ignore}; } diff --git a/extension.h b/extension.h index 8d6bbe3..9a383f0 100644 --- a/extension.h +++ b/extension.h @@ -2,7 +2,9 @@ #include "khook.hpp" #include #include -#include +#include +#include +#include class AcceleratorCS2 : public ISmmPlugin, public IMetamodListener { diff --git a/premake/mm-linux.lua b/premake/mm-linux.lua index 6c9968b..8bf87e0 100644 --- a/premake/mm-linux.lua +++ b/premake/mm-linux.lua @@ -1,8 +1,10 @@ files { path.join(SDK_PATH, "public", "tier0", "memoverride.cpp"), - path.join(SDK_PATH, "tier1", "convar.cpp"), + path.join(SDK_PATH, "tier0_perproject", "convar.cpp"), path.join(SDK_PATH, "entity2", "entityidentity.cpp"), path.join(SDK_PATH, "entity2", "entitysystem.cpp"), + path.join(SDK_PATH, "entity2", "entitykeyvalues.cpp"), + path.join(SDK_PATH, "tier0_perproject", "keyvalues3.cpp"), } libdirs { diff --git a/premake/mm-windows.lua b/premake/mm-windows.lua index 911b33b..5f1aaec 100644 --- a/premake/mm-windows.lua +++ b/premake/mm-windows.lua @@ -1,7 +1,9 @@ files { - path.join(SDK_PATH, "tier1", "convar.cpp"), + path.join(SDK_PATH, "tier0_perproject", "convar.cpp"), path.join(SDK_PATH, "entity2", "entityidentity.cpp"), path.join(SDK_PATH, "entity2", "entitysystem.cpp"), + path.join(SDK_PATH, "entity2", "entitykeyvalues.cpp"), + path.join(SDK_PATH, "tier0_perproject", "keyvalues3.cpp"), } links { From d7adfd55a3590e132324b32a254589326b008a72 Mon Sep 17 00:00:00 2001 From: Vauff Date: Tue, 24 Nov 2026 21:22:16 -0500 Subject: [PATCH 2/2] lil more cleanup --- .github/workflows/build.yml | 2 +- extension.cpp | 8 +++----- extension.h | 3 +-- premake/mm-linux.lua | 8 -------- premake/mm-windows.lua | 8 -------- 5 files changed, 5 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c9048dd..31a8850 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,7 +38,7 @@ jobs: path: mmsource-2.0 submodules: recursive - - name: Checkout HL2SDK + - name: Checkout s2sdk uses: actions/checkout@v7 with: repository: alliedmodders/s2sdk diff --git a/extension.cpp b/extension.cpp index 7a4661b..6f0704b 100644 --- a/extension.cpp +++ b/extension.cpp @@ -37,7 +37,6 @@ #include #include -#include #if defined WIN32 #include #endif @@ -475,7 +474,7 @@ bool AcceleratorCS2::Load(PluginId id, ISmmAPI* ismm, char* error, size_t maxlen strncpy(crashCommandLine, CommandLine()->GetCmdLine(), sizeof(crashCommandLine) - 1); if (late) - StartupServer(nullptr, {}, nullptr, nullptr); + StartupServer(nullptr, {}, nullptr, ""); LoadServerId(); LoadConfig(); @@ -537,10 +536,9 @@ KHook::Return AcceleratorCS2::GameFrame(IServerGameDLL* pThis, bool simula #endif -KHook::Return AcceleratorCS2::StartupServer(INetworkServerService* pThis, const GameSessionConfiguration_t& config, ISource2WorldSession*, const char*) +KHook::Return AcceleratorCS2::StartupServer(INetworkServerService* pThis, const GameSessionConfiguration_t& config, ISource2WorldSession*, const char* pszMapName) { - auto *server = reinterpret_cast(g_pNetworkServerService->GetIGameServer()); - strncpy(crashMap, server->GetMapName(), sizeof(crashMap) - 1); + strncpy(crashMap, pszMapName, sizeof(crashMap) - 1); return {KHook::Action::Ignore}; } diff --git a/extension.h b/extension.h index 9a383f0..2130d2e 100644 --- a/extension.h +++ b/extension.h @@ -4,7 +4,6 @@ #include #include #include -#include class AcceleratorCS2 : public ISmmPlugin, public IMetamodListener { @@ -22,5 +21,5 @@ class AcceleratorCS2 : public ISmmPlugin, public IMetamodListener const char* GetLogTag(); public: // Hooks KHook::Return GameFrame(IServerGameDLL* pThis, bool simulating, bool bFirstTick, bool bLastTick); - KHook::Return StartupServer(INetworkServerService* pThis, const GameSessionConfiguration_t& config, ISource2WorldSession*, const char*); + KHook::Return StartupServer(INetworkServerService* pThis, const GameSessionConfiguration_t& config, ISource2WorldSession*, const char* pszMapName); }; \ No newline at end of file diff --git a/premake/mm-linux.lua b/premake/mm-linux.lua index 8bf87e0..a3aa484 100644 --- a/premake/mm-linux.lua +++ b/premake/mm-linux.lua @@ -1,10 +1,6 @@ files { path.join(SDK_PATH, "public", "tier0", "memoverride.cpp"), path.join(SDK_PATH, "tier0_perproject", "convar.cpp"), - path.join(SDK_PATH, "entity2", "entityidentity.cpp"), - path.join(SDK_PATH, "entity2", "entitysystem.cpp"), - path.join(SDK_PATH, "entity2", "entitykeyvalues.cpp"), - path.join(SDK_PATH, "tier0_perproject", "keyvalues3.cpp"), } libdirs { @@ -24,14 +20,10 @@ includedirs { path.join(SDK_PATH, "thirdparty", "protobuf-3.21.8", "src"), path.join(SDK_PATH, "common"), path.join(SDK_PATH, "game", "shared"), - path.join(SDK_PATH, "game", "server"), path.join(SDK_PATH, "public"), - path.join(SDK_PATH, "public", "engine"), path.join(SDK_PATH, "public", "mathlib"), path.join(SDK_PATH, "public", "tier0"), - path.join(SDK_PATH, "public", "tier1"), path.join(SDK_PATH, "public", "entity2"), - path.join(SDK_PATH, "public", "public", "entity2"), -- metamod path.join(MM_PATH, "core"), path.join(MM_PATH, "third_party", "khook", "include"), diff --git a/premake/mm-windows.lua b/premake/mm-windows.lua index 5f1aaec..de7ea68 100644 --- a/premake/mm-windows.lua +++ b/premake/mm-windows.lua @@ -1,9 +1,5 @@ files { path.join(SDK_PATH, "tier0_perproject", "convar.cpp"), - path.join(SDK_PATH, "entity2", "entityidentity.cpp"), - path.join(SDK_PATH, "entity2", "entitysystem.cpp"), - path.join(SDK_PATH, "entity2", "entitykeyvalues.cpp"), - path.join(SDK_PATH, "tier0_perproject", "keyvalues3.cpp"), } links { @@ -19,14 +15,10 @@ includedirs { path.join(SDK_PATH, "thirdparty", "protobuf-3.21.8", "src"), path.join(SDK_PATH, "common"), path.join(SDK_PATH, "game", "shared"), - path.join(SDK_PATH, "game", "server"), path.join(SDK_PATH, "public"), - path.join(SDK_PATH, "public", "engine"), path.join(SDK_PATH, "public", "mathlib"), path.join(SDK_PATH, "public", "tier0"), - path.join(SDK_PATH, "public", "tier1"), path.join(SDK_PATH, "public", "entity2"), - path.join(SDK_PATH, "public", "public", "entity2"), -- metamod path.join(MM_PATH, "core"), path.join(MM_PATH, "third_party", "khook", "include"),