[FileSystem] Correctly free iwds

This commit is contained in:
Maurice Heumann 2019-12-26 13:24:48 +01:00
parent bab063a974
commit 6b3ff8fd00
2 changed files with 13 additions and 0 deletions

View File

@ -263,10 +263,18 @@ namespace Components
void FileSystem::FsRestartSync(int a1, int a2)
{
std::lock_guard<std::recursive_mutex> _(FileSystem::FSMutex);
Maps::GetUserMap()->freeIwd();
Utils::Hook::Call<void(int, int)>(0x461A50)(a1, a2); // FS_Restart
Maps::GetUserMap()->reloadIwd();
}
void FileSystem::FsShutdownSync(int a1)
{
std::lock_guard<std::recursive_mutex> _(FileSystem::FSMutex);
Maps::GetUserMap()->freeIwd();
Utils::Hook::Call<void(int)>(0x4A46C0)(a1); // FS_Shutdown
}
void FileSystem::DelayLoadImagesSync()
{
std::lock_guard<std::recursive_mutex> _(FileSystem::FSMutex);
@ -322,6 +330,10 @@ namespace Components
Utils::Hook(0x4C8609, FileSystem::FsRestartSync, HOOK_CALL).install()->quick(); // FS_ConditionalRestart
Utils::Hook(0x5AC68E, FileSystem::FsRestartSync, HOOK_CALL).install()->quick(); // CL_ParseServerMessage
// Synchronize filesystem stops
Utils::Hook(0x461A55, FileSystem::FsShutdownSync, HOOK_CALL).install()->quick(); // FS_Restart
Utils::Hook(0x4D40DB, FileSystem::FsShutdownSync, HOOK_CALL).install()->quick(); // Com_Quitf
// Synchronize db image loading
Utils::Hook(0x415AB8, FileSystem::DelayLoadImagesSync, HOOK_CALL).install()->quick();
Utils::Hook(0x4D32BC, FileSystem::LoadTextureSync, HOOK_CALL).install()->quick();

View File

@ -109,6 +109,7 @@ namespace Components
static void FsStartupSync(const char* a1);
static void FsRestartSync(int a1, int a2);
static void FsShutdownSync(int a1);
static void DelayLoadImagesSync();
static int LoadTextureSync(Game::GfxImageLoadDef **loadDef, Game::GfxImage *image);