diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/LibSaturnus.cs b/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/LibSaturnus.cs index 4e51d824fb..df9f6e25e1 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/LibSaturnus.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/LibSaturnus.cs @@ -55,6 +55,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn public int Width; [FieldOffset(44)] public int Height; + [FieldOffset(48)] + public int ResetPushed; }; [UnmanagedFunctionPointer(CC)] diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Saturnus.cs b/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Saturnus.cs index 48a4aa7a29..93cd9406e1 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Saturnus.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Saturnus.cs @@ -13,7 +13,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn { [CoreAttributes("Saturnus", "Ryphecha", true, false, "0.9.44.1", "https://mednafen.github.io/releases/", false)] - public class Saturnus : IEmulator, IVideoProvider, ISoundProvider, IInputPollable + public class Saturnus : IEmulator, IVideoProvider, ISoundProvider, IInputPollable, IDriveLight { private static readonly DiscSectorReaderPolicy _diskPolicy = new DiscSectorReaderPolicy { @@ -61,7 +61,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn ControllerDefinition = _controllerDeck.Definition; ControllerDefinition.Name = "Saturn Controller"; ControllerDefinition.BoolButtons.Add("Power"); - ControllerDefinition.BoolButtons.Add("Reset"); // not yet hooked up + ControllerDefinition.BoolButtons.Add("Reset"); _exe.Seal(); SetCdCallbacks(); @@ -70,6 +70,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn public unsafe void FrameAdvance(IController controller, bool render, bool rendersound = true) { + DriveLightOn = false; if (controller.IsPressed("Power")) _core.HardReset(); @@ -82,7 +83,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn SoundBuf = (IntPtr)_sp, SoundBufMaxSize = _soundBuffer.Length / 2, Pixels = (IntPtr)_vp, - Controllers = (IntPtr)_cp + Controllers = (IntPtr)_cp, + ResetPushed = controller.IsPressed("Reset") ? 1 : 0 }; _core.FrameAdvance(info); @@ -206,8 +208,12 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn var buff = new byte[2448]; _diskReaders[disk].ReadLBA_2448(lba, buff, 0); Marshal.Copy(buff, 0, dest, 2448); + DriveLightOn = true; } + public bool DriveLightEnabled => true; + public bool DriveLightOn { get; private set; } + #endregion #region IVideoProvider diff --git a/waterbox/ss/bizhawk.cpp b/waterbox/ss/bizhawk.cpp index 688039cdc4..f3f2f52a07 100644 --- a/waterbox/ss/bizhawk.cpp +++ b/waterbox/ss/bizhawk.cpp @@ -154,6 +154,8 @@ struct FrameAdvanceInfo int32 Width; int32 Height; + int32 ResetPushed; + // Set by the system emulation code every frame, to denote the horizontal and vertical offsets of the image, and the size // of the image. If the emulated system sets the elements of LineWidths, then the width(w) of this structure // is ignored while drawing the image. @@ -179,6 +181,7 @@ EXPORT void FrameAdvance(FrameAdvanceInfo &f) e.SoundBuf = f.SoundBuf; e.SoundBufMaxSize = f.SoundBufMaxSize; memcpy(ControllerInput, f.Controllers, sizeof(ControllerInput)); + IsResetPushed = f.ResetPushed; Emulate(&e); f.SoundBufSize = e.SoundBufSize;