diff options
author | Michael Pavone <pavone@retrodev.com> | 2017-01-03 20:43:35 -0800 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2017-01-03 20:43:35 -0800 |
commit | 5a9c697cd66203fa6160f2dfed02a5dad2351eec (patch) | |
tree | 6125e121b4241683645e006eff88c6249c69c493 | |
parent | c562554ca59360448c10c6e3e9444d35dd464e47 (diff) |
Increment TH counter on low to high transitions rather than high to low transitions for six button controllers. Fixes Charles MacDonald's SMS six button controller demo
-rw-r--r-- | io.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1298,7 +1298,7 @@ void io_data_write(io_port * port, uint8_t value, uint32_t current_cycle) if (current_cycle >= port->device.pad.timeout_cycle) { port->device.pad.th_counter = 0; } - if (!(output & TH)) { + if ((output & TH)) { port->device.pad.th_counter++; } port->device.pad.timeout_cycle = current_cycle + TH_TIMEOUT; @@ -1389,9 +1389,9 @@ uint8_t io_data_read(io_port * port, uint32_t current_cycle) input = port->input[GAMEPAD_TH1]; } } else { - if (port->device.pad.th_counter == 3) { + if (port->device.pad.th_counter == 2) { input = port->input[GAMEPAD_TH0] | 0xF; - } else if(port->device.pad.th_counter == 4) { + } else if(port->device.pad.th_counter == 3) { input = port->input[GAMEPAD_TH0] & 0x30; } else { input = port->input[GAMEPAD_TH0] | 0xC; |