big update

lots cleaned, added cia to cci conv, it
's called a block, separated reading from building, improved ncch keyx
stuff, and basic verbose for keys, elf checking and romfs
This commit is contained in:
applestash
2014-08-26 00:34:28 +10:00
parent c6e98ca578
commit 9c548197c1
66 changed files with 2970 additions and 2551 deletions
+7 -8
View File
@@ -1,6 +1,6 @@
#include "lib.h"
#include "ncch.h"
#include "exefs.h"
#include "ncch_build.h"
#include "exefs_build.h"
// Private Prototypes
u32 PredictExeFS_Size(exefs_buildctx *ctx);
@@ -18,7 +18,7 @@ int BuildExeFs(ncch_settings *ncchset)
fprintf(stderr,"[EXEFS ERROR] Not enough memory\n");
return MEM_ERROR;
}
ctx->mediaUnit = ncchset->options.mediaSize;
ctx->blockSize = ncchset->options.blockSize;
/* Importing ExeFs */
if(ncchset->exefsSections.code.size)
@@ -56,10 +56,9 @@ int BuildExeFs(ncch_settings *ncchset)
u32 PredictExeFS_Size(exefs_buildctx *ctx)
{
u32 exefs_size = 0x200; // Size of header
for(int i = 0; i < ctx->fileCount; i++){
exefs_size += align(ctx->fileSize[i],ctx->mediaUnit);
}
u32 exefs_size = sizeof(exefs_hdr); // Size of header
for(int i = 0; i < ctx->fileCount; i++)
exefs_size += align(ctx->fileSize[i],ctx->blockSize);
//exefs_size = align(ctx->exefs_size,ctx->mediaUnit);
return exefs_size;
}
@@ -70,7 +69,7 @@ int GenerateExeFS_Header(exefs_buildctx *ctx, u8 *outbuff)
if(i == 0)
ctx->fileOffset[i] = 0;
else
ctx->fileOffset[i] = align((ctx->fileOffset[i-1]+ctx->fileSize[i-1]),ctx->mediaUnit);
ctx->fileOffset[i] = align((ctx->fileOffset[i-1]+ctx->fileSize[i-1]),ctx->blockSize);
memcpy(ctx->fileHdr[i].name,ctx->fileName[i],8);
u32_to_u8(ctx->fileHdr[i].offset,ctx->fileOffset[i],LE);