From 906d785c73cb3644e8984fbfcbf5fcb8a1ebbc6f Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Fri, 27 Jul 2018 18:14:03 -0400 Subject: RomFS Extraction --- src/core/file_sys/content_archive.cpp | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'src/core/file_sys/content_archive.cpp') diff --git a/src/core/file_sys/content_archive.cpp b/src/core/file_sys/content_archive.cpp index d6b20c047..61cb0bbe3 100644 --- a/src/core/file_sys/content_archive.cpp +++ b/src/core/file_sys/content_archive.cpp @@ -9,6 +9,7 @@ #include "core/file_sys/content_archive.h" #include "core/file_sys/vfs_offset.h" #include "core/loader/loader.h" +#include "romfs.h" namespace FileSys { @@ -46,21 +47,9 @@ struct PFS0Superblock { }; static_assert(sizeof(PFS0Superblock) == 0x200, "PFS0Superblock has incorrect size."); -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 RomFSSuperblock { NCASectionHeaderBlock header_block; - u32_le magic; - u32_le magic_number; - INSERT_PADDING_BYTES(8); - std::array levels; - INSERT_PADDING_BYTES(64); + IVFCHeader ivfc; }; static_assert(sizeof(RomFSSuperblock) == 0xE8, "RomFSSuperblock has incorrect size."); @@ -92,8 +81,8 @@ NCA::NCA(VirtualFile file_) : file(std::move(file_)) { const size_t romfs_offset = header.section_tables[i].media_offset * MEDIA_OFFSET_MULTIPLIER + - sb.levels[IVFC_MAX_LEVEL - 1].offset; - const size_t romfs_size = sb.levels[IVFC_MAX_LEVEL - 1].size; + sb.ivfc.levels[IVFC_MAX_LEVEL - 1].offset; + const size_t romfs_size = sb.ivfc.levels[IVFC_MAX_LEVEL - 1].size; files.emplace_back(std::make_shared(file, romfs_size, romfs_offset)); romfs = files.back(); } else if (block.filesystem_type == NCASectionFilesystemType::PFS0) { -- cgit v1.2.3