openvibers/source.openvibe.games Commits

Fix Windows server stub PCH include order

CO Copilot committed 29 Jun 2026 · 6cfef2fe8a · 5 files, +19 −12


Changes

ddiff --git a/docs/WINDOWS_SERVER_STUB_PCH_ORDER.md b/docs/WINDOWS_SERVER_STUB_PCH_ORDER.md
nnew file mode 100644
iindex 0000000..fd73332
---- /dev/null
++++ b/docs/WINDOWS_SERVER_STUB_PCH_ORDER.md
@@@ -0,0 +1,15 @@
++# Windows server stub PCH order
++
++Source SDK server projects compile with MSVC precompiled headers using `/Yu cbase.h`.
++MSVC ignores/skips text before the configured PCH include, so the Windows server
++QuickJS stub wrapper cannot put `#if ...` before `#include "cbase.h"`.
++
++The stubbed OpenVibe server `.cpp` files must start with:
++
++```cpp
++#include "cbase.h"
++// OPENVIBE_WINDOWS_SERVER_QUICKJS_STUB
++#if defined(_WIN32) && defined(GAME_DLL) && !defined(OPENVIBE_WINDOWS_SERVER_REAL_QUICKJS)
++```
++
++The non-stub branch must not re-include `cbase.h` immediately after `#else`.
ddiff --git a/sdk/openvibe/server/hl2mp/openvibe_js_server.cpp b/sdk/openvibe/server/hl2mp/openvibe_js_server.cpp
iindex 370532e..ac62d93 100644
---- a/sdk/openvibe/server/hl2mp/openvibe_js_server.cpp
++++ b/sdk/openvibe/server/hl2mp/openvibe_js_server.cpp
@@@ -1,7 +1,6 @@
++#include "cbase.h"
// OPENVIBE_WINDOWS_SERVER_QUICKJS_STUB
#if defined(_WIN32) && defined(GAME_DLL) && !defined(OPENVIBE_WINDOWS_SERVER_REAL_QUICKJS)
--
--#include "cbase.h"
#include "hl2mp_player.h"
#include "openvibe_js_server.h"
@@@ -82,7 +81,6 @@ static ConCommand ov_js_cmd(
FCVAR_GAMEDLL
);
#else
--#include "cbase.h"
#include "hl2mp_player.h"
#include "openvibe_js_server.h"
#include "openvibe/ov_js_runtime.h"
ddiff --git a/sdk/openvibe/shared/ov_js_bindings.cpp b/sdk/openvibe/shared/ov_js_bindings.cpp
iindex d35a4fc..7a7e6ba 100644
---- a/sdk/openvibe/shared/ov_js_bindings.cpp
++++ b/sdk/openvibe/shared/ov_js_bindings.cpp
@@@ -1,14 +1,12 @@
++#include "cbase.h"
// OPENVIBE_WINDOWS_SERVER_QUICKJS_STUB
#if defined(_WIN32) && defined(GAME_DLL) && !defined(OPENVIBE_WINDOWS_SERVER_REAL_QUICKJS)
--
--#include "cbase.h"
#include "ov_js_bindings.h"
#include "tier0/memdbgon.h"
void OVJS_RegisterNativeBindings(JSContext *ctx, COpenVibeJSRuntime *runtime) {}
#else
--#include "cbase.h"
#include "ov_js_bindings.h"
#include "ov_js_runtime.h"
#include "ov_js_player.h"
ddiff --git a/sdk/openvibe/shared/ov_js_player.cpp b/sdk/openvibe/shared/ov_js_player.cpp
iindex 930e771..e9aba57 100644
---- a/sdk/openvibe/shared/ov_js_player.cpp
++++ b/sdk/openvibe/shared/ov_js_player.cpp
@@@ -1,7 +1,6 @@
++#include "cbase.h"
// OPENVIBE_WINDOWS_SERVER_QUICKJS_STUB
#if defined(_WIN32) && defined(GAME_DLL) && !defined(OPENVIBE_WINDOWS_SERVER_REAL_QUICKJS)
--
--#include "cbase.h"
#include "ov_js_player.h"
#include "hl2mp_player.h"
@@@ -12,7 +11,6 @@ JSValue OVJS_NewPlayer(JSContext *ctx, CHL2MP_Player *player) { return JS_NULL;
CHL2MP_Player *OVJS_ResolvePlayerByUserId(int userId) { return nullptr; }
CHL2MP_Player *OVJS_GetPlayerFromThis(JSContext *ctx, JSValueConst thisVal) { return nullptr; }
#else
--#include "cbase.h"
#include "hl2mp_player.h"
#include "player.h"
#include "util.h"
ddiff --git a/sdk/openvibe/shared/ov_js_runtime.cpp b/sdk/openvibe/shared/ov_js_runtime.cpp
iindex 64b3484..112452e 100644
---- a/sdk/openvibe/shared/ov_js_runtime.cpp
++++ b/sdk/openvibe/shared/ov_js_runtime.cpp
@@@ -1,7 +1,6 @@
++#include "cbase.h"
// OPENVIBE_WINDOWS_SERVER_QUICKJS_STUB
#if defined(_WIN32) && defined(GAME_DLL) && !defined(OPENVIBE_WINDOWS_SERVER_REAL_QUICKJS)
--
--#include "cbase.h"
#include "ov_js_runtime.h"
#include "tier0/memdbgon.h"
@@@ -28,7 +27,6 @@ bool COpenVibeJSRuntime::CallHookBool(const char *pszHookName, bool *pOut, int a
return false;
}
#else
--#include "cbase.h"
#include "filesystem.h"
#include "ov_js_runtime.h"
#include "ov_js_bindings.h"