diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs
index 2839340073..973520d960 100644
--- a/BizHawk.Client.EmuHawk/MainForm.cs
+++ b/BizHawk.Client.EmuHawk/MainForm.cs
@@ -2503,14 +2503,14 @@ namespace BizHawk.Client.EmuHawk
}
}
- if (Global.Emulator.CoreComm.UsesLinkCable)
+ if (Global.Emulator.UsesLinkCable())
{
if (!LinkConnectStatusBarButton.Visible)
{
LinkConnectStatusBarButton.Visible = true;
}
- LinkConnectStatusBarButton.Image = Global.Emulator.CoreComm.LinkConnected
+ LinkConnectStatusBarButton.Image = Global.Emulator.AsLinkable().LinkConnected
? LinkCableOn
: LinkCableOff;
}
diff --git a/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj b/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj
index cfb34c0508..b865c7d83d 100644
--- a/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj
+++ b/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj
@@ -88,6 +88,7 @@
+
diff --git a/BizHawk.Emulation.Common/CoreComms.cs b/BizHawk.Emulation.Common/CoreComms.cs
index a757a59128..66e1ad5d6f 100644
--- a/BizHawk.Emulation.Common/CoreComms.cs
+++ b/BizHawk.Emulation.Common/CoreComms.cs
@@ -33,9 +33,6 @@ namespace BizHawk.Emulation.Common
public int NominalWidth = 640;
public int NominalHeight = 480;
- public bool LinkConnected = false;
- public bool UsesLinkCable = false;
-
//I know we want to get rid of CoreComm, but while it's still here, I'll use it for this
public string LaunchLibretroCore;
diff --git a/BizHawk.Emulation.Common/Extensions.cs b/BizHawk.Emulation.Common/Extensions.cs
index 82f90911af..9b10a1500f 100644
--- a/BizHawk.Emulation.Common/Extensions.cs
+++ b/BizHawk.Emulation.Common/Extensions.cs
@@ -255,6 +255,21 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
return core.ServiceProvider.GetService();
}
+ public static ILinkable AsLinkable(this IEmulator core)
+ {
+ return core.ServiceProvider.GetService();
+ }
+
+ public static bool UsesLinkCable(this IEmulator core)
+ {
+ if (core == null)
+ {
+ return false;
+ }
+
+ return core.ServiceProvider.HasService();
+ }
+
// TODO: a better place for these
public static bool IsImplemented(this MethodInfo info)
{
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.cs
index ed4d92db21..585b30176d 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.cs
@@ -18,7 +18,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
isReleased: true
)]
[ServiceNotApplicable(typeof(IDriveLight))]
- public partial class GambatteLink : IEmulator, IVideoProvider, ISyncSoundProvider, IInputPollable, ISaveRam, IStatable,
+ public partial class GambatteLink : IEmulator, IVideoProvider, ISyncSoundProvider, IInputPollable, ISaveRam, IStatable, ILinkable,
IDebuggable, ISettable
{
public GambatteLink(CoreComm comm, GameInfo leftinfo, byte[] leftrom, GameInfo rightinfo, byte[] rightrom, object Settings, object SyncSettings, bool deterministic)
@@ -48,8 +48,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
comm.RomStatusDetails = "LEFT:\r\n" + L.CoreComm.RomStatusDetails + "RIGHT:\r\n" + R.CoreComm.RomStatusDetails;
comm.NominalWidth = L.CoreComm.NominalWidth + R.CoreComm.NominalWidth;
comm.NominalHeight = L.CoreComm.NominalHeight;
- comm.UsesLinkCable = true;
- comm.LinkConnected = true;
+
+ LinkConnected = true;
Frame = 0;
LagCount = 0;
@@ -63,6 +63,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
SetMemoryDomains();
}
+ public bool LinkConnected { get; private set; }
+
bool disposed = false;
Gameboy L;
@@ -126,7 +128,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
{
cableconnected ^= true;
Console.WriteLine("Cable connect status to {0}", cableconnected);
- CoreComm.LinkConnected = cableconnected;
+ LinkConnected = cableconnected;
}
cablediscosignal = cablediscosignal_new;