Merge pull request #180 from diamante0018/indentation

[AssetHandler] Fix indentation
This commit is contained in:
Dss0 2022-01-29 17:25:39 +01:00 committed by GitHub
commit cba376a4dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 46 deletions

View File

@ -3,7 +3,7 @@
namespace Components namespace Components
{ {
thread_local int AssetHandler::BypassState = 0; thread_local int AssetHandler::BypassState = 0;
bool AssetHandler::ShouldSearchTempAssets = false; bool AssetHandler::ShouldSearchTempAssets = false;
std::map<Game::XAssetType, AssetHandler::IAsset*> AssetHandler::AssetInterfaces; std::map<Game::XAssetType, AssetHandler::IAsset*> AssetHandler::AssetInterfaces;
std::map<Game::XAssetType, Utils::Slot<AssetHandler::Callback>> AssetHandler::TypeCallbacks; std::map<Game::XAssetType, Utils::Slot<AssetHandler::Callback>> AssetHandler::TypeCallbacks;
Utils::Signal<AssetHandler::RestrictCallback> AssetHandler::RestrictSignal; Utils::Signal<AssetHandler::RestrictCallback> AssetHandler::RestrictSignal;
@ -70,20 +70,20 @@ namespace Components
return header; return header;
} }
Game::XAssetHeader AssetHandler::FindTemporaryAsset(Game::XAssetType type, const char* filename) Game::XAssetHeader AssetHandler::FindTemporaryAsset(Game::XAssetType type, const char* filename)
{ {
Game::XAssetHeader header = { nullptr }; Game::XAssetHeader header = { nullptr };
if (type >= Game::XAssetType::ASSET_TYPE_COUNT) return header; if (type >= Game::XAssetType::ASSET_TYPE_COUNT) return header;
auto tempPool = &AssetHandler::TemporaryAssets[type]; auto tempPool = &AssetHandler::TemporaryAssets[type];
auto entry = tempPool->find(filename); auto entry = tempPool->find(filename);
if (entry != tempPool->end()) if (entry != tempPool->end())
{ {
header = { entry->second }; header = { entry->second };
} }
return header; return header;
} }
int AssetHandler::HasThreadBypass() int AssetHandler::HasThreadBypass()
{ {
@ -119,7 +119,6 @@ namespace Components
push esi push esi
push edi push edi
push eax push eax
pushad pushad
@ -130,14 +129,12 @@ namespace Components
popad popad
pop eax pop eax
test al, al test al, al
jnz checkTempAssets jnz checkTempAssets
mov ecx, [esp + 18h] // Asset type mov ecx, [esp + 18h] // Asset type
mov ebx, [esp + 1Ch] // Filename mov ebx, [esp + 1Ch] // Filename
push eax push eax
pushad pushad
@ -152,31 +149,30 @@ namespace Components
popad popad
pop eax 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 test eax, eax
jnz finishFound jnz finishFound
checkTempAssets:
mov al, AssetHandler::ShouldSearchTempAssets // check to see if enabled
test eax, eax
jz finishOriginal
mov ecx, [esp + 18h] // Asset type finishOriginal:
mov ebx, [esp + 1Ch] // Filename
push ebx
push ecx
call AssetHandler::FindTemporaryAsset
add esp, 8h
test eax, eax
jnz finishFound
finishOriginal:
// Asset not found using custom handlers or in temp assets or bypasses were enabled // 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 ebx, ds:6D7190h // InterlockedDecrement
mov eax, 40793Bh mov eax, 40793Bh
jmp eax jmp eax
@ -546,10 +542,10 @@ namespace Components
for (int i = 0; i < vertexdecl->streamCount; i++) for (int i = 0; i < vertexdecl->streamCount; i++)
{ {
routingData.push_back(json11::Json::object routingData.push_back(json11::Json::object
{ {
{ "source", (int)vertexdecl->routing.data[i].source }, { "source", (int)vertexdecl->routing.data[i].source },
{ "dest", (int)vertexdecl->routing.data[i].dest }, { "dest", (int)vertexdecl->routing.data[i].dest },
}); });
} }
std::vector<json11::Json> declData; std::vector<json11::Json> declData;
@ -770,7 +766,7 @@ namespace Components
Game::ReallocateAssetPool(Game::XAssetType::ASSET_TYPE_LEADERBOARD, 500); Game::ReallocateAssetPool(Game::XAssetType::ASSET_TYPE_LEADERBOARD, 500);
AssetHandler::RegisterInterface(new Assets::IFont_s()); 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::IXModel());
AssetHandler::RegisterInterface(new Assets::IFxWorld()); AssetHandler::RegisterInterface(new Assets::IFxWorld());
AssetHandler::RegisterInterface(new Assets::IMapEnts()); AssetHandler::RegisterInterface(new Assets::IMapEnts());
@ -781,9 +777,9 @@ namespace Components
AssetHandler::RegisterInterface(new Assets::ISndCurve()); AssetHandler::RegisterInterface(new Assets::ISndCurve());
AssetHandler::RegisterInterface(new Assets::IMaterial()); AssetHandler::RegisterInterface(new Assets::IMaterial());
AssetHandler::RegisterInterface(new Assets::IMenuList()); 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::ImenuDef_t());
AssetHandler::RegisterInterface(new Assets::ITracerDef()); AssetHandler::RegisterInterface(new Assets::ITracerDef());
AssetHandler::RegisterInterface(new Assets::IPhysPreset()); AssetHandler::RegisterInterface(new Assets::IPhysPreset());
AssetHandler::RegisterInterface(new Assets::IXAnimParts()); AssetHandler::RegisterInterface(new Assets::IXAnimParts());
AssetHandler::RegisterInterface(new Assets::IFxEffectDef()); AssetHandler::RegisterInterface(new Assets::IFxEffectDef());

View File

@ -39,13 +39,13 @@ namespace Components
static void ResetBypassState(); static void ResetBypassState();
static void ExposeTemporaryAssets(bool expose); static void ExposeTemporaryAssets(bool expose);
static void OffsetToAlias(Utils::Stream::Offset* offset); static void OffsetToAlias(Utils::Stream::Offset* offset);
private: private:
static thread_local int BypassState; static thread_local int BypassState;
static bool ShouldSearchTempAssets; static bool ShouldSearchTempAssets;
static std::map<std::string, Game::XAssetHeader> TemporaryAssets[Game::XAssetType::ASSET_TYPE_COUNT]; static std::map<std::string, Game::XAssetHeader> TemporaryAssets[Game::XAssetType::ASSET_TYPE_COUNT];
@ -60,7 +60,7 @@ namespace Components
static void RegisterInterface(IAsset* iAsset); static void RegisterInterface(IAsset* iAsset);
static Game::XAssetHeader FindAsset(Game::XAssetType type, const char* filename); 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 bool IsAssetEligible(Game::XAssetType type, Game::XAssetHeader* asset);
static void FindAssetStub(); static void FindAssetStub();
static void AddAssetStub(); static void AddAssetStub();