aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRSDuck <RSDuck@users.noreply.github.com>2023-12-22 23:30:59 +0100
committerRSDuck <RSDuck@users.noreply.github.com>2023-12-22 23:30:59 +0100
commit989b93c92ab03985426619f6fc4d0076fa973406 (patch)
tree699337842147e8ac9467dab024cdbd3c86a1437e
parent521fc249a3b95b66147be848a63d29e4425d4c5d (diff)
do not access NDS object emulation is paused
-rw-r--r--src/frontend/qt_sdl/main.cpp102
1 files changed, 51 insertions, 51 deletions
diff --git a/src/frontend/qt_sdl/main.cpp b/src/frontend/qt_sdl/main.cpp
index cd84988..725a75f 100644
--- a/src/frontend/qt_sdl/main.cpp
+++ b/src/frontend/qt_sdl/main.cpp
@@ -592,68 +592,68 @@ void EmuThread::run()
if (Input::HotkeyPressed(HK_SwapScreens)) emit swapScreensToggle();
if (Input::HotkeyPressed(HK_SwapScreenEmphasis)) emit screenEmphasisToggle();
- if (Input::HotkeyPressed(HK_SolarSensorDecrease))
- {
- int level = NDS->GBACartSlot.SetInput(GBACart::Input_SolarSensorDown, true);
- if (level != -1)
- {
- char msg[64];
- sprintf(msg, "Solar sensor level: %d", level);
- OSD::AddMessage(0, msg);
- }
- }
- if (Input::HotkeyPressed(HK_SolarSensorIncrease))
- {
- int level = NDS->GBACartSlot.SetInput(GBACart::Input_SolarSensorUp, true);
- if (level != -1)
- {
- char msg[64];
- sprintf(msg, "Solar sensor level: %d", level);
- OSD::AddMessage(0, msg);
- }
- }
-
- if (NDS->ConsoleType == 1)
+ if (EmuRunning == emuStatus_Running || EmuRunning == emuStatus_FrameStep)
{
- DSi& dsi = static_cast<DSi&>(*NDS);
- double currentTime = SDL_GetPerformanceCounter() * perfCountsSec;
+ EmuStatus = emuStatus_Running;
+ if (EmuRunning == emuStatus_FrameStep) EmuRunning = emuStatus_Paused;
- // Handle power button
- if (Input::HotkeyDown(HK_PowerButton))
+ if (Input::HotkeyPressed(HK_SolarSensorDecrease))
{
- dsi.I2C.GetBPTWL()->SetPowerButtonHeld(currentTime);
+ int level = NDS->GBACartSlot.SetInput(GBACart::Input_SolarSensorDown, true);
+ if (level != -1)
+ {
+ char msg[64];
+ sprintf(msg, "Solar sensor level: %d", level);
+ OSD::AddMessage(0, msg);
+ }
}
- else if (Input::HotkeyReleased(HK_PowerButton))
+ if (Input::HotkeyPressed(HK_SolarSensorIncrease))
{
- dsi.I2C.GetBPTWL()->SetPowerButtonReleased(currentTime);
+ int level = NDS->GBACartSlot.SetInput(GBACart::Input_SolarSensorUp, true);
+ if (level != -1)
+ {
+ char msg[64];
+ sprintf(msg, "Solar sensor level: %d", level);
+ OSD::AddMessage(0, msg);
+ }
}
- // Handle volume buttons
- if (Input::HotkeyDown(HK_VolumeUp))
+ if (NDS->ConsoleType == 1)
{
- dsi.I2C.GetBPTWL()->SetVolumeSwitchHeld(DSi_BPTWL::volumeKey_Up);
- }
- else if (Input::HotkeyReleased(HK_VolumeUp))
- {
- dsi.I2C.GetBPTWL()->SetVolumeSwitchReleased(DSi_BPTWL::volumeKey_Up);
- }
+ DSi& dsi = static_cast<DSi&>(*NDS);
+ double currentTime = SDL_GetPerformanceCounter() * perfCountsSec;
- if (Input::HotkeyDown(HK_VolumeDown))
- {
- dsi.I2C.GetBPTWL()->SetVolumeSwitchHeld(DSi_BPTWL::volumeKey_Down);
- }
- else if (Input::HotkeyReleased(HK_VolumeDown))
- {
- dsi.I2C.GetBPTWL()->SetVolumeSwitchReleased(DSi_BPTWL::volumeKey_Down);
- }
+ // Handle power button
+ if (Input::HotkeyDown(HK_PowerButton))
+ {
+ dsi.I2C.GetBPTWL()->SetPowerButtonHeld(currentTime);
+ }
+ else if (Input::HotkeyReleased(HK_PowerButton))
+ {
+ dsi.I2C.GetBPTWL()->SetPowerButtonReleased(currentTime);
+ }
- dsi.I2C.GetBPTWL()->ProcessVolumeSwitchInput(currentTime);
- }
+ // Handle volume buttons
+ if (Input::HotkeyDown(HK_VolumeUp))
+ {
+ dsi.I2C.GetBPTWL()->SetVolumeSwitchHeld(DSi_BPTWL::volumeKey_Up);
+ }
+ else if (Input::HotkeyReleased(HK_VolumeUp))
+ {
+ dsi.I2C.GetBPTWL()->SetVolumeSwitchReleased(DSi_BPTWL::volumeKey_Up);
+ }
- if (EmuRunning == emuStatus_Running || EmuRunning == emuStatus_FrameStep)
- {
- EmuStatus = emuStatus_Running;
- if (EmuRunning == emuStatus_FrameStep) EmuRunning = emuStatus_Paused;
+ if (Input::HotkeyDown(HK_VolumeDown))
+ {
+ dsi.I2C.GetBPTWL()->SetVolumeSwitchHeld(DSi_BPTWL::volumeKey_Down);
+ }
+ else if (Input::HotkeyReleased(HK_VolumeDown))
+ {
+ dsi.I2C.GetBPTWL()->SetVolumeSwitchReleased(DSi_BPTWL::volumeKey_Down);
+ }
+
+ dsi.I2C.GetBPTWL()->ProcessVolumeSwitchInput(currentTime);
+ }
// update render settings if needed
// HACK: