Skip to content

Commit

Permalink
[WIRED] Fix N64 accessories init state
Browse files Browse the repository at this point in the history
  • Loading branch information
darthcloud committed Dec 7, 2023
1 parent 465849a commit 841d0dd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion main/wired/nsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ static uint8_t rumble_state[4] = {0};
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;

Expand Down Expand Up @@ -581,7 +582,15 @@ static unsigned n64_isr(unsigned cause) {
item = nsi_items_to_bytes(channel * RMT_MEM_ITEM_NUM, buf, 1);

/* Check if need to flag a pak change */
if (config.global_cfg.banksel != ctrl_mem_banksel) {
if (ctrl_init == 0) {
ctrl_mem_banksel = config.global_cfg.banksel;
ctrl_acc_mode[0] = config.out_cfg[0].acc_mode;
ctrl_acc_mode[1] = config.out_cfg[1].acc_mode;
ctrl_acc_mode[2] = config.out_cfg[2].acc_mode;
ctrl_acc_mode[3] = config.out_cfg[3].acc_mode;
ctrl_init = 1;
}
else if (config.global_cfg.banksel != ctrl_mem_banksel) {
*(uint32_t *)ctrl_acc_update = 0x20202020;
ctrl_mem_banksel = config.global_cfg.banksel;
}
Expand Down

0 comments on commit 841d0dd

Please sign in to comment.