From c781238d6dec8215ad32a7dff30bf20c1bfbce4e Mon Sep 17 00:00:00 2001 From: Valiantsin Dzerakh Date: Tue, 17 Nov 2026 20:12:56 +0300 Subject: [PATCH] The Shapes step keeps its old key when it writes no capped HUD folder, so an install with hud_width full does not prepare its shaped folders again (#643) Co-Authored-By: Claude Opus 5.5 --- installer/steps.py | 8 ++++++-- tests/installer_test.py | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/installer/steps.py b/installer/steps.py index 3588a2df..3d16825e 100644 --- a/installer/steps.py +++ b/installer/steps.py @@ -1444,8 +1444,12 @@ class Shapes(Step): sizes, style = self.wanted(ctx) # The pc prompts' shaped folders are drawn from the same bindings as romfs-patches-pc, so they follow its key prompts = ctx.keys.get('pc_prompts', '') if style == 'pc' else '' - return fingerprint('shapes-3', ctx.keys.get('prepare', ''), prompts, style or 'nintendo', - hud_width(ctx.dest), *sizes) + # Without a capped folder to write (hud_width full, or no shape wider than the cap) the key stays the one a + # setup before hud_width wrote, so an existing install does not prepare its shaped folders again + hud = hud_width(ctx.dest) + if not any(shape_hud(size, hud) for size in sizes): + return fingerprint('shapes-2', ctx.keys.get('prepare', ''), prompts, style or 'nintendo', *sizes) + return fingerprint('shapes-3', ctx.keys.get('prepare', ''), prompts, style or 'nintendo', hud, *sizes) def current(self, ctx, record): return not record.get('failed') and all((ctx.dest / name / 'manifest.tsv').is_file() diff --git a/tests/installer_test.py b/tests/installer_test.py index 35884f6f..ae5c2685 100644 --- a/tests/installer_test.py +++ b/tests/installer_test.py @@ -931,6 +931,22 @@ class ShapesTest(unittest.TestCase): self.assertTrue(all('--hud' not in c for c in self.calls)) self.assertFalse((self.dest / 'romfs-patches-2560x1080-hud16x9').exists()) + def test_full_hud_keeps_the_key_of_a_setup_before_hud_width(self): + # An install that writes no capped folder keeps the Shapes key it had, so its next setup run prepares nothing + screens.displays = lambda: [(2560, 1080), (2560, 1600)] + step = steps.Shapes() + sizes, style = step.wanted(self.ctx) + old = steps.fingerprint('shapes-2', 'p', '', style or 'nintendo', *sizes) + self.assertEqual(step.key(self.ctx), old) + (self.dest / 'totk.ini').write_text('hud_width = full\n') + self.assertEqual(step.key(self.ctx), old) + # a cap no shape here is wider than writes nothing either + screens.displays = lambda: [(2560, 1600)] + del self.ctx.shapes_wanted + (self.dest / 'totk.ini').write_text('hud_width = 16:9\n') + sizes, style = step.wanted(self.ctx) + self.assertEqual(step.key(self.ctx), steps.fingerprint('shapes-2', 'p', '', style or 'nintendo', *sizes)) + def test_capped_pc_prompts_reuse_bindings(self): screens.displays = lambda: [(3840, 1080)] (self.dest / 'totk.ini').write_text('prompts = pc\nhud_width = 16:9\nbind_attack = key:f\n')