aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArisotura <thetotalworm@gmail.com>2019-01-24 21:28:58 +0100
committerArisotura <thetotalworm@gmail.com>2019-01-24 21:28:58 +0100
commit86b894ca71199922d5c37f85b1b99e12dd04e766 (patch)
tree22b4111266f97ef75bf53de73af390cf53aa5747
parent4bd96207fe8ba24a7c6296f64807e594d742ec0f (diff)
change LidCommand to HotkeyMask so we can use it for other hotkeys without needing a billion variables
-rw-r--r--src/libui_sdl/main.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp
index dbd8a7e..cd8e033 100644
--- a/src/libui_sdl/main.cpp
+++ b/src/libui_sdl/main.cpp
@@ -112,7 +112,8 @@ uiDrawMatrix BottomScreenTrans;
bool Touching = false;
u32 KeyInputMask;
-bool LidCommand, LidStatus;
+u32 HotkeyMask;
+bool LidStatus;
SDL_Joystick* Joystick;
SDL_AudioDeviceID AudioDevice, MicDevice;
@@ -417,7 +418,7 @@ int EmuThreadFunc(void* burp)
ScreenDrawInited = false;
Touching = false;
KeyInputMask = 0xFFF;
- LidCommand = false;
+ HotkeyMask = 0;
LidStatus = false;
MicCommand = 0;
@@ -509,7 +510,7 @@ int EmuThreadFunc(void* burp)
if (JoyButtonPressed(Config::HKJoyMapping[HK_Lid], njoybuttons, joybuttons, joyhat))
{
LidStatus = !LidStatus;
- LidCommand = true;
+ HotkeyMask |= 0x1;
}
if (JoyButtonHeld(Config::HKJoyMapping[HK_Mic], njoybuttons, joybuttons, joyhat))
@@ -519,10 +520,10 @@ int EmuThreadFunc(void* burp)
}
NDS::SetKeyMask(keymask & joymask);
- if (LidCommand)
+ if (HotkeyMask & 0x1)
{
NDS::SetLidClosed(LidStatus);
- LidCommand = false;
+ HotkeyMask &= ~0x1;
}
// microphone input
@@ -783,7 +784,7 @@ int OnAreaKeyEvent(uiAreaHandler* handler, uiArea* area, uiAreaKeyEvent* evt)
if (evt->Scancode == Config::HKKeyMapping[HK_Lid])
{
LidStatus = !LidStatus;
- LidCommand = true;
+ HotkeyMask |= 0x1;
}
if (evt->Scancode == Config::HKKeyMapping[HK_Mic])
MicCommand |= 1;