From 692c80bf9829b45321dab72ef66bdc8db96ef1d9 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Sat, 27 May 2017 19:22:56 +0200 Subject: [PATCH] [Maps] Don't wait for the entire database, just glass data This actually allows the thread to continue and this 'fixes' the material crash for custom maps. The Material_Sort function requires something our thread seems to compute. I haven't had a deep look into it, as for now this fix works, but for the future, a real fix is needed! --- src/Components/Modules/Maps.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Components/Modules/Maps.cpp b/src/Components/Modules/Maps.cpp index 1a721485..3b390ee5 100644 --- a/src/Components/Modules/Maps.cpp +++ b/src/Components/Modules/Maps.cpp @@ -269,17 +269,19 @@ namespace Components Game::G_GlassData* Maps::GetWorldData() { - Logger::Print("Waiting for database...\n"); - while (!Game::Sys_IsDatabaseReady()) std::this_thread::sleep_for(100ms); - + Game::G_GlassData** dataPtr; if (!Utils::String::StartsWith(Maps::CurrentMainZone, "mp_") || Maps::SPMap) { - return Game::DB_XAssetPool[Game::XAssetType::ASSET_TYPE_GAMEWORLD_SP].gameWorldSp[0].data; + dataPtr = &Game::DB_XAssetPool[Game::XAssetType::ASSET_TYPE_GAMEWORLD_SP].gameWorldSp[0].data; } else { - return Game::DB_XAssetPool[Game::XAssetType::ASSET_TYPE_GAMEWORLD_MP].gameWorldMp[0].data; + dataPtr = &Game::DB_XAssetPool[Game::XAssetType::ASSET_TYPE_GAMEWORLD_MP].gameWorldMp[0].data; } + + Logger::Print("Waiting for database...\n"); + while(!*dataPtr) std::this_thread::sleep_for(1ms); + return *dataPtr; } __declspec(naked) void Maps::GetWorldDataStub()