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 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-11-17 20:12:56 +03:00
1 parent 006c186928
commit c781238d6d
2 files changed
+22 -2

No files matched your search

+6 -2
View File
@@ -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()
+16
View File
@@ -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')