Added some more stuff

This commit is contained in:
purpasmart96 2014-10-26 17:12:09 -07:00 committed by purpasmart96
parent 19db92c0c8
commit 143b6ed4f0
3 changed files with 42 additions and 2 deletions

View file

@ -46,6 +46,10 @@ set(SRCS
loader/elf.cpp loader/elf.cpp
loader/loader.cpp loader/loader.cpp
loader/ncch.cpp loader/ncch.cpp
loader/polarssl/aes.c
loader/polarssl/bignum.c
loader/polarssl/rsa.c
loader/polarssl/sha2.c
core.cpp core.cpp
core_timing.cpp core_timing.cpp
mem_map.cpp mem_map.cpp
@ -105,9 +109,17 @@ set(HEADERS
hw/gpu.h hw/gpu.h
hw/hw.h hw/hw.h
hw/ndma.h hw/ndma.h
loader/crypto.h
loader/elf.h loader/elf.h
loader/loader.h loader/loader.h
loader/ncch.h loader/ncch.h
loader/polarssl/aes.h
loader/polarssl/bignum.h
loader/polarssl/bn_mul.h
loader/polarssl/config.h
loader/polarssl/padlock.h
loader/polarssl/rsa.h
loader/polarssl/sha2.h
core.h core.h
core_timing.h core_timing.h
mem_map.h mem_map.h

View file

@ -276,7 +276,6 @@ ResultStatus AppLoader_NCCH::Load() {
INFO_LOG(LOADER, "ExeFS offset: 0x%08X", exefs_offset); INFO_LOG(LOADER, "ExeFS offset: 0x%08X", exefs_offset);
INFO_LOG(LOADER, "ExeFS size: 0x%08X", exefs_size); INFO_LOG(LOADER, "ExeFS size: 0x%08X", exefs_size);
file.Seek(exefs_offset + ncch_offset, 0); file.Seek(exefs_offset + ncch_offset, 0);
file.ReadBytes(&exefs_header, sizeof(ExeFs_Header)); file.ReadBytes(&exefs_header, sizeof(ExeFs_Header));

View file

@ -8,6 +8,7 @@
#include "common/file_util.h" #include "common/file_util.h"
#include "core/loader/loader.h" #include "core/loader/loader.h"
#include "core/loader/polarssl/aes.h"
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
/// NCCH header (Note: "NCCH" appears to be a publically unknown acronym) /// NCCH header (Note: "NCCH" appears to be a publically unknown acronym)
@ -18,7 +19,7 @@ struct NCCH_Header {
u32 content_size; u32 content_size;
u8 partition_id[8]; u8 partition_id[8];
u16 maker_code; u16 maker_code;
u16 version; u8 version[2];
u8 reserved_0[4]; u8 reserved_0[4];
u8 program_id[8]; u8 program_id[8];
u8 temp_flag; u8 temp_flag;
@ -139,6 +140,32 @@ struct ExHeader_Header{
} access_desc; } access_desc;
}; };
struct Cia_Header{
u32 header_size;
u16 type;
u16 version;
u32 cert_size;
u32 tik_size;
u32 tmd_size;
u32 meta_size;
u64 content_size;
u8 content_idx[0x2000];
};
#define CIA_MAGIC sizeof(Cia_Header)
enum CTR_NCCH_TYPES{
NCCHTYPE_EXHEADER = 1,
NCCHTYPE_EXEFS = 2,
NCCHTYPE_ROMFS = 3,
};
struct ctr_aes_context{
u8 ctr[16];
u8 iv[16];
aes_context aes;
};
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
// Loader namespace // Loader namespace
@ -211,6 +238,7 @@ private:
bool is_loaded; bool is_loaded;
bool is_compressed; bool is_compressed;
bool is_encrypted;
u32 entry_point; u32 entry_point;
u32 ncch_offset; // Offset to NCCH header, can be 0 or after NCSD header u32 ncch_offset; // Offset to NCCH header, can be 0 or after NCSD header
@ -219,6 +247,7 @@ private:
NCCH_Header ncch_header; NCCH_Header ncch_header;
ExeFs_Header exefs_header; ExeFs_Header exefs_header;
ExHeader_Header exheader_header; ExHeader_Header exheader_header;
ExeFs_SectionHeader exfs_section_header;
}; };
} // namespace Loader } // namespace Loader