diff --git a/Source/Core/DiscIO/DirectoryBlob.cpp b/Source/Core/DiscIO/DirectoryBlob.cpp index 6392651edd..16b5ac0de9 100644 --- a/Source/Core/DiscIO/DirectoryBlob.cpp +++ b/Source/Core/DiscIO/DirectoryBlob.cpp @@ -54,12 +54,7 @@ constexpr u64 BI2_SIZE = 0x2000; constexpr u64 APPLOADER_ADDRESS = 0x2440; constexpr u64 WII_REGION_DATA_ADDRESS = 0x4E000; constexpr u64 WII_REGION_DATA_SIZE = 0x20; - constexpr u64 GAME_PARTITION_ADDRESS = 0x50000; -constexpr u64 PARTITION_TABLE_ADDRESS = 0x40000; -const std::array PARTITION_TABLE = { - {Common::swap32(1), Common::swap32((PARTITION_TABLE_ADDRESS + 0x20) >> 2), 0, 0, 0, 0, 0, 0, - Common::swap32(GAME_PARTITION_ADDRESS >> 2), 0}}; DiscContent::DiscContent(u64 offset, u64 size, const std::string& path) : m_offset(offset), m_size(size), m_content_source(path) @@ -181,9 +176,7 @@ DirectoryBlobReader::DirectoryBlobReader(const std::string& root_directory) if (m_is_wii) { - m_nonpartition_contents.emplace(PARTITION_TABLE_ADDRESS, PARTITION_TABLE.size() * sizeof(u32), - reinterpret_cast(PARTITION_TABLE.data())); - + SetPartitionTable(); SetWiiRegionData(); SetTMDAndTicket(); } @@ -295,6 +288,17 @@ void DirectoryBlobReader::SetDiscHeaderAndDiscType() } } +void DirectoryBlobReader::SetPartitionTable() +{ + constexpr u64 PARTITION_TABLE_ADDRESS = 0x40000; + static const std::array PARTITION_TABLE = { + {Common::swap32(1), Common::swap32((PARTITION_TABLE_ADDRESS + 0x20) >> 2), 0, 0, 0, 0, 0, 0, + Common::swap32(GAME_PARTITION_ADDRESS >> 2), 0}}; + + m_nonpartition_contents.emplace(PARTITION_TABLE_ADDRESS, PARTITION_TABLE.size() * sizeof(u32), + reinterpret_cast(PARTITION_TABLE.data())); +} + void DirectoryBlobReader::SetWiiRegionData() { m_wii_region_data.resize(0x10, 0x00); diff --git a/Source/Core/DiscIO/DirectoryBlob.h b/Source/Core/DiscIO/DirectoryBlob.h index efb865c124..da7cddbf5c 100644 --- a/Source/Core/DiscIO/DirectoryBlob.h +++ b/Source/Core/DiscIO/DirectoryBlob.h @@ -77,6 +77,7 @@ private: bool ReadInternal(u64 offset, u64 length, u8* buffer, const std::set& contents); void SetDiscHeaderAndDiscType(); + void SetPartitionTable(); void SetWiiRegionData(); void SetTMDAndTicket(); bool SetApploader(const std::string& apploader);