diff options
| author | JosJuice <josjuice@gmail.com> | 2017-07-18 15:53:04 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2017-08-01 11:36:40 +0200 |
| commit | d0c322f6e6cf5b574d4f54eb38df82c52c288671 (patch) | |
| tree | 8776b50959264c5289748a202b9e8f21442bd484 /Source/Core/DiscIO/DirectoryBlob.cpp | |
| parent | 3fd0d39a853ddb677e8dccd045b8ccae38be1429 (diff) | |
DirectoryBlob: Don't silently set GC region to NTSC-J if bi2.bin is missing
We were already handling the Wii region in region.bin in this way.
Diffstat (limited to 'Source/Core/DiscIO/DirectoryBlob.cpp')
| -rw-r--r-- | Source/Core/DiscIO/DirectoryBlob.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/Source/Core/DiscIO/DirectoryBlob.cpp b/Source/Core/DiscIO/DirectoryBlob.cpp index ab53bd3af7..a91472fb63 100644 --- a/Source/Core/DiscIO/DirectoryBlob.cpp +++ b/Source/Core/DiscIO/DirectoryBlob.cpp @@ -56,6 +56,9 @@ enum class PartitionType : u32 // There are more types used by Super Smash Bros. Brawl, but they don't have special names }; +// 0xFF is an arbitrarily picked value. Note that we can't use 0x00, because that means NTSC-J +constexpr u32 INVALID_REGION = 0xFF; + constexpr u8 ENTRY_SIZE = 0x0c; constexpr u8 FILE_ENTRY = 0; constexpr u8 DIRECTORY_ENTRY = 1; @@ -422,9 +425,6 @@ void DirectoryBlobReader::SetWiiRegionData(const std::string& game_partition_roo { m_wii_region_data.resize(0x10, 0x00); m_wii_region_data.resize(0x20, 0x80); - - // 0xFF is an arbitrarily picked value. Note that we can't use 0x00, because that means NTSC-J - constexpr u32 INVALID_REGION = 0xFF; Write32(INVALID_REGION, 0, &m_wii_region_data); const std::string region_bin_path = game_partition_root + "disc/region.bin"; @@ -590,7 +590,17 @@ void DirectoryBlobPartition::SetBI2() { constexpr u64 BI2_ADDRESS = 0x440; constexpr u64 BI2_SIZE = 0x2000; - AddFileToContents(&m_contents, m_root_directory + "sys/bi2.bin", BI2_ADDRESS, BI2_SIZE); + m_bi2.resize(BI2_SIZE); + + if (!m_is_wii) + Write32(INVALID_REGION, 0x18, &m_bi2); + + const std::string bi2_path = m_root_directory + "sys/bi2.bin"; + const size_t bytes_read = ReadFileToVector(bi2_path, &m_bi2); + if (!m_is_wii && bytes_read < 0x1C) + ERROR_LOG(DISCIO, "Couldn't read region from %s", bi2_path.c_str()); + + m_contents.emplace(BI2_ADDRESS, BI2_SIZE, m_bi2.data()); } u64 DirectoryBlobPartition::SetApploader() |
