mirror of
https://github.com/suchmememanyskill/TegraExplorer.git
synced 2024-11-12 15:06:42 +00:00
controller can be NULL
This commit is contained in:
parent
8709e3aa2e
commit
7862a15e1d
1 changed files with 17 additions and 7 deletions
|
@ -21,6 +21,11 @@ extern hekate_config h_cfg;
|
||||||
Input_t *hidRead(){
|
Input_t *hidRead(){
|
||||||
jc_gamepad_rpt_t *controller = joycon_poll();
|
jc_gamepad_rpt_t *controller = joycon_poll();
|
||||||
|
|
||||||
|
inputs.buttons = 0;
|
||||||
|
u8 left_connected = 0;
|
||||||
|
u8 right_connected = 0;
|
||||||
|
|
||||||
|
if (controller != NULL){
|
||||||
if (controller->home)
|
if (controller->home)
|
||||||
RebootToPayloadOrRcm();
|
RebootToPayloadOrRcm();
|
||||||
|
|
||||||
|
@ -29,12 +34,17 @@ Input_t *hidRead(){
|
||||||
|
|
||||||
inputs.buttons = controller->buttons;
|
inputs.buttons = controller->buttons;
|
||||||
|
|
||||||
|
left_connected = controller->conn_l;
|
||||||
|
right_connected = controller->conn_r;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
u8 btn = btn_read();
|
u8 btn = btn_read();
|
||||||
inputs.volp = (btn & BTN_VOL_UP) ? 1 : 0;
|
inputs.volp = (btn & BTN_VOL_UP) ? 1 : 0;
|
||||||
inputs.volm = (btn & BTN_VOL_DOWN) ? 1 : 0;
|
inputs.volm = (btn & BTN_VOL_DOWN) ? 1 : 0;
|
||||||
inputs.power = (btn & BTN_POWER) ? 1 : 0;
|
inputs.power = (btn & BTN_POWER) ? 1 : 0;
|
||||||
|
|
||||||
if (controller->conn_l){
|
if (left_connected){
|
||||||
if ((LbaseX == 0 || LbaseY == 0) || controller->l3){
|
if ((LbaseX == 0 || LbaseY == 0) || controller->l3){
|
||||||
LbaseX = controller->lstick_x;
|
LbaseX = controller->lstick_x;
|
||||||
LbaseY = controller->lstick_y;
|
LbaseY = controller->lstick_y;
|
||||||
|
@ -50,7 +60,7 @@ Input_t *hidRead(){
|
||||||
inputs.down = inputs.volm;
|
inputs.down = inputs.volm;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (controller->conn_r){
|
if (right_connected){
|
||||||
if ((RbaseX == 0 || RbaseY == 0) || controller->r3){
|
if ((RbaseX == 0 || RbaseY == 0) || controller->r3){
|
||||||
RbaseX = controller->rstick_x;
|
RbaseX = controller->rstick_x;
|
||||||
RbaseY = controller->rstick_y;
|
RbaseY = controller->rstick_y;
|
||||||
|
|
Loading…
Reference in a new issue