mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
core, linux+libretro, multiplayer adaptor support
This commit is contained in:
parent
a833e78c98
commit
1d5885dd84
9 changed files with 104 additions and 49 deletions
|
@ -262,43 +262,29 @@ static u32 read_pad_team(int i, u32 out_bits)
|
|||
int phase = Pico.m.padTHPhase[i];
|
||||
u32 value;
|
||||
|
||||
if (phase == 0) {
|
||||
switch (phase) {
|
||||
case 0:
|
||||
value = 0x03;
|
||||
goto out;
|
||||
}
|
||||
if (phase == 1) {
|
||||
break;
|
||||
case 1:
|
||||
value = 0x0f;
|
||||
goto out;
|
||||
}
|
||||
|
||||
pad = ~PicoIn.padInt[0]; // Get inverse of pad MXYZ SACB RLDU
|
||||
if (phase == 8) {
|
||||
break;
|
||||
case 4: case 5: case 6: case 7: // controller IDs, all 3 btn for now
|
||||
value = 0x00;
|
||||
break;
|
||||
case 8: case 10: case 12: case 14:
|
||||
pad = ~PicoIn.padInt[(phase-8) >> 1];
|
||||
value = pad & 0x0f; // ?x?x RLDU
|
||||
goto out;
|
||||
}
|
||||
else if(phase == 9) {
|
||||
break;
|
||||
case 9: case 11: case 13: case 15:
|
||||
pad = ~PicoIn.padInt[(phase-8) >> 1];
|
||||
value = (pad & 0xf0) >> 4; // ?x?x SACB
|
||||
goto out;
|
||||
break;
|
||||
default:
|
||||
value = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
pad = ~PicoIn.padInt[1]; // Get inverse of pad MXYZ SACB RLDU
|
||||
if (phase == 12) {
|
||||
value = pad & 0x0f; // ?x?x RLDU
|
||||
goto out;
|
||||
}
|
||||
else if(phase == 13) {
|
||||
value = (pad & 0xf0) >> 4; // ?x?x SACB
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (phase >= 8 && pad < 16) {
|
||||
value = 0x0f;
|
||||
goto out;
|
||||
}
|
||||
|
||||
value = 0;
|
||||
|
||||
out:
|
||||
value |= (out_bits & 0x40) | ((out_bits & 0x20)>>1);
|
||||
return value;
|
||||
}
|
||||
|
@ -308,8 +294,8 @@ static u32 read_pad_4way(int i, u32 out_bits)
|
|||
u32 pad = (PicoMem.ioports[2] & 0x70) >> 4;
|
||||
u32 value = 0;
|
||||
|
||||
if (i == 0 && !(pad & 1))
|
||||
value = read_pad_3btn(pad >> 1, out_bits);
|
||||
if (i == 0 && pad <= 3)
|
||||
value = read_pad_3btn(pad, out_bits);
|
||||
|
||||
value |= (out_bits & 0x40);
|
||||
return value;
|
||||
|
@ -357,7 +343,10 @@ void PicoSetInputDevice(int port, enum input_device device)
|
|||
if (port < 0 || port > 2)
|
||||
return;
|
||||
|
||||
switch (device) {
|
||||
if (port == 1 && port_readers[0] == read_pad_team)
|
||||
func = read_nothing;
|
||||
|
||||
else switch (device) {
|
||||
case PICO_INPUT_PAD_3BTN:
|
||||
func = read_pad_3btn;
|
||||
break;
|
||||
|
@ -409,7 +398,7 @@ NOINLINE void io_ports_write(u32 a, u32 d)
|
|||
Pico.m.padTHPhase[a - 1] = 0;
|
||||
else if ((d^PicoMem.ioports[a]) & 0x60)
|
||||
Pico.m.padTHPhase[a - 1]++;
|
||||
} else if (port_readers[a - 1] == read_pad_4way) {
|
||||
} else if (port_readers[0] == read_pad_4way) {
|
||||
if (a == 2 && ((PicoMem.ioports[a] ^ d) & 0x70))
|
||||
Pico.m.padTHPhase[0] = 0;
|
||||
if (a == 1 && !(PicoMem.ioports[a] & 0x40) && (d & 0x40))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue