From ce66223fc7d8a57cd7e6f7506bd9b0ee3f1e98ec Mon Sep 17 00:00:00 2001 From: chrg6 Date: Tue, 10 Nov 2026 23:00:17 -0500 Subject: [PATCH] Encode each note button picture once when drawing the button prompts. The prompt overlays for the pad layouts repeat the same note pictures, and every one was fitted and encoded to ASTC again for each layout. The encoded bytes are now kept for the build under the picture and its box. With stand-in pictures, 42 note textures over seven layouts came out byte for byte the same from 12 encodes instead of 42, in 0.66 s instead of 2.30 s. Co-Authored-By: Claude Fable 5.2 --- tests/launcher_test.py | 2 +- tools/pad_prompts.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/launcher_test.py b/tests/launcher_test.py index a0365fa2..ce0c1a4e 100644 --- a/tests/launcher_test.py +++ b/tests/launcher_test.py @@ -3228,7 +3228,7 @@ class FileCheckTest(Tmp): # PROMPT_TOOLS a new value (every install then draws its prompts again) and record both here; if it cannot, record # only the new digests. PROMPT_LOGIC = ('ad59f2c4533f6ea2630b916ef5f3695f72daffe9b2b7663eea4168a4f08e4249', - {'pad_prompts.py': '1b008475289e0dabfefb8c61969c719c6faa79bbfc8504593e5fe1e79d4d4d33', + {'pad_prompts.py': '780c246b5fde7a0e9dbf3f59ad16372e1737592add6f2f2d9825bee6df4e296f', 'prompt_art.py': '87edacabcddb4952f5862373815d7d46a05c67f350e0734025ae4d2f83b12038', 'button_icons.py': '3804e371a030965bc9eb4226f333b611651f25efaa67ee523b404edc3257818a'}) diff --git a/tools/pad_prompts.py b/tools/pad_prompts.py index 7cee1d02..400e2a88 100644 --- a/tools/pad_prompts.py +++ b/tools/pad_prompts.py @@ -747,6 +747,11 @@ def mask_of(img, rel): return out +def note_texture(art, rel, box): + pic = fit(load_art(art, rel), box, (93, 93)) + return astc_encode(bleed(pic)) + + def draw_textures(data, glyph, note, art, cache): """Paints the action prompt's letters (from glyph) and the ocarina's note buttons (from note; both Switch button -> picture) into the BNTX data (a bytearray) in place. A new letter takes the height and centre of the game's own @@ -772,8 +777,9 @@ def draw_textures(data, glyph, note, art, cache): assert t['fmt'] == ASTC_4X4_SRGB and (t['w'], t['h']) == (93, 93), f'{name}: format {t["fmt"]:#x}, ' \ f'{t["w"]}x{t["h"]}' box = NOTE_BOXES['shoulder' if button in 'LR' else 'disc'] - pic = fit(load_art(art, note[button]), box, (t['w'], t['h'])) - write_level(data, t, astc_encode(bleed(pic)), wb * 16, hb) + rel = note[button] + encoded = cache(('note', rel, box), lambda: note_texture(art, rel, box)) + write_level(data, t, encoded, wb * 16, hb) # Where the game's own note buttons are opaque in their 93x93 textures (1.1.1), which the new ones fill: the face