mirror of
https://github.com/DarkStore-3DS/Project_CTR.git
synced 2026-07-04 08:49:03 +00:00
added: makerom
It has some issues, but I'm going to do anymore work on it.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user