more misc code cleanups, with some C#6isms
This commit is contained in:
parent
fc59710dab
commit
37c989c661
|
@ -1,5 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
|
@ -11,11 +10,11 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
public bool IsActive { get; set; }
|
||||
public int CurrentPlayer{ get; set; }
|
||||
public bool RecordAll { get; set; }
|
||||
public int CurrentPlayer{ get; private set; }
|
||||
public bool RecordAll { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// A user friendly multitrack status
|
||||
/// A user friendly multi-track status
|
||||
/// </summary>
|
||||
public string Status
|
||||
{
|
||||
|
@ -94,12 +93,9 @@ namespace BizHawk.Client.Common
|
|||
public int PlayerSource { get; set; }
|
||||
public int PlayerTargetMask { get; set; }
|
||||
|
||||
public ControllerDefinition Definition { get { return Source.Definition; } }
|
||||
public ControllerDefinition Definition => Source.Definition;
|
||||
|
||||
public bool this[string button]
|
||||
{
|
||||
get { return IsPressed(button); }
|
||||
}
|
||||
public bool this[string button] => IsPressed(button);
|
||||
|
||||
public bool IsPressed(string button)
|
||||
{
|
||||
|
@ -129,7 +125,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
// Ok, this looks like a normal `P1 Button` type thing. we can handle it
|
||||
// Were we supposed to replace this one?
|
||||
int foundPlayerMask = (1 << bnp.PlayerNum);
|
||||
int foundPlayerMask = 1 << bnp.PlayerNum;
|
||||
if ((PlayerTargetMask & foundPlayerMask) == 0)
|
||||
{
|
||||
return button;
|
||||
|
@ -163,22 +159,20 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return new ButtonNameParser
|
||||
{
|
||||
PlayerNum = player,
|
||||
ButtonPart = button.Substring(parts[0].Length + 1)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public int PlayerNum { get; set; }
|
||||
public string ButtonPart { get; private set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("P{0} {1}", PlayerNum, ButtonPart);
|
||||
return $"P{PlayerNum} {ButtonPart}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,8 +48,6 @@ namespace BizHawk.Emulation.Common
|
|||
/// <summary>
|
||||
/// the core can call this to register an additional service
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="provider"></param>
|
||||
public void Register<T>(T provider)
|
||||
where T : IEmulatorService
|
||||
{
|
||||
|
|
|
@ -7,20 +7,12 @@
|
|||
/// <seealso cref="IController" />
|
||||
public class NullController : IController
|
||||
{
|
||||
private static readonly ControllerDefinition _definition = new ControllerDefinition
|
||||
public ControllerDefinition Definition => new ControllerDefinition
|
||||
{
|
||||
Name = "Null Controller"
|
||||
};
|
||||
|
||||
public ControllerDefinition Definition
|
||||
{
|
||||
get { return _definition; }
|
||||
}
|
||||
|
||||
public bool this[string button]
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
public bool this[string button] => false;
|
||||
|
||||
public bool IsPressed(string button)
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
{
|
||||
/// <summary>
|
||||
/// A default IVideoProvider that simply returns
|
||||
/// a black screen at an arbitruary size
|
||||
/// a black screen at an arbitrary size
|
||||
/// </summary>
|
||||
/// <seealso cref="IVideoProvider" />
|
||||
public class NullVideo : IVideoProvider
|
||||
|
@ -12,19 +12,18 @@
|
|||
return new int[BufferWidth * BufferHeight];
|
||||
}
|
||||
|
||||
public int VirtualWidth { get { return 256; } }
|
||||
public int VirtualHeight { get { return 192; } }
|
||||
public int VirtualWidth => 256;
|
||||
|
||||
public int BufferWidth { get { return 256; } }
|
||||
public int BufferHeight { get { return 192; } }
|
||||
public int VirtualHeight => 192;
|
||||
|
||||
public int BackgroundColor { get { return 0; } }
|
||||
public int BufferWidth => 256;
|
||||
|
||||
private static NullVideo _nullVideo = new NullVideo();
|
||||
public int BufferHeight => 192;
|
||||
|
||||
public static NullVideo Instance
|
||||
{
|
||||
get { return _nullVideo; }
|
||||
}
|
||||
public int BackgroundColor => 0;
|
||||
|
||||
private static readonly NullVideo _nullVideo = new NullVideo();
|
||||
|
||||
public static NullVideo Instance => _nullVideo;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,8 +17,11 @@ namespace BizHawk.Emulation.Common
|
|||
|
||||
public ITraceSink Sink { get; set; }
|
||||
|
||||
public bool Enabled { get { return Sink != null; } }
|
||||
public bool Enabled => Sink != null;
|
||||
|
||||
public void Put(TraceInfo info) { Sink.Put(info); }
|
||||
public void Put(TraceInfo info)
|
||||
{
|
||||
Sink.Put(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace BizHawk.Emulation.Common
|
|||
/// <summary>
|
||||
/// This service provides the means to generate disassembly by the core for a given cpu and memory domain
|
||||
/// Tools such the debugger use this, but also lua scripting, and tools like trace logging and code data logging can make use of this tool
|
||||
/// If unavailable the debugger tool will still be avilable but disable the disassembly window but still be available if the IDebuggable service is available
|
||||
/// If unavailable the debugger tool will still be available but disable the disassembly window but still be available if the IDebuggable service is available
|
||||
/// </summary>
|
||||
public interface IDisassemblable : IEmulatorService
|
||||
{
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
}
|
||||
}
|
||||
|
||||
public IMemoryCallbackSystem MemoryCallbacks { get; private set; }
|
||||
public IMemoryCallbackSystem MemoryCallbacks { get; } = new MemoryCallbackSystem();
|
||||
|
||||
public bool CanStep(StepType type)
|
||||
{
|
||||
|
@ -88,10 +88,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
}
|
||||
}
|
||||
|
||||
public int TotalExecutedCycles
|
||||
{
|
||||
get { return Cpu.TotalExecutedCycles; }
|
||||
}
|
||||
public int TotalExecutedCycles => Cpu.TotalExecutedCycles;
|
||||
|
||||
private void StepInto()
|
||||
{
|
||||
|
@ -160,7 +157,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
private const byte RTS = 0x60;
|
||||
|
||||
// the opsize table is used to quickly grab the instruction sizes (in bytes)
|
||||
private readonly byte[] opsize = new byte[]
|
||||
private readonly byte[] opsize =
|
||||
{
|
||||
/*0x00*/ 1,2,0,0,0,2,2,0,1,2,1,0,0,3,3,0,
|
||||
/*0x10*/ 2,2,0,0,0,2,2,0,1,3,0,0,0,3,3,0,
|
||||
|
@ -193,7 +190,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
// 7 = Absolute,X
|
||||
// 8 = Zero Page,Y
|
||||
*/
|
||||
private readonly byte[] optype = new byte[]
|
||||
private readonly byte[] optype =
|
||||
{
|
||||
/*0x00*/ 0,1,0,0,0,2,2,0,0,0,0,0,0,3,3,0,
|
||||
/*0x10*/ 0,4,0,0,0,5,5,0,0,6,0,0,0,7,7,0,
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
set { _islag = value; }
|
||||
}
|
||||
|
||||
public IInputCallbackSystem InputCallbacks { get; private set; }
|
||||
public IInputCallbackSystem InputCallbacks { get; } = new InputCallbackSystem();
|
||||
|
||||
private bool _islag = true;
|
||||
private int _lagcount;
|
||||
|
|
|
@ -25,10 +25,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
{
|
||||
if (Settings == null || Settings.SECAMColors != o.SECAMColors)
|
||||
{
|
||||
if (_tia != null)
|
||||
{
|
||||
_tia.SetSECAM(o.SECAMColors);
|
||||
}
|
||||
_tia?.SetSECAM(o.SECAMColors);
|
||||
}
|
||||
|
||||
Settings = o;
|
||||
|
@ -104,7 +101,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
[DefaultValue(24)]
|
||||
public int NTSCTopLine
|
||||
{
|
||||
get { return this._ntscTopLine; }
|
||||
get { return _ntscTopLine; }
|
||||
set { _ntscTopLine = Math.Min(64, Math.Max(value, 0)); }
|
||||
}
|
||||
|
||||
|
@ -122,8 +119,8 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
[DefaultValue(24)]
|
||||
public int PALTopLine
|
||||
{
|
||||
get { return this._palTopLine; }
|
||||
set { this._palTopLine = Math.Min(64, Math.Max(value, 0)); }
|
||||
get { return _palTopLine; }
|
||||
set { _palTopLine = Math.Min(64, Math.Max(value, 0)); }
|
||||
}
|
||||
|
||||
[DisplayName("PAL Bottom Line")]
|
||||
|
@ -131,8 +128,8 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
[DefaultValue(296)]
|
||||
public int PALBottomLine
|
||||
{
|
||||
get { return this._palBottomLine; }
|
||||
set { this._palBottomLine = Math.Min(310, Math.Max(value, 192)); }
|
||||
get { return _palBottomLine; }
|
||||
set { _palBottomLine = Math.Min(310, Math.Max(value, 192)); }
|
||||
}
|
||||
|
||||
[DisplayName("Background Color")]
|
||||
|
|
|
@ -7,10 +7,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
{
|
||||
public partial class Atari2600 : IStatable
|
||||
{
|
||||
public bool BinarySaveStatesPreferred
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
public bool BinarySaveStatesPreferred => false;
|
||||
|
||||
public void SaveStateText(TextWriter writer)
|
||||
{
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Common.BufferExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
|
@ -22,7 +20,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
private readonly GameInfo _game;
|
||||
private int _frame;
|
||||
|
||||
private ITraceable Tracer { get; set; }
|
||||
private ITraceable Tracer { get; }
|
||||
|
||||
[CoreConstructor("A26")]
|
||||
public Atari2600(CoreComm comm, GameInfo game, byte[] rom, object settings, object syncSettings)
|
||||
|
@ -30,9 +28,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
var ser = new BasicServiceProvider(this);
|
||||
ServiceProvider = ser;
|
||||
|
||||
MemoryCallbacks = new MemoryCallbackSystem();
|
||||
InputCallbacks = new InputCallbackSystem();
|
||||
|
||||
Ram = new byte[128];
|
||||
CoreComm = comm;
|
||||
Settings = (A2600Settings)settings ?? new A2600Settings();
|
||||
|
@ -76,9 +71,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
get { return _pal ? DisplayType.PAL : Common.DisplayType.NTSC; }
|
||||
}
|
||||
|
||||
public string SystemId { get { return "A26"; } }
|
||||
public string SystemId => "A26";
|
||||
|
||||
public string BoardName { get { return _mapper.GetType().Name; } }
|
||||
public string BoardName => _mapper.GetType().Name;
|
||||
|
||||
public CoreComm CoreComm { get; private set; }
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
|
||||
using BizHawk.Common;
|
||||
|
@ -24,7 +23,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
|||
}
|
||||
|
||||
Port1 = (IPort)Activator.CreateInstance(ValidControllerTypes[controller1Name], 1);
|
||||
Port2 = (IPort)Activator.CreateInstance(ValidControllerTypes[controller2Name], 2); ;
|
||||
Port2 = (IPort)Activator.CreateInstance(ValidControllerTypes[controller2Name], 2);
|
||||
|
||||
Definition = new ControllerDefinition
|
||||
{
|
||||
|
@ -41,8 +40,8 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
|||
Definition.FloatRanges.AddRange(Port2.Definition.FloatRanges);
|
||||
}
|
||||
|
||||
public int wheel1;
|
||||
public int wheel2;
|
||||
private int wheel1;
|
||||
private int wheel2;
|
||||
|
||||
public byte ReadPort1(IController c, bool left_mode, bool update_wheel)
|
||||
{
|
||||
|
|
|
@ -4,7 +4,6 @@ using System.ComponentModel;
|
|||
using System.Linq;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Common.ReflectionExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.ColecoVision
|
||||
|
@ -12,7 +11,6 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
|||
/// <summary>
|
||||
/// Represents a controller plugged into a controller port on the intellivision
|
||||
/// </summary>
|
||||
///
|
||||
public interface IPort
|
||||
{
|
||||
byte Read(IController c, bool left_mode, int wheel);
|
||||
|
@ -24,7 +22,6 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
|||
void SyncState(Serializer ser);
|
||||
|
||||
int PortNum { get; }
|
||||
|
||||
}
|
||||
|
||||
[DisplayName("Unplugged Controller")]
|
||||
|
|
|
@ -4,7 +4,6 @@ using System.Collections.Generic;
|
|||
using BizHawk.Common.NumberExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
|
||||
namespace BizHawk.Emulation.Cores.ColecoVision
|
||||
{
|
||||
public partial class ColecoVision : IDebuggable
|
||||
|
@ -121,16 +120,16 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
|||
}
|
||||
}
|
||||
|
||||
public IMemoryCallbackSystem MemoryCallbacks { get; private set; }
|
||||
public IMemoryCallbackSystem MemoryCallbacks { get; }
|
||||
|
||||
public bool CanStep(StepType type) { return false; }
|
||||
public bool CanStep(StepType type) => false;
|
||||
|
||||
[FeatureNotImplemented]
|
||||
public void Step(StepType type) { throw new NotImplementedException(); }
|
||||
|
||||
public int TotalExecutedCycles
|
||||
public void Step(StepType type)
|
||||
{
|
||||
get { return Cpu.TotalExecutedCycles; }
|
||||
}
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public int TotalExecutedCycles => Cpu.TotalExecutedCycles;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
using System;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Cores.Components;
|
||||
using BizHawk.Emulation.Cores.Components;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.ColecoVision
|
||||
{
|
||||
|
|
|
@ -7,10 +7,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
|||
{
|
||||
public partial class ColecoVision : IStatable
|
||||
{
|
||||
public bool BinarySaveStatesPreferred
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
public bool BinarySaveStatesPreferred => false;
|
||||
|
||||
public void SaveStateBinary(BinaryWriter bw)
|
||||
{
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using BizHawk.Emulation.Cores.Components;
|
||||
using BizHawk.Emulation.Cores.Components.Z80;
|
||||
using BizHawk.Common.NumberExtensions;
|
||||
using System;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.ColecoVision
|
||||
{
|
||||
|
@ -16,13 +15,13 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
|||
public sealed partial class ColecoVision : IEmulator, IDebuggable, IInputPollable, IStatable, ISettable<ColecoVision.ColecoSettings, ColecoVision.ColecoSyncSettings>
|
||||
{
|
||||
// ROM
|
||||
public byte[] RomData;
|
||||
public int RomLength;
|
||||
public byte[] BiosRom;
|
||||
private byte[] RomData;
|
||||
private int RomLength;
|
||||
private byte[] BiosRom;
|
||||
|
||||
// Machine
|
||||
public Z80A Cpu;
|
||||
public TMS9918A VDP;
|
||||
private Z80A Cpu;
|
||||
private TMS9918A VDP;
|
||||
|
||||
public byte[] Ram = new byte[1024];
|
||||
private readonly TraceBuffer Tracer = new TraceBuffer();
|
||||
|
@ -36,18 +35,20 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
|||
_syncSettings = (ColecoSyncSettings)SyncSettings ?? new ColecoSyncSettings();
|
||||
bool skipbios = _syncSettings.SkipBiosIntro;
|
||||
|
||||
Cpu = new Z80A();
|
||||
Cpu.ReadMemory = ReadMemory;
|
||||
Cpu.WriteMemory = WriteMemory;
|
||||
Cpu.ReadHardware = ReadPort;
|
||||
Cpu.WriteHardware = WritePort;
|
||||
Cpu.MemoryCallbacks = MemoryCallbacks;
|
||||
Cpu = new Z80A
|
||||
{
|
||||
ReadMemory = ReadMemory,
|
||||
WriteMemory = WriteMemory,
|
||||
ReadHardware = ReadPort,
|
||||
WriteHardware = WritePort,
|
||||
MemoryCallbacks = MemoryCallbacks
|
||||
};
|
||||
|
||||
PSG = new SN76489();
|
||||
_fakeSyncSound = new FakeSyncSound(PSG, 735);
|
||||
(ServiceProvider as BasicServiceProvider).Register<ISoundProvider>(_fakeSyncSound);
|
||||
|
||||
ControllerDeck = new ColecoVisionControllerDeck(this._syncSettings.Port1, this._syncSettings.Port2);
|
||||
ControllerDeck = new ColecoVisionControllerDeck(_syncSettings.Port1, _syncSettings.Port2);
|
||||
|
||||
VDP = new TMS9918A(Cpu);
|
||||
(ServiceProvider as BasicServiceProvider).Register<IVideoProvider>(VDP);
|
||||
|
@ -57,9 +58,12 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
|||
|
||||
// gamedb can overwrite the syncsettings; this is ok
|
||||
if (game["NoSkip"])
|
||||
{
|
||||
skipbios = false;
|
||||
}
|
||||
|
||||
LoadRom(rom, skipbios);
|
||||
this.game = game;
|
||||
_game = game;
|
||||
SetupMemoryDomains();
|
||||
|
||||
Tracer.Header = Cpu.TraceHeader;
|
||||
|
@ -68,16 +72,18 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
|||
serviceProvider.Register<ITraceable>(Tracer);
|
||||
}
|
||||
|
||||
public IEmulatorServiceProvider ServiceProvider { get; private set; }
|
||||
public IEmulatorServiceProvider ServiceProvider { get; }
|
||||
|
||||
public ControllerDefinition ControllerDefinition
|
||||
{
|
||||
get { return ControllerDeck.Definition; }
|
||||
}
|
||||
public ColecoVisionControllerDeck ControllerDeck { get; private set; }
|
||||
|
||||
public ColecoVisionControllerDeck ControllerDeck { get; }
|
||||
|
||||
public IController Controller { get; set; }
|
||||
|
||||
const ushort RamSizeMask = 0x03FF;
|
||||
private const ushort RamSizeMask = 0x03FF;
|
||||
|
||||
public void FrameAdvance(bool render, bool renderSound)
|
||||
{
|
||||
|
@ -106,7 +112,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
|||
}
|
||||
}
|
||||
|
||||
void LoadRom(byte[] rom, bool skipbios)
|
||||
private void LoadRom(byte[] rom, bool skipbios)
|
||||
{
|
||||
RomData = new byte[0x8000];
|
||||
for (int i = 0; i < 0x8000; i++)
|
||||
|
@ -120,28 +126,34 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
|||
}
|
||||
}
|
||||
|
||||
byte ReadPort(ushort port)
|
||||
private byte ReadPort(ushort port)
|
||||
{
|
||||
port &= 0xFF;
|
||||
|
||||
if (port >= 0xA0 && port < 0xC0)
|
||||
{
|
||||
if ((port & 1) == 0)
|
||||
{
|
||||
return VDP.ReadData();
|
||||
}
|
||||
|
||||
return VDP.ReadVdpStatus();
|
||||
}
|
||||
|
||||
if (port >= 0xE0)
|
||||
{
|
||||
if ((port & 1) == 0)
|
||||
{
|
||||
return ReadController1();
|
||||
}
|
||||
|
||||
return ReadController2();
|
||||
}
|
||||
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
void WritePort(ushort port, byte value)
|
||||
private void WritePort(ushort port, byte value)
|
||||
{
|
||||
port &= 0xFF;
|
||||
|
||||
|
@ -173,9 +185,10 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
|||
}
|
||||
}
|
||||
|
||||
public bool DeterministicEmulation { get { return true; } }
|
||||
public bool DeterministicEmulation => true;
|
||||
|
||||
public void Dispose() { }
|
||||
|
||||
public void ResetCounters()
|
||||
{
|
||||
Frame = 0;
|
||||
|
@ -183,9 +196,10 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
|||
_isLag = false;
|
||||
}
|
||||
|
||||
public string SystemId { get { return "Coleco"; } }
|
||||
public GameInfo game;
|
||||
public CoreComm CoreComm { get; private set; }
|
||||
public string BoardName { get { return null; } }
|
||||
public string SystemId => "Coleco";
|
||||
|
||||
private GameInfo _game;
|
||||
public CoreComm CoreComm { get; }
|
||||
public string BoardName => null;
|
||||
}
|
||||
}
|
|
@ -1,7 +1,4 @@
|
|||
using BizHawk.Emulation.Common;
|
||||
using System;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.ColecoVision
|
||||
namespace BizHawk.Emulation.Cores.ColecoVision
|
||||
{
|
||||
public partial class ColecoVision
|
||||
{
|
||||
|
@ -25,7 +22,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
|||
public enum InputPortMode { Left, Right }
|
||||
InputPortMode InputPortSelection;
|
||||
|
||||
byte ReadController1()
|
||||
private byte ReadController1()
|
||||
{
|
||||
_isLag = false;
|
||||
byte retval;
|
||||
|
@ -43,8 +40,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
|||
return 0x7F;
|
||||
}
|
||||
|
||||
|
||||
byte ReadController2()
|
||||
private byte ReadController2()
|
||||
{
|
||||
_isLag = false;
|
||||
byte retval;
|
||||
|
@ -63,6 +59,6 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
|||
}
|
||||
|
||||
public int Frame { get { return frame; } set { frame = value; } }
|
||||
int frame;
|
||||
private int frame;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
using BizHawk.Common;
|
||||
using System;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Common.BufferExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
using System;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Intellivision
|
||||
{
|
||||
|
@ -68,11 +69,13 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
{
|
||||
return Data[addr - 0x5000];
|
||||
}
|
||||
else if (addr>=0xD000 && addr<=0xDFFF)
|
||||
|
||||
if (addr >= 0xD000 && addr <= 0xDFFF)
|
||||
{
|
||||
return Data[addr - 0xB000];
|
||||
}
|
||||
else if (addr>=0xF000 && addr<=0xFFFF)
|
||||
|
||||
if (addr >= 0xF000 && addr <= 0xFFFF)
|
||||
{
|
||||
return Data[addr - 0xC000];
|
||||
}
|
||||
|
@ -83,7 +86,8 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
{
|
||||
return Data[addr - 0x5000];
|
||||
}
|
||||
else if (addr >= 0xD000 && addr <= 0xFFFF)
|
||||
|
||||
if (addr >= 0xD000 && addr <= 0xFFFF)
|
||||
{
|
||||
return Data[addr - 0xB000];
|
||||
}
|
||||
|
@ -94,11 +98,13 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
{
|
||||
return Data[addr - 0x5000];
|
||||
}
|
||||
else if (addr >= 0x9000 && addr <= 0xBFFF)
|
||||
|
||||
if (addr >= 0x9000 && addr <= 0xBFFF)
|
||||
{
|
||||
return Data[addr - 0x7000];
|
||||
}
|
||||
else if (addr >= 0xD000 && addr <= 0xDFFF)
|
||||
|
||||
if (addr >= 0xD000 && addr <= 0xDFFF)
|
||||
{
|
||||
return Data[addr - 0x8000];
|
||||
}
|
||||
|
@ -109,15 +115,18 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
{
|
||||
return Data[addr - 0x5000];
|
||||
}
|
||||
else if (addr >= 0x9000 && addr <= 0xAFFF)
|
||||
|
||||
if (addr >= 0x9000 && addr <= 0xAFFF)
|
||||
{
|
||||
return Data[addr - 0x7000];
|
||||
}
|
||||
else if (addr >= 0xD000 && addr <= 0xDFFF)
|
||||
|
||||
if (addr >= 0xD000 && addr <= 0xDFFF)
|
||||
{
|
||||
return Data[addr - 0x9000];
|
||||
}
|
||||
else if (addr >= 0xF000 && addr <= 0xFFFF)
|
||||
|
||||
if (addr >= 0xF000 && addr <= 0xFFFF)
|
||||
{
|
||||
return Data[addr - 0xA000];
|
||||
}
|
||||
|
@ -128,7 +137,8 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
{
|
||||
return Data[addr - 0x5000];
|
||||
}
|
||||
else if (addr >= 0xD000 && addr <= 0xD3FF)
|
||||
|
||||
if (addr >= 0xD000 && addr <= 0xD3FF)
|
||||
{
|
||||
return Cart_Ram[addr - 0xD000];
|
||||
}
|
||||
|
@ -139,7 +149,8 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
{
|
||||
return Data[addr - 0x5000];
|
||||
}
|
||||
else if (addr >= 0x9000 && addr <= 0xBFFF)
|
||||
|
||||
if (addr >= 0x9000 && addr <= 0xBFFF)
|
||||
{
|
||||
return Data[addr - 0x6000];
|
||||
}
|
||||
|
@ -175,19 +186,23 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
{
|
||||
return Data[addr - 0x5000];
|
||||
}
|
||||
else if (addr >= 0x9000 && addr <= 0xAFFF)
|
||||
|
||||
if (addr >= 0x9000 && addr <= 0xAFFF)
|
||||
{
|
||||
return Data[addr - 0x7000];
|
||||
}
|
||||
else if (addr >= 0xD000 && addr <= 0xDFFF)
|
||||
|
||||
if (addr >= 0xD000 && addr <= 0xDFFF)
|
||||
{
|
||||
return Data[addr - 0x9000];
|
||||
}
|
||||
else if (addr >= 0xF000 && addr <= 0xFFFF)
|
||||
|
||||
if (addr >= 0xF000 && addr <= 0xFFFF)
|
||||
{
|
||||
return Data[addr - 0xA000];
|
||||
}
|
||||
else if (addr >= 0x8800 && addr <= 0x8FFF)
|
||||
|
||||
if (addr >= 0x8800 && addr <= 0x8FFF)
|
||||
{
|
||||
return Cart_Ram[addr - 0x8800];
|
||||
}
|
||||
|
@ -198,11 +213,13 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
{
|
||||
return Data[addr - 0x5000];
|
||||
}
|
||||
else if (addr >= 0x8800 && addr <= 0xB7FF)
|
||||
|
||||
if (addr >= 0x8800 && addr <= 0xB7FF)
|
||||
{
|
||||
return Data[addr - 0x6800];
|
||||
}
|
||||
else if (addr >= 0xD000 && addr <= 0xFFFF)
|
||||
|
||||
if (addr >= 0xD000 && addr <= 0xFFFF)
|
||||
{
|
||||
return Data[addr - 0x8000];
|
||||
}
|
||||
|
@ -232,6 +249,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
|
||||
using BizHawk.Common;
|
||||
|
@ -24,7 +23,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
}
|
||||
|
||||
Port1 = (IPort)Activator.CreateInstance(ValidControllerTypes[controller1Name], 1);
|
||||
Port2 = (IPort)Activator.CreateInstance(ValidControllerTypes[controller2Name], 2); ;
|
||||
Port2 = (IPort)Activator.CreateInstance(ValidControllerTypes[controller2Name], 2);
|
||||
|
||||
Definition = new ControllerDefinition
|
||||
{
|
||||
|
@ -51,7 +50,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
return Port2.Read(c);
|
||||
}
|
||||
|
||||
public ControllerDefinition Definition { get; private set; }
|
||||
public ControllerDefinition Definition { get; }
|
||||
|
||||
public void SyncState(Serializer ser)
|
||||
{
|
||||
|
|
|
@ -1,28 +1,29 @@
|
|||
using BizHawk.Emulation.Common;
|
||||
using System;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Intellivision
|
||||
{
|
||||
public sealed partial class Intellivision : IEmulator
|
||||
{
|
||||
public IEmulatorServiceProvider ServiceProvider { get; private set; }
|
||||
public IEmulatorServiceProvider ServiceProvider { get; }
|
||||
|
||||
public ControllerDefinition ControllerDefinition
|
||||
{
|
||||
get { return ControllerDeck.Definition; }
|
||||
}
|
||||
public ControllerDefinition ControllerDefinition => ControllerDeck.Definition;
|
||||
|
||||
public IController Controller { get; set; }
|
||||
|
||||
public void FrameAdvance(bool render, bool rendersound)
|
||||
{
|
||||
if (Tracer.Enabled)
|
||||
{
|
||||
_cpu.TraceCallback = (s) => Tracer.Put(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
_cpu.TraceCallback = null;
|
||||
}
|
||||
|
||||
_frame++;
|
||||
stic_row = -1;
|
||||
|
||||
// read the controller state here for now
|
||||
get_controller_state();
|
||||
|
||||
|
@ -30,7 +31,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
int delay_cycles = 700;
|
||||
int delay_timer = -1;
|
||||
|
||||
_cpu.PendingCycles = (14934 - 3791 + _cpu.GetPendingCycles());
|
||||
_cpu.PendingCycles = 14934 - 3791 + _cpu.GetPendingCycles();
|
||||
_stic.Sr1 = true;
|
||||
islag = true;
|
||||
|
||||
|
@ -68,6 +69,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
_stic.Background(stic_row);
|
||||
_stic.in_vb_2 = false;
|
||||
}
|
||||
|
||||
stic_row++;
|
||||
}
|
||||
Connect();
|
||||
|
@ -85,7 +87,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
_stic.active_display = false;
|
||||
_stic.Sr1 = false;
|
||||
|
||||
_cpu.PendingCycles = (3000 + _cpu.GetPendingCycles());
|
||||
_cpu.PendingCycles = 3000 + _cpu.GetPendingCycles();
|
||||
|
||||
while (_cpu.GetPendingCycles() > 0)
|
||||
{
|
||||
|
@ -95,7 +97,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
}
|
||||
|
||||
// vblank phase 2
|
||||
_cpu.PendingCycles = (791 + _cpu.GetPendingCycles());
|
||||
_cpu.PendingCycles = 791 + _cpu.GetPendingCycles();
|
||||
_stic.in_vb_1 = false;
|
||||
|
||||
while (_cpu.GetPendingCycles() > 0)
|
||||
|
@ -121,17 +123,15 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
public bool islag;
|
||||
public int lagcount;
|
||||
private int stic_row;
|
||||
public int Frame { get { return _frame; } }
|
||||
|
||||
public string SystemId
|
||||
{
|
||||
get { return "INTV"; }
|
||||
}
|
||||
public int Frame => _frame;
|
||||
|
||||
public bool DeterministicEmulation { get { return true; } }
|
||||
public string SystemId => "INTV";
|
||||
|
||||
public bool DeterministicEmulation => true;
|
||||
|
||||
[FeatureNotImplemented]
|
||||
public string BoardName { get { return null; } }
|
||||
public string BoardName => null;
|
||||
|
||||
public void ResetCounters()
|
||||
{
|
||||
|
@ -139,7 +139,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
lagcount = 0;
|
||||
}
|
||||
|
||||
public CoreComm CoreComm { get; private set; }
|
||||
public CoreComm CoreComm { get; }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue