2016-02-28 17:01:12 +00:00
|
|
|
|
using BizHawk.Emulation.Common;
|
|
|
|
|
|
|
|
|
|
namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
|
|
|
|
{
|
|
|
|
|
public sealed partial class SMS : IEmulator
|
|
|
|
|
{
|
|
|
|
|
public IEmulatorServiceProvider ServiceProvider { get; private set; }
|
|
|
|
|
|
|
|
|
|
public ControllerDefinition ControllerDefinition
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (IsGameGear)
|
|
|
|
|
{
|
|
|
|
|
return GGController;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return SmsController;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-02 01:09:11 +00:00
|
|
|
|
public void FrameAdvance(IController controller, bool render, bool rendersound)
|
2016-02-28 17:01:12 +00:00
|
|
|
|
{
|
2017-05-02 01:09:11 +00:00
|
|
|
|
_controller = controller;
|
2016-02-28 17:01:12 +00:00
|
|
|
|
_lagged = true;
|
|
|
|
|
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
|
|
|
|
|
{
|
|
|
|
|
Cpu.Logger = (s) => Tracer.Put(s);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (IsGameGear == false)
|
|
|
|
|
{
|
2017-05-02 01:09:11 +00:00
|
|
|
|
Cpu.NonMaskableInterrupt = controller.IsPressed("Pause");
|
2016-02-28 17:01:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string SystemId { get { return "SMS"; } }
|
|
|
|
|
|
|
|
|
|
public bool DeterministicEmulation { get { return true; } }
|
|
|
|
|
|
|
|
|
|
public void ResetCounters()
|
|
|
|
|
{
|
|
|
|
|
Frame = 0;
|
|
|
|
|
_lagCount = 0;
|
|
|
|
|
_isLag = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public CoreComm CoreComm { get; private set; }
|
|
|
|
|
|
|
|
|
|
public void Dispose() { }
|
|
|
|
|
}
|
|
|
|
|
}
|