Don't always simulate joystick by dpad

This commit is contained in:
Chips 2016-06-18 14:14:30 +00:00
parent 90a5fa1649
commit 2d08053948
2 changed files with 31 additions and 2 deletions

View file

@ -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);

View file

@ -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();