Merge pull request #5959 from thedax/escapeEditOption

Enable --escape-exit for all relevant (e.g. non-mobile) platforms.
This commit is contained in:
Henrik Rydgård 2014-04-26 08:44:47 +02:00
commit c24886f2d0
4 changed files with 35 additions and 10 deletions

View file

@ -72,8 +72,12 @@ public:
bool bTopMost;
std::string sFont;
bool bIgnoreWindowsKey;
bool bEscapeExitsEmulator;
#endif
#if !defined(MOBILE_DEVICE)
bool bPauseExitsEmulator;
#endif
// Core
bool bIgnoreBadMemAccess;
bool bFastMemory;

View file

@ -28,6 +28,11 @@
// in NativeShutdown.
#include <locale.h>
// Linux doesn't like using std::find with std::vector<int> without this :/
#if !defined(MOBILE_DEVICE)
#include <algorithm>
#endif
#ifdef _WIN32
#include <libpng16/png.h>
#include "ext/jpge/jpge.h"
@ -79,6 +84,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;
@ -320,6 +329,10 @@ void NativeInit(int argc, const char *argv[],
fileToLog = argv[i] + strlen("--log=");
if (!strncmp(argv[i], "--state=", strlen("--state=")) && strlen(argv[i]) > strlen("--state="))
stateToLoad = argv[i] + strlen("--state=");
#if !defined(MOBILE_DEVICE)
if (!strncmp(argv[i], "--escape-exit", strlen("--escape-exit")))
g_Config.bPauseExitsEmulator = true;
#endif
break;
}
} else {
@ -684,6 +697,18 @@ 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.bPauseExitsEmulator) {
static std::vector<int> 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);
if (screenManager)
screenManager->key(key);

View file

@ -118,11 +118,6 @@ namespace WindowsRawInput {
return;
}
if (g_Config.bEscapeExitsEmulator && raw->data.keyboard.VKey == VK_ESCAPE) {
PostMessage(MainWindow::GetHWND(), WM_CLOSE, 0, 0);
return;
}
KeyInput key;
key.deviceId = DEVICE_ID_KEYBOARD;

View file

@ -168,7 +168,11 @@ std::string System_GetProperty(SystemProperty prop) {
}
}
void System_SendMessage(const char *command, const char *parameter) {}
void System_SendMessage(const char *command, const char *parameter) {
if (!strcmp(command, "finish")) {
PostMessage(MainWindow::GetHWND(), WM_CLOSE, 0, 0);
}
}
void EnableCrashingOnCrashes()
{
@ -340,9 +344,6 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
if (!strncmp(__argv[i], "--windowed", strlen("--windowed")))
g_Config.bFullScreen = false;
if (!strncmp(__argv[i], "--escapeexitsemu", strlen("--escapeexitsemu")))
g_Config.bEscapeExitsEmulator = true;
}
}
#ifdef _DEBUG