nyx: Allow disabling of Joycon
Setting `jcdisable=1` in nyx.ini disables the usage of Joycon completely. This also disables the BT pairing data dumping tool.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user