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);