mirror of
https://github.com/DarkStore-3DS/Project_CTR.git
synced 2026-07-03 08:49:03 +00:00
cc707c160f
* Move files around to new directory structure * Rework libyaml into a stand-alone dep for makerom. * Rework libpolarssl to be standalone dependency for makerom. * Update includes. * Delete makefile * Add new makefile for makerom. * Update MakeROM github actions script. * Fix again. * Update MakeROM's makefile * Tweak makerom build script * Tweak MakeROM build script. * Fix typo * Update MakeROM makefiles. * Tweak CTRTool build script. * Tweak build script * Tweak CTRTool build script. * Tweak CTRTool build script * Add libmbedtls to makerom deps * Partially migrate makerom to libmbedtls * Break out libblz as an external dependency for makerom. * Tweak makerom build script. * Move dependencies to the top level. * Put everything back. * misc * Update makerom documentation. * Link to ctrtool/makerom readmes from the root readme. * Update root readme again. * Migrate makerom to modern mbedtls * Bump makerom version to 0.18.1 * Change signing errors to be warnings when they fail. * Add error verbosity to errors when generating CIA files. * Fix bug in RSA code. * misc. * Remove polarssl now migration to mbedtls complete. * Surface more makerom errors. * [makerom] Tolerate CCI signing errors as a warning. * Add missing return. * Import initial data key_x (prod/dev included) * [makerom] Fix initial data generation.
34 lines
908 B
C
34 lines
908 B
C
#include "lib.h"
|
|
#include "romfs_fs.h"
|
|
#include "ncch_build.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));
|
|
|
|
ReadFile64(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)
|
|
{
|
|
ReadFile64(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;
|
|
}
|