GBHawkLink: Fix logic error in linking

This commit is contained in:
alyosha-tas 2019-01-12 14:57:25 -06:00
parent cc532a2988
commit f6dd99a3ce
3 changed files with 12 additions and 1 deletions

View File

@ -100,7 +100,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
R.do_single_step();
// the signal to shift out a bit is when serial_clock = 1
if ((L.serialport.serial_clock == 1) || (L.serialport.serial_clock == 2))
if (((L.serialport.serial_clock == 1) || (L.serialport.serial_clock == 2)) && !do_r_next)
{
if (LinkConnected)
{
@ -118,6 +118,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
}
else if ((R.serialport.serial_clock == 1) || (R.serialport.serial_clock == 2))
{
do_r_next = false;
if (LinkConnected)
{
R.serialport.send_external_bit((byte)(R.serialport.serial_data & 0x80));
@ -131,6 +133,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
R.serialport.coming_in = L.serialport.going_out;
}
if (R.serialport.serial_clock == 2) { do_r_next = true; }
}
else
{
do_r_next = false;
}
// if we hit a frame boundary, update video

View File

@ -59,6 +59,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
ser.Sync("IsLag", ref _islag);
ser.Sync("_cableconnected", ref _cableconnected);
ser.Sync("_cablediscosignal", ref _cablediscosignal);
ser.Sync("do_r_next", ref do_r_next);
_controllerDeck.SyncState(ser);
LinkConnected = _cableconnected;

View File

@ -30,6 +30,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
// if true, the link cable toggle signal is currently asserted
private bool _cablediscosignal = false;
private bool do_r_next = false;
//[CoreConstructor("GB", "GBC")]
public GBHawkLink(CoreComm comm, GameInfo game_L, byte[] rom_L, GameInfo game_R, byte[] rom_R, /*string gameDbFn,*/ object settings, object syncSettings)
{