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
README.md
src/controller/emulated

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:
| 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 "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 |
| 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/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 |
| 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 |
| 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/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.

View file

@ -134,61 +134,72 @@ 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;
// Calculate data for handles
match state.power {
0 => {
buttons1.insert(Buttons1::LEFT | Buttons1::RIGHT);
// 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);
}
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 => {
buttons1.insert(Buttons1::RIGHT);
buttons2.insert(Buttons2::TRIANGLE);
match state.brake {
0 => {
buttons2.insert(Buttons2::L2 | Buttons2::R1 | Buttons2::R2);
}
1 => {
buttons2.insert(Buttons2::L1 | Buttons2::R1 | Buttons2::R2);
}
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);
}
_ => ()
}
2 => {
buttons1.insert(Buttons1::RIGHT);
}
3 => {
buttons1.insert(Buttons1::LEFT);
buttons2.insert(Buttons2::TRIANGLE);
}
4 => {
buttons1.insert(Buttons1::LEFT);
}
_ => {
buttons2.insert(Buttons2::TRIANGLE);
}
}
match state.brake {
0 => {
buttons2.insert(Buttons2::L2 | Buttons2::R1 | Buttons2::R2);
}
1 => {
buttons2.insert(Buttons2::L1 | Buttons2::R1 | Buttons2::R2);
}
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);
}
_ => ()
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