2017-05-05 16:56:28 +00:00
|
|
|
|
using BizHawk.Emulation.Common;
|
2017-11-08 23:22:53 +00:00
|
|
|
|
using System;
|
2017-05-05 16:56:28 +00:00
|
|
|
|
|
|
|
|
|
namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|
|
|
|
{
|
|
|
|
|
public partial class Atari2600 : IEmulator
|
|
|
|
|
{
|
|
|
|
|
public IEmulatorServiceProvider ServiceProvider { get; }
|
|
|
|
|
|
2017-06-27 20:14:41 +00:00
|
|
|
|
public ControllerDefinition ControllerDefinition => _controllerDeck.Definition;
|
2017-05-05 16:56:28 +00:00
|
|
|
|
|
|
|
|
|
public void FrameAdvance(IController controller, bool render, bool rendersound)
|
|
|
|
|
{
|
|
|
|
|
_controller = controller;
|
|
|
|
|
|
2017-09-20 14:27:27 +00:00
|
|
|
|
_frame++;
|
|
|
|
|
_islag = true;
|
|
|
|
|
|
|
|
|
|
// Handle all the console controls here
|
|
|
|
|
if (_controller.IsPressed("Power"))
|
|
|
|
|
{
|
|
|
|
|
HardReset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_controller.IsPressed("Toggle Left Difficulty") && !_leftDifficultySwitchHeld)
|
|
|
|
|
{
|
|
|
|
|
_leftDifficultySwitchPressed ^= true;
|
|
|
|
|
_leftDifficultySwitchHeld = true;
|
|
|
|
|
}
|
|
|
|
|
else if (!_controller.IsPressed("Toggle Left Difficulty"))
|
|
|
|
|
{
|
|
|
|
|
_leftDifficultySwitchHeld = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_controller.IsPressed("Toggle Right Difficulty") && !_rightDifficultySwitchHeld)
|
|
|
|
|
{
|
|
|
|
|
_rightDifficultySwitchPressed ^= true;
|
|
|
|
|
_rightDifficultySwitchHeld = true;
|
|
|
|
|
}
|
|
|
|
|
else if (!_controller.IsPressed("Toggle Right Difficulty"))
|
|
|
|
|
{
|
|
|
|
|
_rightDifficultySwitchHeld = false;
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-08 19:11:13 +00:00
|
|
|
|
int count = 0;
|
2017-09-20 14:27:27 +00:00
|
|
|
|
while (!_tia.New_Frame)
|
2017-05-05 16:56:28 +00:00
|
|
|
|
{
|
|
|
|
|
Cycle();
|
2017-11-08 19:11:13 +00:00
|
|
|
|
count++;
|
|
|
|
|
if (count > 1000000) { throw new Exception("ERROR: Unable to resolve Frame. Please Report."); }
|
2017-05-05 16:56:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-09-20 14:27:27 +00:00
|
|
|
|
_tia.New_Frame = false;
|
|
|
|
|
|
2017-05-05 16:56:28 +00:00
|
|
|
|
if (rendersound == false)
|
|
|
|
|
{
|
2017-05-05 18:49:36 +00:00
|
|
|
|
_tia.AudioClocks = 0; // we need this here since the async sound provider won't check in this case
|
2017-05-05 16:56:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-09-20 14:27:27 +00:00
|
|
|
|
if (_islag)
|
|
|
|
|
{
|
|
|
|
|
_lagcount++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_tia.LineCount = 0;
|
2017-05-05 16:56:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int Frame => _frame;
|
|
|
|
|
|
|
|
|
|
public string SystemId => "A26";
|
|
|
|
|
|
|
|
|
|
public bool DeterministicEmulation => true;
|
|
|
|
|
|
|
|
|
|
public CoreComm CoreComm { get; }
|
|
|
|
|
|
|
|
|
|
public void ResetCounters()
|
|
|
|
|
{
|
|
|
|
|
_frame = 0;
|
|
|
|
|
_lagcount = 0;
|
|
|
|
|
_islag = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|