BizHawk/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.IEmulator.cs

96 lines
1.8 KiB
C#
Raw Normal View History

using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Sega.MasterSystem
{
public sealed partial class SMS : IEmulator
{
2017-05-08 16:42:22 +00:00
public IEmulatorServiceProvider ServiceProvider { get; }
public ControllerDefinition ControllerDefinition
{
get
{
if (IsGameGear)
{
return GGController;
}
2017-08-31 03:02:36 +00:00
switch(Settings.ControllerType)
{
case "Paddle":
return SMSPaddleController;
2017-08-31 16:58:27 +00:00
case "Light Phaser":
// scale the vertical to the display mode
SMSLightPhaserController.FloatRanges[1] = new ControllerDefinition.FloatRange(0, Vdp.FrameHeight / 2, Vdp.FrameHeight - 1);
return SMSLightPhaserController;
2017-08-31 03:02:36 +00:00
default:
return SmsController;
}
}
}
public void FrameAdvance(IController controller, bool render, bool rendersound)
{
_controller = controller;
_lagged = true;
2017-05-08 16:42:22 +00:00
_frame++;
PSG.BeginFrame(Cpu.TotalExecutedCycles);
Cpu.Debug = Tracer.Enabled;
if (!IsGameGear)
{
PSG.StereoPanning = Settings.ForceStereoSeparation ? ForceStereoByte : (byte)0xFF;
}
if (Cpu.Debug && Cpu.Logger == null) // TODO, lets not do this on each frame. But lets refactor CoreComm/CoreComm first
{
2017-05-08 16:42:22 +00:00
Cpu.Logger = s => Tracer.Put(s);
}
if (IsGameGear == false)
{
Cpu.NonMaskableInterrupt = controller.IsPressed("Pause");
}
if (IsGame3D && Settings.Fix3D)
{
Vdp.ExecFrame((Frame & 1) == 0);
}
else
{
Vdp.ExecFrame(render);
}
PSG.EndFrame(Cpu.TotalExecutedCycles);
if (_lagged)
{
_lagCount++;
_isLag = true;
}
else
{
_isLag = false;
}
}
2017-05-08 16:42:22 +00:00
public int Frame => _frame;
2017-05-08 16:42:22 +00:00
public string SystemId => "SMS";
public bool DeterministicEmulation => true;
public void ResetCounters()
{
2017-05-08 16:42:22 +00:00
_frame = 0;
_lagCount = 0;
_isLag = false;
}
2017-05-08 16:42:22 +00:00
public CoreComm CoreComm { get; }
2017-05-08 16:42:22 +00:00
public void Dispose()
{
}
}
}