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

Some changes.

* Remove references to the secondary Nintendo Extended BFTTF because it's identical to the first one.

* Use format attribute in functions that need it (and fixed errors I made in the past).
This commit is contained in:
Pablo Curiel 2021-03-29 14:27:35 -04:00
parent 45b2e2398f
commit 194389b73f
10 changed files with 22 additions and 24 deletions

View file

@ -31,14 +31,13 @@ extern "C" {
/// Loosely based on PlSharedFontType.
typedef enum {
BfttfFontType_Standard = 0, ///< Japan, US and Europe
BfttfFontType_NintendoExt1 = 1, ///< Nintendo Extended (1). This font only has the special Nintendo-specific characters, which aren't available with the other fonts.
BfttfFontType_NintendoExt2 = 2, ///< Nintendo Extended (2). This font only has the special Nintendo-specific characters, which aren't available with the other fonts.
BfttfFontType_Korean = 3, ///< Korean (Hangul).
BfttfFontType_ChineseSimplified = 4, ///< Chinese Simplified.
BfttfFontType_ExtChineseSimplified = 5, ///< Extended Chinese Simplified.
BfttfFontType_ChineseTraditional = 6, ///< Chinese Traditional.
BfttfFontType_Total = 7 ///< Total fonts supported by this enum.
BfttfFontType_Standard = 0, ///< Japan, US and Europe.
BfttfFontType_NintendoExt = 1, ///< Extended Nintendo. This font contains special, Nintendo-specific characters, which aren't available in the other fonts.
BfttfFontType_Korean = 2, ///< Korean (Hangul).
BfttfFontType_ChineseSimplified = 3, ///< Simplified Chinese.
BfttfFontType_ExtChineseSimplified = 4, ///< Extended Simplified Chinese.
BfttfFontType_ChineseTraditional = 5, ///< Traditional Chinese.
BfttfFontType_Total = 6 ///< Total fonts supported by this enum.
} BfttfFontType;
/// Loosely based on PlFontData.

View file

@ -37,14 +37,14 @@ extern "C" {
void logWriteStringToLogFile(const char *src);
/// Writes a formatted log string to the logfile.
void logWriteFormattedStringToLogFile(const char *func_name, const char *fmt, ...);
__attribute__((format(printf, 2, 3))) void logWriteFormattedStringToLogFile(const char *func_name, const char *fmt, ...);
/// Writes a formatted log string to the provided buffer.
/// If the buffer isn't big enough to hold both its current contents and the new formatted string, it will be resized.
void logWriteFormattedStringToBuffer(char **dst, size_t *dst_size, const char *func_name, const char *fmt, ...);
__attribute__((format(printf, 4, 5))) void logWriteFormattedStringToBuffer(char **dst, size_t *dst_size, const char *func_name, const char *fmt, ...);
/// Writes a formatted log string + a hex string representation of the provided binary data to the logfile.
void logWriteBinaryDataToLogFile(const void *data, size_t data_size, const char *func_name, const char *fmt, ...);
__attribute__((format(printf, 4, 5))) void logWriteBinaryDataToLogFile(const void *data, size_t data_size, const char *func_name, const char *fmt, ...);
/// Forces a flush operation on the logfile.
void logFlushLogFile(void);

View file

@ -78,7 +78,7 @@ void utilsWaitForButtonPress(u64 flag);
/// Formats a string and appends it to the provided buffer.
/// If the buffer isn't big enough to hold both its current contents and the new formatted string, it will be resized.
bool utilsAppendFormattedStringToBuffer(char **dst, size_t *dst_size, const char *fmt, ...);
__attribute__((format(printf, 3, 4))) bool utilsAppendFormattedStringToBuffer(char **dst, size_t *dst_size, const char *fmt, ...);
/// Replaces illegal FAT characters in the provided string with underscores.
/// If 'ascii_only' is set to true, all characters outside the (0x20,0x7E] range will also be replaced with underscores.

View file

@ -41,8 +41,7 @@ static bool g_bfttfInterfaceInit = false;
static BfttfFontInfo g_fontInfo[] = {
{ 0x0100000000000811, "/nintendo_udsg-r_std_003.bfttf", 0, NULL }, /* FontStandard. */
{ 0x0100000000000810, "/nintendo_ext_003.bfttf", 0, NULL }, /* FontNintendoExtension (1).*/
{ 0x0100000000000810, "/nintendo_ext2_003.bfttf", 0, NULL }, /* FontNintendoExtension (2).*/
{ 0x0100000000000810, "/nintendo_ext_003.bfttf", 0, NULL }, /* FontNintendoExtension. There's a secondary entry at "/nintendo_ext2_003.bfttf", but it's identical to this one. */
{ 0x0100000000000812, "/nintendo_udsg-r_ko_003.bfttf", 0, NULL }, /* FontKorean. */
{ 0x0100000000000814, "/nintendo_udsg-r_org_zh-cn_003.bfttf", 0, NULL }, /* FontChineseSimplified (1). */
{ 0x0100000000000814, "/nintendo_udsg-r_ext_zh-cn_003.bfttf", 0, NULL }, /* FontChineseSimplified (2). */

View file

@ -164,7 +164,7 @@ u8 *certRetrieveRawCertificateChainFromGameCardByRightsId(const FsRightsId *id,
raw_chain = malloc(raw_chain_size);
if (!raw_chain)
{
LOG_MSG("Unable to allocate memory for raw \"%s\" certificate chain! (0x%lX).", raw_chain_size);
LOG_MSG("Unable to allocate memory for raw \"%s\" certificate chain! (0x%lX).", raw_chain_filename, raw_chain_size);
return NULL;
}

View file

@ -236,7 +236,7 @@ static u8 *nsoGetRodataSegment(NsoContext *nso_ctx)
/* Read .rodata segment data. */
if (!pfsReadEntryData(nso_ctx->pfs_ctx, nso_ctx->pfs_entry, rodata_read_ptr, rodata_read_size, nso_ctx->nso_header.rodata_segment_info.file_offset))
{
LOG_MSG("Failed to read %s .rodata segment in NRO \"%s\"!", nso_ctx->nso_filename);
LOG_MSG("Failed to read .rodata segment in NRO \"%s\"!", nso_ctx->nso_filename);
goto end;
}

View file

@ -56,7 +56,7 @@ void logWriteStringToLogFile(const char *src)
_logWriteStringToLogFile(src, true);
}
void logWriteFormattedStringToLogFile(const char *func_name, const char *fmt, ...)
__attribute__((format(printf, 2, 3))) void logWriteFormattedStringToLogFile(const char *func_name, const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
@ -64,7 +64,7 @@ void logWriteFormattedStringToLogFile(const char *func_name, const char *fmt, ..
va_end(args);
}
void logWriteFormattedStringToBuffer(char **dst, size_t *dst_size, const char *func_name, const char *fmt, ...)
__attribute__((format(printf, 4, 5))) void logWriteFormattedStringToBuffer(char **dst, size_t *dst_size, const char *func_name, const char *fmt, ...)
{
if (!dst || !dst_size || (!*dst && *dst_size) || (*dst && !*dst_size) || !func_name || !*func_name || !fmt || !*fmt) return;
@ -127,7 +127,7 @@ end:
va_end(args);
}
void logWriteBinaryDataToLogFile(const void *data, size_t data_size, const char *func_name, const char *fmt, ...)
__attribute__((format(printf, 4, 5))) void logWriteBinaryDataToLogFile(const void *data, size_t data_size, const char *func_name, const char *fmt, ...)
{
if (!data || !data_size || !func_name || !*func_name || !fmt || !*fmt) return;

View file

@ -355,7 +355,7 @@ void utilsWaitForButtonPress(u64 flag)
}
}
bool utilsAppendFormattedStringToBuffer(char **dst, size_t *dst_size, const char *fmt, ...)
__attribute__((format(printf, 3, 4))) bool utilsAppendFormattedStringToBuffer(char **dst, size_t *dst_size, const char *fmt, ...)
{
if (!dst || !dst_size || (!*dst && *dst_size) || (*dst && !*dst_size) || !fmt || !*fmt)
{

View file

@ -508,7 +508,7 @@ static bool tikRetrieveRightsIdsByTitleKeyType(FsRightsId **out, u32 *out_count,
rc = (personalized ? esCountPersonalizedTicket((s32*)&count) : esCountCommonTicket((s32*)&count));
if (R_FAILED(rc))
{
LOG_MSG("esCount%c%sTicket failed! (0x%08X).", toupper(g_tikTitleKeyTypeStrings[str_idx][0]), g_tikTitleKeyTypeStrings[str_idx] + 1);
LOG_MSG("esCount%c%sTicket failed! (0x%08X).", toupper(g_tikTitleKeyTypeStrings[str_idx][0]), g_tikTitleKeyTypeStrings[str_idx] + 1, rc);
return false;
}
@ -647,7 +647,7 @@ static bool tikRetrieveTicketEntryFromTicketBin(save_ctx_t *save_ctx, u8 *buf, u
/* Read ticket data. */
if ((br = save_allocation_table_storage_read(&fat_storage, buf, ticket_offset, SIGNED_TIK_MAX_SIZE)) != SIGNED_TIK_MAX_SIZE)
{
LOG_MSG("Failed to read 0x%lX bytes long ticket at offset 0x%lX from \"%s\" in ES %s ticket system save!", SIGNED_TIK_MAX_SIZE, ticket_offset, TIK_DB_STORAGE_PATH, \
LOG_MSG("Failed to read 0x%X-byte long ticket at offset 0x%lX from \"%s\" in ES %s ticket system save!", SIGNED_TIK_MAX_SIZE, ticket_offset, TIK_DB_STORAGE_PATH, \
g_tikTitleKeyTypeStrings[titlekey_type]);
return false;
}

View file

@ -1269,7 +1269,7 @@ static bool titleRetrieveApplicationMetadataByTitleId(u64 title_id, TitleApplica
rc = nsGetApplicationControlData(NsApplicationControlSource_Storage, title_id, g_nsAppControlData, sizeof(NsApplicationControlData), &write_size);
if (R_FAILED(rc))
{
LOG_MSG("nsGetApplicationControlData failed for title ID \"%016lX\"! (0x%08X).", rc, title_id);
LOG_MSG("nsGetApplicationControlData failed for title ID \"%016lX\"! (0x%08X).", title_id, rc);
return false;
}
@ -1688,7 +1688,7 @@ static bool titleGetContentInfosFromTitle(u8 storage_id, const NcmContentMetaKey
if (content_meta_header_read_size != sizeof(NcmContentMetaHeader))
{
LOG_MSG("Content meta header size mismatch! (0x%lX != 0x%lX).", rc, content_meta_header_read_size, sizeof(NcmContentMetaHeader));
LOG_MSG("Content meta header size mismatch! (0x%lX != 0x%lX).", content_meta_header_read_size, sizeof(NcmContentMetaHeader));
goto end;
}