[NCSD/NCCH] More NCSD parsing

This commit is contained in:
wheremyfoodat 2022-10-02 03:26:24 +03:00
parent 6b6cc7ca2f
commit 71cc187f93
3 changed files with 75 additions and 10 deletions

View file

@ -1,8 +1,18 @@
#pragma once
#include <array>
#include "io_file.hpp"
#include "helpers.hpp"
struct NCCH {
struct FSInfo { // Info on the ExeFS/RomFS
u64 offset = 0;
u64 size = 0;
u64 hashRegionSize = 0;
};
u64 partitionIndex = 0;
u64 fileOffset = 0;
bool isNew3DS = false;
bool initialized = false;
bool compressExeFS = false;
@ -16,10 +26,17 @@ struct NCCH {
u32 bssSize = 0;
u32 exheaderSize = 0;
FSInfo exeFS;
FSInfo romFS;
// Header: 0x200 + 0x800 byte NCCH header + exheadr
// Returns true on success, false on failure
bool loadFromHeader(u8* header);
// Partition index/offset/size must have been set before this
bool loadFromHeader(u8* header, IOFile& file);
bool hasExtendedHeader() { return exheaderSize != 0; }
bool hasExeFS() { return exeFS.size != 0; }
bool hasRomFS() { return romFS.size != 0; }
private:
std::array<u8, 16> primaryKey = {}; // For exheader, ExeFS header and icons