jak3: fix hud sprite crash + add entity debugger (#3516)

This commit is contained in:
ManDude
2024-05-13 04:09:25 +01:00
committed by GitHub
parent d1ece445d4
commit ebbbedabc5
20 changed files with 584 additions and 166 deletions
+3 -19
View File
@@ -28,25 +28,9 @@ namespace decompiler {
std::optional<ObjectFileRecord> get_bsp_file(const std::vector<ObjectFileRecord>& records,
const std::string& dgo_name) {
std::optional<ObjectFileRecord> result;
bool found = false;
for (auto& file : records) {
if (file.name.length() > 4 && file.name.substr(file.name.length() - 4) == "-vis") {
ASSERT(!found);
found = true;
result = file;
}
}
if (!result) {
if (str_util::ends_with(dgo_name, ".DGO") || str_util::ends_with(dgo_name, ".CGO")) {
auto expected_name = dgo_name.substr(0, dgo_name.length() - 4);
for (auto& c : expected_name) {
c = tolower(c);
}
if (!records.empty() && expected_name == records.back().name) {
return records.back();
}
}
if (str_util::ends_with(dgo_name, ".DGO")) {
// only DGOs are valid levels, and the last file is the bsp file
result = records.at(records.size() - 1);
}
return result;
}