From aa0923a3a86686ca4a8bc6dff73fce7a02fe56f8 Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Thu, 14 Aug 2008 16:49:18 +0000 Subject: [PATCH] frame advance improvements in sdl --- src/drivers/sdl/input.cpp | 21 ++++++++++++++++----- src/drivers/sdl/sdl-sound.cpp | 22 ++++++++++++---------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/src/drivers/sdl/input.cpp b/src/drivers/sdl/input.cpp index 0ad905aa..74e82be7 100644 --- a/src/drivers/sdl/input.cpp +++ b/src/drivers/sdl/input.cpp @@ -334,12 +334,23 @@ KeyboardCommands() } g_config->getOption("SDL.Hotkeys.FrameAdvance", &key); - if(_keyonly(key)) { - // 8-10-08 - this freezes fceux for me - punkrockguy318 - FCEUI_FrameAdvance(); + static bool frameAdvancing = false; + if(g_keyState[key]) + { + if(frameAdvancing == false) + { + FCEUI_FrameAdvance(); + frameAdvancing = true; + } + } + else + { + if(frameAdvancing) + { + FCEUI_FrameAdvanceEnd(); + frameAdvancing = false; + } } - - g_config->getOption("SDL.Hotkeys.Reset", &key); if(_keyonly(key)) { diff --git a/src/drivers/sdl/sdl-sound.cpp b/src/drivers/sdl/sdl-sound.cpp index c6653e87..effad424 100644 --- a/src/drivers/sdl/sdl-sound.cpp +++ b/src/drivers/sdl/sdl-sound.cpp @@ -149,17 +149,19 @@ void WriteSound(int32 *buf, int Count) { - while(Count) { - while(s_BufferIn == s_BufferSize) { - SDL_Delay(1); - } + extern int EmulationPaused; + if (EmulationPaused == 0) + while(Count) { + while(s_BufferIn == s_BufferSize) { + SDL_Delay(1); + } - s_Buffer[s_BufferWrite] = *buf; - Count--; - s_BufferWrite = (s_BufferWrite + 1) % s_BufferSize; - s_BufferIn++; - buf++; - } + s_Buffer[s_BufferWrite] = *buf; + Count--; + s_BufferWrite = (s_BufferWrite + 1) % s_BufferSize; + s_BufferIn++; + buf++; + } } /**