Skip to content

Commit

Permalink
[WIRED] Fix GC triggers in multiplayer
Browse files Browse the repository at this point in the history
  • Loading branch information
darthcloud committed Apr 14, 2024
1 parent 2c4ba90 commit af10aba
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions main/wired/nsi.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2023, Jacques Gagnon
* Copyright (c) 2019-2024, Jacques Gagnon
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down Expand Up @@ -107,8 +107,8 @@ static uint8_t ctrl_acc_mode[4] = {0};
static uint8_t ctrl_acc_update[4] = {0};
static uint8_t ctrl_mem_banksel = 0;
static uint8_t ctrl_init = 0;
static uint32_t gc_l_trig_prev_state = 0;
static uint32_t gc_r_trig_prev_state = 0;
static uint32_t gc_l_trig_prev_state[4] = {0};
static uint32_t gc_r_trig_prev_state[4] = {0};

static inline void load_mouse_axes(uint8_t port, uint8_t *axes) {
uint8_t *relative = (uint8_t *)(wired_adapter.data[port].output + 2);
Expand Down Expand Up @@ -454,10 +454,10 @@ static void gc_pad_cmd_hdlr(uint8_t channel, uint8_t port, uint16_t item) {
}

/* Delay Digital trigger state until analog part is set at least 2 frames */
if (gc_r_trig_prev_state < 2) {
if (gc_r_trig_prev_state[port] < 2) {
buf[5] &= ~0x20;
}
if (gc_l_trig_prev_state < 2) {
if (gc_l_trig_prev_state[port] < 2) {
buf[5] &= ~0x40;
}

Expand Down Expand Up @@ -504,20 +504,20 @@ static void gc_pad_cmd_hdlr(uint8_t channel, uint8_t port, uint16_t item) {
RMT.conf_ch[channel].conf1.tx_start = 1;

if (buf[10] > 0x30) {
if (gc_l_trig_prev_state < 2) {
gc_l_trig_prev_state++;
if (gc_l_trig_prev_state[port] < 2) {
gc_l_trig_prev_state[port]++;
}
}
else {
gc_l_trig_prev_state = 0;
gc_l_trig_prev_state[port] = 0;
}
if (buf[11] > 0x30) {
if (gc_r_trig_prev_state < 2) {
gc_r_trig_prev_state++;
if (gc_r_trig_prev_state[port] < 2) {
gc_r_trig_prev_state[port]++;
}
}
else {
gc_r_trig_prev_state = 0;
gc_r_trig_prev_state[port] = 0;
}

if (config.out_cfg[port].acc_mode == ACC_RUMBLE) {
Expand Down

0 comments on commit af10aba

Please sign in to comment.