From 157e6190848f0c4de5f4fb703e46a125b9c8e4e0 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Sun, 1 Nov 2026 01:40:46 +0800 Subject: [PATCH] Trust the narrowed shader walk when it finds the version's shaders The fallback read the whole RomFS whenever the shader list named shaders this version does not have. The list covers several versions, and 1.1.1 holds 17,587 of its 41,414 rows, so every 1.1.1 install read all 304,469 files again: 23827 of the 41414 listed variants are not among the 27576 shaders found, and the narrowed walk costs 2.8 s against 70.6 s for the whole RomFS. What says the walk fell short is a walk that found next to nothing, which is when the shader directories have moved. Counting absent list rows does not: for 1.1.1 most of them are absent because the game does not have them. Co-authored-by: deepseek-v4.1-flash-1017 --- tools/prepare_shaders.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/prepare_shaders.py b/tools/prepare_shaders.py index 3ff5def2..f26aa30d 100644 --- a/tools/prepare_shaders.py +++ b/tools/prepare_shaders.py @@ -142,10 +142,12 @@ def main(): extracted = ROOT / 'build' / 'extracted' / a.version listed = len(variants) shaders, _ = inventory(a.romfs or extracted / 'romfs', a.exefs or extracted / 'exefs', everything=False) - missing = sum(1 for key, _ in variants if key not in shaders) - if missing > max(16, listed // 20): # the list names shaders the narrowed walk did not reach - print(f'{missing} of the {listed} listed variants are not among the {len(shaders)} shaders found: reading every ' - f'RomFS file instead', flush=True) + # A missing list row says nothing about the walk: the list covers several versions, and 1.1.1 holds 17,587 of its + # 41,414 rows, so most rows are absent because the game does not have them, not because the walk missed them. A walk + # that found next to nothing does say something: the shader directories have moved. + if len(shaders) < max(64, listed // 20): + print(f'only {len(shaders)} shaders found of the {listed} listed variants: reading every RomFS file instead', + flush=True) shaders, _ = inventory(a.romfs or extracted / 'romfs', a.exefs or extracted / 'exefs') t1 = time.monotonic() progs, recs, seen, skipped = {}, [], set(), {'not in this version': 0, 'stage': 0}