From 35ff9999584db4a2db22daa2990a6758292222bd Mon Sep 17 00:00:00 2001 From: chrg6 Date: Sun, 8 Nov 2026 09:25:24 -0500 Subject: [PATCH] Rebuild from extracted game folders whose files changed, not only when their count did. With --exefs and --romfs folders, the identity the exefs and romfs steps are keyed on was the two paths and the number of RomFS files: a RomFS extracted again or edited with the same number of files, or a replaced sdk or subsdk0, printed "done before" and the build kept the old unpacked files. Each file's size and modification time is now part of it. A build from such folders unpacks once more after this change. Co-Authored-By: Claude Opus 5.5 --- tools/make_game.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/make_game.py b/tools/make_game.py index 7a297436..cebc5202 100644 --- a/tools/make_game.py +++ b/tools/make_game.py @@ -222,7 +222,14 @@ class Source: fail(f'{d} is not a folder') self.exefs = {name: self.exefs_dir / name for name in EXEFS_FILES if (self.exefs_dir / name).is_file()} self.romfs = [(p.relative_to(self.romfs_dir).as_posix(), p) for p in self.romfs_dir.rglob('*') if p.is_file()] - self.identity = f'folders {self.exefs_dir.resolve()} {self.romfs_dir.resolve()} {len(self.romfs)}' + # every file's size and modification time, not only their count: a RomFS extracted again (or edited) + # with the same number of files, or a replaced sdk, kept the old unpacked files ("done before") + h = hashlib.sha256() + for rel, f in sorted([(n, self.exefs[n]) for n in self.exefs] + self.romfs): + st = f.stat() + h.update(f'{rel}\0{st.st_size}\0{st.st_mtime_ns}\n'.encode('utf-8', 'surrogateescape')) + self.identity = (f'folders {self.exefs_dir.resolve()} {self.romfs_dir.resolve()} {len(self.romfs)} ' + f'{h.hexdigest()[:32]}') missing = [x for x in EXEFS_FILES if x not in self.exefs] if missing: fail(f'the ExeFS lacks {", ".join(missing)} (or holds something else under that name)')