From af10aba8a6d12a620dc468fda25e7098bad90d12 Mon Sep 17 00:00:00 2001 From: Jacques Gagnon Date: Sun, 14 Apr 2024 14:32:18 -0400 Subject: [PATCH] [WIRED] Fix GC triggers in multiplayer --- main/wired/nsi.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/main/wired/nsi.c b/main/wired/nsi.c index f1724c35..8c1bcceb 100644 --- a/main/wired/nsi.c +++ b/main/wired/nsi.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2023, Jacques Gagnon + * Copyright (c) 2019-2024, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -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); @@ -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; } @@ -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) {