Skip to content

Commit

Permalink
1st attempt at removing recursive processing
Browse files Browse the repository at this point in the history
  • Loading branch information
KiritoDv committed Jan 3, 2025
1 parent bdcdd4a commit 4c3530e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 21 deletions.
27 changes: 8 additions & 19 deletions src/Companion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,23 +277,6 @@ std::optional<ParseResultData> Companion::ParseNode(YAML::Node& node, std::strin
return std::nullopt;
}

for (auto [fst, snd] : this->gAssetDependencies[this->gCurrentFile]) {
if(snd.second) {
continue;
}
std::string doutput = (this->gCurrentDirectory / fst).string();
std::replace(doutput.begin(), doutput.end(), '\\', '/');
this->gAssetDependencies[this->gCurrentFile][fst].second = true;
auto dResult = this->ParseNode(snd.first, doutput);
if(dResult.has_value()) {
this->gParseResults[this->gCurrentFile].push_back(dResult.value());
}
spdlog::set_pattern(regular);
SPDLOG_INFO("------------------------------------------------");
spdlog::set_pattern(line);
}


SPDLOG_INFO("Processed {}", name);

return ParseResultData {
Expand Down Expand Up @@ -1262,13 +1245,19 @@ std::optional<std::tuple<std::string, YAML::Node>> Companion::RegisterAsset(cons
return std::nullopt;
}

this->gAssetDependencies[this->gCurrentFile][name] = std::make_pair(node, false);

auto output = (this->gCurrentDirectory / name).string();
std::replace(output.begin(), output.end(), '\\', '/');

auto entry = std::make_tuple(output, node);
this->gAddrMap[this->gCurrentFile][node["offset"].as<uint32_t>()] = entry;
this->gAssetDependencies[this->gCurrentFile][name] = std::make_pair(node, true);
auto dResult = this->ParseNode(node, output);
if(dResult.has_value()) {
this->gParseResults[this->gCurrentFile].push_back(dResult.value());
}
spdlog::set_pattern(regular);
SPDLOG_INFO("------------------------------------------------");
spdlog::set_pattern(line);

return entry;
}
Expand Down
2 changes: 2 additions & 0 deletions src/factories/DisplayListFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,8 @@ std::optional<std::shared_ptr<IParsedData>> DListFactory::parse(std::vector<uint
light = true;
}
break;
default:
throw std::runtime_error("Unsupported GBI version");
}

if(light){
Expand Down
4 changes: 2 additions & 2 deletions src/factories/DisplayListOverrides.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ int Viewport(uint32_t ptr) {
return 1;
}

SPDLOG_WARN("Could not find viewport to override at 0x{:X}", ptr);
SPDLOG_TRACE("Could not find viewport to override at 0x{:X}", ptr);
return 0;
}

Expand All @@ -188,7 +188,7 @@ std::optional<std::tuple<std::string, YAML::Node>> GetVtxOverlap(uint32_t ptr){
return mVtxOverlaps[ptr];
}

SPDLOG_INFO("Failed to find overlap for ptr 0x{:X}", ptr);
SPDLOG_TRACE("Failed to find overlap for ptr 0x{:X}", ptr);

return std::nullopt;
}
Expand Down

0 comments on commit 4c3530e

Please sign in to comment.