diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs
index 2b0cc497d5..ee0c5c4869 100644
--- a/BizHawk.Client.EmuHawk/MainForm.cs
+++ b/BizHawk.Client.EmuHawk/MainForm.cs
@@ -2422,14 +2422,16 @@ namespace BizHawk.Client.EmuHawk
{
if (MainStatusBar.Visible)
{
- if (Global.Emulator.CoreComm.UsesDriveLed)
+ var hasDriveLight = Global.Emulator.HasDriveLight() && Global.Emulator.AsDriveLight().DriveLightEnabled;
+
+ if (hasDriveLight)
{
if (!LedLightStatusLabel.Visible)
{
LedLightStatusLabel.Visible = true;
}
- LedLightStatusLabel.Image = Global.Emulator.CoreComm.DriveLED
+ LedLightStatusLabel.Image = Global.Emulator.AsDriveLight().DriveLightOn
? StatusBarDiskLightOnImage
: StatusBarDiskLightOffImage;
}
diff --git a/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj b/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj
index 8348590576..99206673d3 100644
--- a/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj
+++ b/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj
@@ -72,6 +72,7 @@
+
diff --git a/BizHawk.Emulation.Common/CoreComms.cs b/BizHawk.Emulation.Common/CoreComms.cs
index 1191d41c71..557691c1a1 100644
--- a/BizHawk.Emulation.Common/CoreComms.cs
+++ b/BizHawk.Emulation.Common/CoreComms.cs
@@ -35,9 +35,6 @@ namespace BizHawk.Emulation.Common
public int NominalWidth = 640;
public int NominalHeight = 480;
- public bool DriveLED = false;
- public bool UsesDriveLed = false;
-
public bool LinkConnected = false;
public bool UsesLinkCable = false;
diff --git a/BizHawk.Emulation.Common/Extensions.cs b/BizHawk.Emulation.Common/Extensions.cs
index 1c72ba65fb..b7ddf5d46f 100644
--- a/BizHawk.Emulation.Common/Extensions.cs
+++ b/BizHawk.Emulation.Common/Extensions.cs
@@ -77,6 +77,21 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
return (IInputPollable)core.ServiceProvider.GetService();
}
+ public static bool HasDriveLight(this IEmulator core)
+ {
+ if (core == null)
+ {
+ return false;
+ }
+
+ return core.ServiceProvider.HasService();
+ }
+
+ public static IDriveLight AsDriveLight(this IEmulator core)
+ {
+ return (IDriveLight)core.ServiceProvider.GetService();
+ }
+
public static bool CanDebug(this IEmulator core)
{
if (core == null)
diff --git a/BizHawk.Emulation.Common/Interfaces/IDriveLight.cs b/BizHawk.Emulation.Common/Interfaces/IDriveLight.cs
new file mode 100644
index 0000000000..a5425614ea
--- /dev/null
+++ b/BizHawk.Emulation.Common/Interfaces/IDriveLight.cs
@@ -0,0 +1,18 @@
+namespace BizHawk.Emulation.Common
+{
+ ///
+ /// Specifies an interface to returning the state of a LED drive light such as on Disk and CD Drives
+ ///
+ public interface IDriveLight : IEmulatorService
+ {
+ ///
+ /// Specifies whether there is currently a Drive light available
+ ///
+ bool DriveLightEnabled { get; }
+
+ ///
+ /// Specifies whether the light is currently lit
+ ///
+ bool DriveLightOn { get; }
+ }
+}
diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs
index 89ead8f7b3..9f42083022 100644
--- a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs
+++ b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs
@@ -14,7 +14,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
isReleased: false
)]
[ServiceNotApplicable(typeof(ISettable<,>))]
- sealed public partial class C64 : IEmulator, IMemoryDomains, IStatable, IInputPollable
+ sealed public partial class C64 : IEmulator, IMemoryDomains, IStatable, IInputPollable, IDriveLight
{
// internal variables
private bool _islag = true;
@@ -84,11 +84,13 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
CoreComm = comm;
Init(Region.PAL);
cyclesPerFrame = board.vic.CyclesPerFrame;
- CoreComm.UsesDriveLed = true;
SetupMemoryDomains();
HardReset();
}
+ public bool DriveLightEnabled { get { return true; } }
+ public bool DriveLightOn { get; private set; }
+
public IEmulatorServiceProvider ServiceProvider { get; private set; }
public void Dispose()
@@ -169,7 +171,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
//Console.WriteLine("CPUPC: " + C64Util.ToHex(board.cpu.PC, 4) + " 1541PC: " + C64Util.ToHex(disk.PC, 4));
int test = board.cpu.LagCycles;
- CoreComm.DriveLED = DriveLED;
+ DriveLightOn = DriveLED;
}
private void HandleFirmwareError(string file)
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs
index f5352986ec..33f9c09289 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs
@@ -46,8 +46,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
Init(game, rom, fdsbios);
if (board is FDS)
{
- CoreComm.UsesDriveLed = true;
- (board as FDS).SetDriveLightCallback((val) => CoreComm.DriveLED = val);
+ DriveLightEnabled = true;
+ (board as FDS).SetDriveLightCallback((val) => DriveLightOn = val);
}
PutSettings((NESSettings)Settings ?? new NESSettings());
}
@@ -59,6 +59,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
BootGodDB.Initialize();
}
+ public bool DriveLightEnabled { get; private set; }
+ public bool DriveLightOn { get; private set; }
+
public void WriteLogTimestamp()
{
if (ppu != null)
diff --git a/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs b/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs
index 8be810246d..44200d4d8e 100644
--- a/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs
+++ b/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs
@@ -23,7 +23,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
isReleased: true
)]
public sealed partial class PCEngine : IEmulator, IMemoryDomains, ISaveRam, IStatable, IInputPollable,
- IDebuggable, ISettable
+ IDebuggable, ISettable, IDriveLight
{
// ROM
public byte[] RomData;
@@ -102,7 +102,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
CoreComm = comm;
Tracer = new TraceBuffer();
MemoryCallbacks = new MemoryCallbackSystem();
- CoreComm.UsesDriveLed = true;
+ DriveLightEnabled = true;
systemid = "PCECD";
Type = NecSystemType.TurboCD;
this.disc = disc;
@@ -152,6 +152,9 @@ namespace BizHawk.Emulation.Cores.PCEngine
SetControllerButtons();
}
+ public bool DriveLightEnabled { get; private set; }
+ public bool DriveLightOn { get; internal set; }
+
void Init(GameInfo game, byte[] rom)
{
Controller = NullController.GetNullController();
@@ -317,7 +320,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
public void FrameAdvance(bool render, bool rendersound)
{
lagged = true;
- CoreComm.DriveLED = false;
+ DriveLightOn = false;
Frame++;
CheckSpriteLimit();
PSG.BeginFrame(Cpu.TotalExecutedCycles);
diff --git a/BizHawk.Emulation.Cores/Consoles/PC Engine/ScsiCDBus.cs b/BizHawk.Emulation.Cores/Consoles/PC Engine/ScsiCDBus.cs
index 2461431c18..13fa66e042 100644
--- a/BizHawk.Emulation.Cores/Consoles/PC Engine/ScsiCDBus.cs
+++ b/BizHawk.Emulation.Cores/Consoles/PC Engine/ScsiCDBus.cs
@@ -170,7 +170,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
if (DataReadInProgress && pce.Cpu.TotalExecutedCycles > DataReadWaitTimer)
{
if (SectorsLeftToRead > 0)
- pce.CoreComm.DriveLED = true;
+ pce.DriveLightOn = true;
if (DataIn.Count == 0)
{
diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.cs b/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.cs
index 759d072bea..524325c67d 100644
--- a/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.cs
@@ -24,7 +24,7 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
portedUrl: "http://yabause.org"
)]
public class Yabause : IEmulator, IVideoProvider, ISyncSoundProvider, IMemoryDomains, ISaveRam, IStatable, IInputPollable,
- ISettable