From abf2e4cf4a756256852e9ae949f6e2c467cdfe76 Mon Sep 17 00:00:00 2001 From: Will Toohey Date: Mon, 18 May 2026 08:19:52 +1000 Subject: [PATCH] scratch: fix ifs-in-arc? --- src/hook.cpp | 14 +++++++------- src/tests.cpp | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/hook.cpp b/src/hook.cpp index f82b2d3..0f55889 100644 --- a/src/hook.cpp +++ b/src/hook.cpp @@ -255,16 +255,16 @@ void handle_arc(HookFile &file) { // Register inner-ifs basenames with the demangler. The game extracts each // inner ifs into a ramfs whose mountpoint/fsroot carries only the basename; - // demangler then re-qualifies it as "//..." (with .arc - // pre-substituted to _arc), and normalise_path -> mod lookup applies the - // .ifs -> _ifs transform afterwards. Use file.path (raw) so the demangled - // result still contains the game-folder prefix normalise_path looks for. - string arc_raw_underscored = file.path; - string_replace(arc_raw_underscored, ".arc", "_arc"); + // demangler then re-qualifies it as "data///..." (with + // .arc pre-substituted to _arc), and normalise_path -> mod lookup applies + // the .ifs -> _ifs transform afterwards. Build off norm_path with an + // explicit "data/" so the registration is stable regardless of which AVS + // drive prefix the game opened the arc through (otherwise the same arc + // reached via "data/" and "/local/data/" produces a basename collision). for (auto const& inner_rel : scan.inner_ifs_paths) { auto pos = inner_rel.rfind('/'); string basename = (pos == string::npos) ? inner_rel : inner_rel.substr(pos + 1); - string demangled = arc_raw_underscored + "/" + inner_rel; + string demangled = "data/" + arc_mod_path + "/" + inner_rel; ramfs_demangler_register_arc_inner_ifs(basename, demangled); } diff --git a/src/tests.cpp b/src/tests.cpp index b6adba7..95fb371 100644 --- a/src/tests.cpp +++ b/src/tests.cpp @@ -303,7 +303,7 @@ static void exercise_inner_ifs_demangle(std::string const& arc_path) { ramfs_demangler_demangle_if_possible(p); std::string expected_arc = arc_path; string_replace(expected_arc, ".arc", "_arc"); - EXPECT_EQ(p, expected_arc + "/inner.ifs/some_subfile"); + EXPECT_EQ(p, "data/" + expected_arc + "/inner.ifs/some_subfile"); } TEST(ArcArchive, IfsOnlySubtreeSkipsRepack) {