diff --git a/README.md b/README.md index 385e090..c3f0a46 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/src/controller/emulated/slph00051.rs b/src/controller/emulated/slph00051.rs index 9ed0a8c..aedda6f 100644 --- a/src/controller/emulated/slph00051.rs +++ b/src/controller/emulated/slph00051.rs @@ -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