1
0
mirror of https://github.com/CTCaer/hekate.git synced 2024-11-05 02:27:39 +00:00

nyx: disable reboot to OFW button if autorcm

This commit is contained in:
CTCaer 2023-02-11 23:59:30 +02:00
parent c9405680f2
commit a6d7fa7fe1
7 changed files with 16 additions and 8 deletions

View File

@ -42,6 +42,7 @@ void set_default_configuration()
h_cfg.errors = 0;
h_cfg.eks = NULL;
h_cfg.rcm_patched = fuse_check_patched_rcm();
h_cfg.autorcm_enabled = false;
h_cfg.emummc_force_disable = false;
sd_power_cycle_time_start = 0;

View File

@ -37,6 +37,7 @@ typedef struct _hekate_config
bool t210b01;
bool emummc_force_disable;
bool rcm_patched;
bool autorcm_enabled;
u32 errors;
hos_eks_mbr_t *eks;
} hekate_config;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2022 CTCaer
* Copyright (c) 2018-2023 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,
@ -1101,6 +1101,7 @@ static lv_res_t _create_mbox_reboot(lv_obj_t *btn)
lv_obj_set_size(dark_bg, LV_HOR_RES, LV_VER_RES);
static const char * mbox_btn_map[] = { "\221OFW", "\221RCM", "\221Cancel", "" };
static const char * mbox_btn_map_autorcm[] = { "\261OFW", "\221RCM", "\221Cancel", "" };
static const char * mbox_btn_map_patched[] = { "\221OFW", "\221Normal", "\221Cancel", "" };
lv_obj_t *mbox = lv_mbox_create(dark_bg, NULL);
lv_mbox_set_recolor_text(mbox, true);
@ -1108,7 +1109,10 @@ static lv_res_t _create_mbox_reboot(lv_obj_t *btn)
lv_mbox_set_text(mbox, "#FF8000 Choose where to reboot:#");
lv_mbox_add_btns(mbox, h_cfg.rcm_patched ? mbox_btn_map_patched : mbox_btn_map, _reboot_action);
if (h_cfg.rcm_patched)
lv_mbox_add_btns(mbox, mbox_btn_map_patched, _reboot_action);
else
lv_mbox_add_btns(mbox, !h_cfg.autorcm_enabled ? mbox_btn_map : mbox_btn_map_autorcm, _reboot_action);
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_top(mbox, true);

View File

@ -155,7 +155,7 @@ static void _create_window_backup_restore(emmcPartType_t type, const char* win_l
// Refresh AutoRCM button.
if (emmc_btn_ctxt.restore && (type == PART_BOOT) && !emmc_btn_ctxt.raw_emummc)
{
if (get_autorcm_status(false))
if (get_set_autorcm_status(false))
lv_btn_set_state(autorcm_btn, LV_BTN_STATE_TGL_REL);
else
lv_btn_set_state(autorcm_btn, LV_BTN_STATE_REL);

View File

@ -56,7 +56,7 @@ static lv_obj_t *_create_container(lv_obj_t *parent)
return h1;
}
bool get_autorcm_status(bool toggle)
bool get_set_autorcm_status(bool toggle)
{
u32 sector;
u8 corr_mod0, mod1;
@ -128,6 +128,8 @@ out:
free(tempbuf);
emmc_end();
h_cfg.autorcm_enabled = enabled;
return enabled;
}
@ -141,7 +143,7 @@ static lv_res_t _create_mbox_autorcm_status(lv_obj_t *btn)
lv_obj_t * mbox = lv_mbox_create(dark_bg, NULL);
lv_mbox_set_recolor_text(mbox, true);
bool enabled = get_autorcm_status(true);
bool enabled = get_set_autorcm_status(true);
if (enabled)
{
@ -1660,7 +1662,7 @@ static void _create_tab_tools_arc_autorcm(lv_theme_t *th, lv_obj_t *parent)
lv_btn_set_action(btn3, LV_BTN_ACTION_CLICK, _create_mbox_autorcm_status);
// Set default state for AutoRCM and lock it out if patched unit.
if (get_autorcm_status(false))
if (get_set_autorcm_status(false))
lv_btn_set_state(btn3, LV_BTN_STATE_TGL_REL);
else
lv_btn_set_state(btn3, LV_BTN_STATE_REL);

View File

@ -23,7 +23,7 @@ extern lv_obj_t *ums_mbox;
void create_tab_tools(lv_theme_t *th, lv_obj_t *parent);
void nyx_run_ums(void *param);
bool get_autorcm_status(bool change);
bool get_set_autorcm_status(bool change);
lv_res_t action_ums_sd(lv_obj_t *btn);
#endif

View File

@ -1,7 +1,7 @@
/*
* Copyright (c) 2018 naehrwert
*
* Copyright (c) 2018-2022 CTCaer
* Copyright (c) 2018-2023 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,