From a91378b9c11938df96a8d8c08745dd1b52718915 Mon Sep 17 00:00:00 2001 From: CTCaer Date: Tue, 5 May 2020 19:26:10 +0300 Subject: [PATCH] nyx: Allow always writeable emmc via config The key is `umsemmcrw` and resides in nyx.ini --- README.md | 1 + nyx/nyx_gui/config/config.c | 4 ++++ nyx/nyx_gui/config/config.h | 3 ++- nyx/nyx_gui/frontend/gui_tools.c | 6 +++--- nyx/nyx_gui/nyx.c | 2 ++ 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 274e7df..d0dd2e5 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,7 @@ You can find a template [Here](./res/hekate_ipl_template.ini) | timeoff=100 | Sets time offset in HEX. Must be in HOS epoch format | | homescreen=0 | Sets home screen. 0: Home menu, 1: All configs (merges Launch and More configs), 2: Launch, 3: More Configs. | | verification=1 | 0: Disable Backup/Restore verification, 1: Sparse (block based, fast and mostly reliable), 2: Full (sha256 based, slow and 100% reliable). | +| umsemmcrw=1 | 1: eMMC/emuMMC UMS will be mounted as writable by default. | ### Boot entry key/value combinations: diff --git a/nyx/nyx_gui/config/config.c b/nyx/nyx_gui/config/config.c index 08a41e4..c87d8d3 100644 --- a/nyx/nyx_gui/config/config.c +++ b/nyx/nyx_gui/config/config.c @@ -60,6 +60,7 @@ void set_nyx_default_configuration() n_cfg.timeoff = 0; n_cfg.home_screen = 0; n_cfg.verification = 1; + n_cfg.ums_emmc_rw = 0; } int create_config_entry() @@ -202,6 +203,9 @@ int create_nyx_config_entry() f_puts("\nverification=", &fp); itoa(n_cfg.verification, lbuf, 10); f_puts(lbuf, &fp); + f_puts("\numsemmcrw=", &fp); + itoa(n_cfg.ums_emmc_rw, lbuf, 10); + f_puts(lbuf, &fp); f_puts("\n", &fp); f_close(&fp); diff --git a/nyx/nyx_gui/config/config.h b/nyx/nyx_gui/config/config.h index 3a6bea4..61b3acd 100644 --- a/nyx/nyx_gui/config/config.h +++ b/nyx/nyx_gui/config/config.h @@ -45,9 +45,10 @@ typedef struct _hekate_config typedef struct _nyx_config { u32 themecolor; - s32 timeoff; + u32 timeoff; u32 home_screen; u32 verification; + u32 ums_emmc_rw; } nyx_config; void set_default_configuration(); diff --git a/nyx/nyx_gui/frontend/gui_tools.c b/nyx/nyx_gui/frontend/gui_tools.c index db0aee7..d4bcfaa 100644 --- a/nyx/nyx_gui/frontend/gui_tools.c +++ b/nyx/nyx_gui/frontend/gui_tools.c @@ -46,6 +46,7 @@ extern volatile boot_cfg_t *b_cfg; extern hekate_config h_cfg; +extern nyx_config n_cfg; extern void emmcsn_path_impl(char *path, char *sub_dir, char *filename, sdmmc_storage_t *storage); @@ -643,8 +644,6 @@ static lv_res_t _create_window_usb_tools(lv_obj_t *parent) { lv_obj_t *win = nyx_create_standard_window(SYMBOL_USB" USB Tools"); - usb_msc_emmc_read_only = true; - static lv_style_t h_style; lv_style_copy(&h_style, &lv_style_transp); h_style.body.padding.inner = 0; @@ -747,7 +746,8 @@ static lv_res_t _create_window_usb_tools(lv_obj_t *parent) lv_obj_t *btn_write_access = lv_btn_create(h_write, NULL); nyx_create_onoff_button(lv_theme_get_current(), h_write, btn_write_access, SYMBOL_EDIT" Read-Only", _emmc_read_only_toggle, false); - lv_btn_set_state(btn_write_access, LV_BTN_STATE_TGL_REL); + if (!n_cfg.ums_emmc_rw) + lv_btn_set_state(btn_write_access, LV_BTN_STATE_TGL_REL); _emmc_read_only_toggle(btn_write_access); // Create USB Input Devices container. diff --git a/nyx/nyx_gui/nyx.c b/nyx/nyx_gui/nyx.c index 921cd3b..92fe952 100644 --- a/nyx/nyx_gui/nyx.c +++ b/nyx/nyx_gui/nyx.c @@ -270,6 +270,8 @@ void load_saved_configuration() n_cfg.home_screen = atoi(kv->val); else if (!strcmp("verification", kv->key)) n_cfg.verification = atoi(kv->val); + else if (!strcmp("umsemmcrw", kv->key)) + n_cfg.ums_emmc_rw = atoi(kv->val) == 1; } break;