# HG changeset patch # User Michael Pavone # Date 1483505015 28800 # Node ID be3df2d8530ae07f57c203ab54e54936811e10b2 # Parent d4d770cfbc62812673a8315b4c37a8f87757cc8f 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 diff -r d4d770cfbc62 -r be3df2d8530a io.c --- a/io.c Tue Jan 03 20:42:15 2017 -0800 +++ b/io.c Tue Jan 03 20:43:35 2017 -0800 @@ -1298,7 +1298,7 @@ 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 @@ 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;