mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-26 15:55:31 +01:00
DirectoryBlob: Support region.bin
This commit is contained in:
parent
c73f6b6c26
commit
8747b1b6ab
@ -52,6 +52,8 @@ constexpr u64 NONPARTITION_DISKHEADER_SIZE = 0x100;
|
|||||||
constexpr u64 BI2_ADDRESS = 0x440;
|
constexpr u64 BI2_ADDRESS = 0x440;
|
||||||
constexpr u64 BI2_SIZE = 0x2000;
|
constexpr u64 BI2_SIZE = 0x2000;
|
||||||
constexpr u64 APPLOADER_ADDRESS = 0x2440;
|
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 GAME_PARTITION_ADDRESS = 0x50000;
|
||||||
constexpr u64 PARTITION_TABLE_ADDRESS = 0x40000;
|
constexpr u64 PARTITION_TABLE_ADDRESS = 0x40000;
|
||||||
@ -187,6 +189,10 @@ DirectoryBlobReader::DirectoryBlobReader(const std::string& root_directory)
|
|||||||
m_nonpartition_contents.emplace(PARTITION_TABLE_ADDRESS, PARTITION_TABLE.size() * sizeof(u32),
|
m_nonpartition_contents.emplace(PARTITION_TABLE_ADDRESS, PARTITION_TABLE.size() * sizeof(u32),
|
||||||
reinterpret_cast<const u8*>(PARTITION_TABLE.data()));
|
reinterpret_cast<const u8*>(PARTITION_TABLE.data()));
|
||||||
|
|
||||||
|
SetWiiRegionData();
|
||||||
|
m_nonpartition_contents.emplace(WII_REGION_DATA_ADDRESS, WII_REGION_DATA_SIZE,
|
||||||
|
m_wii_region_data.data());
|
||||||
|
|
||||||
constexpr u32 TICKET_OFFSET = 0x0;
|
constexpr u32 TICKET_OFFSET = 0x0;
|
||||||
constexpr u32 TICKET_SIZE = 0x2a4;
|
constexpr u32 TICKET_SIZE = 0x2a4;
|
||||||
constexpr u32 TMD_OFFSET = 0x2c0;
|
constexpr u32 TMD_OFFSET = 0x2c0;
|
||||||
@ -304,6 +310,23 @@ void DirectoryBlobReader::SetDiscHeaderAndDiscType()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DirectoryBlobReader::SetWiiRegionData()
|
||||||
|
{
|
||||||
|
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 = m_root_directory + "disc/region.bin";
|
||||||
|
const size_t bytes_read = ReadFileToVector(region_bin_path, &m_wii_region_data);
|
||||||
|
if (bytes_read < 0x4)
|
||||||
|
ERROR_LOG(DISCIO, "Couldn't read region from %s", region_bin_path.c_str());
|
||||||
|
else if (bytes_read < 0x20)
|
||||||
|
ERROR_LOG(DISCIO, "Couldn't read age ratings from %s", region_bin_path.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
bool DirectoryBlobReader::SetApploader(const std::string& apploader)
|
bool DirectoryBlobReader::SetApploader(const std::string& apploader)
|
||||||
{
|
{
|
||||||
if (!apploader.empty())
|
if (!apploader.empty())
|
||||||
|
@ -77,6 +77,7 @@ private:
|
|||||||
bool ReadInternal(u64 offset, u64 length, u8* buffer, const std::set<DiscContent>& contents);
|
bool ReadInternal(u64 offset, u64 length, u8* buffer, const std::set<DiscContent>& contents);
|
||||||
|
|
||||||
void SetDiscHeaderAndDiscType();
|
void SetDiscHeaderAndDiscType();
|
||||||
|
void SetWiiRegionData();
|
||||||
bool SetApploader(const std::string& apploader);
|
bool SetApploader(const std::string& apploader);
|
||||||
void SetDOL();
|
void SetDOL();
|
||||||
|
|
||||||
@ -111,6 +112,7 @@ private:
|
|||||||
|
|
||||||
std::vector<u8> m_disk_header;
|
std::vector<u8> m_disk_header;
|
||||||
std::vector<u8> m_disk_header_nonpartition;
|
std::vector<u8> m_disk_header_nonpartition;
|
||||||
|
std::vector<u8> m_wii_region_data;
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
struct TMDHeader
|
struct TMDHeader
|
||||||
|
Loading…
x
Reference in New Issue
Block a user