mirror of
https://github.com/DarkMatterCore/nxdumptool.git
synced 2024-11-12 21:46:39 +00:00
nca: fix ctx init for NCAs with bogus Patch RomFS.
This commit is contained in:
parent
f5d418e0d3
commit
b70da7e7bf
4 changed files with 18 additions and 4 deletions
|
@ -118,6 +118,7 @@ static void consolePrint(const char *text, ...)
|
||||||
static void consoleRefresh(void)
|
static void consoleRefresh(void)
|
||||||
{
|
{
|
||||||
mutexLock(&g_conMutex);
|
mutexLock(&g_conMutex);
|
||||||
|
fflush(stdout);
|
||||||
consoleUpdate(NULL);
|
consoleUpdate(NULL);
|
||||||
mutexUnlock(&g_conMutex);
|
mutexUnlock(&g_conMutex);
|
||||||
}
|
}
|
||||||
|
@ -405,6 +406,8 @@ static void dump_thread_func(void *arg)
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
consoleRefresh();
|
||||||
|
|
||||||
// generate cnmt xml right away even though we don't yet have all the data we need
|
// generate cnmt xml right away even though we don't yet have all the data we need
|
||||||
// This is because we need its size to calculate the full nsp size
|
// This is because we need its size to calculate the full nsp size
|
||||||
if (append_authoringtool_data && !cnmtGenerateAuthoringToolXml(&cnmt_ctx, nca_ctx, title_info->content_count))
|
if (append_authoringtool_data && !cnmtGenerateAuthoringToolXml(&cnmt_ctx, nca_ctx, title_info->content_count))
|
||||||
|
@ -545,6 +548,7 @@ static void dump_thread_func(void *arg)
|
||||||
|
|
||||||
nsp_size = (nsp_header_size + pfs_file_ctx.fs_size);
|
nsp_size = (nsp_header_size + pfs_file_ctx.fs_size);
|
||||||
consolePrint("nsp header size: 0x%lX | nsp size: 0x%lX\n", nsp_header_size, nsp_size);
|
consolePrint("nsp header size: 0x%lX | nsp size: 0x%lX\n", nsp_header_size, nsp_size);
|
||||||
|
consoleRefresh();
|
||||||
|
|
||||||
if (output_device != 1)
|
if (output_device != 1)
|
||||||
{
|
{
|
||||||
|
@ -586,6 +590,7 @@ static void dump_thread_func(void *arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
consolePrint("dump process started, please wait. hold b to cancel.\n");
|
consolePrint("dump process started, please wait. hold b to cancel.\n");
|
||||||
|
consoleRefresh();
|
||||||
|
|
||||||
nsp_offset += nsp_header_size;
|
nsp_offset += nsp_header_size;
|
||||||
|
|
||||||
|
@ -1010,6 +1015,8 @@ static void nspDump(TitleInfo *title_info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
consoleRefresh();
|
||||||
|
|
||||||
// create dump thread
|
// create dump thread
|
||||||
shared_data.data = title_info;
|
shared_data.data = title_info;
|
||||||
utilsCreateThread(&dump_thread, dump_thread_func, &shared_data, 2);
|
utilsCreateThread(&dump_thread, dump_thread_func, &shared_data, 2);
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <sys/param.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
|
@ -30,9 +30,6 @@
|
||||||
|
|
||||||
#define MAX_ELEMENTS(x) ((sizeof((x))) / (sizeof((x)[0])))
|
#define MAX_ELEMENTS(x) ((sizeof((x))) / (sizeof((x)[0])))
|
||||||
|
|
||||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
|
||||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
|
||||||
|
|
||||||
#define BIT_LONG(n) (1UL << (n))
|
#define BIT_LONG(n) (1UL << (n))
|
||||||
|
|
||||||
#define ALIGN_UP(x, y) (((x) + ((y) - 1)) & ~((y) - 1))
|
#define ALIGN_UP(x, y) (((x) + ((y) - 1)) & ~((y) - 1))
|
||||||
|
|
|
@ -852,7 +852,7 @@ static bool ncaInitializeFsSectionContext(NcaContext *nca_ctx, u32 section_idx)
|
||||||
if (!raw_storage_size || !sparse_bucket->header.entry_count)
|
if (!raw_storage_size || !sparse_bucket->header.entry_count)
|
||||||
{
|
{
|
||||||
/* Return true but don't set this FS section as enabled, since we can't really use it. */
|
/* Return true but don't set this FS section as enabled, since we can't really use it. */
|
||||||
LOG_MSG_ERROR("Empty SparseInfo data detected for FS section #%u in \"%s\". Skipping FS section.", section_idx, nca_ctx->content_id_str);
|
LOG_MSG_WARNING("Empty SparseInfo data detected for FS section #%u in \"%s\". Skipping FS section.", section_idx, nca_ctx->content_id_str);
|
||||||
success = true;
|
success = true;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
@ -918,6 +918,15 @@ static bool ncaInitializeFsSectionContext(NcaContext *nca_ctx, u32 section_idx)
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check if we're dealing with a bogus Patch RomFS (seem to be available in HtmlDocument NCAs). */
|
||||||
|
if (fs_ctx->section_type == NcaFsSectionType_PatchRomFs && fs_ctx->section_size <= (fs_ctx->header.patch_info.indirect_bucket.size + fs_ctx->header.patch_info.aes_ctr_ex_bucket.size))
|
||||||
|
{
|
||||||
|
/* Return true but don't set this FS section as enabled, since we can't really use it. */
|
||||||
|
LOG_MSG_WARNING("Empty Patch RomFS data detected for FS section #%u in \"%s\". Skipping FS section.", section_idx, nca_ctx->content_id_str);
|
||||||
|
success = true;
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
/* Validate HashData boundaries. */
|
/* Validate HashData boundaries. */
|
||||||
if (!ncaFsSectionValidateHashDataBoundaries(fs_ctx)) goto end;
|
if (!ncaFsSectionValidateHashDataBoundaries(fs_ctx)) goto end;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue