Fix connect protocol

This commit is contained in:
momo5502 2016-10-03 01:36:18 +02:00
parent 7b230bf9d7
commit b3c0487797
6 changed files with 39 additions and 13 deletions

View File

@ -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() ConnectProtocol::ConnectProtocol()
{ {
// IPC handler // IPC handler
@ -202,13 +217,7 @@ namespace Components
}); });
// Invocation handler // Invocation handler
Renderer::Once([] () QuickPatch::Once(ConnectProtocol::Invocation);
{
if (ConnectProtocol::Used())
{
Command::Execute(fmt::sprintf("connect %s", ConnectProtocol::ConnectContainer.ConnectString.data()), false);
}
});
ConnectProtocol::InstallProtocol(); ConnectProtocol::InstallProtocol();
ConnectProtocol::EvaluateProtocol(); ConnectProtocol::EvaluateProtocol();
@ -225,7 +234,7 @@ namespace Components
else else
{ {
// Only skip intro here, invocation will be done later. // Only skip intro here, invocation will be done later.
Utils::Hook::Set<BYTE>(0x60BECF, 0xEB); //Utils::Hook::Set<BYTE>(0x60BECF, 0xEB);
} }
} }
} }

View File

@ -24,5 +24,7 @@ namespace Components
static void EvaluateProtocol(); static void EvaluateProtocol();
static bool InstallProtocol(); static bool InstallProtocol();
static void Invocation();
}; };
} }

View File

@ -223,9 +223,13 @@ namespace Components
void Dedicated::FrameStub() void Dedicated::FrameStub()
{ {
Dedicated::FrameSignal(); auto copy = Dedicated::FrameSignal;
Dedicated::FrameOnceSignal(); copy();
copy = Dedicated::FrameOnceSignal;
Dedicated::FrameOnceSignal.clear(); Dedicated::FrameOnceSignal.clear();
copy();
Utils::Hook::Call<void()>(0x5A8E80)(); Utils::Hook::Call<void()>(0x5A8E80)();
} }

View File

@ -21,9 +21,12 @@ namespace Components
void Renderer::FrameHandler() void Renderer::FrameHandler()
{ {
Renderer::FrameSignal(); auto copy = Renderer::FrameSignal;
Renderer::FrameOnceSignal(); copy();
copy = Renderer::FrameOnceSignal;
Renderer::FrameOnceSignal.clear(); Renderer::FrameOnceSignal.clear();
copy();
} }
__declspec(naked) void Renderer::BackendFrameStub() __declspec(naked) void Renderer::BackendFrameStub()

View File

@ -204,6 +204,8 @@ namespace Game
SV_DirectConnect_t SV_DirectConnect = (SV_DirectConnect_t)0x460480; SV_DirectConnect_t SV_DirectConnect = (SV_DirectConnect_t)0x460480;
Sys_FreeFileList_t Sys_FreeFileList = (Sys_FreeFileList_t)0x4D8580; 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_IsMainThread_t Sys_IsMainThread = (Sys_IsMainThread_t)0x4C37D0;
Sys_SendPacket_t Sys_SendPacket = (Sys_SendPacket_t)0x60FDC0; Sys_SendPacket_t Sys_SendPacket = (Sys_SendPacket_t)0x60FDC0;
Sys_ShowConsole_t Sys_ShowConsole = (Sys_ShowConsole_t)0x4305E0; Sys_ShowConsole_t Sys_ShowConsole = (Sys_ShowConsole_t)0x4305E0;

View File

@ -473,9 +473,15 @@ namespace Game
typedef void(__cdecl * SV_DirectConnect_t)(netadr_t adr); typedef void(__cdecl * SV_DirectConnect_t)(netadr_t adr);
extern SV_DirectConnect_t SV_DirectConnect; 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; 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)(); typedef bool(__cdecl * Sys_IsMainThread_t)();
extern Sys_IsMainThread_t Sys_IsMainThread; extern Sys_IsMainThread_t Sys_IsMainThread;