diff --git a/Core/HLE/Plugins.cpp b/Core/HLE/Plugins.cpp index 202fdda331..044d926b05 100644 --- a/Core/HLE/Plugins.cpp +++ b/Core/HLE/Plugins.cpp @@ -29,6 +29,7 @@ #include "Core/HLE/sceKernelModule.h" namespace HLEPlugins { + float PluginDataAxis[JOYSTICK_AXIS_MAX]; std::map PluginDataKeys; @@ -214,4 +215,10 @@ bool HasEnabled() { return anyEnabled; } -}; +void SetKey(int key, uint8_t value) { + if (anyEnabled) { + PluginDataKeys[key] = value; + } +} + +} // namespace diff --git a/Core/HLE/Plugins.h b/Core/HLE/Plugins.h index 7503d01cb0..bef0494536 100644 --- a/Core/HLE/Plugins.h +++ b/Core/HLE/Plugins.h @@ -17,6 +17,7 @@ #pragma once +#include #include "Input/KeyCodes.h" class PointerWrap; @@ -33,6 +34,9 @@ void DoState(PointerWrap &p); bool HasEnabled(); +void SetKey(int key, uint8_t value); + extern float PluginDataAxis[JOYSTICK_AXIS_MAX]; extern std::map PluginDataKeys; -}; + +} // namespace diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index e1f858c2c3..1985583e5d 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -1257,7 +1257,7 @@ bool NativeKey(const KeyInput &key) { // INFO_LOG(SYSTEM, "Key code: %i flags: %i", key.keyCode, key.flags); #if !defined(MOBILE_DEVICE) if (g_Config.bPauseExitsEmulator) { - static std::vector pspKeys; + std::vector pspKeys; pspKeys.clear(); if (KeyMap::InputMappingToPspButton(InputMapping(key.deviceId, key.keyCode), &pspKeys)) { if (std::find(pspKeys.begin(), pspKeys.end(), VIRTKEY_PAUSE) != pspKeys.end()) { @@ -1267,10 +1267,10 @@ bool NativeKey(const KeyInput &key) { } } #endif + bool retval = false; - if (g_screenManager) - { - HLEPlugins::PluginDataKeys[key.keyCode] = (key.flags & KEY_DOWN) ? 1 : 0; + if (g_screenManager) { + HLEPlugins::SetKey(key.keyCode, (key.flags & KEY_DOWN) ? 1 : 0); retval = g_screenManager->key(key); }