scratch: fix ifs-in-arc?
Some checks failed
Build / build (push) Has been cancelled

This commit is contained in:
Will Toohey
2026-05-18 08:19:52 +10:00
parent e8302b1fa4
commit abf2e4cf4a
2 changed files with 8 additions and 8 deletions

View File

@@ -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 "<arc.path>/<inner.ifs>/..." (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/<arc.path>/<inner.ifs>/..." (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);
}

View File

@@ -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) {