Game Linking: resolve #321

This commit is contained in:
alyosha-tas 2019-02-10 16:22:29 -06:00
parent cf80d15c8f
commit cb517aaded
12 changed files with 34 additions and 22 deletions

View File

@ -3865,10 +3865,11 @@
this.LinkConnectStatusBarButton.Size = new System.Drawing.Size(16, 17);
this.LinkConnectStatusBarButton.Text = "Link connection is currently enabled";
this.LinkConnectStatusBarButton.ToolTipText = "Link connection is currently enabled";
//
// UpdateNotification
//
this.UpdateNotification.IsLink = true;
this.LinkConnectStatusBarButton.Click += new System.EventHandler(this.LinkConnectStatusBarButton_Click);
//
// UpdateNotification
//
this.UpdateNotification.IsLink = true;
this.UpdateNotification.LinkColor = System.Drawing.Color.Red;
this.UpdateNotification.Name = "UpdateNotification";
this.UpdateNotification.Size = new System.Drawing.Size(46, 17);

View File

@ -3124,6 +3124,16 @@ namespace BizHawk.Client.EmuHawk
ProfileFirstBootLabel.Visible = false;
}
private void LinkConnectStatusBarButton_Click(object sender, EventArgs e)
{
// toggle Link status (only outside of a movie session)
if (!Global.MovieSession.Movie.IsPlaying || Global.MovieSession.Movie.IsFinished)
{
Emulator.AsLinkable().LinkConnected ^= true;
Console.WriteLine("Cable connect status to {0}", Emulator.AsLinkable().LinkConnected);
}
}
private void UpdateNotification_Click(object sender, EventArgs e)
{
GlobalWin.Sound.StopSound();

View File

@ -9,6 +9,6 @@
/// <summary>
/// Gets a value indicating whether or not the link cable is currently connected
/// </summary>
bool LinkConnected { get; }
bool LinkConnected { get; set; }
}
}

View File

@ -66,7 +66,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
{
_cableconnected ^= true;
Console.WriteLine("Cable connect status to {0}", _cableconnected);
LinkConnected = _cableconnected;
}
_cablediscosignal = cablediscosignalNew;
@ -101,7 +100,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
// the signal to shift out a bit is when serial_clock = 1
if (((L.serialport.serial_clock == 1) || (L.serialport.serial_clock == 2)) && !do_r_next)
{
if (LinkConnected)
if (_cableconnected)
{
L.serialport.send_external_bit((byte)(L.serialport.serial_data & 0x80));
@ -119,7 +118,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
{
do_r_next = false;
if (LinkConnected)
if (_cableconnected)
{
R.serialport.send_external_bit((byte)(R.serialport.serial_data & 0x80));

View File

@ -61,8 +61,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
ser.Sync("_cablediscosignal", ref _cablediscosignal);
ser.Sync("do_r_next", ref do_r_next);
_controllerDeck.SyncState(ser);
LinkConnected = _cableconnected;
}
}
}

View File

@ -70,8 +70,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
SetupMemoryDomains();
HardReset();
LinkConnected = _cableconnected;
}
public void HardReset()
@ -88,7 +86,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
private readonly ITraceable _tracer;
public bool LinkConnected { get; private set; }
public bool LinkConnected
{
get { return _cableconnected; }
set { _cableconnected = value; }
}
private void ExecFetch(ushort addr)
{

View File

@ -10,6 +10,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
{
public partial class Gameboy : ILinkable
{
public bool LinkConnected { get; private set; }
public bool LinkConnected { get; set; }
}
}

View File

@ -34,7 +34,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
{
_cableconnected ^= true;
Console.WriteLine("Cable connect status to {0}", _cableconnected);
LinkConnected = _cableconnected;
}
_cablediscosignal = cablediscosignalNew;

View File

@ -51,7 +51,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
SetMemoryDomains();
}
public bool LinkConnected { get; private set; }
public bool LinkConnected
{
get { return _cableconnected; }
set { _cableconnected = value; }
}
private bool _disposed = false;

View File

@ -34,7 +34,6 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink
{
_cableconnected ^= true;
Console.WriteLine("Cable connect status to {0}", _cableconnected);
LinkConnected = _cableconnected;
}
_cablediscosignal = cablediscosignalNew;

View File

@ -60,8 +60,6 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink
ser.Sync("_cablediscosignal", ref _cablediscosignal);
ser.Sync("do_r_next", ref do_r_next);
_controllerDeck.SyncState(ser);
LinkConnected = _cableconnected;
}
}
}

View File

@ -64,8 +64,6 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink
HardReset();
LinkConnected = _cableconnected;
L.stand_alone = false;
R.stand_alone = false;
}
@ -84,7 +82,11 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink
private readonly ITraceable _tracer;
public bool LinkConnected { get; private set; }
public bool LinkConnected
{
get { return _cableconnected; }
set { _cableconnected = value; }
}
private void ExecFetch(ushort addr)
{