diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.IEmulator.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.IEmulator.cs index 1cebe9f5b4..dee9cfa0e3 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.IEmulator.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.IEmulator.cs @@ -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 diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.IStatable.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.IStatable.cs index 5429566225..7b3049f1e2 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.IStatable.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.IStatable.cs @@ -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; diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.cs index d007d533fb..619a17c479 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.cs @@ -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) {