diff options
author | bunnei <bunneidev@gmail.com> | 2019-11-04 00:54:03 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2019-11-04 04:22:41 +0100 |
commit | 1bdae0fe29f87daa81d2aba052a10a709b87485a (patch) | |
tree | 16d0f4aa4c4a11222c6950b3ad60e7d1d9905036 /src/core/file_sys | |
parent | Merge pull request #3059 from FearlessTobi/stub-am-commands (diff) | |
download | yuzu-1bdae0fe29f87daa81d2aba052a10a709b87485a.tar yuzu-1bdae0fe29f87daa81d2aba052a10a709b87485a.tar.gz yuzu-1bdae0fe29f87daa81d2aba052a10a709b87485a.tar.bz2 yuzu-1bdae0fe29f87daa81d2aba052a10a709b87485a.tar.lz yuzu-1bdae0fe29f87daa81d2aba052a10a709b87485a.tar.xz yuzu-1bdae0fe29f87daa81d2aba052a10a709b87485a.tar.zst yuzu-1bdae0fe29f87daa81d2aba052a10a709b87485a.zip |
Diffstat (limited to 'src/core/file_sys')
-rw-r--r-- | src/core/file_sys/content_archive.cpp | 39 | ||||
-rw-r--r-- | src/core/file_sys/romfs.h | 19 |
2 files changed, 28 insertions, 30 deletions
diff --git a/src/core/file_sys/content_archive.cpp b/src/core/file_sys/content_archive.cpp index ea5c92f61..b8bbdd1ef 100644 --- a/src/core/file_sys/content_archive.cpp +++ b/src/core/file_sys/content_archive.cpp @@ -32,11 +32,28 @@ enum class NCASectionFilesystemType : u8 { ROMFS = 0x3, }; +struct IVFCLevel { + u64_le offset; + u64_le size; + u32_le block_size; + u32_le reserved; +}; +static_assert(sizeof(IVFCLevel) == 0x18, "IVFCLevel has incorrect size."); + +struct IVFCHeader { + u32_le magic; + u32_le magic_number; + INSERT_UNION_PADDING_BYTES(8); + std::array<IVFCLevel, 6> levels; + INSERT_UNION_PADDING_BYTES(64); +}; +static_assert(sizeof(IVFCHeader) == 0xE0, "IVFCHeader has incorrect size."); + struct NCASectionHeaderBlock { - INSERT_PADDING_BYTES(3); + INSERT_UNION_PADDING_BYTES(3); NCASectionFilesystemType filesystem_type; NCASectionCryptoType crypto_type; - INSERT_PADDING_BYTES(3); + INSERT_UNION_PADDING_BYTES(3); }; static_assert(sizeof(NCASectionHeaderBlock) == 0x8, "NCASectionHeaderBlock has incorrect size."); @@ -44,7 +61,7 @@ struct NCASectionRaw { NCASectionHeaderBlock header; std::array<u8, 0x138> block_data; std::array<u8, 0x8> section_ctr; - INSERT_PADDING_BYTES(0xB8); + INSERT_UNION_PADDING_BYTES(0xB8); }; static_assert(sizeof(NCASectionRaw) == 0x200, "NCASectionRaw has incorrect size."); @@ -52,19 +69,19 @@ struct PFS0Superblock { NCASectionHeaderBlock header_block; std::array<u8, 0x20> hash; u32_le size; - INSERT_PADDING_BYTES(4); + INSERT_UNION_PADDING_BYTES(4); u64_le hash_table_offset; u64_le hash_table_size; u64_le pfs0_header_offset; u64_le pfs0_size; - INSERT_PADDING_BYTES(0x1B0); + INSERT_UNION_PADDING_BYTES(0x1B0); }; static_assert(sizeof(PFS0Superblock) == 0x200, "PFS0Superblock has incorrect size."); struct RomFSSuperblock { NCASectionHeaderBlock header_block; IVFCHeader ivfc; - INSERT_PADDING_BYTES(0x118); + INSERT_UNION_PADDING_BYTES(0x118); }; static_assert(sizeof(RomFSSuperblock) == 0x200, "RomFSSuperblock has incorrect size."); @@ -72,24 +89,24 @@ struct BKTRHeader { u64_le offset; u64_le size; u32_le magic; - INSERT_PADDING_BYTES(0x4); + INSERT_UNION_PADDING_BYTES(0x4); u32_le number_entries; - INSERT_PADDING_BYTES(0x4); + INSERT_UNION_PADDING_BYTES(0x4); }; static_assert(sizeof(BKTRHeader) == 0x20, "BKTRHeader has incorrect size."); struct BKTRSuperblock { NCASectionHeaderBlock header_block; IVFCHeader ivfc; - INSERT_PADDING_BYTES(0x18); + INSERT_UNION_PADDING_BYTES(0x18); BKTRHeader relocation; BKTRHeader subsection; - INSERT_PADDING_BYTES(0xC0); + INSERT_UNION_PADDING_BYTES(0xC0); }; static_assert(sizeof(BKTRSuperblock) == 0x200, "BKTRSuperblock has incorrect size."); union NCASectionHeader { - NCASectionRaw raw; + NCASectionRaw raw{}; PFS0Superblock pfs0; RomFSSuperblock romfs; BKTRSuperblock bktr; diff --git a/src/core/file_sys/romfs.h b/src/core/file_sys/romfs.h index 0f35639bc..1c89be8a4 100644 --- a/src/core/file_sys/romfs.h +++ b/src/core/file_sys/romfs.h @@ -13,25 +13,6 @@ namespace FileSys { -struct RomFSHeader; - -struct IVFCLevel { - u64_le offset; - u64_le size; - u32_le block_size; - u32_le reserved; -}; -static_assert(sizeof(IVFCLevel) == 0x18, "IVFCLevel has incorrect size."); - -struct IVFCHeader { - u32_le magic; - u32_le magic_number; - INSERT_PADDING_BYTES(8); - std::array<IVFCLevel, 6> levels; - INSERT_PADDING_BYTES(64); -}; -static_assert(sizeof(IVFCHeader) == 0xE0, "IVFCHeader has incorrect size."); - enum class RomFSExtractionType { Full, // Includes data directory Truncated, // Traverses into data directory |