From 08f812518f1665c61064ac5c9d8bb54da766dacc Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 25 Jan 2014 11:34:18 -0800 Subject: [PATCH] Switch game browser tabs using L/R buttons. Even with keyboard / custom controller mapping. --- Common/KeyMap.cpp | 19 ++++++++++++------- native | 2 +- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Common/KeyMap.cpp b/Common/KeyMap.cpp index 2bb451428a..f8b13a89c4 100644 --- a/Common/KeyMap.cpp +++ b/Common/KeyMap.cpp @@ -277,19 +277,23 @@ static const DefMappingStruct defaultXperiaPlay[] = { {VIRTKEY_AXIS_Y_MAX, JOYSTICK_AXIS_Y, +1}, }; +static void KeyCodesFromPspButton(int btn, std::vector *keycodes) { + for (auto i = g_controllerMap[btn].begin(), end = g_controllerMap[btn].end(); i != end; ++i) { + keycodes->push_back((keycode_t)i->keyCode); + } +} + void UpdateConfirmCancelKeys() { std::vector confirmKeys, cancelKeys; + std::vector tabLeft, tabRight; int confirmKey = g_Config.iButtonPreference == PSP_SYSTEMPARAM_BUTTON_CROSS ? CTRL_CROSS : CTRL_CIRCLE; int cancelKey = g_Config.iButtonPreference == PSP_SYSTEMPARAM_BUTTON_CROSS ? CTRL_CIRCLE : CTRL_CROSS; - for (auto i = g_controllerMap[confirmKey].begin(); i != g_controllerMap[confirmKey].end(); ++i) { - confirmKeys.push_back((keycode_t)i->keyCode); - } - - for (auto i = g_controllerMap[cancelKey].begin(); i != g_controllerMap[cancelKey].end(); ++i) { - cancelKeys.push_back((keycode_t)i->keyCode); - } + KeyCodesFromPspButton(confirmKey, &confirmKeys); + KeyCodesFromPspButton(cancelKey, &cancelKeys); + KeyCodesFromPspButton(CTRL_LTRIGGER, &tabLeft); + KeyCodesFromPspButton(CTRL_RTRIGGER, &tabRight); // Push several hard-coded keys before submitting to native. const keycode_t hardcodedConfirmKeys[] = { @@ -314,6 +318,7 @@ void UpdateConfirmCancelKeys() { } SetConfirmCancelKeys(confirmKeys, cancelKeys); + SetTabLeftRightKeys(tabLeft, tabRight); } static void SetDefaultKeyMap(int deviceId, const DefMappingStruct *array, size_t count, bool replace) { diff --git a/native b/native index 08157613d5..1c87fb7485 160000 --- a/native +++ b/native @@ -1 +1 @@ -Subproject commit 08157613d5b394be62bc5e094167486f4d45859c +Subproject commit 1c87fb74850cfe406e37bf796aba96e0186c2d90