From 543a40c7cb402bfd8cb556bf47a1d1d751562070 Mon Sep 17 00:00:00 2001 From: Arisotura Date: Tue, 11 Jun 2019 04:04:49 +0200 Subject: add some OSD messages. prepare shit. --- src/libui_sdl/main.cpp | 51 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp index 064be0b..cc01fb6 100644 --- a/src/libui_sdl/main.cpp +++ b/src/libui_sdl/main.cpp @@ -1502,6 +1502,34 @@ void Run() uiMenuItemSetChecked(MenuItem_Pause, 0); } +void TogglePause(void* blarg) +{ + if (!RunningSomething) return; + + if (EmuRunning == 1) + { + // enable pause + EmuRunning = 2; + uiMenuItemSetChecked(MenuItem_Pause, 1); + + SDL_PauseAudioDevice(AudioDevice, 1); + SDL_PauseAudioDevice(MicDevice, 1); + + OSD::AddMessage(0, "Paused"); + } + else + { + // disable pause + EmuRunning = 1; + uiMenuItemSetChecked(MenuItem_Pause, 0); + + SDL_PauseAudioDevice(AudioDevice, 0); + SDL_PauseAudioDevice(MicDevice, 0); + + OSD::AddMessage(0, "Resumed"); + } +} + void Stop(bool internal) { EmuRunning = 2; @@ -1524,6 +1552,8 @@ void Stop(bool internal) SDL_PauseAudioDevice(AudioDevice, 1); SDL_PauseAudioDevice(MicDevice, 1); + + OSD::AddMessage(0xFFC040, "Shutdown"); } void SetupSRAMPath() @@ -1877,26 +1907,7 @@ void OnRun(uiMenuItem* item, uiWindow* window, void* blarg) void OnPause(uiMenuItem* item, uiWindow* window, void* blarg) { - if (!RunningSomething) return; - - if (EmuRunning == 1) - { - // enable pause - EmuRunning = 2; - uiMenuItemSetChecked(MenuItem_Pause, 1); - - SDL_PauseAudioDevice(AudioDevice, 1); - SDL_PauseAudioDevice(MicDevice, 1); - } - else - { - // disable pause - EmuRunning = 1; - uiMenuItemSetChecked(MenuItem_Pause, 0); - - SDL_PauseAudioDevice(AudioDevice, 0); - SDL_PauseAudioDevice(MicDevice, 0); - } + TogglePause(NULL); } void OnReset(uiMenuItem* item, uiWindow* window, void* blarg) -- cgit v1.2.3