+static u32 read_nothing(int i, u32 out_bits)\r
+{\r
+ return 0xff;\r
+}\r
+\r
+typedef u32 (port_read_func)(int index, u32 out_bits);\r
+\r
+static port_read_func *port_readers[3] = {\r
+ read_pad_3btn,\r
+ read_pad_3btn,\r
+ read_nothing\r
+};\r
+\r
+static NOINLINE u32 port_read(int i)\r
+{\r
+ u32 data_reg = PicoMem.ioports[i + 1];\r
+ u32 ctrl_reg = PicoMem.ioports[i + 4] | 0x80;\r
+ u32 in, out;\r
+\r
+ out = data_reg & ctrl_reg;\r
+\r
+ // pull-ups: should be 0x7f, but Decap Attack has a bug where it temp.\r
+ // disables output before doing TH-low read, so don't emulate it for TH.\r
+ // Decap Attack reportedly doesn't work on Nomad but works on must\r
+ // other MD revisions (different pull-up strength?).\r
+ out |= 0x3f & ~ctrl_reg;\r