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

@ -20,16 +20,17 @@ 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: 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 | | Controller | Button combination | Notes |
|-----------------------------------------|-----------------------|--------------------------------------------------| |-----------------------------------------|--------------------------|--------------------------------------------------|
| One handle controller (Nintendo Switch) | UP | SELECT+START=HOME, SELECT+LEFT=L, SELECT+RIGHT=R | | 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 (PC) | RIGHT | D-Pad is mapped to SELECT+ABCD |
| Two handle controller "Type 2" (PS2) | D | | | Two handle controller (PS1) | DOWN + Power handle at 0 | Hold D to disable handles and enable D-Pad |
| Shinkansen controller (PS2) | B | Power notches are mapped to P2-P4-P7-P10-P13 | | Two handle controller "Type 2" (PS2) | D | |
| Multi Train Controller (PS2) - P4/B7 | C + Power handle at 0 | SELECT+A=A2, SELECT+D=ATS, SELECT+D-Pad=Reverser | | Shinkansen controller (PS2) | B | Power notches are mapped to P2-P4-P7-P10-P13 |
| Multi Train Controller (PS2) - P4/B2-B6 | C + Power handle at 1 | SELECT+A=A2, SELECT+D=ATS, SELECT+D-Pad=Reverser | | Multi Train Controller (PS2) - P4/B7 | C + Power handle at 0 | SELECT+A=A2, SELECT+D=ATS, SELECT+D-Pad=Reverser |
| Multi Train Controller (PS2) - P5/B5 | C + Power handle at 2 | SELECT+A=A2, SELECT+D=ATS, SELECT+D-Pad=Reverser | | Multi Train Controller (PS2) - P4/B2-B6 | C + Power handle at 1 | SELECT+A=A2, SELECT+D=ATS, SELECT+D-Pad=Reverser |
| Multi Train Controller (PS2) - P5/B7 | C + Power handle at 3 | SELECT+A=A2, SELECT+D=ATS, SELECT+D-Pad=Reverser | | Multi Train Controller (PS2) - P5/B5 | C + Power handle at 2 | SELECT+A=A2, SELECT+D=ATS, SELECT+D-Pad=Reverser |
| Multi Train Controller (PS2) - P5/B7 | C + Power handle at 3 | SELECT+A=A2, SELECT+D=ATS, SELECT+D-Pad=Reverser |
Hold the buttons until the controller vibrates to confirm selection. If no button is pressed, you can play with the Plug & Play as usual. Hold the buttons until the controller vibrates to confirm selection. If no button is pressed, you can play with the Plug & Play as usual.

View file

@ -134,61 +134,72 @@ bitflags! {
} }
pub fn update_gadget(state: &mut ControllerState) { pub fn update_gadget(state: &mut ControllerState) {
let mut buttons1 = Buttons1::UP | Buttons1::DOWN; let mut buttons1 = Buttons1::NONE;
let mut buttons2 = Buttons2::NONE; let mut buttons2 = Buttons2::NONE;
// Calculate data for handles // If D is pressed, D-pad mode is active
match state.power { if !state.button_d {
0 => { // Calculate data for handles
buttons1.insert(Buttons1::LEFT | Buttons1::RIGHT); buttons1.insert(Buttons1::UP | Buttons1::DOWN);
match state.power {
0 => {
buttons1.insert(Buttons1::LEFT | Buttons1::RIGHT);
}
1 => {
buttons1.insert(Buttons1::RIGHT);
buttons2.insert(Buttons2::TRIANGLE);
}
2 => {
buttons1.insert(Buttons1::RIGHT);
}
3 => {
buttons1.insert(Buttons1::LEFT);
buttons2.insert(Buttons2::TRIANGLE);
}
4 => {
buttons1.insert(Buttons1::LEFT);
}
_ => {
buttons2.insert(Buttons2::TRIANGLE);
}
} }
1 => { match state.brake {
buttons1.insert(Buttons1::RIGHT); 0 => {
buttons2.insert(Buttons2::TRIANGLE); buttons2.insert(Buttons2::L2 | Buttons2::R1 | Buttons2::R2);
} }
2 => { 1 => {
buttons1.insert(Buttons1::RIGHT); buttons2.insert(Buttons2::L1 | Buttons2::R1 | Buttons2::R2);
} }
3 => { 2 => {
buttons1.insert(Buttons1::LEFT); buttons2.insert(Buttons2::R1 | Buttons2::R2);
buttons2.insert(Buttons2::TRIANGLE); }
} 3 => {
4 => { buttons2.insert(Buttons2::L1 | Buttons2::L2 | Buttons2::R2);
buttons1.insert(Buttons1::LEFT); }
} 4 => {
_ => { buttons2.insert(Buttons2::L2 | Buttons2::R2);
buttons2.insert(Buttons2::TRIANGLE); }
5 => {
buttons2.insert(Buttons2::L1 | Buttons2::R2);
}
6 => {
buttons2.insert(Buttons2::R2);
}
7 => {
buttons2.insert(Buttons2::L1 | Buttons2::L2 | Buttons2::R1);
}
8 => {
buttons2.insert(Buttons2::L2 | Buttons2::R1);
}
_ => ()
} }
} }
match state.brake { else {
0 => { // D-pad mode
buttons2.insert(Buttons2::L2 | Buttons2::R1 | Buttons2::R2); if state.button_up { buttons1.insert(Buttons1::UP) }
} if state.button_down { buttons1.insert(Buttons1::DOWN) }
1 => { if state.button_left { buttons1.insert(Buttons1::LEFT) }
buttons2.insert(Buttons2::L1 | Buttons2::R1 | Buttons2::R2); if state.button_right { buttons1.insert(Buttons1::RIGHT) }
}
2 => {
buttons2.insert(Buttons2::R1 | Buttons2::R2);
}
3 => {
buttons2.insert(Buttons2::L1 | Buttons2::L2 | Buttons2::R2);
}
4 => {
buttons2.insert(Buttons2::L2 | Buttons2::R2);
}
5 => {
buttons2.insert(Buttons2::L1 | Buttons2::R2);
}
6 => {
buttons2.insert(Buttons2::R2);
}
7 => {
buttons2.insert(Buttons2::L1 | Buttons2::L2 | Buttons2::R1);
}
8 => {
buttons2.insert(Buttons2::L2 | Buttons2::R1);
}
_ => ()
} }
// Calculate data for buttons // Calculate data for buttons