mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-04-22 04:24:44 +00:00
support back button to touchpad for spacebar as well
This commit is contained in:
parent
f0de2e83bc
commit
1da4d769a2
2 changed files with 12 additions and 2 deletions
|
@ -102,7 +102,7 @@ PAD DOWN | DOWN |
|
|||
PAD LEFT | LEFT |
|
||||
PAD RIGHT | RIGHT |
|
||||
OPTIONS | RETURN |
|
||||
TOUCH PAD | SPACE |
|
||||
BACK BUTTON / TOUCH PAD | SPACE |
|
||||
L1 | Q |
|
||||
R1 | U |
|
||||
L2 | E |
|
||||
|
|
|
@ -145,6 +145,7 @@ void WindowSDL::onKeyPress(const SDL_Event* event) {
|
|||
Input::Axis axis = Input::Axis::AxisMax;
|
||||
int axisvalue = 0;
|
||||
int ax = 0;
|
||||
std::string backButtonBehavior = Config::getBackButtonBehavior();
|
||||
switch (event->key.key) {
|
||||
case SDLK_UP:
|
||||
button = OrbisPadButtonDataOffset::ORBIS_PAD_BUTTON_UP;
|
||||
|
@ -278,7 +279,16 @@ void WindowSDL::onKeyPress(const SDL_Event* event) {
|
|||
ax = Input::GetAxis(0, 0x80, axisvalue);
|
||||
break;
|
||||
case SDLK_SPACE:
|
||||
button = OrbisPadButtonDataOffset::ORBIS_PAD_BUTTON_TOUCH_PAD;
|
||||
if (backButtonBehavior != "none") {
|
||||
float x = backButtonBehavior == "left"
|
||||
? 0.25f
|
||||
: (backButtonBehavior == "right" ? 0.75f : 0.5f);
|
||||
// trigger a touchpad event so that the touchpad emulation for back button works
|
||||
controller->SetTouchpadState(0, true, x, 0.5f);
|
||||
button = OrbisPadButtonDataOffset::ORBIS_PAD_BUTTON_TOUCH_PAD;
|
||||
} else {
|
||||
button = 0;
|
||||
}
|
||||
break;
|
||||
case SDLK_F11:
|
||||
if (event->type == SDL_EVENT_KEY_DOWN) {
|
||||
|
|
Loading…
Add table
Reference in a new issue