mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-03 12:27:21 +12:00
We can almost load commercial carts now
This commit is contained in:
parent
36b0117ebc
commit
87bf469447
5 changed files with 50 additions and 8 deletions
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
#include <array>
|
||||
#include <vector>
|
||||
#include "io_file.hpp"
|
||||
#include "helpers.hpp"
|
||||
|
||||
|
@ -10,6 +11,20 @@ struct NCCH {
|
|||
u64 hashRegionSize = 0;
|
||||
};
|
||||
|
||||
// Descriptions for .text, .data and .rodata sections
|
||||
struct CodeSetInfo {
|
||||
u32 address = 0;
|
||||
u32 pageCount = 0;
|
||||
u32 size = 0;
|
||||
|
||||
// Extract the code set info from the relevant header data
|
||||
void extract(const u8* headerEntry) {
|
||||
address = *(u32*)&headerEntry[0];
|
||||
pageCount = *(u32*)&headerEntry[4];
|
||||
size = *(u32*)&headerEntry[8];
|
||||
}
|
||||
};
|
||||
|
||||
u64 partitionIndex = 0;
|
||||
u64 fileOffset = 0;
|
||||
|
||||
|
@ -28,6 +43,10 @@ struct NCCH {
|
|||
|
||||
FSInfo exeFS;
|
||||
FSInfo romFS;
|
||||
CodeSetInfo text, data, rodata;
|
||||
|
||||
// Contents of the .code file in the ExeFS
|
||||
std::vector<u8> codeFile;
|
||||
|
||||
// Header: 0x200 + 0x800 byte NCCH header + exheadr
|
||||
// Returns true on success, false on failure
|
||||
|
@ -37,6 +56,7 @@ struct NCCH {
|
|||
bool hasExtendedHeader() { return exheaderSize != 0; }
|
||||
bool hasExeFS() { return exeFS.size != 0; }
|
||||
bool hasRomFS() { return romFS.size != 0; }
|
||||
bool hasCode() { return codeFile.size() != 0; }
|
||||
|
||||
private:
|
||||
std::array<u8, 16> primaryKey = {}; // For exheader, ExeFS header and icons
|
||||
|
|
|
@ -16,4 +16,6 @@ struct NCSD {
|
|||
IOFile file;
|
||||
u64 size = 0; // Image size according to the header converted to bytes
|
||||
std::array<Partition, 8> partitions; // NCCH partitions
|
||||
|
||||
u32 entrypoint; // Initial ARM11 PC
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue