mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 16:19:28 +01:00
DirectoryBlob: Reorder functions in .cpp file
They're now grouped by which class they belong to.
This commit is contained in:
parent
ba0ee3f54b
commit
fb09874f79
@ -239,34 +239,6 @@ u64 DirectoryBlobReader::GetDataSize() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
DirectoryBlobPartition::DirectoryBlobPartition(const std::string& root_directory)
|
||||
: m_root_directory(root_directory)
|
||||
{
|
||||
SetDiscHeaderAndDiscType();
|
||||
SetBI2();
|
||||
BuildFST(SetDOL(SetApploader()));
|
||||
}
|
||||
|
||||
void DirectoryBlobPartition::SetDiscHeaderAndDiscType()
|
||||
{
|
||||
constexpr u64 DISKHEADER_ADDRESS = 0;
|
||||
constexpr u64 DISKHEADER_SIZE = 0x440;
|
||||
|
||||
m_disk_header.resize(DISKHEADER_SIZE);
|
||||
const std::string boot_bin_path = m_root_directory + "sys/boot.bin";
|
||||
if (ReadFileToVector(boot_bin_path, &m_disk_header) < 0x20)
|
||||
ERROR_LOG(DISCIO, "%s doesn't exist or is too small", boot_bin_path.c_str());
|
||||
|
||||
m_contents.emplace(DISKHEADER_ADDRESS, DISKHEADER_SIZE, m_disk_header.data());
|
||||
|
||||
m_is_wii = Common::swap32(&m_disk_header[0x18]) == 0x5d1c9ea3;
|
||||
const bool is_gc = Common::swap32(&m_disk_header[0x1c]) == 0xc2339f3d;
|
||||
if (m_is_wii == is_gc)
|
||||
ERROR_LOG(DISCIO, "Couldn't detect disc type based on %s", boot_bin_path.c_str());
|
||||
|
||||
m_address_shift = m_is_wii ? 2 : 0;
|
||||
}
|
||||
|
||||
void DirectoryBlobReader::SetNonpartitionDiscHeader(const std::vector<u8>& partition_header)
|
||||
{
|
||||
constexpr u64 NONPARTITION_DISKHEADER_ADDRESS = 0;
|
||||
@ -291,13 +263,6 @@ void DirectoryBlobReader::SetNonpartitionDiscHeader(const std::vector<u8>& parti
|
||||
m_disk_header_nonpartition.data());
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void DirectoryBlobReader::SetPartitionTable()
|
||||
{
|
||||
constexpr u64 PARTITION_TABLE_ADDRESS = 0x40000;
|
||||
@ -346,6 +311,41 @@ void DirectoryBlobReader::SetTMDAndTicket()
|
||||
reinterpret_cast<const u8*>(&m_tmd_header));
|
||||
}
|
||||
|
||||
DirectoryBlobPartition::DirectoryBlobPartition(const std::string& root_directory)
|
||||
: m_root_directory(root_directory)
|
||||
{
|
||||
SetDiscHeaderAndDiscType();
|
||||
SetBI2();
|
||||
BuildFST(SetDOL(SetApploader()));
|
||||
}
|
||||
|
||||
void DirectoryBlobPartition::SetDiscHeaderAndDiscType()
|
||||
{
|
||||
constexpr u64 DISKHEADER_ADDRESS = 0;
|
||||
constexpr u64 DISKHEADER_SIZE = 0x440;
|
||||
|
||||
m_disk_header.resize(DISKHEADER_SIZE);
|
||||
const std::string boot_bin_path = m_root_directory + "sys/boot.bin";
|
||||
if (ReadFileToVector(boot_bin_path, &m_disk_header) < 0x20)
|
||||
ERROR_LOG(DISCIO, "%s doesn't exist or is too small", boot_bin_path.c_str());
|
||||
|
||||
m_contents.emplace(DISKHEADER_ADDRESS, DISKHEADER_SIZE, m_disk_header.data());
|
||||
|
||||
m_is_wii = Common::swap32(&m_disk_header[0x18]) == 0x5d1c9ea3;
|
||||
const bool is_gc = Common::swap32(&m_disk_header[0x1c]) == 0xc2339f3d;
|
||||
if (m_is_wii == is_gc)
|
||||
ERROR_LOG(DISCIO, "Couldn't detect disc type based on %s", boot_bin_path.c_str());
|
||||
|
||||
m_address_shift = m_is_wii ? 2 : 0;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
u64 DirectoryBlobPartition::SetApploader()
|
||||
{
|
||||
bool success = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user