mirror of
https://github.com/CTCaer/hekate
synced 2024-11-16 00:49:27 +00:00
nyx: Refactor nyx extra cfg
This commit is contained in:
parent
af790aeaf8
commit
eea5463a5c
6 changed files with 42 additions and 33 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2018 naehrwert
|
||||
* Copyright (c) 2018-2020 CTCaer
|
||||
* Copyright (c) 2018-2021 CTCaer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
@ -75,10 +75,9 @@ typedef int bool;
|
|||
#define EXTRA_CFG_PAYLOAD BIT(1)
|
||||
#define EXTRA_CFG_MODULE BIT(2)
|
||||
|
||||
#define EXTRA_CFG_NYX_BIS BIT(4)
|
||||
#define EXTRA_CFG_NYX_UMS BIT(5)
|
||||
#define EXTRA_CFG_NYX_RELOAD BIT(6)
|
||||
#define EXTRA_CFG_NYX_DUMP BIT(7)
|
||||
#define EXTRA_CFG_NYX_SEPT BIT(7)
|
||||
|
||||
typedef enum _nyx_ums_type
|
||||
{
|
||||
|
@ -91,6 +90,12 @@ typedef enum _nyx_ums_type
|
|||
NYX_UMS_EMUMMC_GPP
|
||||
} nyx_ums_type;
|
||||
|
||||
typedef enum _nyx_sept_type
|
||||
{
|
||||
NYX_SEPT_DUMP = 0,
|
||||
NYX_SEPT_CAL0
|
||||
} nyx_sept_type;
|
||||
|
||||
typedef struct __attribute__((__packed__)) _boot_cfg_t
|
||||
{
|
||||
u8 boot_cfg;
|
||||
|
@ -104,7 +109,8 @@ typedef struct __attribute__((__packed__)) _boot_cfg_t
|
|||
char id[8]; // 7 char ASCII null teminated.
|
||||
char emummc_path[0x78]; // emuMMC/XXX, ASCII null teminated.
|
||||
};
|
||||
u8 ums; // nyx_ums_type.
|
||||
u8 ums; // nyx_ums_type.
|
||||
u8 sept; // nyx_sept_type.
|
||||
u8 xt_str[0x80];
|
||||
};
|
||||
} boot_cfg_t;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2018 naehrwert
|
||||
* Copyright (c) 2018-2020 CTCaer
|
||||
* Copyright (c) 2018-2021 CTCaer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
@ -35,9 +35,10 @@ typedef enum
|
|||
|
||||
typedef enum
|
||||
{
|
||||
NYX_CFG_BIS = BIT(5),
|
||||
NYX_CFG_UMS = BIT(6),
|
||||
NYX_CFG_DUMP = BIT(7),
|
||||
NYX_CFG_SEPT = BIT(7),
|
||||
|
||||
NYX_CFG_EXTRA = 0xFF << 24
|
||||
} nyx_cfg_t;
|
||||
|
||||
typedef enum
|
||||
|
|
|
@ -714,15 +714,11 @@ void nyx_load_run()
|
|||
nyx_str->cfg = 0;
|
||||
if (b_cfg.extra_cfg)
|
||||
{
|
||||
if (b_cfg.extra_cfg & EXTRA_CFG_NYX_DUMP)
|
||||
if (b_cfg.extra_cfg & EXTRA_CFG_NYX_SEPT)
|
||||
{
|
||||
b_cfg.extra_cfg &= ~(EXTRA_CFG_NYX_DUMP);
|
||||
nyx_str->cfg |= NYX_CFG_DUMP;
|
||||
}
|
||||
if (b_cfg.extra_cfg & EXTRA_CFG_NYX_BIS)
|
||||
{
|
||||
b_cfg.extra_cfg &= ~(EXTRA_CFG_NYX_BIS);
|
||||
nyx_str->cfg |= NYX_CFG_BIS;
|
||||
b_cfg.extra_cfg &= ~(EXTRA_CFG_NYX_SEPT);
|
||||
nyx_str->cfg |= NYX_CFG_SEPT;
|
||||
nyx_str->cfg |= b_cfg.sept << 24;
|
||||
}
|
||||
if (b_cfg.extra_cfg & EXTRA_CFG_NYX_UMS)
|
||||
{
|
||||
|
@ -802,7 +798,7 @@ static void _bootloader_corruption_protect()
|
|||
|
||||
static void _auto_launch_firmware()
|
||||
{
|
||||
if(b_cfg.extra_cfg & (EXTRA_CFG_NYX_DUMP | EXTRA_CFG_NYX_BIS))
|
||||
if(b_cfg.extra_cfg & EXTRA_CFG_NYX_SEPT)
|
||||
{
|
||||
if (!h_cfg.sept_run)
|
||||
EMC(EMC_SCRATCH0) |= EMC_HEKA_UPD;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020 CTCaer
|
||||
* Copyright (c) 2018-2021 CTCaer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
@ -2206,17 +2206,21 @@ static void _nyx_main_menu(lv_theme_t * th)
|
|||
lv_tabview_set_tab_load_action(tv, _show_hide_save_button);
|
||||
|
||||
// If we rebooted to run sept for dumping, lunch dump immediately.
|
||||
if (nyx_str->cfg & NYX_CFG_DUMP)
|
||||
if (nyx_str->cfg & NYX_CFG_SEPT)
|
||||
{
|
||||
nyx_str->cfg &= ~(NYX_CFG_DUMP);
|
||||
lv_task_t *task_run_dump = lv_task_create(sept_run_dump, LV_TASK_ONESHOT, LV_TASK_PRIO_MID, NULL);
|
||||
lv_task_once(task_run_dump);
|
||||
}
|
||||
else if (nyx_str->cfg & NYX_CFG_BIS)
|
||||
{
|
||||
nyx_str->cfg &= ~(NYX_CFG_BIS);
|
||||
lv_task_t *task_run_cal0 = lv_task_create(sept_run_cal0, LV_TASK_ONESHOT, LV_TASK_PRIO_LOWEST, NULL);
|
||||
lv_task_once(task_run_cal0);
|
||||
u32 type = nyx_str->cfg >> 24;
|
||||
nyx_str->cfg &= ~(NYX_CFG_SEPT | NYX_CFG_EXTRA);
|
||||
|
||||
if (type == NYX_SEPT_DUMP)
|
||||
{
|
||||
lv_task_t *task_run_dump = lv_task_create(sept_run_dump, LV_TASK_ONESHOT, LV_TASK_PRIO_MID, NULL);
|
||||
lv_task_once(task_run_dump);
|
||||
}
|
||||
else if (type == NYX_SEPT_CAL0)
|
||||
{
|
||||
lv_task_t *task_run_cal0 = lv_task_create(sept_run_cal0, LV_TASK_ONESHOT, LV_TASK_PRIO_LOWEST, NULL);
|
||||
lv_task_once(task_run_cal0);
|
||||
}
|
||||
}
|
||||
else if (nyx_str->cfg & NYX_CFG_UMS)
|
||||
{
|
||||
|
|
|
@ -384,7 +384,8 @@ try_load:
|
|||
// Set boot cfg.
|
||||
b_cfg->autoboot = 0;
|
||||
b_cfg->autoboot_list = 0;
|
||||
b_cfg->extra_cfg = EXTRA_CFG_NYX_BIS;
|
||||
b_cfg->extra_cfg = EXTRA_CFG_NYX_SEPT;
|
||||
b_cfg->sept = NYX_SEPT_CAL0;
|
||||
|
||||
if (!reboot_to_sept((u8 *)tsec_ctxt.fw, kb))
|
||||
{
|
||||
|
@ -415,7 +416,7 @@ t210b01:;
|
|||
nx_emmc_bis_init(cal0_part);
|
||||
nx_emmc_bis_read(0, 0x40, cal0_buf);
|
||||
|
||||
// Clear BIS keys slots.
|
||||
// Clear BIS keys slots and reinstate SBK.
|
||||
hos_bis_keys_clear();
|
||||
|
||||
nx_emmc_cal0_t *cal0 = (nx_emmc_cal0_t *)cal0_buf;
|
||||
|
@ -1109,7 +1110,7 @@ try_load:
|
|||
|
||||
if (!pkg1_id)
|
||||
{
|
||||
strcat(txt_buf, "#FFDD00 Unknown pkg1 version for reading#\n#FFDD00 TSEC firmware!#\n");
|
||||
strcat(txt_buf, "#FFDD00 Unknown pkg1 version!#\n");
|
||||
// Try backup bootloader.
|
||||
if (bootloader_offset != BOOTLOADER_BACKUP_OFFSET)
|
||||
{
|
||||
|
|
|
@ -607,7 +607,7 @@ void nyx_run_ums(void *param)
|
|||
u32 *cfg = (u32 *)param;
|
||||
|
||||
u8 type = (*cfg) >> 24;
|
||||
*cfg = *cfg & 0xFFFFFF;
|
||||
*cfg = *cfg & (~NYX_CFG_EXTRA);
|
||||
|
||||
// Disable read only flag.
|
||||
usb_msc_emmc_read_only = false;
|
||||
|
@ -1123,7 +1123,7 @@ static lv_res_t _create_window_dump_pk12_tool(lv_obj_t *btn)
|
|||
// Dump package1 in its encrypted state if unknown.
|
||||
if (!pkg1_id)
|
||||
{
|
||||
strcat(txt_buf, "#FFDD00 Unknown pkg1 version for reading#\n#FFDD00 TSEC firmware!#");
|
||||
strcat(txt_buf, "#FFDD00 Unknown pkg1 version!#");
|
||||
lv_label_set_text(lb_desc, txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
|
@ -1175,7 +1175,8 @@ static lv_res_t _create_window_dump_pk12_tool(lv_obj_t *btn)
|
|||
// Set boot cfg.
|
||||
b_cfg->autoboot = 0;
|
||||
b_cfg->autoboot_list = 0;
|
||||
b_cfg->extra_cfg = EXTRA_CFG_NYX_DUMP;
|
||||
b_cfg->extra_cfg = EXTRA_CFG_NYX_SEPT;
|
||||
b_cfg->sept = NYX_SEPT_DUMP;
|
||||
|
||||
if (!reboot_to_sept((u8 *)tsec_ctxt.fw, kb))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue