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()
{
// 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<BYTE>(0x60BECF, 0xEB);
//Utils::Hook::Set<BYTE>(0x60BECF, 0xEB);
}
}
}

View File

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

View File

@ -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<void()>(0x5A8E80)();
}

View File

@ -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()

View File

@ -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;

View File

@ -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;