diff --git a/src/Components/Modules/ConnectProtocol.cpp b/src/Components/Modules/ConnectProtocol.cpp index d1f0719e..80936761 100644 --- a/src/Components/Modules/ConnectProtocol.cpp +++ b/src/Components/Modules/ConnectProtocol.cpp @@ -193,6 +193,21 @@ namespace Components } } + void ConnectProtocol::Invocation() + { + if (ConnectProtocol::Used()) + { + if (!Game::Sys_IsDatabaseReady() && !Game::Sys_IsDatabaseReady2()) + { + QuickPatch::Once(ConnectProtocol::Invocation); + } + else + { + Command::Execute(fmt::sprintf("connect %s", ConnectProtocol::ConnectContainer.ConnectString.data()), false); + } + } + } + ConnectProtocol::ConnectProtocol() { // IPC handler @@ -202,13 +217,7 @@ namespace Components }); // Invocation handler - Renderer::Once([] () - { - if (ConnectProtocol::Used()) - { - Command::Execute(fmt::sprintf("connect %s", ConnectProtocol::ConnectContainer.ConnectString.data()), false); - } - }); + QuickPatch::Once(ConnectProtocol::Invocation); ConnectProtocol::InstallProtocol(); ConnectProtocol::EvaluateProtocol(); @@ -225,7 +234,7 @@ namespace Components else { // Only skip intro here, invocation will be done later. - Utils::Hook::Set(0x60BECF, 0xEB); + //Utils::Hook::Set(0x60BECF, 0xEB); } } } diff --git a/src/Components/Modules/ConnectProtocol.hpp b/src/Components/Modules/ConnectProtocol.hpp index dc463328..7489f628 100644 --- a/src/Components/Modules/ConnectProtocol.hpp +++ b/src/Components/Modules/ConnectProtocol.hpp @@ -24,5 +24,7 @@ namespace Components static void EvaluateProtocol(); static bool InstallProtocol(); + + static void Invocation(); }; } diff --git a/src/Components/Modules/Dedicated.cpp b/src/Components/Modules/Dedicated.cpp index 4e980637..6d95692a 100644 --- a/src/Components/Modules/Dedicated.cpp +++ b/src/Components/Modules/Dedicated.cpp @@ -223,9 +223,13 @@ namespace Components void Dedicated::FrameStub() { - Dedicated::FrameSignal(); - Dedicated::FrameOnceSignal(); + auto copy = Dedicated::FrameSignal; + copy(); + + copy = Dedicated::FrameOnceSignal; Dedicated::FrameOnceSignal.clear(); + copy(); + Utils::Hook::Call(0x5A8E80)(); } diff --git a/src/Components/Modules/Renderer.cpp b/src/Components/Modules/Renderer.cpp index 424e72a1..a8722ba6 100644 --- a/src/Components/Modules/Renderer.cpp +++ b/src/Components/Modules/Renderer.cpp @@ -21,9 +21,12 @@ namespace Components void Renderer::FrameHandler() { - Renderer::FrameSignal(); - Renderer::FrameOnceSignal(); + auto copy = Renderer::FrameSignal; + copy(); + + copy = Renderer::FrameOnceSignal; Renderer::FrameOnceSignal.clear(); + copy(); } __declspec(naked) void Renderer::BackendFrameStub() diff --git a/src/Game/Functions.cpp b/src/Game/Functions.cpp index 8241cb8f..c93f361e 100644 --- a/src/Game/Functions.cpp +++ b/src/Game/Functions.cpp @@ -204,6 +204,8 @@ namespace Game SV_DirectConnect_t SV_DirectConnect = (SV_DirectConnect_t)0x460480; Sys_FreeFileList_t Sys_FreeFileList = (Sys_FreeFileList_t)0x4D8580; + Sys_IsDatabaseReady_t Sys_IsDatabaseReady = (Sys_IsDatabaseReady_t)0x4CA4A0; + Sys_IsDatabaseReady2_t Sys_IsDatabaseReady2 = (Sys_IsDatabaseReady2_t)0x441280; Sys_IsMainThread_t Sys_IsMainThread = (Sys_IsMainThread_t)0x4C37D0; Sys_SendPacket_t Sys_SendPacket = (Sys_SendPacket_t)0x60FDC0; Sys_ShowConsole_t Sys_ShowConsole = (Sys_ShowConsole_t)0x4305E0; diff --git a/src/Game/Functions.hpp b/src/Game/Functions.hpp index 5c4f8314..66d90559 100644 --- a/src/Game/Functions.hpp +++ b/src/Game/Functions.hpp @@ -473,9 +473,15 @@ namespace Game typedef void(__cdecl * SV_DirectConnect_t)(netadr_t adr); extern SV_DirectConnect_t SV_DirectConnect; - typedef FS_FreeFileList_t Sys_FreeFileList_t; + typedef void(__cdecl * Sys_FreeFileList_t)(char** list); extern Sys_FreeFileList_t Sys_FreeFileList; + typedef bool(__cdecl * Sys_IsDatabaseReady_t)(); + extern Sys_IsDatabaseReady_t Sys_IsDatabaseReady; + + typedef bool(__cdecl * Sys_IsDatabaseReady2_t)(); + extern Sys_IsDatabaseReady2_t Sys_IsDatabaseReady2; + typedef bool(__cdecl * Sys_IsMainThread_t)(); extern Sys_IsMainThread_t Sys_IsMainThread;