[ctrtool] Implemented --listromfs & --romfsdir to work directly with NCCH. Also implemented plainrgn extraction.

This commit is contained in:
jakcron
2015-11-26 14:21:46 +08:00
parent 085e37296e
commit 6ab7c2a0dc
11 changed files with 232 additions and 47 deletions
+14 -8
View File
@@ -2,18 +2,13 @@
#define __IVFC_H__
#include "types.h"
#include "ctr.h"
#include "settings.h"
#define IVFC_HEADER_SIZE 0x60
#define IVFC_MAX_LEVEL 4
#define IVFC_MAX_BUFFERSIZE 0x4000
typedef struct
{
u8 magic[4];
u8 id[4];
} ivfc_header;
typedef struct
{
u8 logicaloffset[8];
@@ -33,13 +28,15 @@ typedef struct
typedef struct
{
u8 magic[4];
u8 id[4];
u8 masterhashsize[4];
ivfc_levelheader level1;
ivfc_levelheader level2;
ivfc_levelheader level3;
u8 reserved[4];
u8 optionalsize[4];
} ivfc_header_romfs;
} ivfc_header;
typedef struct
{
@@ -47,9 +44,12 @@ typedef struct
u64 offset;
u64 size;
settings* usersettings;
u8 counter[16];
u8 key[16];
ctr_aes_context aes;
int encrypted;
ivfc_header header;
ivfc_header_romfs romfsheader;
u32 levelcount;
ivfc_level level[IVFC_MAX_LEVEL];
@@ -64,6 +64,12 @@ void ivfc_set_offset(ivfc_context* ctx, u64 offset);
void ivfc_set_size(ivfc_context* ctx, u64 size);
void ivfc_set_file(ivfc_context* ctx, FILE* file);
void ivfc_set_usersettings(ivfc_context* ctx, settings* usersettings);
void ivfc_set_encrypted(ivfc_context* ctx, u32 encrypted);
void ivfc_set_key(ivfc_context* ctx, u8 key[16]);
void ivfc_set_counter(ivfc_context* ctx, u8 counter[16]);
void ivfc_fseek(ivfc_context* ctx, u64 offset);
size_t ivfc_fread(ivfc_context* ctx, void* buffer, size_t size, size_t count);
void ivfc_verify(ivfc_context* ctx, u32 flags);
void ivfc_print(ivfc_context* ctx);