mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-19 20:25:57 +00:00
Extract the RomFS again when its index on disk cannot be read
A 0.2.8 install's romfs/index.json had two flipped bytes, and the update stopped with an unexpected JSONDecodeError instead of extracting again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
454f236a0d
commit
2125ad6eea
1 file changed
+4
-1
+4
-1
@@ -143,7 +143,10 @@ def romfs_verified(romfs, expected):
|
||||
index = romfs / 'index.json'
|
||||
if not index.is_file() or not (romfs / 'romfs.bin').is_file():
|
||||
return False
|
||||
report = json.loads(index.read_text())
|
||||
try:
|
||||
report = json.loads(index.read_text())
|
||||
except ValueError: # damaged on disk (a flipped bit made it unreadable): extract again instead of failing the setup
|
||||
return False
|
||||
return report.get('romfs_sha256') == expected['romfs']['sha256'] and report.get('romfs_size') == expected['romfs']['size']
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user