Add IOFile and headers for NCSD/NCCH

This commit is contained in:
wheremyfoodat 2022-10-01 03:28:12 +03:00
parent 7ba5c5a1bc
commit 9a040e1cde
4 changed files with 116 additions and 1 deletions

15
include/loader/ncch.hpp Normal file
View file

@ -0,0 +1,15 @@
#include "helpers.hpp"
struct NCCH {
bool isNew3DS = false;
bool initialized = false;
bool mountRomFS = false;
bool encrypted = false;
static constexpr u64 mediaUnit = 0x200;
u64 size = 0; // Size of NCCH converted to bytes
// Header: 0x200 byte NCCH header
// Returns true on success, false on failure
bool loadFromHeader(u8* header);
};

18
include/loader/ncsd.hpp Normal file
View file

@ -0,0 +1,18 @@
#include <array>
#include "helpers.hpp"
#include "io_file.hpp"
#include "loader/ncch.hpp"
struct NCSD {
static constexpr u64 mediaUnit = 0x200;
struct Partition {
u64 offset = 0; // Offset of partition converted to bytes
u64 length = 0; // Length of partition converted to bytes
NCCH ncch;
};
IOFile file;
u64 size = 0; // Image size according to the header converted to bytes
std::array<Partition, 8> partitions; // NCCH partitions
};