From bbf1d2f7ad9eaf4ada9b26336d0c66605cc20783 Mon Sep 17 00:00:00 2001 From: Pablo Curiel Date: Sun, 31 Jan 2021 03:34:09 -0400 Subject: [PATCH] NSP dumper PoCs: fix crash while dumping updates/DLCs without an available base application. --- code_templates/nsp_dumper_stor.c | 9 +++++++-- code_templates/nsp_dumper_usb.c | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/code_templates/nsp_dumper_stor.c b/code_templates/nsp_dumper_stor.c index 7e9ac3b..f77efa6 100644 --- a/code_templates/nsp_dumper_stor.c +++ b/code_templates/nsp_dumper_stor.c @@ -79,8 +79,13 @@ static void nspDump(TitleInfo *title_info, u64 free_space) printf("%s info:\n\n", title_info->meta_key.type == NcmContentMetaType_Application ? "base application" : \ (title_info->meta_key.type == NcmContentMetaType_Patch ? "update" : "dlc")); - printf("name: %s\n", app_metadata->lang_entry.name); - printf("publisher: %s\n", app_metadata->lang_entry.author); + + if (app_metadata) + { + printf("name: %s\n", app_metadata->lang_entry.name); + printf("publisher: %s\n", app_metadata->lang_entry.author); + } + printf("source storage: %s\n", title_info->storage_id == NcmStorageId_GameCard ? "gamecard" : (title_info->storage_id == NcmStorageId_BuiltInUser ? "emmc" : "sd card")); printf("title id: %016lX\n", title_info->meta_key.id); printf("version: %u (%u.%u.%u-%u.%u)\n", title_info->version.value, title_info->version.major, title_info->version.minor, title_info->version.micro, title_info->version.major_relstep, \ diff --git a/code_templates/nsp_dumper_usb.c b/code_templates/nsp_dumper_usb.c index 5803b7a..ef81ba4 100644 --- a/code_templates/nsp_dumper_usb.c +++ b/code_templates/nsp_dumper_usb.c @@ -74,8 +74,13 @@ static void nspDump(TitleInfo *title_info) printf("%s info:\n\n", title_info->meta_key.type == NcmContentMetaType_Application ? "base application" : \ (title_info->meta_key.type == NcmContentMetaType_Patch ? "update" : "dlc")); - printf("name: %s\n", app_metadata->lang_entry.name); - printf("publisher: %s\n", app_metadata->lang_entry.author); + + if (app_metadata) + { + printf("name: %s\n", app_metadata->lang_entry.name); + printf("publisher: %s\n", app_metadata->lang_entry.author); + } + printf("source storage: %s\n", title_info->storage_id == NcmStorageId_GameCard ? "gamecard" : (title_info->storage_id == NcmStorageId_BuiltInUser ? "emmc" : "sd card")); printf("title id: %016lX\n", title_info->meta_key.id); printf("version: %u (%u.%u.%u-%u.%u)\n", title_info->version.value, title_info->version.major, title_info->version.minor, title_info->version.micro, title_info->version.major_relstep, \