Atari 2600 - add alyosha as an author, break up IEmulator code to its own file, some misc cleanup
This commit is contained in:
parent
59139ab266
commit
daf3b2539b
|
@ -290,6 +290,9 @@
|
|||
<Compile Include="Consoles\Atari\2600\Atari2600.IDebuggable.cs">
|
||||
<DependentUpon>Atari2600.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Consoles\Atari\2600\Atari2600.IEmulator.cs">
|
||||
<DependentUpon>Atari2600.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Consoles\Atari\2600\Atari2600.IInputPollable.cs">
|
||||
<DependentUpon>Atari2600.cs</DependentUpon>
|
||||
</Compile>
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
|
|||
var domains = new List<MemoryDomain>();
|
||||
|
||||
var mainRamDomain = new MemoryDomainDelegate("Main Ram", 0xC000, MemoryDomain.Endian.Little,
|
||||
(addr) =>
|
||||
addr =>
|
||||
{
|
||||
if (addr < 0 || addr >= 0xC000)
|
||||
{
|
||||
|
@ -34,7 +34,7 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
|
|||
domains.Add(mainRamDomain);
|
||||
|
||||
var systemBusDomain = new MemoryDomainDelegate("System Bus", 0x10000, MemoryDomain.Endian.Little,
|
||||
(addr) =>
|
||||
addr =>
|
||||
{
|
||||
if (addr < 0 || addr >= 65536)
|
||||
{
|
||||
|
|
|
@ -172,7 +172,7 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
|
|||
_prevPressed = false;
|
||||
}
|
||||
|
||||
_machine.BizFrameAdvance(RealButtons.Where(b => controller.IsPressed(b)));
|
||||
_machine.BizFrameAdvance(RealButtons.Where(controller.IsPressed));
|
||||
if (IsLagFrame)
|
||||
{
|
||||
LagCount++;
|
||||
|
|
|
@ -14,6 +14,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
private DCFilter _dcfilter;
|
||||
private MapperBase _mapper;
|
||||
|
||||
private readonly GameInfo _game;
|
||||
private int _frame;
|
||||
|
||||
internal byte[] Ram;
|
||||
|
||||
internal byte[] Rom { get; private set; }
|
||||
|
@ -31,6 +34,16 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
private bool _leftDifficultySwitchHeld = false;
|
||||
private bool _rightDifficultySwitchHeld = false;
|
||||
|
||||
private static readonly ControllerDefinition Atari2600ControllerDefinition = new ControllerDefinition
|
||||
{
|
||||
Name = "Atari 2600 Basic Controller",
|
||||
BoolButtons =
|
||||
{
|
||||
"P1 Up", "P1 Down", "P1 Left", "P1 Right", "P1 Button",
|
||||
"P2 Up", "P2 Down", "P2 Left", "P2 Right", "P2 Button",
|
||||
"Reset", "Select", "Power", "Toggle Left Difficulty", "Toggle Right Difficulty"
|
||||
}
|
||||
};
|
||||
|
||||
internal byte BaseReadMemory(ushort addr)
|
||||
{
|
||||
|
@ -365,17 +378,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
|
||||
private IController _controller;
|
||||
|
||||
public void FrameAdvance(IController controller, bool render, bool rendersound)
|
||||
{
|
||||
_controller = controller;
|
||||
StartFrameCond();
|
||||
while (_tia.LineCount < _tia.NominalNumScanlines)
|
||||
Cycle();
|
||||
if (rendersound==false)
|
||||
_tia._audioClocks = 0; // we need this here since the async sound provider won't check in this case
|
||||
FinishFrameCond();
|
||||
}
|
||||
|
||||
private void VFrameAdvance() // advance up to 500 lines looking for end of video frame
|
||||
// after vsync falling edge, continues to end of next line
|
||||
{
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
||||
{
|
||||
public partial class Atari2600 : IEmulator
|
||||
{
|
||||
public IEmulatorServiceProvider ServiceProvider { get; }
|
||||
|
||||
public ControllerDefinition ControllerDefinition => Atari2600ControllerDefinition;
|
||||
|
||||
public void FrameAdvance(IController controller, bool render, bool rendersound)
|
||||
{
|
||||
_controller = controller;
|
||||
|
||||
StartFrameCond();
|
||||
while (_tia.LineCount < _tia.NominalNumScanlines)
|
||||
{
|
||||
Cycle();
|
||||
}
|
||||
|
||||
if (rendersound == false)
|
||||
{
|
||||
_tia._audioClocks = 0; // we need this here since the async sound provider won't check in this case
|
||||
}
|
||||
|
||||
FinishFrameCond();
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,18 +9,13 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
{
|
||||
[CoreAttributes(
|
||||
"Atari2600Hawk",
|
||||
"Micro500, adelikat, natt",
|
||||
"Micro500, Alyosha, adelikat, natt",
|
||||
isPorted: false,
|
||||
isReleased: true)]
|
||||
[ServiceNotApplicable(typeof(ISaveRam), typeof(IDriveLight))]
|
||||
public partial class Atari2600 : IEmulator, IStatable, IDebuggable, IInputPollable, IBoardInfo,
|
||||
IRegionable, ICreateGameDBEntries, ISettable<Atari2600.A2600Settings, Atari2600.A2600SyncSettings>
|
||||
{
|
||||
private readonly GameInfo _game;
|
||||
private int _frame;
|
||||
|
||||
private ITraceable Tracer { get; }
|
||||
|
||||
[CoreConstructor("A26")]
|
||||
public Atari2600(CoreComm comm, GameInfo game, byte[] rom, object settings, object syncSettings)
|
||||
{
|
||||
|
@ -63,30 +58,11 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
ser.Register<ISoundProvider>(_dcfilter);
|
||||
}
|
||||
|
||||
public IEmulatorServiceProvider ServiceProvider { get; }
|
||||
|
||||
// IRegionable
|
||||
public DisplayType Region => _pal ? DisplayType.PAL : DisplayType.NTSC;
|
||||
|
||||
public string SystemId => "A26";
|
||||
|
||||
public CoreComm CoreComm { get; }
|
||||
|
||||
public ControllerDefinition ControllerDefinition { get { return Atari2600ControllerDefinition; } }
|
||||
|
||||
public int Frame { get { return _frame; } set { _frame = value; } }
|
||||
|
||||
public bool DeterministicEmulation { get; set; }
|
||||
|
||||
public static readonly ControllerDefinition Atari2600ControllerDefinition = new ControllerDefinition
|
||||
{
|
||||
Name = "Atari 2600 Basic Controller",
|
||||
BoolButtons =
|
||||
{
|
||||
"P1 Up", "P1 Down", "P1 Left", "P1 Right", "P1 Button",
|
||||
"P2 Up", "P2 Down", "P2 Left", "P2 Right", "P2 Button",
|
||||
"Reset", "Select", "Power", "Toggle Left Difficulty", "Toggle Right Difficulty"
|
||||
}
|
||||
};
|
||||
// ITraceable
|
||||
private ITraceable Tracer { get; }
|
||||
|
||||
// ICreateGameDBEntries
|
||||
public CompactGameInfo GenerateGameDbEntry()
|
||||
|
@ -105,25 +81,19 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
// IBoardInfo
|
||||
public string BoardName => _mapper.GetType().Name;
|
||||
|
||||
public void ResetCounters()
|
||||
{
|
||||
_frame = 0;
|
||||
_lagcount = 0;
|
||||
_islag = false;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
private static bool DetectPal(GameInfo game, byte[] rom)
|
||||
{
|
||||
// force NTSC mode for the new core we instantiate
|
||||
var newgame = game.Clone();
|
||||
if (newgame["PAL"])
|
||||
{
|
||||
newgame.RemoveOption("PAL");
|
||||
}
|
||||
|
||||
if (!newgame["NTSC"])
|
||||
{
|
||||
newgame.AddOption("NTSC");
|
||||
}
|
||||
|
||||
// give the emu a minimal of input\output connections so it doesn't crash
|
||||
var comm = new CoreComm(null, null);
|
||||
|
|
Loading…
Reference in New Issue