From 884de3c8836368cb3592ed9dec2e117be1fbc744 Mon Sep 17 00:00:00 2001 From: KiritoDv Date: Sat, 13 Apr 2024 00:26:45 -0600 Subject: Fully implemented tlut load by addr or symbol --- src/Companion.cpp | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) (limited to 'src/Companion.cpp') diff --git a/src/Companion.cpp b/src/Companion.cpp index e2e6f21..0a74658 100644 --- a/src/Companion.cpp +++ b/src/Companion.cpp @@ -1171,6 +1171,37 @@ std::optional> Companion::GetNodeByAddr(cons return this->gAddrMap[this->gCurrentFile][addr]; } +std::optional Companion::GetParseDataByAddr(uint32_t addr) { + if(!this->gParseResults.contains(this->gCurrentFile)){ + return std::nullopt; + } + + for(auto& result : this->gParseResults[this->gCurrentFile]){ + if(result.data.has_value() && result.GetOffset() == addr){ + return result; + } + } + + return std::nullopt; +} + +std::optional Companion::GetParseDataBySymbol(const std::string& symbol) { + if(!this->gParseResults.contains(this->gCurrentFile)){ + return std::nullopt; + } + + for(auto& result : this->gParseResults[this->gCurrentFile]){ + auto sym = GetNode(result.node, "symbol"); + + if(result.data.has_value() && sym.has_value() && sym.value() == symbol){ + return result; + } + } + + return std::nullopt; + +} + std::optional>> Companion::GetNodesByType(const std::string& type){ std::vector> nodes; @@ -1263,8 +1294,4 @@ std::optional Companion::AddAsset(YAML::Node asset) { } return std::nullopt; -} - -void Companion::AddTlutTextureMap(std::string index, std::shared_ptr entry) { - this->TlutTextureMap[index] = entry; } \ No newline at end of file -- cgit v1.2.3