From b6e458e97bd918b2cf9c080995d14c886746c179 Mon Sep 17 00:00:00 2001 From: CTCaer Date: Sat, 6 Feb 2021 17:14:07 +0200 Subject: [PATCH] sept: Correct bct buffer pointer and turn on backlight on error --- bootloader/hos/sept.c | 7 ++++++- bootloader/hos/sept.h | 2 +- nyx/nyx_gui/frontend/gui_info.c | 6 +++--- nyx/nyx_gui/frontend/gui_tools.c | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bootloader/hos/sept.c b/bootloader/hos/sept.c index 0259988..ac34528 100644 --- a/bootloader/hos/sept.c +++ b/bootloader/hos/sept.c @@ -33,6 +33,7 @@ #include #include #include +#include #include @@ -129,13 +130,17 @@ void check_sept(ini_sec_t *cfg_sec) } u8 *bct_bldr = (u8 *)calloc(1, 512); - sdmmc_storage_read(&emmc_storage, 0x2200 / NX_EMMC_BLOCKSIZE, 1, &bct_bldr); + sdmmc_storage_read(&emmc_storage, 0x2200 / NX_EMMC_BLOCKSIZE, 1, bct_bldr); u32 bootloader_entrypoint = *(u32 *)&bct_bldr[0x144]; free(bct_bldr); if (bootloader_entrypoint > SEPT_PRI_ENTRY) { gfx_con.mute = false; EPRINTF("Failed to run sept\n""Main BCT is improper!\nRun sept with proper BCT at least once\nto cache keys."); + gfx_printf("\nPress any key...\n"); + display_backlight_brightness(h_cfg.backlight, 1000); + msleep(500); + btn_wait(); goto out_free; } diff --git a/bootloader/hos/sept.h b/bootloader/hos/sept.h index af00f73..2db6b78 100644 --- a/bootloader/hos/sept.h +++ b/bootloader/hos/sept.h @@ -20,6 +20,6 @@ #include void check_sept(ini_sec_t *cfg_sec); -int reboot_to_sept(const u8 *tsec_fw, u32 kb, ini_sec_t *cfg_sec); +int reboot_to_sept(const u8 *tsec_fw, u32 kb, ini_sec_t *cfg_sec); #endif diff --git a/nyx/nyx_gui/frontend/gui_info.c b/nyx/nyx_gui/frontend/gui_info.c index 579aeb2..b23f830 100644 --- a/nyx/nyx_gui/frontend/gui_info.c +++ b/nyx/nyx_gui/frontend/gui_info.c @@ -371,13 +371,13 @@ try_load: { // Check that BCT is proper so sept can run. u8 *bct_bldr = (u8 *)calloc(1, 512); - sdmmc_storage_read(&emmc_storage, 0x2200 / NX_EMMC_BLOCKSIZE, 1, &bct_bldr); + sdmmc_storage_read(&emmc_storage, 0x2200 / NX_EMMC_BLOCKSIZE, 1, bct_bldr); u32 bootloader_entrypoint = *(u32 *)&bct_bldr[0x144]; free(bct_bldr); if (bootloader_entrypoint > SEPT_PRI_ENTRY) { - lv_label_set_text(lb_desc, "#FFDD00 Failed to run sept because main BCT is improper!#\n" - "#FFDD00 Run sept with proper BCT at least once to cache keys.#\n"); + lv_label_set_text(lb_desc, "#FFDD00 Main BCT is improper! Failed to run sept.#\n" + "#FFDD00 Run sept with proper BCT at least once#\n#FFDD00 to cache keys.#\n"); goto out; } diff --git a/nyx/nyx_gui/frontend/gui_tools.c b/nyx/nyx_gui/frontend/gui_tools.c index a961526..f51f83f 100644 --- a/nyx/nyx_gui/frontend/gui_tools.c +++ b/nyx/nyx_gui/frontend/gui_tools.c @@ -1160,7 +1160,7 @@ static lv_res_t _create_window_dump_pk12_tool(lv_obj_t *btn) { // Check that BCT is proper so sept can run. u8 *bct_bldr = (u8 *)calloc(1, 512); - sdmmc_storage_read(&emmc_storage, 0x2200 / NX_EMMC_BLOCKSIZE, 1, &bct_bldr); + sdmmc_storage_read(&emmc_storage, 0x2200 / NX_EMMC_BLOCKSIZE, 1, bct_bldr); u32 bootloader_entrypoint = *(u32 *)&bct_bldr[0x144]; free(bct_bldr); if (bootloader_entrypoint > SEPT_PRI_ENTRY)