[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
+9 -1
View File
@@ -57,6 +57,8 @@ typedef struct
FILE* file;
oschar_t* extractdir;
settings* usersettings;
u8 counter[16];
u8 key[16];
u64 offset;
u64 size;
romfs_header header;
@@ -70,6 +72,8 @@ typedef struct
romfs_direntry direntry;
romfs_fileentry fileentry;
ivfc_context ivfc;
ctr_aes_context aes;
int encrypted;
} romfs_context;
void romfs_init(romfs_context* ctx);
@@ -77,7 +81,11 @@ void romfs_set_file(romfs_context* ctx, FILE* file);
void romfs_set_offset(romfs_context* ctx, u64 offset);
void romfs_set_size(romfs_context* ctx, u64 size);
void romfs_set_usersettings(romfs_context* ctx, settings* usersettings);
void romfs_test(romfs_context* ctx);
void romfs_set_encrypted(romfs_context* ctx, u32 encrypted);
void romfs_set_key(romfs_context* ctx, u8 key[16]);
void romfs_set_counter(romfs_context* ctx, u8 counter[16]);
void romfs_fseek(romfs_context* ctx, u64 offset);
size_t romfs_fread(romfs_context* ctx, void* buffer, size_t size, size_t count);
int romfs_dirblock_read(romfs_context* ctx, u32 diroffset, u32 dirsize, void* buffer);
int romfs_dirblock_readentry(romfs_context* ctx, u32 diroffset, romfs_direntry* entry);
int romfs_fileblock_read(romfs_context* ctx, u32 fileoffset, u32 filesize, void* buffer);