diff --git a/src/Components/Modules/AssetHandler.cpp b/src/Components/Modules/AssetHandler.cpp index cd507f14..aeb0a830 100644 --- a/src/Components/Modules/AssetHandler.cpp +++ b/src/Components/Modules/AssetHandler.cpp @@ -3,7 +3,7 @@ namespace Components { thread_local int AssetHandler::BypassState = 0; - bool AssetHandler::ShouldSearchTempAssets = false; + bool AssetHandler::ShouldSearchTempAssets = false; std::map AssetHandler::AssetInterfaces; std::map> AssetHandler::TypeCallbacks; Utils::Signal AssetHandler::RestrictSignal; @@ -70,20 +70,20 @@ namespace Components return header; } - Game::XAssetHeader AssetHandler::FindTemporaryAsset(Game::XAssetType type, const char* filename) - { - Game::XAssetHeader header = { nullptr }; - if (type >= Game::XAssetType::ASSET_TYPE_COUNT) return header; + Game::XAssetHeader AssetHandler::FindTemporaryAsset(Game::XAssetType type, const char* filename) + { + Game::XAssetHeader header = { nullptr }; + if (type >= Game::XAssetType::ASSET_TYPE_COUNT) return header; - auto tempPool = &AssetHandler::TemporaryAssets[type]; - auto entry = tempPool->find(filename); - if (entry != tempPool->end()) - { - header = { entry->second }; - } + auto tempPool = &AssetHandler::TemporaryAssets[type]; + auto entry = tempPool->find(filename); + if (entry != tempPool->end()) + { + header = { entry->second }; + } - return header; - } + return header; + } int AssetHandler::HasThreadBypass() { @@ -119,7 +119,6 @@ namespace Components push esi push edi - push eax pushad @@ -130,14 +129,12 @@ namespace Components popad pop eax - test al, al jnz checkTempAssets mov ecx, [esp + 18h] // Asset type mov ebx, [esp + 1Ch] // Filename - push eax pushad @@ -152,31 +149,30 @@ namespace Components popad pop eax + test eax, eax + jnz finishFound + + checkTempAssets: + mov al, AssetHandler::ShouldSearchTempAssets // check to see if enabled + test eax, eax + jz finishOriginal + + mov ecx, [esp + 18h] // Asset type + mov ebx, [esp + 1Ch] // Filename + + push ebx + push ecx + + call AssetHandler::FindTemporaryAsset + + add esp, 8h test eax, eax jnz finishFound - - checkTempAssets: - mov al, AssetHandler::ShouldSearchTempAssets // check to see if enabled - test eax, eax - jz finishOriginal - mov ecx, [esp + 18h] // Asset type - mov ebx, [esp + 1Ch] // Filename - - push ebx - push ecx - - call AssetHandler::FindTemporaryAsset - - add esp, 8h - - test eax, eax - jnz finishFound - - finishOriginal: + finishOriginal: // Asset not found using custom handlers or in temp assets or bypasses were enabled - // redirect to DB_FindXAssetHeader + // redirect to DB_FindXAssetHeader mov ebx, ds:6D7190h // InterlockedDecrement mov eax, 40793Bh jmp eax @@ -546,10 +542,10 @@ namespace Components for (int i = 0; i < vertexdecl->streamCount; i++) { routingData.push_back(json11::Json::object - { - { "source", (int)vertexdecl->routing.data[i].source }, - { "dest", (int)vertexdecl->routing.data[i].dest }, - }); + { + { "source", (int)vertexdecl->routing.data[i].source }, + { "dest", (int)vertexdecl->routing.data[i].dest }, + }); } std::vector declData; @@ -770,7 +766,7 @@ namespace Components Game::ReallocateAssetPool(Game::XAssetType::ASSET_TYPE_LEADERBOARD, 500); AssetHandler::RegisterInterface(new Assets::IFont_s()); - AssetHandler::RegisterInterface(new Assets::IWeapon()); + AssetHandler::RegisterInterface(new Assets::IWeapon()); AssetHandler::RegisterInterface(new Assets::IXModel()); AssetHandler::RegisterInterface(new Assets::IFxWorld()); AssetHandler::RegisterInterface(new Assets::IMapEnts()); @@ -781,9 +777,9 @@ namespace Components AssetHandler::RegisterInterface(new Assets::ISndCurve()); AssetHandler::RegisterInterface(new Assets::IMaterial()); AssetHandler::RegisterInterface(new Assets::IMenuList()); - AssetHandler::RegisterInterface(new Assets::IclipMap_t()); + AssetHandler::RegisterInterface(new Assets::IclipMap_t()); AssetHandler::RegisterInterface(new Assets::ImenuDef_t()); - AssetHandler::RegisterInterface(new Assets::ITracerDef()); + AssetHandler::RegisterInterface(new Assets::ITracerDef()); AssetHandler::RegisterInterface(new Assets::IPhysPreset()); AssetHandler::RegisterInterface(new Assets::IXAnimParts()); AssetHandler::RegisterInterface(new Assets::IFxEffectDef()); diff --git a/src/Components/Modules/AssetHandler.hpp b/src/Components/Modules/AssetHandler.hpp index 5207a0f7..5d0426b2 100644 --- a/src/Components/Modules/AssetHandler.hpp +++ b/src/Components/Modules/AssetHandler.hpp @@ -39,13 +39,13 @@ namespace Components static void ResetBypassState(); - static void ExposeTemporaryAssets(bool expose); + static void ExposeTemporaryAssets(bool expose); static void OffsetToAlias(Utils::Stream::Offset* offset); private: static thread_local int BypassState; - static bool ShouldSearchTempAssets; + static bool ShouldSearchTempAssets; static std::map TemporaryAssets[Game::XAssetType::ASSET_TYPE_COUNT]; @@ -60,7 +60,7 @@ namespace Components static void RegisterInterface(IAsset* iAsset); static Game::XAssetHeader FindAsset(Game::XAssetType type, const char* filename); - static Game::XAssetHeader FindTemporaryAsset(Game::XAssetType type, const char* filename); + static Game::XAssetHeader FindTemporaryAsset(Game::XAssetType type, const char* filename); static bool IsAssetEligible(Game::XAssetType type, Game::XAssetHeader* asset); static void FindAssetStub(); static void AddAssetStub();