added: makerom

It has some issues, but I'm going to do anymore work on it.
This commit is contained in:
3DSGuy
2014-05-05 21:00:48 +08:00
parent c56a16756e
commit 6c44c7af5e
168 changed files with 71978 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
#include "lib.h"
#include "dir.h"
#include "ncch.h"
#include "romfs.h"
int PrepareImportRomFsBinaryFromFile(ncch_settings *ncchset, romfs_buildctx *ctx)
{
ctx->ImportRomfsBinary = true;
ctx->romfsSize = ncchset->componentFilePtrs.romfsSize;
ctx->romfsBinary = ncchset->componentFilePtrs.romfs;
ivfc_hdr *hdr = calloc(1,sizeof(ivfc_hdr));
ReadFile_64(hdr,sizeof(ivfc_hdr),0,ctx->romfsBinary);
if(memcmp(hdr->magic,"IVFC",4) != 0){
fprintf(stderr,"[ROMFS ERROR] Invalid RomFS Binary.\n");
return INVALID_ROMFS_FILE;
}
ctx->romfsHeaderSize = align(sizeof(ivfc_hdr),0x10) + (u64)u8_to_u32(hdr->masterHashSize,LE);
return 0;
}
int ImportRomFsBinaryFromFile(romfs_buildctx *ctx)
{
ReadFile_64(ctx->output,ctx->romfsSize,0,ctx->romfsBinary);
if(memcmp(ctx->output,"IVFC",4) != 0){
fprintf(stderr,"[ROMFS ERROR] Invalid RomFS Binary.\n");
return INVALID_ROMFS_FILE;
}
return 0;
}