From 0ae09389656f09342b19ca10517753485f3d6bdd Mon Sep 17 00:00:00 2001 From: Luminar Light <18116946+LuminarLight@users.noreply.github.com> Date: Sat, 24 Feb 2024 20:13:48 +0100 Subject: [PATCH] Only remove -vis from name if it is part of the name. (#3257) During level extraction, the last 4 characters of the level name are always removed, because it is assumed that '-vis' is there. But it isn't always there. This is especially true in post-TPL games. This causes multiple problems: - There can be levels in the extraction that will miss their last 4 characters from their name, which is sad, and may make it harder to identify them. - If there are '-vis'-less levels whose names are identical apart from the last 4 characters, the extractor will only get the last one (it probably extracts all but overwrites everything but the last one). For example 'ctyasha' and 'ctykora'. This issue affects the glb extraction and the entities json extraction. I personally think that just keeping the -vis in the name would be the best solution, but I guess there was a reason why it was decided that it should be removed from the name. So to adapt to this, my implementation will still remove '-vis' from the name, but only if it is actually in the name - otherwise it won't remove anything. I hope my changes didn't break anything. Extraction seemed to run fine after my changes, and I was able to see both ctyasha and ctykora json files. And didn't see any '-vis', so it is still properly removed. --------- Co-authored-by: Tyler Wilding --- decompiler/config/jak1/ntsc_v1/hacks.jsonc | 2 +- decompiler/config/jak2/ntsc_v1/hacks.jsonc | 2 +- decompiler/level_extractor/extract_level.cpp | 4 ++-- game/settings/settings.cpp | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/decompiler/config/jak1/ntsc_v1/hacks.jsonc b/decompiler/config/jak1/ntsc_v1/hacks.jsonc index 771715535..c9b83b339 100644 --- a/decompiler/config/jak1/ntsc_v1/hacks.jsonc +++ b/decompiler/config/jak1/ntsc_v1/hacks.jsonc @@ -634,7 +634,7 @@ // there are some missing textures. I don't know what the game actually does here. // the format for entries is [level, tpage, index] - "missing_textures": [["finalboss", 1419, 3]], + "missing_textures": [["finalboss-vis", 1419, 3]], // some object files have garbage pad data at the end which makes the decompiler // assume they must be different files, such as the art group for orb-cache-top. diff --git a/decompiler/config/jak2/ntsc_v1/hacks.jsonc b/decompiler/config/jak2/ntsc_v1/hacks.jsonc index cd609bbfc..b28403c10 100644 --- a/decompiler/config/jak2/ntsc_v1/hacks.jsonc +++ b/decompiler/config/jak2/ntsc_v1/hacks.jsonc @@ -769,7 +769,7 @@ // there are some missing textures. I don't know what the game actually does here. // the format for entries is [level, tpage, index] "missing_textures": [ - ["vinroom", 0, 0], + ["vinroom-vis", 0, 0], ["ctyfence", 0, 0] ], diff --git a/decompiler/level_extractor/extract_level.cpp b/decompiler/level_extractor/extract_level.cpp index 9fdfe5faa..191f1a2d3 100644 --- a/decompiler/level_extractor/extract_level.cpp +++ b/decompiler/level_extractor/extract_level.cpp @@ -142,7 +142,7 @@ std::vector extract_tex_remap(const ObjectFileDB& db, lg::warn("Skipping extract for {} because the BSP file was not found", dgo_name); return {}; } - std::string level_name = bsp_rec->name.substr(0, bsp_rec->name.length() - 4); + std::string level_name = bsp_rec->name; lg::info("Processing level {} ({})", dgo_name, level_name); const auto& bsp_file = db.lookup_record(*bsp_rec); @@ -167,7 +167,7 @@ level_tools::BspHeader extract_bsp_from_level(const ObjectFileDB& db, lg::warn("Skipping extract for {} because the BSP file was not found", dgo_name); return {}; } - std::string level_name = bsp_rec->name.substr(0, bsp_rec->name.length() - 4); + std::string level_name = bsp_rec->name; lg::info("Processing level {} ({})", dgo_name, level_name); const auto& bsp_file = db.lookup_record(*bsp_rec); diff --git a/game/settings/settings.cpp b/game/settings/settings.cpp index adcb819d8..f17edbcca 100644 --- a/game/settings/settings.cpp +++ b/game/settings/settings.cpp @@ -40,7 +40,7 @@ DebugSettings::DebugSettings() { if (!file_util::file_exists(file_path)) { return; } - lg::info("Loading display settings at {}", file_path); + lg::info("Loading debug settings at {}", file_path); auto raw = file_util::read_text_file(file_path); from_json(parse_commented_json(raw, "debug-settings.json"), *this); } catch (std::exception& e) { @@ -123,7 +123,7 @@ InputSettings::InputSettings() { if (!file_util::file_exists(file_path)) { return; } - lg::info("Loading display settings at {}", file_path); + lg::info("Loading input settings at {}", file_path); auto raw = file_util::read_text_file(file_path); from_json(parse_commented_json(raw, "input-settings.json"), *this); } catch (std::exception& e) {