all repos — mgba @ 968dbe55db3f8cbb5aa1c0cc50a7b5a96fc5b30f

mGBA Game Boy Advance Emulator

Properly sync to frame only when not in turbo
Jeffrey Pfau jeffrey@endrift.com
Wed, 22 Jan 2014 03:25:09 -0800
commit

968dbe55db3f8cbb5aa1c0cc50a7b5a96fc5b30f

parent

1e0f4000918ab61f637fbce626178225d640c693

2 files changed, 6 insertions(+), 3 deletions(-)

jump to
M src/platform/sdl/gl-main.csrc/platform/sdl/gl-main.c

@@ -74,7 +74,7 @@ context.fname = fname;

context.useDebugger = 1; context.renderer = &renderer.d.d; context.frameskip = 0; - context.sync.videoFrameWait = 0; + context.sync.videoFrameWait = 1; context.sync.audioWait = 1; context.startCallback = _GBASDLStart; context.cleanCallback = _GBASDLClean;

@@ -148,7 +148,9 @@ #else

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, renderer->d.outputBuffer); #endif glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - glFlush(); + if (context->sync.videoFrameWait) { + glFlush(); + } } GBASyncWaitFrameEnd(&context->sync); SDL_GL_SwapBuffers();
M src/platform/sdl/sdl-events.csrc/platform/sdl/sdl-events.c

@@ -66,7 +66,8 @@ }

break; #endif case SDLK_TAB: - context->sync.audioWait = !context->sync.audioWait; + context->sync.audioWait = event->type != SDL_KEYDOWN; + context->sync.videoFrameWait = event->type != SDL_KEYDOWN; return; default: if (event->type == SDL_KEYDOWN) {