From 731a27dd58bcd56bf4b01e42ce9cd4a032b931e6 Mon Sep 17 00:00:00 2001 From: The Dax Date: Sat, 26 Apr 2014 01:54:32 -0400 Subject: [PATCH] Instead of using escape only, allow anything mapped to "Pause" to exit as well. --- Core/Config.h | 2 +- UI/NativeApp.cpp | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Core/Config.h b/Core/Config.h index a25331cdda..00432e2ee1 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -75,7 +75,7 @@ public: #endif #if !defined(MOBILE_DEVICE) - bool bEscapeExitsEmulator; + bool bPauseExitsEmulator; #endif // Core diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 98a6490164..ee2ccf3d6a 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -79,6 +79,10 @@ #include "UI/MiscScreens.h" #include "UI/TiltEventProcessor.h" +#if !defined(MOBILE_DEVICE) +#include "Common/KeyMap.h" +#endif + // The new UI framework, for initialization static UI::Theme ui_theme; @@ -322,7 +326,7 @@ void NativeInit(int argc, const char *argv[], stateToLoad = argv[i] + strlen("--state="); #if !defined(MOBILE_DEVICE) if (!strncmp(argv[i], "--escape-exit", strlen("--escape-exit"))) - g_Config.bEscapeExitsEmulator = true; + g_Config.bPauseExitsEmulator = true; #endif break; } @@ -689,8 +693,15 @@ void NativeTouch(const TouchInput &touch) { void NativeKey(const KeyInput &key) { // ILOG("Key code: %i flags: %i", key.keyCode, key.flags); #if !defined(MOBILE_DEVICE) - if (g_Config.bEscapeExitsEmulator && key.keyCode == NKCODE_ESCAPE) { - System_SendMessage("finish", ""); + if (g_Config.bPauseExitsEmulator) { + static std::vector pspKeys; + pspKeys.clear(); + if (KeyMap::KeyToPspButton(key.deviceId, key.keyCode, &pspKeys)) { + if (std::find(pspKeys.begin(), pspKeys.end(), VIRTKEY_PAUSE) != pspKeys.end()) { + System_SendMessage("finish", ""); + return; + } + } } #endif g_buttonTracker.Process(key);