Fully implemented tlut load by addr or symbol

This commit is contained in:
KiritoDv
2024-04-13 00:26:45 -06:00
parent 4513708c95
commit 884de3c883
3 changed files with 63 additions and 21 deletions
+31 -4
View File
@@ -1171,6 +1171,37 @@ std::optional<std::tuple<std::string, YAML::Node>> Companion::GetNodeByAddr(cons
return this->gAddrMap[this->gCurrentFile][addr];
}
std::optional<ParseResultData> 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<ParseResultData> 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<std::string>(result.node, "symbol");
if(result.data.has_value() && sym.has_value() && sym.value() == symbol){
return result;
}
}
return std::nullopt;
}
std::optional<std::vector<std::tuple<std::string, YAML::Node>>> Companion::GetNodesByType(const std::string& type){
std::vector<std::tuple<std::string, YAML::Node>> nodes;
@@ -1263,8 +1294,4 @@ std::optional<YAML::Node> Companion::AddAsset(YAML::Node asset) {
}
return std::nullopt;
}
void Companion::AddTlutTextureMap(std::string index, std::shared_ptr<TextureData> entry) {
this->TlutTextureMap[index] = entry;
}