Builder: the damaged-texture check after an unpack shows its progress #1764
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!1764
Loading…
Reference in a new issue
No description provided.
Delete branch "builder/damaged-check-progress"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
After a fresh unpack, the first build looks stuck for minutes on "the game was read from this .nup before: reading it again is skipped". It is checking every game file for damage (#1002), but it says nothing while it does.
What changed
nx2/nup.py:damaged_game_fileslists the romfs.zsfiles first, then callsprogress(done, total)after each file it opens.stand_in_damagedpasses it on. Without a callback it works as before.nx2/make_game.py:file_progresssends@@progressup to 4 times a second, plus once at the end. The Builder's bar moves within its Read your game files row.checked 40,874 of 102,185 files (40%, 6 s).tests/test_damaged_check_progress.py(game-free) checks:@@progressgoes out, and the last one at 1.000stand_in_damaged_filesannounces the check and passes the progress onThe check itself, the
.hookshot_romfs_checkedmarker and what gets replaced are unchanged. So is the protocol: the Builder already reads@@progressfor the current stage.Tested
Windows 11, Ryzen 9 9900X3D, using the v2.0.13 Builder's tools (Python 3.14.7), with a full dump freshly unpacked by the v2.0.13 Builder. That's 102,185
.zsfiles.Before: the first v2.0.13 build after the unpack printed that line, then nothing for several minutes. The check opened about 300 files a second with almost no CPU in use. Windows Defender's real-time protection was on.
After: the changed check run on the same romfs, read-only:
It sent 60
@@progresslines, the last at1.000, and found 0 damaged files. This run took 15 s because the files were already cached from the build's first pass.Tests:
tests/test_damaged_check_progress.py,tests/test_make_game_cache.pyandtests/test_missing_nup.pypass. The two changed files byte-compile. I didn't run the fulltests/run_all.pylocally.Not tested:
Looks good. I read the diff against the call sites in make_game.py and the Builder's
@@progresshandling.@@progressand the Builder reads it from the process output, as it already does. The check runs after@@stage read, so both the Tk bar and the WPF row (Weight[current]) pick it up.done >= total), so the bar ends at 1.000. The count islen(paths), which is exactly what gets opened.One thing to sort out before merging: #1738 (monsterlag) changes the same lines. It also adds a progress callback to
nup.damaged_game_filesandstand_in_damagedand prints instand_in_damaged_files, with a different signature (progress(count)againstprogress(done, total)). They'll conflict, and both going in would leave two progress mechanisms. This one is better for the Builder because it drives the bar and has a total, so it's worth settling which one lands.Nit:
test_the_check_is_announced_and_reportsgreps the source text ofstand_in_damaged_files, so it only breaks on a rename. It's fine as a guard, but a test that stubsnup.stand_in_damagedand checks the callback gets passed would be sturdier.No CI checks are reported on this branch.