1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-11-26 12:12:02 +00:00

Fix NACP bitflag checks.

This commit is contained in:
Pablo Curiel 2021-03-20 03:13:16 -04:00
parent ecefbe6163
commit ae3b7266a0
5 changed files with 18 additions and 8 deletions

View file

@ -429,7 +429,7 @@ static void nspDump(TitleInfo *title_info, u64 free_space)
} }
sprintf(entry_name, "%s.nacp.xml", cur_nca_ctx->content_id_str); sprintf(entry_name, "%s.nacp.xml", cur_nca_ctx->content_id_str);
ret = pfsAddEntryInformationToFileContext(&pfs_file_ctx, entry_name, cur_nacp_ctx->authoring_tool_xml_size, NULL); ret = pfsAddEntryInformationToFileContext(&pfs_file_ctx, entry_name, cur_nacp_ctx->authoring_tool_xml_size, !cur_nacp_ctx->icon_count ? &(cur_nca_ctx->content_type_ctx_data_idx) : NULL);
break; break;
} }
case NcmContentType_LegalInformation: case NcmContentType_LegalInformation:

View file

@ -419,7 +419,7 @@ static void dump_thread_func(void *arg)
} }
sprintf(entry_name, "%s.nacp.xml", cur_nca_ctx->content_id_str); sprintf(entry_name, "%s.nacp.xml", cur_nca_ctx->content_id_str);
ret = pfsAddEntryInformationToFileContext(&pfs_file_ctx, entry_name, cur_nacp_ctx->authoring_tool_xml_size, NULL); ret = pfsAddEntryInformationToFileContext(&pfs_file_ctx, entry_name, cur_nacp_ctx->authoring_tool_xml_size, !cur_nacp_ctx->icon_count ? &(cur_nca_ctx->content_type_ctx_data_idx) : NULL);
break; break;
} }
case NcmContentType_LegalInformation: case NcmContentType_LegalInformation:

View file

@ -46,7 +46,9 @@ This is the first USB command issued by nxdumptool. If it succeeds, further USB
*--------*--------*-----------------------------* *--------*--------*-----------------------------*
| 0x03 | 0x01 | nxdumptool USB ABI version. | ------> Currently, always v1. | 0x03 | 0x01 | nxdumptool USB ABI version. | ------> Currently, always v1.
*--------*--------*-----------------------------* *--------*--------*-----------------------------*
| 0x04 | 0x0C | Reserved. | | 0x04 | 0x08 | Git commit hash (string). |
*--------*--------*-----------------------------*
| 0x0C | 0x04 | Reserved. |
*--------*--------*-----------------------------* *--------*--------*-----------------------------*
____________________________________________________________________________________________________________________________________ ____________________________________________________________________________________________________________________________________

View file

@ -260,17 +260,25 @@ bool nacpInitializeContext(NacpContext *out, NcaContext *nca_ctx)
{ {
NacpIconContext *icon_ctx = NULL; NacpIconContext *icon_ctx = NULL;
/* Check if the current language is supported. */
if (!nacpCheckBitflagField(&(out->data->supported_language), sizeof(out->data->supported_language) * 8, i)) continue;
/* Get language string. */ /* Get language string. */
language_str = nacpGetLanguageString(i); language_str = nacpGetLanguageString(i);
/* Check if the current language is supported. */
if (!nacpCheckBitflagField(&(out->data->supported_language), sizeof(out->data->supported_language) * 8, i))
{
//LOG_MSG("\"%s\" language not supported (flag 0x%08X, index %u).", language_str, out->data->supported_language, i);
continue;
}
/* Generate icon path. */ /* Generate icon path. */
sprintf(icon_path, "/icon_%s.dat", language_str); sprintf(icon_path, "/icon_%s.dat", language_str);
/* Retrieve RomFS file entry for this icon. */ /* Retrieve RomFS file entry for this icon. */
if (!(icon_entry = romfsGetFileEntryByPath(&(out->romfs_ctx), icon_path))) continue; if (!(icon_entry = romfsGetFileEntryByPath(&(out->romfs_ctx), icon_path)))
{
//LOG_MSG("\"%s\" file entry not found (flag 0x%08X, index %u).", icon_path, out->data->supported_language, i);
continue;
}
/* Check icon size. */ /* Check icon size. */
if (!icon_entry->size || icon_entry->size > NACP_MAX_ICON_SIZE) if (!icon_entry->size || icon_entry->size > NACP_MAX_ICON_SIZE)

View file

@ -34,7 +34,7 @@
#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))
#define ALIGN_DOWN(x, y) ((x) > (y) ? (((x) - ((y) - 1)) & ~((y) - 1)) : 0) #define ALIGN_DOWN(x, y) ((x) & ~((y) - 1))
#define IS_ALIGNED(x, y) (((x) & ((y) - 1)) == 0) #define IS_ALIGNED(x, y) (((x) & ((y) - 1)) == 0)
#define IS_POWER_OF_TWO(x) (((x) & ((x) - 1)) == 0) #define IS_POWER_OF_TWO(x) (((x) & ((x) - 1)) == 0)