mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
If it's a TV and VIRTKEY_PAUSE is not mapped to a pad control, pause on app switch.
This commit is contained in:
parent
81b4c3b376
commit
aa3daca293
3 changed files with 20 additions and 3 deletions
|
@ -905,6 +905,17 @@ void RemoveButtonMapping(int btn) {
|
|||
}
|
||||
}
|
||||
|
||||
bool IsKeyMapped(int device, int key) {
|
||||
for (auto &iter : g_controllerMap) {
|
||||
for (auto &mappedKey : iter.second) {
|
||||
if (mappedKey == KeyDef(device, key)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void SetKeyMapping(int btn, KeyDef key, bool replace) {
|
||||
if (key.keyCode < 0)
|
||||
return;
|
||||
|
|
|
@ -163,4 +163,6 @@ namespace KeyMap {
|
|||
|
||||
const std::set<std::string> &GetSeenPads();
|
||||
void AutoConfForPad(const std::string &name);
|
||||
|
||||
bool IsKeyMapped(int device, int key);
|
||||
}
|
||||
|
|
|
@ -506,10 +506,14 @@ void EmuScreen::sendMessage(const char *message, const char *value) {
|
|||
}
|
||||
#endif
|
||||
} else if (!strcmp(message, "app_resumed") && screenManager()->topScreen() == this) {
|
||||
// If there's no back button mapped, use this as the way to get into the menu.
|
||||
if (System_GetPropertyInt(SYSPROP_DEVICE_TYPE) == DEVICE_TYPE_TV) {
|
||||
if (!KeyMap::IsKeyMapped(DEVICE_ID_PAD_0, VIRTKEY_PAUSE) || !KeyMap::IsKeyMapped(DEVICE_ID_PAD_1, VIRTKEY_PAUSE)) {
|
||||
// If it's a TV (so no built-in back button), and there's no back button mapped to a pad,
|
||||
// use this as the fallback way to get into the menu.
|
||||
|
||||
// TODO: Check mappings.
|
||||
screenManager()->push(new GamePauseScreen(gamePath_));
|
||||
screenManager()->push(new GamePauseScreen(gamePath_));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue