Finish SLPH-00051 support

This commit is contained in:
Marc Riera 2023-06-01 21:58:32 +02:00
parent f317be0f15
commit b2daa5d017
2 changed files with 72 additions and 60 deletions

View file

@ -21,9 +21,10 @@ This mod allows you to use your Densha de GO! Plug & Play as a USB controller fo
Connect the Plug & Play to a PC or console using the data cable. Press one of the following button combinations to select the controller you want to emulate:
| Controller | Button combination | Notes |
|-----------------------------------------|-----------------------|--------------------------------------------------|
|-----------------------------------------|--------------------------|--------------------------------------------------|
| One handle controller (Nintendo Switch) | UP | SELECT+START=HOME, SELECT+LEFT=L, SELECT+RIGHT=R |
| Two handle controller (PC) | RIGHT | D-Pad is mapped to SELECT+ABCD |
| Two handle controller (PS1) | DOWN + Power handle at 0 | Hold D to disable handles and enable D-Pad |
| Two handle controller "Type 2" (PS2) | D | |
| Shinkansen controller (PS2) | B | Power notches are mapped to P2-P4-P7-P10-P13 |
| Multi Train Controller (PS2) - P4/B7 | C + Power handle at 0 | SELECT+A=A2, SELECT+D=ATS, SELECT+D-Pad=Reverser |

View file

@ -134,10 +134,13 @@ bitflags! {
}
pub fn update_gadget(state: &mut ControllerState) {
let mut buttons1 = Buttons1::UP | Buttons1::DOWN;
let mut buttons1 = Buttons1::NONE;
let mut buttons2 = Buttons2::NONE;
// If D is pressed, D-pad mode is active
if !state.button_d {
// Calculate data for handles
buttons1.insert(Buttons1::UP | Buttons1::DOWN);
match state.power {
0 => {
buttons1.insert(Buttons1::LEFT | Buttons1::RIGHT);
@ -190,6 +193,14 @@ pub fn update_gadget(state: &mut ControllerState) {
}
_ => ()
}
}
else {
// D-pad mode
if state.button_up { buttons1.insert(Buttons1::UP) }
if state.button_down { buttons1.insert(Buttons1::DOWN) }
if state.button_left { buttons1.insert(Buttons1::LEFT) }
if state.button_right { buttons1.insert(Buttons1::RIGHT) }
}
// Calculate data for buttons
if state.button_a { buttons2.insert(Buttons2::SQUARE) }