[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!
This commit is contained in:
momo5502 2017-05-27 19:22:56 +02:00
parent 8076deeb91
commit 692c80bf98

View File

@ -269,17 +269,19 @@ namespace Components
Game::G_GlassData* Maps::GetWorldData() Game::G_GlassData* Maps::GetWorldData()
{ {
Logger::Print("Waiting for database...\n"); Game::G_GlassData** dataPtr;
while (!Game::Sys_IsDatabaseReady()) std::this_thread::sleep_for(100ms);
if (!Utils::String::StartsWith(Maps::CurrentMainZone, "mp_") || Maps::SPMap) 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 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() __declspec(naked) void Maps::GetWorldDataStub()