Fix gamepad hotkey and game profile setting (#510)

This commit is contained in:
goeiecool9999 2022-11-24 12:29:29 +01:00 committed by GitHub
parent c43fc81f8e
commit cbdf381b31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 79 additions and 64 deletions

View file

@ -4,6 +4,7 @@
#if BOOST_OS_LINUX
#include "xcb/xproto.h"
#include <gdk/gdkkeysyms.h>
#endif
struct WindowHandleInfo
@ -25,6 +26,23 @@ struct WindowHandleInfo
#endif
};
enum struct PlatformKeyCodes : uint32
{
#if BOOST_OS_WINDOWS
LCONTROL = VK_LCONTROL,
RCONTROL = VK_RCONTROL,
TAB = VK_TAB,
#elif BOOST_OS_LINUX
LCONTROL = GDK_KEY_Control_L,
RCONTROL = GDK_KEY_Control_R,
TAB = GDK_KEY_Tab,
#else
LCONTROL = 0,
RCONTROL = 0,
TAB = 0,
#endif
};
struct WindowInfo
{
std::atomic_bool app_active; // our app is active/has focus
@ -56,7 +74,7 @@ struct WindowInfo
return result->second;
}
void set_keystatesdown()
void set_keystatesup()
{
const std::lock_guard<std::mutex> lock(keycode_mutex);
std::for_each(m_keydown.begin(), m_keydown.end(), [](std::pair<const uint32, bool>& el){ el.second = false; });
@ -89,7 +107,8 @@ void gui_updateWindowTitles(bool isIdle, bool isLoading, double fps);
void gui_getWindowSize(int* w, int* h);
void gui_getPadWindowSize(int* w, int* h);
bool gui_isPadWindowOpen();
bool gui_isKeyDown(int key);
bool gui_isKeyDown(uint32 key);
bool gui_isKeyDown(PlatformKeyCodes key);
void gui_notifyGameLoaded();
void gui_notifyGameExited();
@ -114,4 +133,4 @@ void debuggerWindow_notifyDebugBreakpointHit2();
void debuggerWindow_notifyRun();
void debuggerWindow_moveIP();
void debuggerWindow_notifyModuleLoaded(void* module);
void debuggerWindow_notifyModuleUnloaded(void* module);
void debuggerWindow_notifyModuleUnloaded(void* module);