frame advance improvements in sdl

This commit is contained in:
punkrockguy318 2008-08-14 16:49:18 +00:00
parent b6edc72bc8
commit aa0923a3a8
2 changed files with 28 additions and 15 deletions

View File

@ -334,12 +334,23 @@ KeyboardCommands()
} }
g_config->getOption("SDL.Hotkeys.FrameAdvance", &key); g_config->getOption("SDL.Hotkeys.FrameAdvance", &key);
if(_keyonly(key)) { static bool frameAdvancing = false;
// 8-10-08 - this freezes fceux for me - punkrockguy318 if(g_keyState[key])
FCEUI_FrameAdvance(); {
if(frameAdvancing == false)
{
FCEUI_FrameAdvance();
frameAdvancing = true;
}
}
else
{
if(frameAdvancing)
{
FCEUI_FrameAdvanceEnd();
frameAdvancing = false;
}
} }
g_config->getOption("SDL.Hotkeys.Reset", &key); g_config->getOption("SDL.Hotkeys.Reset", &key);
if(_keyonly(key)) { if(_keyonly(key)) {

View File

@ -149,17 +149,19 @@ void
WriteSound(int32 *buf, WriteSound(int32 *buf,
int Count) int Count)
{ {
while(Count) { extern int EmulationPaused;
while(s_BufferIn == s_BufferSize) { if (EmulationPaused == 0)
SDL_Delay(1); while(Count) {
} while(s_BufferIn == s_BufferSize) {
SDL_Delay(1);
}
s_Buffer[s_BufferWrite] = *buf; s_Buffer[s_BufferWrite] = *buf;
Count--; Count--;
s_BufferWrite = (s_BufferWrite + 1) % s_BufferSize; s_BufferWrite = (s_BufferWrite + 1) % s_BufferSize;
s_BufferIn++; s_BufferIn++;
buf++; buf++;
} }
} }
/** /**