diff --git a/README.md b/README.md index 1677305..81982c7 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,8 @@ 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. | +| umsemmcrw=0 | 1: eMMC/emuMMC UMS will be mounted as writable by default. | +| jcdisable=0 | 1: Disables Joycon driver completely. | ### Boot entry key/value combinations: diff --git a/bdk/input/joycon.c b/bdk/input/joycon.c index d76b796..9d8ff43 100644 --- a/bdk/input/joycon.c +++ b/bdk/input/joycon.c @@ -523,6 +523,9 @@ jc_gamepad_rpt_t *jc_get_bt_pairing_info(bool *is_l_hos, bool *is_r_hos) u8 retries; jc_bt_conn_t *bt_conn; + if (!jc_init_done) + return NULL; + bt_conn = &jc_gamepad.bt_conn_l; memset(bt_conn->host_mac, 0, 6); memset(bt_conn->ltk, 0, 16); diff --git a/nyx/nyx_gui/config.c b/nyx/nyx_gui/config.c index 3dcb942..a36095f 100644 --- a/nyx/nyx_gui/config.c +++ b/nyx/nyx_gui/config.c @@ -60,6 +60,7 @@ void set_nyx_default_configuration() n_cfg.home_screen = 0; n_cfg.verification = 1; n_cfg.ums_emmc_rw = 0; + n_cfg.jc_disable = 0; } int create_config_entry() @@ -198,6 +199,9 @@ int create_nyx_config_entry() f_puts("\numsemmcrw=", &fp); itoa(n_cfg.ums_emmc_rw, lbuf, 10); f_puts(lbuf, &fp); + f_puts("\njcdisable=", &fp); + itoa(n_cfg.jc_disable, lbuf, 10); + f_puts(lbuf, &fp); f_puts("\n", &fp); f_close(&fp); diff --git a/nyx/nyx_gui/config.h b/nyx/nyx_gui/config.h index c61a015..56c044d 100644 --- a/nyx/nyx_gui/config.h +++ b/nyx/nyx_gui/config.h @@ -48,6 +48,7 @@ typedef struct _nyx_config u32 home_screen; u32 verification; u32 ums_emmc_rw; + u32 jc_disable; } nyx_config; void set_default_configuration(); diff --git a/nyx/nyx_gui/frontend/gui.c b/nyx/nyx_gui/frontend/gui.c index 21b4453..1557ead 100644 --- a/nyx/nyx_gui/frontend/gui.c +++ b/nyx/nyx_gui/frontend/gui.c @@ -2234,8 +2234,11 @@ void nyx_load_and_run() lv_disp_drv_register(&disp_drv); // Initialize Joy-Con. - lv_task_t *task_jc_init_hw = lv_task_create(jc_init_hw, LV_TASK_ONESHOT, LV_TASK_PRIO_LOWEST, NULL); - lv_task_once(task_jc_init_hw); + if (!n_cfg.jc_disable) + { + lv_task_t *task_jc_init_hw = lv_task_create(jc_init_hw, LV_TASK_ONESHOT, LV_TASK_PRIO_LOWEST, NULL); + lv_task_once(task_jc_init_hw); + } lv_indev_drv_t indev_drv_jc; lv_indev_drv_init(&indev_drv_jc); indev_drv_jc.type = LV_INDEV_TYPE_POINTER; diff --git a/nyx/nyx_gui/frontend/gui_options.c b/nyx/nyx_gui/frontend/gui_options.c index 0769825..7b624b2 100644 --- a/nyx/nyx_gui/frontend/gui_options.c +++ b/nyx/nyx_gui/frontend/gui_options.c @@ -740,10 +740,20 @@ void first_time_clock_edit(void *param) static lv_res_t _joycon_info_dump_action(lv_obj_t * btn) { FIL fp; + int error; bool is_l_hos = false; bool is_r_hos = false; jc_gamepad_rpt_t *jc_pad = jc_get_bt_pairing_info(&is_l_hos, &is_r_hos); + char *data = (char *)malloc(0x4000); + char *txt_buf = (char *)malloc(0x1000); + + if (!jc_pad) + { + error = 255; + goto disabled; + } + // Count valid joycon. u32 joycon_found = jc_pad->bt_conn_l.type ? 1 : 0; if (jc_pad->bt_conn_r.type) @@ -753,10 +763,7 @@ static lv_res_t _joycon_info_dump_action(lv_obj_t * btn) jc_pad->bt_conn_l.type = is_l_hos ? jc_pad->bt_conn_l.type : 0; jc_pad->bt_conn_r.type = is_r_hos ? jc_pad->bt_conn_r.type : 0; - int error = !sd_mount(); - - char *data = (char *)malloc(0x4000); - char *txt_buf = (char *)malloc(0x1000); + error = !sd_mount(); if (!error) { @@ -798,6 +805,7 @@ static lv_res_t _joycon_info_dump_action(lv_obj_t * btn) sd_unmount(); } +disabled:; lv_obj_t *dark_bg = lv_obj_create(lv_scr_act(), NULL); lv_obj_set_style(dark_bg, &mbox_darken); lv_obj_set_size(dark_bg, LV_HOR_RES, LV_VER_RES); diff --git a/nyx/nyx_gui/nyx.c b/nyx/nyx_gui/nyx.c index 6ea64b7..127d106 100644 --- a/nyx/nyx_gui/nyx.c +++ b/nyx/nyx_gui/nyx.c @@ -270,6 +270,8 @@ void load_saved_configuration() n_cfg.verification = atoi(kv->val); else if (!strcmp("umsemmcrw", kv->key)) n_cfg.ums_emmc_rw = atoi(kv->val) == 1; + else if (!strcmp("jcdisable", kv->key)) + n_cfg.jc_disable = atoi(kv->val) == 1; } break;