diff options
author | Arisotura <thetotalworm@gmail.com> | 2020-05-19 22:37:48 +0200 |
---|---|---|
committer | Arisotura <thetotalworm@gmail.com> | 2020-05-19 22:37:48 +0200 |
commit | 95f9698077fe50d2567aacd8728ff2625f88f228 (patch) | |
tree | 3c579695c0e86c1ee886015cffe7207a426a5600 /src/frontend/qt_sdl | |
parent | b262313816b9fac581353f74dd71e1dde1f23013 (diff) |
add back some hotkeys.
remove some legacy cruft from NDS.cpp.
Diffstat (limited to 'src/frontend/qt_sdl')
-rw-r--r-- | src/frontend/qt_sdl/Input.cpp | 5 | ||||
-rw-r--r-- | src/frontend/qt_sdl/Input.h | 4 | ||||
-rw-r--r-- | src/frontend/qt_sdl/main.cpp | 48 |
3 files changed, 31 insertions, 26 deletions
diff --git a/src/frontend/qt_sdl/Input.cpp b/src/frontend/qt_sdl/Input.cpp index d60271c..84d20ad 100644 --- a/src/frontend/qt_sdl/Input.cpp +++ b/src/frontend/qt_sdl/Input.cpp @@ -217,6 +217,11 @@ void Process() } +bool HotkeyDown(int id) { return HotkeyMask & (1<<id); } +bool HotkeyPressed(int id) { return HotkeyPress & (1<<id); } +bool HotkeyReleased(int id) { return HotkeyRelease & (1<<id); } + + // TODO: MacOS version of this! // distinguish between left and right modifier keys (Ctrl, Alt, Shift) // Qt provides no real cross-platform way to do this, so here we go diff --git a/src/frontend/qt_sdl/Input.h b/src/frontend/qt_sdl/Input.h index 57b5a4a..14e7ea8 100644 --- a/src/frontend/qt_sdl/Input.h +++ b/src/frontend/qt_sdl/Input.h @@ -40,6 +40,10 @@ void KeyRelease(QKeyEvent* event); void Process(); +bool HotkeyDown(int id); +bool HotkeyPressed(int id); +bool HotkeyReleased(int id); + bool IsRightModKey(QKeyEvent* event); } diff --git a/src/frontend/qt_sdl/main.cpp b/src/frontend/qt_sdl/main.cpp index 962fdaf..67ac92c 100644 --- a/src/frontend/qt_sdl/main.cpp +++ b/src/frontend/qt_sdl/main.cpp @@ -42,6 +42,7 @@ #include "FrontendUtil.h" #include "NDS.h" +#include "GBACart.h" #include "GPU.h" #include "SPU.h" #include "Wifi.h" @@ -136,8 +137,7 @@ void EmuThread::run() } Input::Init(); - /*Touching = false; - LidStatus = false;*/ + /*Touching = false;*/ u32 nframes = 0; u32 starttick = SDL_GetTicks(); @@ -150,35 +150,33 @@ void EmuThread::run() while (EmuRunning != 0) { Input::Process(); - /*ProcessInput(); - if (HotkeyPressed(HK_FastForwardToggle)) + /*if (Input::HotkeyPressed(HK_FastForwardToggle)) { Config::LimitFPS = !Config::LimitFPS; - uiQueueMain(UpdateFPSLimit, NULL); - } - // TODO: similar hotkeys for video/audio sync? + // TODO: reflect in UI! + }*/ - if (HotkeyPressed(HK_Pause)) uiQueueMain(TogglePause, NULL); - if (HotkeyPressed(HK_Reset)) uiQueueMain(Reset, NULL); + //if (Input::HotkeyPressed(HK_Pause)) uiQueueMain(TogglePause, NULL); + //if (Input::HotkeyPressed(HK_Reset)) uiQueueMain(Reset, NULL); if (GBACart::CartInserted && GBACart::HasSolarSensor) { - if (HotkeyPressed(HK_SolarSensorDecrease)) + if (Input::HotkeyPressed(HK_SolarSensorDecrease)) { if (GBACart_SolarSensor::LightLevel > 0) GBACart_SolarSensor::LightLevel--; - char msg[64]; - sprintf(msg, "Solar sensor level set to %d", GBACart_SolarSensor::LightLevel); - OSD::AddMessage(0, msg); + //char msg[64]; + //sprintf(msg, "Solar sensor level set to %d", GBACart_SolarSensor::LightLevel); + //OSD::AddMessage(0, msg); } - if (HotkeyPressed(HK_SolarSensorIncrease)) + if (Input::HotkeyPressed(HK_SolarSensorIncrease)) { if (GBACart_SolarSensor::LightLevel < 10) GBACart_SolarSensor::LightLevel++; - char msg[64]; - sprintf(msg, "Solar sensor level set to %d", GBACart_SolarSensor::LightLevel); - OSD::AddMessage(0, msg); + //char msg[64]; + //sprintf(msg, "Solar sensor level set to %d", GBACart_SolarSensor::LightLevel); + //OSD::AddMessage(0, msg); } - }*/ + } if (EmuRunning == 1) { @@ -186,14 +184,13 @@ void EmuThread::run() // process input and hotkeys NDS::SetKeyMask(Input::InputMask); - /*NDS::SetKeyMask(KeyInputMask & JoyInputMask); - if (HotkeyPressed(HK_Lid)) + if (Input::HotkeyPressed(HK_Lid)) { - LidStatus = !LidStatus; - NDS::SetLidClosed(LidStatus); - OSD::AddMessage(0, LidStatus ? "Lid closed" : "Lid opened"); - }*/ + bool lid = !NDS::IsLidClosed(); + NDS::SetLidClosed(lid); + //OSD::AddMessage(0, lid ? "Lid closed" : "Lid opened"); + } // microphone input /*FeedMicInput(); @@ -250,8 +247,7 @@ void EmuThread::run() uiAreaQueueRedrawAll(MainDrawArea);*/ mainWindow->update(); - bool fastforward = false; - //bool fastforward = HotkeyDown(HK_FastForward); + bool fastforward = Input::HotkeyDown(HK_FastForward); if (Config::AudioSync && (!fastforward) && audioDevice) { |