Merge pull request #269: Trust the narrowed shader walk when it finds the version's shaders (shenjackyuanjie)

The shader list covers several versions, so most of its rows are absent from any one game and the old test fell back to
reading the whole RomFS on every install: 23,825 of 41,414 rows on 1.2.1, 23,370 on 1.4.3. The fallback now runs only
when the narrowed walk finds next to nothing. On 1.2.1 and 1.4.3 the narrowed walk finds the same shaders as the full
one (27,576 and 28,667, none only in the full walk) in 2 s instead of 51 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-10-31 21:14:34 +03:00
commit db4d04a6e5
1 file changed
+6 -4
+6 -4
View File
@@ -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}