BizHawk/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/ChannelF.IEmulator.cs

78 lines
1.3 KiB
C#
Raw Normal View History

using System;
using BizHawk.Common.BufferExtensions;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Consoles.ChannelF
{
public partial class ChannelF : IEmulator
{
public IEmulatorServiceProvider ServiceProvider { get; }
public ControllerDefinition ControllerDefinition { get; set; }
public string SystemId => "ChannelF";
public bool DeterministicEmulation { get; set; }
private static double cpuFreq = 1.7897725;
private static double refreshRate = 60;
public int ClockPerFrame;
public int FrameClock = 0;
private void CalcClock()
{
var c = ((cpuFreq * 1000000) / refreshRate);
ClockPerFrame = (int) c;
SetupAudio();
}
public bool FrameAdvance(IController controller, bool render, bool renderSound)
{
2019-05-07 13:43:36 +00:00
_controller = controller;
_isLag = false;
2019-04-17 21:28:12 +00:00
if (_tracer.Enabled)
{
CPU.TraceCallback = s => _tracer.Put(s);
}
else
{
CPU.TraceCallback = null;
}
2019-05-07 13:43:36 +00:00
_isLag = PollInput();
while (FrameClock++ < ClockPerFrame)
{
CPU.ExecuteOne();
}
FrameClock = 0;
_frame++;
return true;
}
private int _frame;
private int _lagcount;
private bool _islag;
public void ResetCounters()
{
_frame = 0;
_lagcount = 0;
_islag = false;
}
public int Frame => _frame;
public CoreComm CoreComm { get; }
public void Dispose()
{
}
}
}