DirectoryBlob: Support bi2.bin

This commit is contained in:
JosJuice 2017-06-09 21:39:26 +02:00
parent 251828ccc0
commit 975b2b40fa
2 changed files with 3 additions and 33 deletions

View File

@ -159,8 +159,7 @@ std::unique_ptr<DirectoryBlobReader> DirectoryBlobReader::Create(const std::stri
DirectoryBlobReader::DirectoryBlobReader(const std::string& root_directory)
: m_root_directory(root_directory), m_data_start_address(UINT64_MAX),
m_disk_header(DISKHEADERINFO_ADDRESS),
m_disk_header_info(std::make_unique<SDiskHeaderInfo>()), m_fst_address(0), m_dol_address(0)
m_disk_header(DISKHEADERINFO_ADDRESS), m_fst_address(0), m_dol_address(0)
{
SetDiscHeaderAndDiscType();
@ -171,8 +170,8 @@ DirectoryBlobReader::DirectoryBlobReader(const std::string& root_directory)
BuildFST();
m_virtual_disc.emplace(DISKHEADER_ADDRESS, DISKHEADERINFO_ADDRESS, m_disk_header.data());
m_virtual_disc.emplace(DISKHEADERINFO_ADDRESS, sizeof(m_disk_header_info),
reinterpret_cast<const u8*>(m_disk_header_info.get()));
AddFileToContents(&m_virtual_disc, m_root_directory + "sys/bi2.bin", DISKHEADERINFO_ADDRESS,
APPLOADER_ADDRESS - DISKHEADERINFO_ADDRESS);
m_virtual_disc.emplace(APPLOADER_ADDRESS, m_apploader.size(), m_apploader.data());
m_virtual_disc.emplace(m_fst_address, m_fst_data.size(), m_fst_data.data());

View File

@ -119,36 +119,7 @@ private:
u32 tmd_offset;
} m_tmd_header;
static_assert(sizeof(TMDHeader) == 8, "Wrong size for TMDHeader");
struct SDiskHeaderInfo
{
u32 debug_monitor_size;
u32 simulated_mem_size;
u32 arg_offset;
u32 debug_flag;
u32 track_location;
u32 track_size;
u32 country_code;
u32 unknown;
u32 unknown2;
// All the data is byteswapped
SDiskHeaderInfo()
{
debug_monitor_size = 0;
simulated_mem_size = 0;
arg_offset = 0;
debug_flag = 0;
track_location = 0;
track_size = 0;
country_code = 0;
unknown = 0;
unknown2 = 0;
}
};
static_assert(sizeof(SDiskHeaderInfo) == 36, "Wrong size for SDiskHeaderInfo");
#pragma pack(pop)
std::unique_ptr<SDiskHeaderInfo> m_disk_header_info;
std::vector<u8> m_apploader;