Set DPad keys in native for UI navigation

Complements the update to the key repeat logic in native.  Also renames
UpdateConfirmCancelKeys to UpdateNativeMenuKeys since even before this commit,
the function also set the TabLeft and TabRight keys.
This commit is contained in:
Jonas Höglund 2015-08-28 20:55:32 +02:00 committed by Henrik Rydgård
parent 5bb2f20493
commit 06fadd5cad
3 changed files with 12 additions and 6 deletions

View File

@ -294,9 +294,10 @@ static void KeyCodesFromPspButton(int btn, std::vector<keycode_t> *keycodes) {
}
}
void UpdateConfirmCancelKeys() {
void UpdateNativeMenuKeys() {
std::vector<KeyDef> confirmKeys, cancelKeys;
std::vector<KeyDef> tabLeft, tabRight;
std::vector<KeyDef> upKeys, downKeys, leftKeys, rightKeys;
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;
@ -305,6 +306,10 @@ void UpdateConfirmCancelKeys() {
KeyFromPspButton(cancelKey, &cancelKeys);
KeyFromPspButton(CTRL_LTRIGGER, &tabLeft);
KeyFromPspButton(CTRL_RTRIGGER, &tabRight);
KeyFromPspButton(CTRL_UP, &upKeys);
KeyFromPspButton(CTRL_DOWN, &downKeys);
KeyFromPspButton(CTRL_LEFT, &leftKeys);
KeyFromPspButton(CTRL_RIGHT, &rightKeys);
// Push several hard-coded keys before submitting to native.
const KeyDef hardcodedConfirmKeys[] = {
@ -328,6 +333,7 @@ void UpdateConfirmCancelKeys() {
cancelKeys.push_back(hardcodedCancelKeys[i]);
}
SetDPadKeys(upKeys, downKeys, leftKeys, rightKeys);
SetConfirmCancelKeys(confirmKeys, cancelKeys);
SetTabLeftRightKeys(tabLeft, tabRight);
}
@ -402,7 +408,7 @@ void SetDefaultKeyMap(DefaultMaps dmap, bool replace) {
break;
}
UpdateConfirmCancelKeys();
UpdateNativeMenuKeys();
}
const KeyMap_IntStrPair key_names[] = {
@ -830,7 +836,7 @@ void SetKeyMapping(int btn, KeyDef key, bool replace) {
g_controllerMap[btn].push_back(key);
}
UpdateConfirmCancelKeys();
UpdateNativeMenuKeys();
}
void SetAxisMapping(int btn, int deviceId, int axisId, int direction, bool replace) {
@ -900,7 +906,7 @@ void LoadFromIni(IniFile &file) {
}
}
UpdateConfirmCancelKeys();
UpdateNativeMenuKeys();
}
void SaveToIni(IniFile &file) {

View File

@ -126,7 +126,7 @@ namespace KeyMap {
void RestoreDefault();
void SwapAxis();
void UpdateConfirmCancelKeys();
void UpdateNativeMenuKeys();
void NotifyPadConnected(const std::string &name);
bool IsNvidiaShield(const std::string &name);

View File

@ -837,7 +837,7 @@ void GameSettingsScreen::onFinish(DialogResult result) {
host->UpdateUI();
KeyMap::UpdateConfirmCancelKeys();
KeyMap::UpdateNativeMenuKeys();
}
/*