nyx: Allow always writeable emmc via config

The key is `umsemmcrw` and resides in nyx.ini
This commit is contained in:
CTCaer 2020-05-05 19:26:10 +03:00
parent 7543234401
commit a91378b9c1
5 changed files with 12 additions and 4 deletions

View file

@ -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 | | 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. | | 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). | | 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: ### Boot entry key/value combinations:

View file

@ -60,6 +60,7 @@ void set_nyx_default_configuration()
n_cfg.timeoff = 0; n_cfg.timeoff = 0;
n_cfg.home_screen = 0; n_cfg.home_screen = 0;
n_cfg.verification = 1; n_cfg.verification = 1;
n_cfg.ums_emmc_rw = 0;
} }
int create_config_entry() int create_config_entry()
@ -202,6 +203,9 @@ int create_nyx_config_entry()
f_puts("\nverification=", &fp); f_puts("\nverification=", &fp);
itoa(n_cfg.verification, lbuf, 10); itoa(n_cfg.verification, lbuf, 10);
f_puts(lbuf, &fp); 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_puts("\n", &fp);
f_close(&fp); f_close(&fp);

View file

@ -45,9 +45,10 @@ typedef struct _hekate_config
typedef struct _nyx_config typedef struct _nyx_config
{ {
u32 themecolor; u32 themecolor;
s32 timeoff; u32 timeoff;
u32 home_screen; u32 home_screen;
u32 verification; u32 verification;
u32 ums_emmc_rw;
} nyx_config; } nyx_config;
void set_default_configuration(); void set_default_configuration();

View file

@ -46,6 +46,7 @@
extern volatile boot_cfg_t *b_cfg; extern volatile boot_cfg_t *b_cfg;
extern hekate_config h_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); 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"); lv_obj_t *win = nyx_create_standard_window(SYMBOL_USB" USB Tools");
usb_msc_emmc_read_only = true;
static lv_style_t h_style; static lv_style_t h_style;
lv_style_copy(&h_style, &lv_style_transp); lv_style_copy(&h_style, &lv_style_transp);
h_style.body.padding.inner = 0; h_style.body.padding.inner = 0;
@ -747,6 +746,7 @@ static lv_res_t _create_window_usb_tools(lv_obj_t *parent)
lv_obj_t *btn_write_access = lv_btn_create(h_write, NULL); lv_obj_t *btn_write_access = lv_btn_create(h_write, NULL);
nyx_create_onoff_button(lv_theme_get_current(), h_write, nyx_create_onoff_button(lv_theme_get_current(), h_write,
btn_write_access, SYMBOL_EDIT" Read-Only", _emmc_read_only_toggle, false); btn_write_access, SYMBOL_EDIT" Read-Only", _emmc_read_only_toggle, false);
if (!n_cfg.ums_emmc_rw)
lv_btn_set_state(btn_write_access, LV_BTN_STATE_TGL_REL); lv_btn_set_state(btn_write_access, LV_BTN_STATE_TGL_REL);
_emmc_read_only_toggle(btn_write_access); _emmc_read_only_toggle(btn_write_access);

View file

@ -270,6 +270,8 @@ void load_saved_configuration()
n_cfg.home_screen = atoi(kv->val); n_cfg.home_screen = atoi(kv->val);
else if (!strcmp("verification", kv->key)) else if (!strcmp("verification", kv->key))
n_cfg.verification = atoi(kv->val); n_cfg.verification = atoi(kv->val);
else if (!strcmp("umsemmcrw", kv->key))
n_cfg.ums_emmc_rw = atoi(kv->val) == 1;
} }
break; break;