From 87a36128e39be6f229685bf95366a8ccfaba761e Mon Sep 17 00:00:00 2001 From: goyuken Date: Sat, 29 Dec 2012 18:55:10 +0000 Subject: [PATCH] dual gb: fix edge case frame boundary timing thingy --- BizHawk.Emulation/Consoles/Nintendo/Gameboy/GambatteLink.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/BizHawk.Emulation/Consoles/Nintendo/Gameboy/GambatteLink.cs b/BizHawk.Emulation/Consoles/Nintendo/Gameboy/GambatteLink.cs index 7fb650a5a1..618466f9e0 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/Gameboy/GambatteLink.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/Gameboy/GambatteLink.cs @@ -114,13 +114,14 @@ namespace BizHawk.Emulation.Consoles.GB { target += step; - if (nL < target) + // gambatte_runfor() aborts early when a frame is produced, but we don't want that, hence the while() + while (nL < target) { uint nsamp = (uint)(target - nL); LibGambatte.gambatte_runfor(L.GambatteState, leftvbuff, pitch, leftsbuff + nL * 2, ref nsamp); nL += (int)nsamp; } - if (nR < target) + while (nR < target) { uint nsamp = (uint)(target - nR); LibGambatte.gambatte_runfor(R.GambatteState, rightvbuff, pitch, rightsbuff + nR * 2, ref nsamp);