forked from xenia-canary/xenia-canary
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[VFS] Check hash of STFS hash tables (& cache them) when reading, fal…
…lback if invalid. This'll try salvaging any corrupt packages loaded in: normally we find the block numbers belonging to a file by reading them from the hash table. Seems there's some packages out there (eg. Mass Effect 2 demo) that have corrupt hash tables though, so using the block numbers from there just results in a crash. By verifying the hash of each hash table we can detect if this is the case, and if so we can try just using current_block_number + 1 instead of use any invalid block number. (we also let the user know about the corrupt table in the log file) In LIVE/PIRS packages this should hopefully let us get the correct data, since files are usually stored inside consecutive blocks in those package types. It's doubtful that it'd help much with CON ones though, since those are pretty much a living filesystem. The older & more used a CON package is, the more likely blocks will be fragmented throughout the file... Reading from the hash table is the only way to properly read data from these, using current_block + 1 likely won't help much (we'd be going wxPirs-mode, in a way :P) CON packages do have something that might help with this though: redundant hash blocks, where each hash table is actually made up of two blocks. Maybe in future we can find a way to automatically use the secondary block whenever the primary one is invalid.
- Loading branch information
1 parent
1f31d53
commit c89a3eb
Showing
2 changed files
with
99 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters