diff options
| author | 2025-10-05 18:01:35 +0100 | |
|---|---|---|
| committer | 2025-10-05 18:36:46 +0100 | |
| commit | de2a003cd9041c3e711147a4fe3a96a5b0564842 (patch) | |
| tree | 91d9c5ecc401edd4668322326a5a37882de3c036 | |
| parent | b3c359826ae519ea2816128dfe641032b9e9e97f (diff) | |
| download | sst-de2a003cd9041c3e711147a4fe3a96a5b0564842.tar.gz sst-de2a003cd9041c3e711147a4fe3a96a5b0564842.zip | |
Fix deferred init in OE
Not really sure what was going on here. This is just a workaround,
really, but it works well enough for the time being.
| -rw-r--r-- | gamedata/engine.txt | 9 | ||||
| -rw-r--r-- | src/sst.c | 15 |
2 files changed, 17 insertions, 7 deletions
diff --git a/gamedata/engine.txt b/gamedata/engine.txt index f13a63a..511bcec 100644 --- a/gamedata/engine.txt +++ b/gamedata/engine.txt @@ -151,11 +151,10 @@ vtidx_GetPanel NVDTOR vtidx_VGuiConnect 3 + NVDTOR L4Dbased 4 + NVDTOR # ActivateGameUI added L4DS 5 + NVDTOR # some other crap added, god knows -vtidx_VGuiIsInitialized 6 + NVDTOR # this is also just called IsInitialized() - L4Dbased 7 + NVDTOR - L4DS 8 + NVDTOR - OE 5 + NVDTOR - #DMoMM 10 + NVDTOR # untested, can't remember where I got this... +vtidx_VGuiIsInitialized # this is also just called IsInitialized() + NE 6 + NVDTOR + L4Dbased 7 + NVDTOR + L4DS 8 + NVDTOR # CDedicatedServerAPI vtidx_RunFrame 7 @@ -395,8 +395,19 @@ static bool deferinit() { // Arbitrary check to infer whether we've been early- or late-loaded. // We used to just see whether gameui.dll/libgameui.so was loaded, but // Portal 2 does away with the separate gameui library, so now we just call - // CEngineVGui::IsInitialized() which works everywhere. - if (VGuiIsInitialized(vgui)) return false; + // CEngineVGui::IsInitialized() which works everywhere on NE. On OE (Windows + // only), we still do the GameUI check, because I was struggling to get the + // vgui check to work consistently (maybe I just had the wrong vtable index + // for IsInitialized?). TODO(opt): I guess it would be faster to do the + // virtual call if we can figure out how to make it work... + if_hot (has_vtidx_VGuiIsInitialized) { + if (VGuiIsInitialized(vgui)) return false; + } +#ifdef _WIN32 + else { + if (GetModuleHandleW(L"GameUI.dll")) return false; + } +#endif sst_earlyloaded = true; // let other code know if_cold (!os_mprot(vgui->vtable + vtidx_VGuiConnect, ssizeof(void *), PAGE_READWRITE)) { |
