From 8eb48493c069aa03c41a6aad30adc88669a7ba28 Mon Sep 17 00:00:00 2001 From: Valiantsin Dzerakh Date: Sun, 1 Nov 2026 19:28:32 +0300 Subject: [PATCH] Rebuild the code cheats and ExeFS patches of a renamed mod folder The lift key hashed each cheat and ExeFS patch file by its name and content only, but tools/cheats.py and tools/exefs_patches.py name every patch set after "/". After a mod folder was renamed, totk.exe saw none of its code cheats in the build and started the rebuild, the setup found the lift current and skipped it, and the cheats stayed "after the rebuild" for good. The key now takes each file's path under mods/ as well. Co-Authored-By: Claude Opus 5.5 --- installer/steps.py | 7 +++++-- tests/installer_test.py | 13 +++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/installer/steps.py b/installer/steps.py index 81a46cd2..54130b98 100644 --- a/installer/steps.py +++ b/installer/steps.py @@ -768,9 +768,12 @@ class Lift(Step): transient = True def key(self, ctx): + # fingerprint takes a file's name and content only; the paths under mods/ go in too, because tools/cheats.py + # and tools/exefs_patches.py name each patch set after its mod folder, so a renamed folder needs a lift + files = cheat_files(ctx) + exefs_files(ctx) return fingerprint('lift-4', ctx.keys['extract'], ctx.layout.recomp, ctx.layout.patches(game_version(ctx)), - ctx.layout.tools / 'cheats.py', ctx.layout.tools / 'exefs_patches.py', *cheat_files(ctx), - *exefs_files(ctx)) + ctx.layout.tools / 'cheats.py', ctx.layout.tools / 'exefs_patches.py', *files, + *(f.relative_to(ctx.dest / 'mods').as_posix() for f in files)) def current(self, ctx, record): gen = ctx.temp / 'gen' diff --git a/tests/installer_test.py b/tests/installer_test.py index 66cc31c6..e34c55d0 100644 --- a/tests/installer_test.py +++ b/tests/installer_test.py @@ -254,6 +254,19 @@ class LiftKeyTest(unittest.TestCase): self.add_cheats('main.npdm', 'not a patch', mod='Fps', where='exefs') self.assertEqual(self.key(), both) + def test_renaming_a_mod_folder_changes_the_key(self): + # tools/cheats.py and tools/exefs_patches.py name a patch set after "/": a renamed + # folder needs a lift even though its files are the same + self.add_cheats('277178B7DBA1B6D4.txt', '[a]', mod='MyNXCheats') + self.add_cheats('dynamic-fps.pchtxt', '@nsobid-277178B7DBA1B6D4', mod='Fps', where='exefs') + before = self.key() + mods = self.dest / 'mods' + (mods / 'MyNXCheats').rename(mods / 'MyNXCheats 1.4.3') + cheats_renamed = self.key() + self.assertNotEqual(cheats_renamed, before) + (mods / 'Fps').rename(mods / 'Fps 2') + self.assertNotEqual(self.key(), cheats_renamed) + def test_status_and_other_files_keep_the_key(self): self.add_cheats('277178B7DBA1B6D4.txt', '[a]') before = self.key()