X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Fcommon%2Femu.c;h=118dc38314b923114606186f4668d9ae69b766ee;hb=02da059d71b20efd72efbd1009b8f42ab1e4bd02;hp=4341d6ad643ff47eecb7f6f2060e3db397624cd2;hpb=d8afe7b8a7f4e5c359a2d347f0dd182575cf66fc;p=picodrive.git diff --git a/platform/common/emu.c b/platform/common/emu.c index 4341d6a..118dc38 100644 --- a/platform/common/emu.c +++ b/platform/common/emu.c @@ -1276,9 +1276,6 @@ void emu_loop(void) if (PicoAHW & PAHW_MCD) PicoCDBufferInit(); - if (currentConfig.EmuOpt & EOPT_PSYNC) - plat_video_wait_vsync(); - pemu_loop_prep(); timestamp_fps = get_ticks(); @@ -1286,6 +1283,8 @@ void emu_loop(void) frames_done = frames_shown = pframes_done = 0; + plat_video_wait_vsync(); + /* loop with resync every 1 sec. */ while (engineState == PGS_Running) { @@ -1414,12 +1413,9 @@ void emu_loop(void) if (diff < diff_lim) { // we are too fast - if (currentConfig.EmuOpt & EOPT_PSYNC) { - if (diff_lim - diff > target_frametime/2) - plat_wait_till_us(timestamp_base + target_frametime/4); + plat_wait_till_us(timestamp_base + diff_lim - target_frametime / 4); + if (currentConfig.EmuOpt & EOPT_VSYNC) plat_video_wait_vsync(); - } else - plat_wait_till_us(timestamp_base + diff_lim); } }