mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-22 13:05:57 +00:00
Fail the install when romfs/ is gone or unreadable after cleanup
An install whose romfs/ went empty and unreadable after the extraction had verified it (a folder Windows was still deleting) ended with result ok, and the game stopped at its first file read. Cleanup now checks that romfs.bin and index.json are still there, match the verified size and hash record, and that romfs.bin opens; otherwise it fails with cleanup.romfs_unreadable, which tells the player to restart Windows and run the installer on the same folder (resume extracts the game data again). Reported in #107. tests/installer_test.py CleanupTest: an emptied, removed or resized romfs passed cleanup before, fails now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8ba0d5ce15
commit
a76224f8a6
4 files changed
+69
-1
No files matched your search
@@ -661,8 +661,24 @@ class Cleanup(Step):
|
||||
remove(stale)
|
||||
for name in ('gen', 'build', 'check', 'shader_list.tsv'):
|
||||
remove(ctx.temp / name)
|
||||
romfs_problem(dest / 'romfs', expected_update(ctx))
|
||||
return {}
|
||||
|
||||
|
||||
def romfs_problem(romfs, expected):
|
||||
"""Raise cleanup.romfs_unreadable unless romfs/ still holds the verified image. The game opens romfs.bin at start;
|
||||
an install whose romfs/ went empty and unreadable after the extraction verified it (a folder Windows was still
|
||||
deleting, #107) reported success and the game stopped at its first file read."""
|
||||
try:
|
||||
ok = extract.romfs_verified(romfs, expected) and (romfs / 'romfs.bin').stat().st_size == expected['romfs']['size']
|
||||
if ok:
|
||||
with open(romfs / 'romfs.bin', 'rb') as f:
|
||||
f.read(1)
|
||||
except (OSError, ValueError):
|
||||
ok = False
|
||||
if not ok:
|
||||
raise InstallError('cleanup.romfs_unreadable', path=str(romfs))
|
||||
|
||||
|
||||
def all_steps():
|
||||
return [Check(), Extract(), Lift(), Compile(), Prepare(), Cleanup()]
|
||||
Reference in new issue
Block a user