[VFS/STFS] Fix BlockToOffsetSTFS for non-read_only_format (CON) packages

Previous code would give wrong results for those types of packages as the block_shift would cancel itself out, moving it to happen afterward let it give the right result though, probably a mistake while reversing it.
(eg. block 0 would give 0xB000, but that's wrong for non-read_only packages as 0xA000 and 0xB000 are reserved for the first hash-table there, fixed code returns the correct 0xC000 offset)

Also changed it to a multiply & renamed it to blocks_per_hash_table to make it more obvious what the purpose is.
This commit is contained in:
emoose
2021-04-17 13:59:28 +01:00
committed by Rick Gibbed
parent 14783b03f2
commit 509f33ba27
2 changed files with 7 additions and 10 deletions

View File

@@ -462,7 +462,7 @@ class StfsContainerDevice : public Device {
void BlockToOffsetSVOD(size_t sector, size_t* address, size_t* file_index);
Error ReadSTFS();
size_t BlockToOffsetSTFS(uint64_t block);
size_t BlockToOffsetSTFS(uint64_t block_index) const;
StfsHashEntry GetBlockHash(const uint8_t* map_ptr, uint32_t block_index,
uint32_t table_offset);