BizHawk/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/ZXSpectrum.IEmulator.cs

84 lines
1.8 KiB
C#
Raw Normal View History

2017-11-23 17:26:15 +00:00
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
2018-06-14 10:31:09 +00:00
/// <summary>
/// ZXHawk: Core Class
/// * IEmulator *
/// </summary>
2017-11-23 17:26:15 +00:00
public partial class ZXSpectrum : IEmulator
{
public IEmulatorServiceProvider ServiceProvider { get; }
public ControllerDefinition ControllerDefinition { get; set; }
public void FrameAdvance(IController controller, bool render, bool renderSound)
{
_controller = controller;
bool ren = render;
bool renSound = renderSound;
if (DeterministicEmulation)
{
ren = true;
renSound = true;
}
2018-03-06 17:57:13 +00:00
_isLag = true;
2017-11-23 17:26:15 +00:00
if (_tracer.Enabled)
{
_cpu.TraceCallback = s => _tracer.Put(s);
}
else
{
_cpu.TraceCallback = null;
}
_machine.ExecuteFrame(ren, renSound);
2018-03-06 17:57:13 +00:00
if (_isLag)
{
_lagCount++;
}
2017-11-23 17:26:15 +00:00
}
public int Frame
{
get
{
if (_machine == null)
return 0;
else
return _machine.FrameCount;
}
}
2017-11-23 17:26:15 +00:00
public string SystemId => "ZXSpectrum";
private bool deterministicEmulation;
public bool DeterministicEmulation
{
get { return deterministicEmulation; }
}
2017-11-23 17:26:15 +00:00
public void ResetCounters()
{
_machine.FrameCount = 0;
_lagCount = 0;
_isLag = false;
}
public CoreComm CoreComm { get; }
public void Dispose()
{
if (_machine != null)
{
_machine = null;
}
}
}
}