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
+55
View File
@@ -0,0 +1,55 @@
#include "lib.h"
#include "dir.h"
#include "ncch.h"
#include "romfs.h"
#include "romfs_binary.h"
#include "romfs_import.h"
void FreeRomFsCtx(romfs_buildctx *ctx);
// RomFs Build Functions
int SetupRomFs(ncch_settings *ncchset, romfs_buildctx *ctx)
{
ctx->output = NULL;
ctx->romfsSize = 0;
// If Not Using RomFS Return
if(!ncchset->options.UseRomFS)
return 0;
if(ncchset->componentFilePtrs.romfs)// The user has specified a pre-built RomFs Binary
return PrepareImportRomFsBinaryFromFile(ncchset,ctx);
else // Otherwise build ROMFS
return PrepareBuildRomFsBinary(ncchset,ctx);
}
int BuildRomFs(romfs_buildctx *ctx)
{
// If Not Using RomFS Return
if(!ctx->romfsSize)
return 0;
int result = 0;
if(ctx->ImportRomfsBinary) // The user has specified a pre-built RomFs Binary
result = ImportRomFsBinaryFromFile(ctx);
else // Otherwise build ROMFS
result = BuildRomFsBinary(ctx);
FreeRomFsCtx(ctx);
return result;
}
void FreeRomFsCtx(romfs_buildctx *ctx)
{
if(ctx->romfsBinary)
fclose(ctx->romfsBinary);
if(ctx->fs){
fs_FreeFiles(ctx->fs);
fs_FreeDir(ctx->fs);
free(ctx->fs);
}
}