From 2d080539481a359d05f10b0ea1521681cf3a3583 Mon Sep 17 00:00:00 2001 From: Chips Date: Sat, 18 Jun 2016 14:14:30 +0000 Subject: [PATCH] Don't always simulate joystick by dpad --- src/od-pandora/gui/PanelInput.cpp | 6 ++++-- src/od-pandora/pandora_gui.cpp | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/od-pandora/gui/PanelInput.cpp b/src/od-pandora/gui/PanelInput.cpp index 4706a7f4..cfeeb83c 100644 --- a/src/od-pandora/gui/PanelInput.cpp +++ b/src/od-pandora/gui/PanelInput.cpp @@ -103,8 +103,10 @@ StringListModel autofireList(autofireValues, 3); #ifndef RASPBERRY const char *tapDelayValues[] = { "Normal", "Short", "None" }; StringListModel tapDelayList(tapDelayValues, 3); -#endif const char *dPADValues[] = { "Joystick", "Mouse", "Custom" }; +#else +const char *dPADValues[] = { "Joystick", "Keyboard", "Custom" }; +#endif StringListModel dPADList(dPADValues, 3); const char *mappingValues[] = { @@ -270,7 +272,7 @@ void InitPanelInput(const struct _ConfigCategory& category) chkCustomCtrl->setId("CustomCtrl"); chkCustomCtrl->addActionListener(inputActionListener); - lblDPAD = new gcn::Label("DPAD:"); + lblDPAD = new gcn::Label("Keyb DPAD:"); lblDPAD->setSize(100, LABEL_HEIGHT); lblDPAD->setAlignment(gcn::Graphics::RIGHT); cboDPAD = new gcn::UaeDropDown(&dPADList); diff --git a/src/od-pandora/pandora_gui.cpp b/src/od-pandora/pandora_gui.cpp index 28ab2b59..66253f85 100644 --- a/src/od-pandora/pandora_gui.cpp +++ b/src/od-pandora/pandora_gui.cpp @@ -560,6 +560,32 @@ void gui_handle_events (void) Uint8 *keystate = SDL_GetKeyState(NULL); +#if 1 + buttonA = JoystickButton[0]; + buttonB = JoystickButton[1]; + buttonX = JoystickButton[2]; + buttonY = JoystickButton[3]; + triggerL = JoystickButton[4]; + triggerR = JoystickButton[5]; + dpadUp = JoystickButton[6]; + dpadDown = JoystickButton[7]; + dpadLeft = JoystickButton[8]; + dpadRight= JoystickButton[9]; + + if (currprefs.pandora_custom_dpad != 1) + { + dpadUp |= keystate[SDLK_UP]; + dpadDown |= keystate[SDLK_DOWN]; + dpadLeft |= keystate[SDLK_LEFT]; + dpadRight|= keystate[SDLK_RIGHT]; + buttonA |= keystate[SDLK_HOME]; + buttonB |= keystate[SDLK_END]; + buttonX |= keystate[SDLK_PAGEDOWN]; + buttonY |= keystate[SDLK_PAGEUP]; + triggerL |= keystate[SDLK_RSHIFT]; + triggerR |= keystate[SDLK_RCTRL]; + } +#else if(keystate[SDLK_HOME] || JoystickButton[0]) //Updated with Joystick input buttonA = 1; else buttonA = 0; if(keystate[SDLK_END] || JoystickButton[1]) @@ -580,6 +606,7 @@ void gui_handle_events (void) dpadLeft = 1; else dpadLeft = 0; if(keystate[SDLK_RIGHT] || JoystickButton[9]) dpadRight = 1; else dpadRight = 0; +#endif if(keystate[SDLK_F12]) goMenu();