Skip to content

Commit

Permalink
nyx: Update AutoRCM status on eMMC restore
Browse files Browse the repository at this point in the history
  • Loading branch information
CTCaer committed Aug 27, 2019
1 parent 6159d94 commit 9533dea
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
1 change: 1 addition & 0 deletions nyx/nyx_gui/frontend/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ lv_style_t hint_small_style_white;
lv_style_t monospace_text;

lv_obj_t *payload_list;
lv_obj_t *autorcm_btn;

lv_img_dsc_t *icon_switch;
lv_img_dsc_t *icon_payload;
Expand Down
17 changes: 17 additions & 0 deletions nyx/nyx_gui/frontend/gui_emmc_tools.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "gui.h"
#include "gui_emmc_tools.h"
#include "gui_tools.h"
#include "fe_emmc_tools.h"
#include "../config/config.h"
#include "../hos/pkg1.h"
Expand Down Expand Up @@ -156,6 +157,22 @@ static void _create_window_backup_restore(emmcPartType_t type, const char* win_l
restore_emmc_selected(type, &emmc_tool_gui_ctxt);

nyx_window_toggle_buttons(win, false);

// Refresh AutoRCM button.
if (emmc_btn_ctxt.restore && (type == PART_BOOT) && !emmc_btn_ctxt.raw_emummc)
{
if (get_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);
nyx_generic_onoff_toggle(autorcm_btn);

if (h_cfg.rcm_patched)
{
lv_obj_set_click(autorcm_btn, false);
lv_btn_set_state(autorcm_btn, LV_BTN_STATE_INA);
}
}
}

static lv_res_t _emmc_backup_buttons_decider(lv_obj_t *btn)
Expand Down
7 changes: 4 additions & 3 deletions nyx/nyx_gui/frontend/gui_tools.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extern void emmcsn_path_impl(char *path, char *sub_dir, char *filename, sdmmc_st
#pragma GCC push_options
#pragma GCC target ("thumb")

static bool _get_autorcm_status(bool change)
bool get_autorcm_status(bool change)
{
u8 corr_mod_byte0;
sdmmc_storage_t storage;
Expand Down Expand Up @@ -108,7 +108,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_autorcm_status(true);

if (enabled)
{
Expand Down Expand Up @@ -820,7 +820,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_autorcm_status(false))
lv_btn_set_state(btn3, LV_BTN_STATE_TGL_REL);
else
lv_btn_set_state(btn3, LV_BTN_STATE_REL);
Expand All @@ -831,6 +831,7 @@ static void _create_tab_tools_arc_autorcm(lv_theme_t *th, lv_obj_t *parent)
lv_obj_set_click(btn3, false);
lv_btn_set_state(btn3, LV_BTN_STATE_INA);
}
autorcm_btn = btn3;

char *txt_buf = (char *)malloc(0x1000);

Expand Down
1 change: 1 addition & 0 deletions nyx/nyx_gui/frontend/gui_tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@

void create_tab_tools(lv_theme_t *th, lv_obj_t *parent);
void sept_run_dump();
bool get_autorcm_status(bool change);

#endif

0 comments on commit 9533dea

Please sign in to comment.