return value;\r
}\r
\r
+static u32 read_pad_team(int i, u32 out_bits)\r
+{\r
+ u32 pad;\r
+ int phase = Pico.m.padTHPhase[i];\r
+ u32 value;\r
+\r
+ if (phase == 0) {\r
+ value = 0x03;\r
+ goto out;\r
+ }\r
+ if (phase == 1) {\r
+ value = 0x0f;\r
+ goto out;\r
+ }\r
+\r
+ pad = ~PicoIn.padInt[0]; // Get inverse of pad MXYZ SACB RLDU\r
+ if (phase == 8) {\r
+ value = pad & 0x0f; // ?x?x RLDU\r
+ goto out;\r
+ }\r
+ else if(phase == 9) {\r
+ value = (pad & 0xf0) >> 4; // ?x?x SACB\r
+ goto out;\r
+ }\r
+\r
+ pad = ~PicoIn.padInt[1]; // Get inverse of pad MXYZ SACB RLDU\r
+ if (phase == 12) {\r
+ value = pad & 0x0f; // ?x?x RLDU\r
+ goto out;\r
+ }\r
+ else if(phase == 13) {\r
+ value = (pad & 0xf0) >> 4; // ?x?x SACB\r
+ goto out;\r
+ }\r
+\r
+ if (phase >= 8 && pad < 16) {\r
+ value = 0x0f;\r
+ goto out;\r
+ }\r
+\r
+ value = 0;\r
+\r
+out:\r
+ value |= (out_bits & 0x40) | ((out_bits & 0x20)>>1);\r
+ return value;\r
+}\r
+\r
+static u32 read_pad_4way(int i, u32 out_bits)\r
+{\r
+ u32 pad = (PicoMem.ioports[2] & 0x70) >> 4;\r
+ u32 value = 0;\r
+\r
+ if (i == 0 && !(pad & 1))\r
+ value = read_pad_3btn(pad >> 1, out_bits);\r
+\r
+ value |= (out_bits & 0x40);\r
+ return value;\r
+}\r
+\r
static u32 read_nothing(int i, u32 out_bits)\r
{\r
return 0xff;\r
func = read_pad_6btn;\r
break;\r
\r
+ case PICO_INPUT_PAD_TEAM:\r
+ func = read_pad_team;\r
+ break;\r
+\r
+ case PICO_INPUT_PAD_4WAY:\r
+ func = read_pad_4way;\r
+ break;\r
+\r
default:\r
func = read_nothing;\r
break;\r
if (1 <= a && a <= 2)\r
{\r
Pico.m.padDelay[a - 1] = 0;\r
- if (!(PicoMem.ioports[a] & 0x40) && (d & 0x40))\r
+ if (port_readers[a - 1] == read_pad_team) {\r
+ if (d & 0x40)\r
+ Pico.m.padTHPhase[a - 1] = 0;\r
+ else if ((d^PicoMem.ioports[a]) & 0x60)\r
+ Pico.m.padTHPhase[a - 1]++;\r
+ } else if (port_readers[a - 1] == read_pad_4way) {\r
+ if (a == 2 && ((PicoMem.ioports[a] ^ d) & 0x70))\r
+ Pico.m.padTHPhase[0] = 0;\r
+ if (a == 1 && !(PicoMem.ioports[a] & 0x40) && (d & 0x40))\r
+ Pico.m.padTHPhase[0]++;\r
+ } else if (!(PicoMem.ioports[a] & 0x40) && (d & 0x40))\r
Pico.m.padTHPhase[a - 1]++;\r
}\r
\r