Saturnus: Connect reset button, but you need to hold it down for 3 consecutive frames (working as intended). Also, DRIVE LIGHT HOOOOOOOOOOOOOOOOOOOOOOOOO

This commit is contained in:
nattthebear 2017-06-07 17:34:30 -04:00
parent 62597400c1
commit 40680a9d74
3 changed files with 14 additions and 3 deletions

View File

@ -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)]

View File

@ -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

View File

@ -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;