use property initializers in some cores and some constructor cleanups

This commit is contained in:
adelikat 2020-02-18 10:54:39 -06:00
parent 665b331797
commit 2ccf03fd44
8 changed files with 12 additions and 26 deletions

View File

@ -16,7 +16,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
set => _lagCount = value;
}
public IInputCallbackSystem InputCallbacks { get; }
public IInputCallbackSystem InputCallbacks { get; } = new InputCallbackSystem();
private bool _isLagFrame;
private int _lagCount;

View File

@ -23,7 +23,6 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
var ser = new BasicServiceProvider(this);
ServiceProvider = ser;
InputCallbacks = new InputCallbackSystem();
CoreComm = comm;
_roms = roms?.ToList() ?? new List<byte[]>();

View File

@ -14,7 +14,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
public void SetCpuRegister(string register, int value) => _cpu.SetCpuRegister(register, value);
public IMemoryCallbackSystem MemoryCallbacks { get; }
public IMemoryCallbackSystem MemoryCallbacks { get; } = new MemoryCallbackSystem(new[] { "System Bus" });
public bool CanStep(StepType type) => false;

View File

@ -20,7 +20,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
set => _isLag = value;
}
public IInputCallbackSystem InputCallbacks { get; }
public IInputCallbackSystem InputCallbacks { get; } = new InputCallbackSystem();
private int _lagCount = 0;
private bool _isLag = false;

View File

@ -25,9 +25,6 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
var ser = new BasicServiceProvider(this);
ServiceProvider = ser;
InputCallbacks = new InputCallbackSystem();
MemoryCallbacks = new MemoryCallbackSystem(new[] { "System Bus" });
CoreComm = comm;
_gameInfo = game;

View File

@ -33,18 +33,12 @@ namespace BizHawk.Emulation.Cores.PCEngine
throw new NotImplementedException();
}
public IMemoryCallbackSystem MemoryCallbacks { get; }
public IMemoryCallbackSystem MemoryCallbacks { get; } = new MemoryCallbackSystem(new[] { "System Bus" });
public bool CanStep(StepType type)
{
return false;
}
public bool CanStep(StepType type) => false;
[FeatureNotImplemented]
public void Step(StepType type)
{
throw new NotImplementedException();
}
public void Step(StepType type) => throw new NotImplementedException();
public long TotalExecutedCycles => Cpu.TotalExecutedCycles;
}

View File

@ -4,7 +4,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
{
public sealed partial class PCEngine : IDriveLight
{
public bool DriveLightEnabled { get; }
public bool DriveLightEnabled { get; } = true;
public bool DriveLightOn { get; internal set; }
}

View File

@ -22,7 +22,6 @@ namespace BizHawk.Emulation.Cores.PCEngine
[CoreConstructor("PCE", "SGX")]
public PCEngine(CoreComm comm, GameInfo game, byte[] rom, object settings, object syncSettings)
{
MemoryCallbacks = new MemoryCallbackSystem(new[] { "System Bus" });
CoreComm = comm;
switch (game.System)
@ -50,19 +49,16 @@ namespace BizHawk.Emulation.Cores.PCEngine
_syncSettings.Port5);
}
public PCEngine(CoreComm comm, GameInfo game, Disc disc, object Settings, object syncSettings)
public PCEngine(CoreComm comm, GameInfo game, Disc disc, object settings, object syncSettings)
{
CoreComm = comm;
MemoryCallbacks = new MemoryCallbackSystem(new[] { "System Bus" });
DriveLightEnabled = true;
SystemId = "PCECD";
Type = NecSystemType.TurboCD;
this.disc = disc;
this.Settings = (PCESettings)Settings ?? new PCESettings();
Settings = (PCESettings)settings ?? new PCESettings();
_syncSettings = (PCESyncSettings)syncSettings ?? new PCESyncSettings();
GameInfo biosInfo;
byte[] rom = CoreComm.CoreFileProvider.GetFirmwareWithGameInfo("PCECD", "Bios", true, out biosInfo,
byte[] rom = CoreComm.CoreFileProvider.GetFirmwareWithGameInfo("PCECD", "Bios", true, out var biosInfo,
"PCE-CD System Card not found. Please check the BIOS settings in Config->Firmwares.");
if (biosInfo.Status == RomStatus.BadDump)
@ -101,7 +97,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
Init(game, rom);
// the default RomStatusDetails don't do anything with Disc
CoreComm.RomStatusDetails = $"{game.Name}\r\nDisk partial hash:{new DiscSystem.DiscHasher(disc).OldHash()}";
CoreComm.RomStatusDetails = $"{game.Name}\r\nDisk partial hash:{new DiscHasher(disc).OldHash()}";
_controllerDeck = new PceControllerDeck(
_syncSettings.Port1,
@ -220,7 +216,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
RomLength = RomData.Length;
// user request: current value of the SF2MapperLatch on the tracelogger
Cpu.Logger = (s) => Tracer.Put(new TraceInfo
Cpu.Logger = s => Tracer.Put(new TraceInfo
{
Disassembly = $"{SF2MapperLatch:X1}:{s}",
RegisterInfo = ""