diff --git a/include/arm11/menu/menu_color.h b/include/arm11/menu/menu_color.h index c53ae9a..ec27441 100644 --- a/include/arm11/menu/menu_color.h +++ b/include/arm11/menu/menu_color.h @@ -34,6 +34,7 @@ // colors for color scheme #define ESC_SCHEME_STD ESC_RESET ESC_FGCOLOR(7) ESC_BGCOLOR(0) #define ESC_SCHEME_GOOD ESC_RESET ESC_FGCOLOR(2) ESC_BGCOLOR(0) ESC_BOLD +#define ESC_SCHEME_BAD ESC_RESET ESC_FGCOLOR(1) ESC_BGCOLOR(0) ESC_BOLD #define ESC_SCHEME_WEAK ESC_RESET ESC_FGCOLOR(7) ESC_BGCOLOR(0) ESC_BOLD #define ESC_SCHEME_ACCENT0 ESC_RESET ESC_FGCOLOR(4) ESC_BGCOLOR(0) ESC_BOLD #define ESC_SCHEME_ACCENT1 ESC_RESET ESC_FGCOLOR(3) ESC_BGCOLOR(0) ESC_BOLD diff --git a/include/arm11/menu/menu_fb3ds.h b/include/arm11/menu/menu_fb3ds.h index e327f8f..6f072bc 100644 --- a/include/arm11/menu/menu_fb3ds.h +++ b/include/arm11/menu/menu_fb3ds.h @@ -60,7 +60,7 @@ #define DESC_NAND_BACKUP "Backup current NAND to a file." #define DESC_NAND_RESTORE "Restore current NAND from a file.\nThis option preserves your fastboot3ds installation." #define DESC_NAND_RESTORE_F "Restore current NAND from a file.\nWARNING: This will overwrite all of your flash memory, also overwriting fastboot3ds." -#define DESC_FIRM_FLASH "Flash firmware from file.\nWARNING: This will allow you to flash unsigned firmware, overwriting fastboot3ds. Using unsupported firmware can BRICK your console." +#define DESC_FIRM_FLASH "Flash firmware from file to FIRM1.\nWARNING: This will allow you to flash unsigned firmware, overwriting anything previously installed in FIRM1." #define DESC_CHANGE_BRIGHT "Change fastboot3ds brightness. This may also affect firmware launched from within fastboot3ds." #define DESC_SET_CONTIG "Enable/disable contiguous NAND backups.\nContiguous NAND backups may be required on certain CFWs to be bootable from SD cards." @@ -122,13 +122,13 @@ { "Backup NAND", DESC_NAND_BACKUP, &menuBackupNand, 0 }, { "Restore NAND", DESC_NAND_RESTORE, &menuRestoreNand, 0 }, { "Restore NAND (forced)", DESC_NAND_RESTORE_F, &menuRestoreNand, 1 }, - { "Flash firmware", DESC_FIRM_FLASH, &menuInstallFirm, 0 } + { "Flash firmware to FIRM1", DESC_FIRM_FLASH, &menuInstallFirm, 1 } } }, { // 8 "Miscellaneous", 2, NULL, 0, { - { "Update fastboot3DS", DESC_UPDATE, &menuUpdateFastboot3ds, 0 }, + { "Update fastboot3DS", DESC_UPDATE, &menuInstallFirm, 0 }, { "Credits", DESC_CREDITS, &menuShowCredits, 0 } } }, diff --git a/include/arm11/menu/menu_func.h b/include/arm11/menu/menu_func.h index 40860b8..50616e7 100644 --- a/include/arm11/menu/menu_func.h +++ b/include/arm11/menu/menu_func.h @@ -39,10 +39,10 @@ u32 menuBackupNand(PrintConsole* term_con, PrintConsole* menu_con, u32 param); u32 menuRestoreNand(PrintConsole* term_con, PrintConsole* menu_con, u32 param); u32 menuInstallFirm(PrintConsole* term_con, PrintConsole* menu_con, u32 param); -u32 menuUpdateFastboot3ds(PrintConsole* term_con, PrintConsole* menu_con, u32 param); u32 menuContinueBoot(PrintConsole* term_con, PrintConsole* menu_con, u32 param); u32 menuShowCredits(PrintConsole* term_con, PrintConsole* menu_con, u32 param); +// everything below has to go u32 menuDummyFunc(PrintConsole* term_con, PrintConsole* menu_con, u32 param); u32 debugSettingsView(PrintConsole* term_con, PrintConsole* menu_con, u32 param); u32 debugEscapeTest(PrintConsole* term_con, PrintConsole* menu_con, u32 param); diff --git a/source/arm11/console.c b/source/arm11/console.c index 2ad6be7..496306f 100644 --- a/source/arm11/console.c +++ b/source/arm11/console.c @@ -24,7 +24,7 @@ RGB8_to_565(255,255,255), // bright white RGB8_to_565( 64, 64, 64), // almost black - RGB8_to_565(255, 0, 0), // bright red + RGB8_to_565(224, 0, 0), // accent red RGB8_to_565( 64,255, 64), // accent green RGB8_to_565(255,255, 32), // accent yellow RGB8_to_565( 64, 64,255), // accent blue diff --git a/source/arm11/menu/menu_func.c b/source/arm11/menu/menu_func.c index a643273..a203107 100644 --- a/source/arm11/menu/menu_func.c +++ b/source/arm11/menu/menu_func.c @@ -22,6 +22,7 @@ #include #include #include "types.h" +#include "firmwriter.h" #include "fs.h" #include "fsutils.h" #include "arm11/menu/menu_color.h" @@ -544,7 +545,7 @@ // check file size const s64 file_size = fSize(fHandle); - ee_printf("File size: %lu MiB\n", file_size / 0x100000); + ee_printf("File size: %lli MiB\n", file_size / 0x100000); ee_printf("NAND size: %lli MiB\n", nand_size / 0x100000); ee_printf("Buffer size: %lu kiB\n", (u32) DEVICE_BUFSIZE / 0x400); updateScreens(); @@ -614,8 +615,7 @@ u32 menuInstallFirm(PrintConsole* term_con, PrintConsole* menu_con, u32 param) { - (void) param; - + bool to_firm1 = param; u32 result = 1; @@ -632,7 +632,9 @@ char firm_path[256]; - ee_printf_screen_center("Select a firmware file to install.\nPress [HOME] to cancel."); + ee_printf_screen_center("%s\nPress [HOME] to cancel.", + to_firm1 ? "Select a firmware file to install." : + "Select fastboot3DS update file."); updateScreens(); if (!menuFileSelector(firm_path, menu_con, NULL, "*.firm", true)) @@ -643,6 +645,31 @@ consoleSelect(term_con); consoleClear(); + ee_printf(ESC_SCHEME_ACCENT1 "%s:\n%s\n" ESC_RESET "\nLoading firmware... ", + (to_firm1) ? "Flashing firmware to FIRM1" : "Updating fastboot3DS from file", firm_path); + updateScreens(); + + s32 res = loadVerifyFirm(firm_path, false); + if (res != 0) + { + ee_printf(ESC_SCHEME_BAD "failed!\n" ESC_RESET); + ee_printf("Firm %s error code %li!\n", (res > -8) ? "load" : "verify", res); + goto fail; + } + + ee_printf(ESC_SCHEME_GOOD "OK\n" ESC_RESET "Flashing firmware... "); + updateScreens(); + + res = writeFirmPartition(to_firm1 ? "firm1:" : "firm0:"); + if (res != 0) + { + ee_printf(ESC_SCHEME_BAD "failed!\n" ESC_RESET); + ee_printf("Firm flash error code %li!\n", res); + goto fail; + } + + ee_printf(ESC_SCHEME_GOOD "OK\n" ESC_RESET); + ee_printf(ESC_SCHEME_GOOD "\n%s was updated\n" ESC_RESET, to_firm1 ? "Firmware in FIRM1" : "fastboot3DS"); fail: