Fixed a boatload of compiler warnings

This commit is contained in:
d0k3 2022-03-22 19:40:47 +01:00
parent d95a606ec2
commit c13bba4cfe
8 changed files with 64 additions and 58 deletions

View File

@ -146,8 +146,8 @@ static void DrawTextBox(const TouchBox* txtbox, const char* inputstr, const u32
// draw input string // draw input string
DrawStringF(BOT_SCREEN, x, y, COLOR_STD_FONT, COLOR_STD_BG, "%c%-*.*s%c", DrawStringF(BOT_SCREEN, x, y, COLOR_STD_FONT, COLOR_STD_BG, "%c%-*.*s%c",
(*scroll) ? '<' : '|', (*scroll) ? '<' : '|',
input_shown_size, (int) input_shown_size,
input_shown_size, (int) input_shown_size,
(*scroll > inputstr_size) ? "" : inputstr + *scroll, (*scroll > inputstr_size) ? "" : inputstr + *scroll,
(inputstr_size - (s32) *scroll > input_shown_size) ? '>' : '|' (inputstr_size - (s32) *scroll > input_shown_size) ? '>' : '|'
); );
@ -159,11 +159,11 @@ static void DrawTextBox(const TouchBox* txtbox, const char* inputstr, const u32
} }
DrawStringF(BOT_SCREEN, x-(FONT_WIDTH_EXT/2), y+10, COLOR_STD_FONT, COLOR_STD_BG, "%-*.*s^%-*.*s", DrawStringF(BOT_SCREEN, x-(FONT_WIDTH_EXT/2), y+10, COLOR_STD_FONT, COLOR_STD_BG, "%-*.*s^%-*.*s",
1 + cpos, (int) (1 + cpos),
1 + cpos, (int) (1 + cpos),
"", "",
input_shown_length - cpos, (int) (input_shown_length - cpos),
input_shown_length - cpos, (int) (input_shown_length - cpos),
"" ""
); );
} }
@ -255,7 +255,7 @@ bool ShowKeyboard(char* inputstr, const u32 max_size, const char *format, ...) {
static bool show_instr = true; static bool show_instr = true;
static const char* instr = "Keyboard Controls:\n \n←/→ - Move cursor\nR - Caps / Capslock\nX - Delete char\nY - Insert char\nA - Submit\nB - Cancel\n \nSELECT switches to\nclassic prompt"; static const char* instr = "Keyboard Controls:\n \n←/→ - Move cursor\nR - Caps / Capslock\nX - Delete char\nY - Insert char\nA - Submit\nB - Cancel\n \nSELECT switches to\nclassic prompt";
if (show_instr) { if (show_instr) {
ShowPrompt(false, instr); ShowPrompt(false, "%s", instr);
show_instr = false; show_instr = false;
} }
@ -332,7 +332,7 @@ bool ShowKeyboard(char* inputstr, const u32 max_size, const char *format, ...) {
swkbd = swkbd_numpad; swkbd = swkbd_numpad;
} else if (key == KEY_SWITCH) { } else if (key == KEY_SWITCH) {
ClearScreen(BOT_SCREEN, COLOR_STD_BG); ClearScreen(BOT_SCREEN, COLOR_STD_BG);
return ShowStringPrompt(inputstr, max_size, str); return ShowStringPrompt(inputstr, max_size, "%s", str);
} else if (key == KEY_UNICODE) { } else if (key == KEY_UNICODE) {
if (cursor > 3 && cursor <= inputstr_size) { if (cursor > 3 && cursor <= inputstr_size) {
u16 codepoint = 0; u16 codepoint = 0;

View File

@ -705,7 +705,7 @@ void ShowIconString(u16* icon, int w, int h, const char *format, ...)
vsnprintf(str, STRBUF_SIZE, format, va); vsnprintf(str, STRBUF_SIZE, format, va);
va_end(va); va_end(va);
ShowIconStringF(MAIN_SCREEN, icon, w, h, str); ShowIconStringF(MAIN_SCREEN, icon, w, h, "%s", str);
} }
bool ShowPrompt(bool ask, const char *format, ...) bool ShowPrompt(bool ask, const char *format, ...)
@ -936,7 +936,8 @@ u32 ShowFileScrollPrompt(u32 n, const DirEntry** options, bool hide_ext, const c
if (n - n_show - scroll) { if (n - n_show - scroll) {
char more_str[64 + 1]; char more_str[64 + 1];
snprintf(more_str, 64, " [%d more]", (int)(n - (n_show-1) - scroll)); snprintf(more_str, 64, " [%d more]", (int)(n - (n_show-1) - scroll));
DrawStringF(MAIN_SCREEN, x, yopt + (line_height+2)*(n_show-1), COLOR_LIGHTGREY, COLOR_STD_BG, "%-*s", item_width / font_width, more_str); DrawStringF(MAIN_SCREEN, x, yopt + (line_height+2)*(n_show-1), COLOR_LIGHTGREY, COLOR_STD_BG,
"%-*s", (int) (item_width / font_width), more_str);
} }
// show scroll bar // show scroll bar
u32 bar_x = x + item_width + 2; u32 bar_x = x + item_width + 2;
@ -1076,15 +1077,15 @@ bool ShowInputPrompt(char* inputstr, u32 max_size, u32 resize, const char* alpha
DrawStringF(MAIN_SCREEN, x, y + str_height - 76, COLOR_STD_FONT, COLOR_STD_BG, "%c%-*.*s%c\n%-*.*s^%-*.*s", DrawStringF(MAIN_SCREEN, x, y + str_height - 76, COLOR_STD_FONT, COLOR_STD_BG, "%c%-*.*s%c\n%-*.*s^%-*.*s",
(scroll) ? '<' : '|', (scroll) ? '<' : '|',
input_shown_size, (int) input_shown_size,
input_shown_size, (int) input_shown_size,
(scroll > inputstr_size) ? "" : inputstr + scroll, (scroll > inputstr_size) ? "" : inputstr + scroll,
(inputstr_size - (s32) scroll > input_shown_size) ? '>' : '|', (inputstr_size - (s32) scroll > input_shown_size) ? '>' : '|',
1 + cpos, (int) 1 + cpos,
1 + cpos, (int) 1 + cpos,
"", "",
input_shown_length - cpos, (int) input_shown_length - cpos,
input_shown_length - cpos, (int) input_shown_length - cpos,
"" ""
); );
@ -1432,7 +1433,7 @@ int ShowBrightnessConfig(int set_brightness)
// draw initial UI stuff // draw initial UI stuff
DrawStringF(MAIN_SCREEN, DrawStringF(MAIN_SCREEN,
(SCREEN_WIDTH_MAIN - GetDrawStringWidth(brightness_str)) / 2, (SCREEN_WIDTH_MAIN - GetDrawStringWidth(brightness_str)) / 2,
(SCREEN_HEIGHT / 4) * 2, COLOR_STD_FONT, COLOR_STD_BG, brightness_str); (SCREEN_HEIGHT / 4) * 2, COLOR_STD_FONT, COLOR_STD_BG, "%s", brightness_str);
// draw all color gradient bars // draw all color gradient bars
for (int x = 0; x < bar_width; x++) { for (int x = 0; x < bar_width; x++) {

View File

@ -144,14 +144,14 @@ u32 SplashInit(const char* modestr) {
} }
if (modestr) DrawStringF(TOP_SCREEN, SCREEN_WIDTH_TOP - 10 - GetDrawStringWidth(modestr), if (modestr) DrawStringF(TOP_SCREEN, SCREEN_WIDTH_TOP - 10 - GetDrawStringWidth(modestr),
SCREEN_HEIGHT - 10 - GetDrawStringHeight(modestr), COLOR_STD_FONT, COLOR_TRANSPARENT, modestr); SCREEN_HEIGHT - 10 - GetDrawStringHeight(modestr), COLOR_STD_FONT, COLOR_TRANSPARENT, "%s", modestr);
DrawStringF(BOT_SCREEN, pos_xb, pos_yb, COLOR_STD_FONT, COLOR_STD_BG, "%s\n%*.*s\n%s\n \n \n%s\n%s\n \n%s\n%s", DrawStringF(BOT_SCREEN, pos_xb, pos_yb, COLOR_STD_FONT, COLOR_STD_BG, "%s\n%*.*s\n%s\n \n \n%s\n%s\n \n%s\n%s",
namestr, strnlen(namestr, 64), strnlen(namestr, 64), namestr, strnlen(namestr, 64), strnlen(namestr, 64),
"--------------------------------", "https://github.com/d0k3/GodMode9", "--------------------------------", "https://github.com/d0k3/GodMode9",
"Releases:", "https://github.com/d0k3/GodMode9/releases/", // this won't fit with a 8px width font "Releases:", "https://github.com/d0k3/GodMode9/releases/", // this won't fit with a 8px width font
"Hourlies:", "https://d0k3.secretalgorithm.com/"); "Hourlies:", "https://d0k3.secretalgorithm.com/");
DrawStringF(BOT_SCREEN, pos_xu, pos_yu, COLOR_STD_FONT, COLOR_STD_BG, loadstr); DrawStringF(BOT_SCREEN, pos_xu, pos_yu, COLOR_STD_FONT, COLOR_STD_BG, "%s", loadstr);
DrawStringF(BOT_SCREEN, pos_xb, pos_yu, COLOR_STD_FONT, COLOR_STD_BG, "built: " DBUILTL); DrawStringF(BOT_SCREEN, pos_xb, pos_yu, COLOR_STD_FONT, COLOR_STD_BG, "built: " DBUILTL);
return 0; return 0;
@ -330,7 +330,7 @@ void DrawUserInterface(const char* curr_path, DirEntry* curr_entry, u32 curr_pan
snprintf(bytestr, 31, "%s Byte", numstr); snprintf(bytestr, 31, "%s Byte", numstr);
ResizeString(tempstr, bytestr, str_len_info, 8, false); ResizeString(tempstr, bytestr, str_len_info, 8, false);
} }
DrawStringF(MAIN_SCREEN, 4, info_start + 12 + 10, color_current, COLOR_STD_BG, tempstr); DrawStringF(MAIN_SCREEN, 4, info_start + 12 + 10, color_current, COLOR_STD_BG, "%s", tempstr);
// path of file (if in search results) // path of file (if in search results)
if ((DriveType(curr_path) & DRV_SEARCH) && strrchr(curr_entry->path, '/')) { if ((DriveType(curr_path) & DRV_SEARCH) && strrchr(curr_entry->path, '/')) {
char dirstr[256]; char dirstr[256];
@ -345,7 +345,7 @@ void DrawUserInterface(const char* curr_path, DirEntry* curr_entry, u32 curr_pan
// right top - clipboard // right top - clipboard
DrawStringF(MAIN_SCREEN, SCREEN_WIDTH_MAIN - len_info, info_start, COLOR_STD_FONT, COLOR_STD_BG, "%*s", DrawStringF(MAIN_SCREEN, SCREEN_WIDTH_MAIN - len_info, info_start, COLOR_STD_FONT, COLOR_STD_BG, "%*s",
len_info / FONT_WIDTH_EXT, (clipboard->n_entries) ? "[CLIPBOARD]" : ""); (int) (len_info / FONT_WIDTH_EXT), (clipboard->n_entries) ? "[CLIPBOARD]" : "");
for (u32 c = 0; c < n_cb_show; c++) { for (u32 c = 0; c < n_cb_show; c++) {
u32 color_cb = COLOR_ENTRY(&(clipboard->entry[c])); u32 color_cb = COLOR_ENTRY(&(clipboard->entry[c]));
ResizeString(tempstr, (clipboard->n_entries > c) ? clipboard->entry[c].name : "", str_len_info, 8, true); ResizeString(tempstr, (clipboard->n_entries > c) ? clipboard->entry[c].name : "", str_len_info, 8, true);
@ -354,7 +354,7 @@ void DrawUserInterface(const char* curr_path, DirEntry* curr_entry, u32 curr_pan
*tempstr = '\0'; *tempstr = '\0';
if (clipboard->n_entries > n_cb_show) snprintf(tempstr, 60, "+ %lu more", clipboard->n_entries - n_cb_show); if (clipboard->n_entries > n_cb_show) snprintf(tempstr, 60, "+ %lu more", clipboard->n_entries - n_cb_show);
DrawStringF(MAIN_SCREEN, SCREEN_WIDTH_MAIN - len_info - 4, info_start + 12 + (n_cb_show*10), COLOR_DARKGREY, COLOR_STD_BG, DrawStringF(MAIN_SCREEN, SCREEN_WIDTH_MAIN - len_info - 4, info_start + 12 + (n_cb_show*10), COLOR_DARKGREY, COLOR_STD_BG,
"%*s", len_info / FONT_WIDTH_EXT, tempstr); "%*s", (int) (len_info / FONT_WIDTH_EXT), tempstr);
// bottom: instruction block // bottom: instruction block
char instr[512]; char instr[512];
@ -370,7 +370,7 @@ void DrawUserInterface(const char* curr_path, DirEntry* curr_entry, u32 curr_pan
"R+←→ - Switch to prev/next pane\n", "R+←→ - Switch to prev/next pane\n",
(clipboard->n_entries) ? "SELECT - Clear Clipboard\n" : "SELECT - Restore Clipboard\n", // only if clipboard is full (clipboard->n_entries) ? "SELECT - Clear Clipboard\n" : "SELECT - Restore Clipboard\n", // only if clipboard is full
"START - Reboot / [+R] Poweroff\nHOME button for HOME menu"); // generic end part "START - Reboot / [+R] Poweroff\nHOME button for HOME menu"); // generic end part
DrawStringF(MAIN_SCREEN, instr_x, SCREEN_HEIGHT - 4 - GetDrawStringHeight(instr), COLOR_STD_FONT, COLOR_STD_BG, instr); DrawStringF(MAIN_SCREEN, instr_x, SCREEN_HEIGHT - 4 - GetDrawStringHeight(instr), COLOR_STD_FONT, COLOR_STD_BG, "%s", instr);
} }
void DrawDirContents(DirStruct* contents, u32 cursor, u32* scroll) { void DrawDirContents(DirStruct* contents, u32 cursor, u32* scroll) {
@ -573,11 +573,11 @@ u32 FileHexViewer(const char* path) {
static bool show_instr = true; static bool show_instr = true;
static const char* instr = "Hexeditor Controls:\n \n↑↓→←(+R) - Scroll\nR+Y - Switch view\nX - Search / goto...\nA - Enter edit mode\nA+↑↓→← - Edit value\nB - Exit\n"; static const char* instr = "Hexeditor Controls:\n \n↑↓→←(+R) - Scroll\nR+Y - Switch view\nX - Search / goto...\nA - Enter edit mode\nA+↑↓→← - Edit value\nB - Exit\n";
if (show_instr) { // show one time instructions if (show_instr) { // show one time instructions
ShowPrompt(false, instr); ShowPrompt(false, "%s", instr);
show_instr = false; show_instr = false;
} }
if (MAIN_SCREEN != TOP_SCREEN) ShowString(instr); if (MAIN_SCREEN != TOP_SCREEN) ShowString("%s", instr);
memcpy(bottom_cpy, BOT_SCREEN, SCREEN_SIZE_BOT); memcpy(bottom_cpy, BOT_SCREEN, SCREEN_SIZE_BOT);
data = buffer; data = buffer;
@ -708,7 +708,7 @@ u32 FileHexViewer(const char* path) {
// draw offset / ASCII representation // draw offset / ASCII representation
if (x_off >= 0) DrawStringF(screen, x_off - x0, y, cutoff ? COLOR_HVOFFS : COLOR_HVOFFSI, if (x_off >= 0) DrawStringF(screen, x_off - x0, y, cutoff ? COLOR_HVOFFS : COLOR_HVOFFSI,
COLOR_STD_BG, "%08X", (unsigned int) offset + curr_pos); COLOR_STD_BG, "%08X", (unsigned int) (offset + curr_pos));
if (x_ascii >= 0) { if (x_ascii >= 0) {
for (u32 i = 0; i < cols; i++) for (u32 i = 0; i < cols; i++)
DrawCharacter(screen, ascii[i], x_ascii - x0 + (FONT_WIDTH_EXT * i), y, COLOR_HVASCII, COLOR_STD_BG); DrawCharacter(screen, ascii[i], x_ascii - x0 + (FONT_WIDTH_EXT * i), y, COLOR_HVASCII, COLOR_STD_BG);
@ -799,7 +799,7 @@ u32 FileHexViewer(const char* path) {
// check for user edits // check for user edits
u32 diffs = 0; u32 diffs = 0;
for (u32 i = 0; i < edit_bsize; i++) if (buffer[i] != buffer_cpy[i]) diffs++; for (u32 i = 0; i < edit_bsize; i++) if (buffer[i] != buffer_cpy[i]) diffs++;
if (diffs && ShowPrompt(true, "You made edits in %i place(s).\nWrite changes to file?", diffs)) if (diffs && ShowPrompt(true, "You made edits in %lu place(s).\nWrite changes to file?", diffs))
if (!FileSetData(path, buffer, min(edit_bsize, (fsize - edit_start)), edit_start, false)) if (!FileSetData(path, buffer, min(edit_bsize, (fsize - edit_start)), edit_start, false))
ShowPrompt(false, "Failed writing to file!"); ShowPrompt(false, "Failed writing to file!");
data = buffer; data = buffer;
@ -1295,8 +1295,9 @@ u32 FileHandlerMenu(char* current_path, u32* cursor, u32* scroll, PaneData** pan
if (searchdrv > 0) optionstr[searchdrv-1] = "Open containing folder"; if (searchdrv > 0) optionstr[searchdrv-1] = "Open containing folder";
if (titleman > 0) optionstr[titleman-1] = "Open title folder"; if (titleman > 0) optionstr[titleman-1] = "Open title folder";
int user_select = ShowSelectPrompt(n_opt, optionstr, (n_marked > 1) ? int user_select = (int) ((n_marked > 1) ?
"%s%0.0s\n(%lu files selected)" : "%s%s", pathstr, tidstr, n_marked); ShowSelectPrompt(n_opt, optionstr, "%s\n(%lu files selected)", pathstr, n_marked) :
ShowSelectPrompt(n_opt, optionstr, "%s%s", pathstr, tidstr));
if (user_select == hexviewer) { // -> show in hex viewer if (user_select == hexviewer) { // -> show in hex viewer
FileHexViewer(file_path); FileHexViewer(file_path);
GetDirContents(current_dir, current_path); GetDirContents(current_dir, current_path);
@ -1484,8 +1485,9 @@ u32 FileHandlerMenu(char* current_path, u32* cursor, u32* scroll, PaneData** pan
if (setup > 0) optionstr[setup-1] = "Set as default"; if (setup > 0) optionstr[setup-1] = "Set as default";
// auto select when there is only one option // auto select when there is only one option
user_select = (n_opt <= 1) ? n_opt : (int) ShowSelectPrompt(n_opt, optionstr, (n_marked > 1) ? user_select = (n_opt <= 1) ? n_opt : (int) ((n_marked > 1) ?
"%s%0.0s\n(%lu files selected)" : "%s%s", pathstr, tidstr, n_marked); ShowSelectPrompt(n_opt, optionstr, "%s\n(%lu files selected)", pathstr, n_marked) :
ShowSelectPrompt(n_opt, optionstr, "%s%s", pathstr, tidstr));
if (user_select == mount) { // -> mount file as image if (user_select == mount) { // -> mount file as image
const char* mnt_drv_paths[] = { "7:", "G:", "K:", "T:", "I:", "D:" }; // maybe move that to fsdrive.h const char* mnt_drv_paths[] = { "7:", "G:", "K:", "T:", "I:", "D:" }; // maybe move that to fsdrive.h
if (clipboard->n_entries && (DriveType(clipboard->entry[0].path) & DRV_IMAGE)) if (clipboard->n_entries && (DriveType(clipboard->entry[0].path) & DRV_IMAGE))
@ -1523,8 +1525,9 @@ u32 FileHandlerMenu(char* current_path, u32* cursor, u32* scroll, PaneData** pan
if (cryptable_inplace) { if (cryptable_inplace) {
optionstr[0] = "Decrypt to " OUTPUT_PATH; optionstr[0] = "Decrypt to " OUTPUT_PATH;
optionstr[1] = "Decrypt inplace"; optionstr[1] = "Decrypt inplace";
user_select = (int) ShowSelectPrompt(2, optionstr, (n_marked > 1) ? user_select = (int) ((n_marked > 1) ?
"%s%0.0s\n(%lu files selected)" : "%s%s", pathstr, tidstr, n_marked); ShowSelectPrompt(2, optionstr, "%s\n(%lu files selected)", pathstr, n_marked) :
ShowSelectPrompt(2, optionstr, "%s%s", pathstr, tidstr));
} else user_select = 1; } else user_select = 1;
bool inplace = (user_select == 2); bool inplace = (user_select == 2);
if (!user_select) { // do nothing when no choice is made if (!user_select) { // do nothing when no choice is made
@ -1577,8 +1580,9 @@ u32 FileHandlerMenu(char* current_path, u32* cursor, u32* scroll, PaneData** pan
if (cryptable_inplace) { if (cryptable_inplace) {
optionstr[0] = "Encrypt to " OUTPUT_PATH; optionstr[0] = "Encrypt to " OUTPUT_PATH;
optionstr[1] = "Encrypt inplace"; optionstr[1] = "Encrypt inplace";
user_select = (int) ShowSelectPrompt(2, optionstr, (n_marked > 1) ? user_select = (int) ((n_marked > 1) ?
"%s%0.0s\n(%lu files selected)" : "%s%s", pathstr, tidstr, n_marked); ShowSelectPrompt(2, optionstr, "%s\n(%lu files selected)", pathstr, n_marked) :
ShowSelectPrompt(2, optionstr, "%s%s", pathstr, tidstr));
} else user_select = 1; } else user_select = 1;
bool inplace = (user_select == 2); bool inplace = (user_select == 2);
if (!user_select) { // do nothing when no choice is made if (!user_select) { // do nothing when no choice is made
@ -1677,8 +1681,9 @@ u32 FileHandlerMenu(char* current_path, u32* cursor, u32* scroll, PaneData** pan
if (CheckVirtualDrive("E:")) { if (CheckVirtualDrive("E:")) {
optionstr[0] = "Install to SysNAND"; optionstr[0] = "Install to SysNAND";
optionstr[1] = "Install to EmuNAND"; optionstr[1] = "Install to EmuNAND";
user_select = (int) ShowSelectPrompt(2, optionstr, (n_marked > 1) ? user_select = (int) ((n_marked > 1) ?
"%s%0.0s\n(%lu files selected)" : "%s%s", pathstr, tidstr, n_marked); ShowSelectPrompt(2, optionstr, "%s\n(%lu files selected)", pathstr, n_marked) :
ShowSelectPrompt(2, optionstr, "%s%s", pathstr, tidstr));
if (!user_select) return 0; if (!user_select) return 0;
else to_emunand = (user_select == 2); else to_emunand = (user_select == 2);
} }
@ -2195,7 +2200,7 @@ u32 HomeMoreMenu(char* current_path) {
if (sysinfo > 0) optionstr[sysinfo - 1] = "System info"; if (sysinfo > 0) optionstr[sysinfo - 1] = "System info";
if (readme > 0) optionstr[readme - 1] = "Show ReadMe"; if (readme > 0) optionstr[readme - 1] = "Show ReadMe";
int user_select = ShowSelectPrompt(n_opt, optionstr, promptstr); int user_select = ShowSelectPrompt(n_opt, optionstr, "%s", promptstr);
if (user_select == sdformat) { // format SD card if (user_select == sdformat) { // format SD card
bool sd_state = CheckSDMountState(); bool sd_state = CheckSDMountState();
char slabel[DRV_LABEL_LEN] = { '\0' }; char slabel[DRV_LABEL_LEN] = { '\0' };
@ -2223,7 +2228,7 @@ u32 HomeMoreMenu(char* current_path) {
return 0; return 0;
} }
else if (user_select == multi) { // switch EmuNAND offset else if (user_select == multi) { // switch EmuNAND offset
while (ShowPrompt(true, "Current EmuNAND offset is %06X.\nSwitch to next offset?", GetEmuNandBase())) { while (ShowPrompt(true, "Current EmuNAND offset is %06lX.\nSwitch to next offset?", GetEmuNandBase())) {
if (clipboard->n_entries && (DriveType(clipboard->entry[0].path) & DRV_EMUNAND)) if (clipboard->n_entries && (DriveType(clipboard->entry[0].path) & DRV_EMUNAND))
clipboard->n_entries = 0; // remove EmuNAND clipboard entries clipboard->n_entries = 0; // remove EmuNAND clipboard entries
DismountDriveType(DRV_EMUNAND); DismountDriveType(DRV_EMUNAND);
@ -2264,7 +2269,7 @@ u32 HomeMoreMenu(char* current_path) {
if (!seed_sys || BuildSeedInfo(NULL, true) != 0) if (!seed_sys || BuildSeedInfo(NULL, true) != 0)
seed_sys = seed_emu = false; seed_sys = seed_emu = false;
} }
ShowPrompt(false, "Built in " OUTPUT_PATH ":\n \n%18.18-s %s\n%18.18-s %s\n%18.18-s %s", ShowPrompt(false, "Built in " OUTPUT_PATH ":\n \n%-18.18s %s\n%-18.18s %s\n%-18.18s %s",
TIKDB_NAME_ENC, tik_enc_sys ? tik_enc_emu ? "OK (Sys&Emu)" : "OK (Sys)" : "Failed", TIKDB_NAME_ENC, tik_enc_sys ? tik_enc_emu ? "OK (Sys&Emu)" : "OK (Sys)" : "Failed",
TIKDB_NAME_DEC, tik_dec_sys ? tik_dec_emu ? "OK (Sys&Emu)" : "OK (Sys)" : "Failed", TIKDB_NAME_DEC, tik_dec_sys ? tik_dec_emu ? "OK (Sys&Emu)" : "OK (Sys)" : "Failed",
SEEDINFO_NAME, seed_sys ? seed_emu ? "OK (Sys&Emu)" : "OK (Sys)" : "Failed"); SEEDINFO_NAME, seed_sys ? seed_emu ? "OK (Sys&Emu)" : "OK (Sys)" : "Failed");
@ -2277,7 +2282,7 @@ u32 HomeMoreMenu(char* current_path) {
int emu = (CheckHealthAndSafetyInject("4:") == 0) ? (int) ++n_opt : -1; int emu = (CheckHealthAndSafetyInject("4:") == 0) ? (int) ++n_opt : -1;
if (sys > 0) optionstr[sys - 1] = "Restore H&S (SysNAND)"; if (sys > 0) optionstr[sys - 1] = "Restore H&S (SysNAND)";
if (emu > 0) optionstr[emu - 1] = "Restore H&S (EmuNAND)"; if (emu > 0) optionstr[emu - 1] = "Restore H&S (EmuNAND)";
user_select = (n_opt > 1) ? ShowSelectPrompt(n_opt, optionstr, promptstr) : n_opt; user_select = (n_opt > 1) ? ShowSelectPrompt(n_opt, optionstr, "%s", promptstr) : n_opt;
if (user_select > 0) { if (user_select > 0) {
InjectHealthAndSafety(NULL, (user_select == sys) ? "1:" : "4:"); InjectHealthAndSafety(NULL, (user_select == sys) ? "1:" : "4:");
GetDirContents(current_dir, current_path); GetDirContents(current_dir, current_path);
@ -2719,14 +2724,14 @@ u32 GodMode(int entrypoint) {
if (current_dir->entry[c].marked) n_marked++; if (current_dir->entry[c].marked) n_marked++;
} }
if (n_marked) { if (n_marked) {
if (ShowPrompt(true, "Delete %u path(s)?", n_marked)) { if (ShowPrompt(true, "Delete %lu path(s)?", n_marked)) {
u32 n_errors = 0; u32 n_errors = 0;
ShowString("Deleting files, please wait..."); ShowString("Deleting files, please wait...");
for (u32 c = 0; c < current_dir->n_entries; c++) for (u32 c = 0; c < current_dir->n_entries; c++)
if (current_dir->entry[c].marked && !PathDelete(current_dir->entry[c].path)) if (current_dir->entry[c].marked && !PathDelete(current_dir->entry[c].path))
n_errors++; n_errors++;
ClearScreenF(true, false, COLOR_STD_BG); ClearScreenF(true, false, COLOR_STD_BG);
if (n_errors) ShowPrompt(false, "Failed deleting %u/%u path(s)", n_errors, n_marked); if (n_errors) ShowPrompt(false, "Failed deleting %lu/%lu path(s)", n_errors, n_marked);
} }
} else if (curr_entry->type != T_DOTDOT) { } else if (curr_entry->type != T_DOTDOT) {
char namestr[UTF_BUFFER_BYTESIZE(28)]; char namestr[UTF_BUFFER_BYTESIZE(28)];
@ -2881,7 +2886,7 @@ u32 GodMode(int entrypoint) {
u32 tmnum = 2; u32 tmnum = 2;
if (!CheckSDMountState() || (tmnum = ShowSelectPrompt( if (!CheckSDMountState() || (tmnum = ShowSelectPrompt(
(CheckVirtualDrive("E:")) ? 4 : 2, tmoptionstr, (CheckVirtualDrive("E:")) ? 4 : 2, tmoptionstr,
"Title manager menu.\nSelect titles source:", buttonstr))) { "Title manager menu.\nSelect titles source:"))) {
const char* tpath = tmpaths[tmnum-1]; const char* tpath = tmpaths[tmnum-1];
if (InitImgFS(tpath)) { if (InitImgFS(tpath)) {
SetTitleManagerMode(true); SetTitleManagerMode(true);

View File

@ -94,7 +94,7 @@ void XRQ_DumpRegisters(u32 xrq, u32 *regs)
u32 draw_y_upd = draw_y + draw_height - 10; u32 draw_y_upd = draw_y + draw_height - 10;
ClearScreen(MAIN_SCREEN, COLOR_STD_BG); ClearScreen(MAIN_SCREEN, COLOR_STD_BG);
DrawStringF(MAIN_SCREEN, draw_x, draw_y, COLOR_STD_FONT, COLOR_STD_BG, dumpstr); DrawStringF(MAIN_SCREEN, draw_x, draw_y, COLOR_STD_FONT, COLOR_STD_BG, "%s", dumpstr);
/* Dump STACK */ /* Dump STACK */
sp = regs[13] & ~0xF; sp = regs[13] & ~0xF;

View File

@ -744,7 +744,7 @@ u32 VerifyNcsdFile(const char* path) {
if (!size) continue; if (!size) continue;
if (VerifyNcchFile(path, offset, size) != 0) { if (VerifyNcchFile(path, offset, size) != 0) {
ShowPrompt(false, "%s\nContent%lu (%08lX@%08lX):\nVerification failed", ShowPrompt(false, "%s\nContent%lu (%08lX@%08lX):\nVerification failed",
pathstr, i, size, offset, i); pathstr, i, size, offset);
return 1; return 1;
} }
} }
@ -789,7 +789,7 @@ u32 VerifyCiaFile(const char* path) {
if (!(cnt_index[index/8] & (1 << (7-(index%8))))) continue; // don't check missing contents if (!(cnt_index[index/8] & (1 << (7-(index%8))))) continue; // don't check missing contents
if (VerifyTmdContent(path, next_offset, chunk, titlekey) != 0) { if (VerifyTmdContent(path, next_offset, chunk, titlekey) != 0) {
ShowPrompt(false, "%s\nID %08lX (%08llX@%08llX)\nVerification failed", ShowPrompt(false, "%s\nID %08lX (%08llX@%08llX)\nVerification failed",
pathstr, getbe32(chunk->id), getbe64(chunk->size), next_offset, i); pathstr, getbe32(chunk->id), getbe64(chunk->size), next_offset);
free(cia); free(cia);
return 1; return 1;
} }
@ -927,7 +927,7 @@ u32 VerifyFirmFile(const char* path) {
void* section = ((u8*) firm_buffer) + sct->offset; void* section = ((u8*) firm_buffer) + sct->offset;
if (!(sct->size)) continue; if (!(sct->size)) continue;
if (sha_cmp(sct->hash, section, sct->size, SHA256_MODE) != 0) { if (sha_cmp(sct->hash, section, sct->size, SHA256_MODE) != 0) {
ShowPrompt(false, "%s\nSection %u hash mismatch", pathstr, i); ShowPrompt(false, "%s\nSection %lu hash mismatch", pathstr, i);
free(firm_buffer); free(firm_buffer);
return 1; return 1;
} }
@ -3589,7 +3589,7 @@ u32 ShowGameCheckerInfo(const char* path) {
if (!ShowPrompt(state_verify < 0, if (!ShowPrompt(state_verify < 0,
"%s\n%s %s Title\n \n" "%s\n%s %s Title\n \n"
"Title ID: %016llX\n" "Title ID: %016llX\n"
"Title version: %u.%u.%u\n" "Title version: %lu.%lu.%lu\n"
"Contents size: %s\n" "Contents size: %s\n"
"%s\n%s \n" "%s\n%s \n"
"Ticket/TMD: %s/%s\n" "Ticket/TMD: %s/%s\n"

View File

@ -360,7 +360,7 @@ u32 ValidateNandDump(const char* path) {
if (!p_sector) continue; if (!p_sector) continue;
if ((ReadNandFile(&file, fat, info.sector + p_sector, 1, info.keyslot) != 0) || if ((ReadNandFile(&file, fat, info.sector + p_sector, 1, info.keyslot) != 0) ||
(ValidateFatHeader(fat) != 0)) { (ValidateFatHeader(fat) != 0)) {
ShowPrompt(false, "%s\nError: %s partition%u is corrupt", pathstr, section_type, p); ShowPrompt(false, "%s\nError: %s partition%lu is corrupt", pathstr, section_type, p);
fvx_close(&file); fvx_close(&file);
return 1; return 1;
} }
@ -558,7 +558,7 @@ u32 SafeInstallFirmBuffered(const char* path, u32 slots, u8* buffer, u32 bufsiz)
// if (!SetWritePermissions(PERM_SYS_LVL3, true)) return 1; // one unlock sequence is enough // if (!SetWritePermissions(PERM_SYS_LVL3, true)) return 1; // one unlock sequence is enough
// point of no return // point of no return
ShowString(false, "Installing FIRM, please wait..."); ShowString("Installing FIRM, please wait...");
if (fix_sector0x96 && (WriteNandSectors(sector0x96, 0x96, 1, 0x11, NAND_SYSNAND) != 0)) { if (fix_sector0x96 && (WriteNandSectors(sector0x96, 0x96, 1, 0x11, NAND_SYSNAND) != 0)) {
ShowPrompt(false, "!THIS IS BAD!\n \nFailed writing sector 0x96.\nTry to fix before reboot!"); ShowPrompt(false, "!THIS IS BAD!\n \nFailed writing sector 0x96.\nTry to fix before reboot!");
return 1; return 1;
@ -574,7 +574,7 @@ u32 SafeInstallFirmBuffered(const char* path, u32 slots, u8* buffer, u32 bufsiz)
} }
// done, now check the installation // done, now check the installation
ShowString(false, "Checking installation, please wait..."); ShowString("Checking installation, please wait...");
if (fix_sector0x96 && ((ReadNandSectors(sector0x96, 0x96, 1, 0x11, NAND_SYSNAND) != 0) || if (fix_sector0x96 && ((ReadNandSectors(sector0x96, 0x96, 1, 0x11, NAND_SYSNAND) != 0) ||
(ValidateSecretSector(sector0x96) != 0))) { (ValidateSecretSector(sector0x96) != 0))) {
ShowPrompt(false, "!THIS IS BAD!\n \nFailed verifying sector 0x96.\nTry to fix before reboot!"); ShowPrompt(false, "!THIS IS BAD!\n \nFailed verifying sector 0x96.\nTry to fix before reboot!");

View File

@ -116,7 +116,7 @@ u32 Paint9(void) {
} }
} else DrawStringF(TOP_SCREEN, 10, 10, COLOR_STD_FONT, COLOR_TRANSPARENT, "(" VRAM0_EASTER_BIN " not found)"); } else DrawStringF(TOP_SCREEN, 10, 10, COLOR_STD_FONT, COLOR_TRANSPARENT, "(" VRAM0_EASTER_BIN " not found)");
DrawStringF(TOP_SCREEN, SCREEN_WIDTH_TOP - 10 - GetDrawStringWidth(snapstr), DrawStringF(TOP_SCREEN, SCREEN_WIDTH_TOP - 10 - GetDrawStringWidth(snapstr),
SCREEN_HEIGHT - 10 - GetDrawStringHeight(snapstr), COLOR_STD_FONT, COLOR_TRANSPARENT, snapstr); SCREEN_HEIGHT - 10 - GetDrawStringHeight(snapstr), COLOR_STD_FONT, COLOR_TRANSPARENT, "%s", snapstr);
// outline canvas // outline canvas
DrawRectangle(BOT_SCREEN, 0, 0, 30, SCREEN_HEIGHT, outline_bg); DrawRectangle(BOT_SCREEN, 0, 0, 30, SCREEN_HEIGHT, outline_bg);

View File

@ -1679,8 +1679,8 @@ void MemTextView(const char* text, u32 len, char* line0, int off_disp, int lno,
} }
// colorize arrows // colorize arrows
if (al) DrawStringF(TOP_SCREEN, x_al, y, COLOR_TVOFFS, COLOR_TRANSPARENT, al_str); if (al) DrawStringF(TOP_SCREEN, x_al, y, COLOR_TVOFFS, COLOR_TRANSPARENT, "%s", al_str);
if (ar) DrawStringF(TOP_SCREEN, x_ar, y, COLOR_TVOFFS, COLOR_TRANSPARENT, ar_str); if (ar) DrawStringF(TOP_SCREEN, x_ar, y, COLOR_TVOFFS, COLOR_TRANSPARENT, "%s", ar_str);
// advance pointer / line number // advance pointer / line number
for (char* c = ptr; c < ptr_next; c++) if (*c == '\n') ++nln; for (char* c = ptr; c < ptr_next; c++) if (*c == '\n') ++nln;
@ -1702,7 +1702,7 @@ bool MemTextViewer(const char* text, u32 len, u32 start, bool as_script) {
// instructions // instructions
static const char* instr = "Textviewer Controls:\n \n↑↓→←(+R) - Scroll\nR+Y - Toggle wordwrap\nR+X - Goto line #\nB - Exit\n"; static const char* instr = "Textviewer Controls:\n \n↑↓→←(+R) - Scroll\nR+Y - Toggle wordwrap\nR+X - Goto line #\nB - Exit\n";
ShowString(instr); ShowString("%s", instr);
// set script colors // set script colors
if (as_script) { if (as_script) {
@ -1743,7 +1743,7 @@ bool MemTextViewer(const char* text, u32 len, u32 start, bool as_script) {
else if (switched && (pad_state & BUTTON_X)) { else if (switched && (pad_state & BUTTON_X)) {
u64 lnext64 = ShowNumberPrompt(lcurr, "Current line: %i\nEnter new line below.", lcurr); u64 lnext64 = ShowNumberPrompt(lcurr, "Current line: %i\nEnter new line below.", lcurr);
if (lnext64 && (lnext64 != (u64) -1)) line0_next = line_seek(text, len, 0, line0, (int) lnext64 - lcurr); if (lnext64 && (lnext64 != (u64) -1)) line0_next = line_seek(text, len, 0, line0, (int) lnext64 - lcurr);
ShowString(instr); ShowString("%s", instr);
} else if (switched && (pad_state & BUTTON_Y)) { } else if (switched && (pad_state & BUTTON_Y)) {
ww = ww ? 0 : TV_LLEN_DISP; ww = ww ? 0 : TV_LLEN_DISP;
line0_next = line_seek(text, len, ww, line0, 0); line0_next = line_seek(text, len, ww, line0, 0);
@ -1818,7 +1818,7 @@ bool MemToCViewer(const char* text, u32 len, const char* title) {
for (; IS_WHITESPACE(*caption); caption++); for (; IS_WHITESPACE(*caption); caption++);
for (; caption[len] != '\n' && caption[len] != '\r'; len++); for (; caption[len] != '\n' && caption[len] != '\r'; len++);
DrawStringF(BOT_SCREEN, x0 + (lvl-1) * (FONT_WIDTH_EXT/2), y0, text_color, COLOR_STD_BG, DrawStringF(BOT_SCREEN, x0 + (lvl-1) * (FONT_WIDTH_EXT/2), y0, text_color, COLOR_STD_BG,
"%*.*s", len, len, caption); "%*.*s", (int) len, (int) len, caption);
y0 += FONT_HEIGHT_EXT + (2*TV_VPAD); y0 += FONT_HEIGHT_EXT + (2*TV_VPAD);
} }