mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 09:09:52 -06:00
WIA: Add reading raw data
This commit is contained in:
@ -41,6 +41,7 @@ private:
|
||||
static std::string VersionToString(u32 version);
|
||||
|
||||
using SHA1 = std::array<u8, 20>;
|
||||
using WiiKey = std::array<u8, 16>;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct WIAHeader1
|
||||
@ -54,10 +55,8 @@ private:
|
||||
u64 wia_file_size;
|
||||
SHA1 header_1_hash;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
static_assert(sizeof(WIAHeader1) == 0x48, "Wrong size for WIA header 1");
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct WIAHeader2
|
||||
{
|
||||
u32 disc_type;
|
||||
@ -67,7 +66,7 @@ private:
|
||||
|
||||
std::array<u8, 0x80> disc_header;
|
||||
|
||||
u32 number_of_partitions_entries;
|
||||
u32 number_of_partition_entries;
|
||||
u32 partition_entry_size;
|
||||
u64 partition_entries_offset;
|
||||
SHA1 partition_entries_hash;
|
||||
@ -79,9 +78,51 @@ private:
|
||||
u32 number_of_group_entries;
|
||||
u64 group_entries_offset;
|
||||
u32 group_entries_size;
|
||||
|
||||
u8 compressor_data_size;
|
||||
u8 compressor_data[7];
|
||||
};
|
||||
static_assert(sizeof(WIAHeader2) == 0xdc, "Wrong size for WIA header 2");
|
||||
|
||||
struct PartitionDataEntry
|
||||
{
|
||||
u32 first_sector;
|
||||
u32 number_of_sectors;
|
||||
u32 group_index;
|
||||
u32 number_of_groups;
|
||||
};
|
||||
static_assert(sizeof(PartitionDataEntry) == 0x10, "Wrong size for WIA partition data entry");
|
||||
|
||||
struct PartitionEntry
|
||||
{
|
||||
WiiKey partition_key;
|
||||
std::array<PartitionDataEntry, 2> data_entries;
|
||||
};
|
||||
static_assert(sizeof(PartitionEntry) == 0x30, "Wrong size for WIA partition entry");
|
||||
|
||||
struct RawDataEntry
|
||||
{
|
||||
u64 data_offset;
|
||||
u64 data_size;
|
||||
u32 group_index;
|
||||
u32 number_of_groups;
|
||||
};
|
||||
static_assert(sizeof(RawDataEntry) == 0x18, "Wrong size for WIA raw data entry");
|
||||
|
||||
struct GroupEntry
|
||||
{
|
||||
u32 data_offset; // >> 2
|
||||
u32 data_size;
|
||||
};
|
||||
static_assert(sizeof(GroupEntry) == 0x08, "Wrong size for WIA group entry");
|
||||
|
||||
struct HashExceptionEntry
|
||||
{
|
||||
u16 offset;
|
||||
SHA1 hash;
|
||||
};
|
||||
static_assert(sizeof(HashExceptionEntry) == 0x16, "Wrong size for WIA hash exception entry");
|
||||
#pragma pack(pop)
|
||||
static_assert(sizeof(WIAHeader2) == 0xd4, "Wrong size for WIA header 2");
|
||||
|
||||
bool m_valid;
|
||||
|
||||
@ -89,6 +130,9 @@ private:
|
||||
|
||||
WIAHeader1 m_header_1;
|
||||
WIAHeader2 m_header_2;
|
||||
std::vector<PartitionEntry> m_partition_entries;
|
||||
std::vector<RawDataEntry> m_raw_data_entries;
|
||||
std::vector<GroupEntry> m_group_entries;
|
||||
|
||||
static constexpr u32 WIA_VERSION = 0x01000000;
|
||||
static constexpr u32 WIA_VERSION_WRITE_COMPATIBLE = 0x01000000;
|
||||
|
Reference in New Issue
Block a user