From 5f20366bf799fa9d6550079703364666c1ac524e Mon Sep 17 00:00:00 2001 From: momo5502 Date: Wed, 11 Jan 2017 19:38:17 +0100 Subject: [PATCH] [FileSystem] Synchronize filesystem start --- src/Components/Modules/FileSystem.cpp | 12 +++++++++++- src/Components/Modules/FileSystem.hpp | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Components/Modules/FileSystem.cpp b/src/Components/Modules/FileSystem.cpp index 332ff343..ece19bdd 100644 --- a/src/Components/Modules/FileSystem.cpp +++ b/src/Components/Modules/FileSystem.cpp @@ -254,6 +254,12 @@ namespace Components return !File(execFilename).exists(); } + void FileSystem::FsStartupSync(const char* a1) + { + std::lock_guard _(FileSystem::FSMutex); + return Utils::Hook::Call(0x4823A0)(a1); // FS_Startup + } + void FileSystem::FsRestartSync(int a1, int a2) { std::lock_guard _(FileSystem::FSMutex); @@ -297,10 +303,14 @@ namespace Components // Ignore bad magic, when trying to free hunk when it's already cleared Utils::Hook::Set(0x49AACE, 0xC35E); + // Synchronize filesystem starts + Utils::Hook(0x4290C6, FileSystem::FsStartupSync, HOOK_CALL).install()->quick(); // FS_InitFilesystem + Utils::Hook(0x461A88, FileSystem::FsStartupSync, HOOK_CALL).install()->quick(); // FS_Restart + // Synchronize filesystem restarts Utils::Hook(0x4A745B, FileSystem::FsRestartSync, HOOK_CALL).install()->quick(); // SV_SpawnServer Utils::Hook(0x4C8609, FileSystem::FsRestartSync, HOOK_CALL).install()->quick(); // FS_ConditionalRestart - Utils::Hook(0x5AC68E, FileSystem::FsRestartSync, HOOK_CALL).install()->quick(); + Utils::Hook(0x5AC68E, FileSystem::FsRestartSync, HOOK_CALL).install()->quick(); // CL_ParseServerMessage // Synchronize db image loading Utils::Hook(0x415AB8, FileSystem::DelayLoadImagesSync, HOOK_CALL).install()->quick(); diff --git a/src/Components/Modules/FileSystem.hpp b/src/Components/Modules/FileSystem.hpp index c2db0827..eab27b02 100644 --- a/src/Components/Modules/FileSystem.hpp +++ b/src/Components/Modules/FileSystem.hpp @@ -109,6 +109,7 @@ namespace Components static void StartupStub(); static int ExecIsFSStub(const char* execFilename); + static void FsStartupSync(const char* a1); static void FsRestartSync(int a1, int a2); static void DelayLoadImagesSync(); static int LoadTextureSync(Game::GfxImageLoadDef **loadDef, Game::GfxImage *image);