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-04-27 00:09:00 +00:00
|
|
|
|
public IController Controller { private get; set; }
|
2016-02-28 17:01:12 +00:00
|
|
|
|
|
|
|
|
|
public void FrameAdvance(bool render, bool rendersound)
|
|
|
|
|
{
|
|
|
|
|
_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)
|
|
|
|
|
{
|
2016-12-14 18:42:15 +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() { }
|
|
|
|
|
}
|
|
|
|
|
}
|