From 5ec81298f2f00e0b704a93dad1ab412a57b8788b Mon Sep 17 00:00:00 2001 From: emoose Date: Sat, 11 Jan 2020 09:59:51 +0000 Subject: [PATCH] [VFS] Fix GetHashEntry for level 2 entries... --- src/xenia/vfs/devices/stfs_container_device.cc | 5 +---- src/xenia/vfs/devices/stfs_container_device.h | 6 ++---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/xenia/vfs/devices/stfs_container_device.cc b/src/xenia/vfs/devices/stfs_container_device.cc index 411547311..edd3c5fcf 100644 --- a/src/xenia/vfs/devices/stfs_container_device.cc +++ b/src/xenia/vfs/devices/stfs_container_device.cc @@ -683,12 +683,9 @@ StfsContainerDevice::BlockHash StfsContainerDevice::GetHashEntry( const uint8_t* map_ptr, uint32_t block_index, uint32_t level, uint32_t table_offset) { uint32_t record = block_index; - if (level == 1) { + for (uint32_t i = 0; i < level; i++) { record = record / 0xAA; } - if (level == 2) { - record = record / 0x70E4; - } record = record % 0xAA; size_t hash_offset = BlockToHashBlockOffset(block_index, level); diff --git a/src/xenia/vfs/devices/stfs_container_device.h b/src/xenia/vfs/devices/stfs_container_device.h index 8776240f7..60a151368 100644 --- a/src/xenia/vfs/devices/stfs_container_device.h +++ b/src/xenia/vfs/devices/stfs_container_device.h @@ -227,10 +227,8 @@ class StfsContainerDevice : public Device { size_t BlockToHashBlockOffset(uint64_t block, uint32_t hash_level = 0); - StfsContainerDevice::BlockHash GetHashEntry(const uint8_t* map_ptr, - uint32_t block_index, - uint32_t level, - uint32_t table_offset); + BlockHash GetHashEntry(const uint8_t* map_ptr, uint32_t block_index, + uint32_t level, uint32_t table_offset); BlockHash GetBlockHash(const uint8_t* map_ptr, uint32_t block_index);