mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-10 04:52:13 +12:00
More NCSD loading
This commit is contained in:
parent
9a040e1cde
commit
f6c2e390c1
11 changed files with 142 additions and 17 deletions
30
src/core/loader/ncch.cpp
Normal file
30
src/core/loader/ncch.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
#include "loader/ncch.hpp"
|
||||
|
||||
bool NCCH::loadFromHeader(u8* header) {
|
||||
const u8* exheader = &header[0x200]; // Extended NCCH header
|
||||
|
||||
if (header[0x100] != 'N' || header[0x101] != 'C' || header[0x102] != 'C' || header[0x103] != 'H') {
|
||||
printf("Invalid header on NCCH\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
size = u64(*(u32*)&header[0x104]) * mediaUnit; // TODO: Maybe don't type pun because big endian will break
|
||||
|
||||
// Read NCCH flags
|
||||
isNew3DS = header[0x188 + 4] == 2;
|
||||
mountRomFS = (header[0x188 + 7] & 0x1) != 0x1;
|
||||
encrypted = (header[0x188 + 7] & 0x4) != 0x4;
|
||||
|
||||
compressExeFS = (exheader[0xD] & 1) != 0;
|
||||
|
||||
if (compressExeFS) {
|
||||
Helpers::panic("Compressed ExeFS");
|
||||
}
|
||||
|
||||
if (encrypted) {
|
||||
Helpers::panic("Encrypted NCCH partition");
|
||||
}
|
||||
|
||||
initialized = true;
|
||||
return true;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue