refactor CoreComm usages in Computer cores

This commit is contained in:
adelikat 2020-03-15 09:10:13 -05:00
parent d6af18accb
commit 9fa59bad42
13 changed files with 9 additions and 18 deletions

View File

@ -954,7 +954,7 @@ namespace BizHawk.Client.Common
using (var ti83AsHawkFile = new HawkFile(ti83BiosPath)) using (var ti83AsHawkFile = new HawkFile(ti83BiosPath))
{ {
var ti83BiosAsRom = new RomGame(ti83AsHawkFile); var ti83BiosAsRom = new RomGame(ti83AsHawkFile);
var ti83 = new TI83(nextComm, ti83BiosAsRom.GameInfo, ti83Bios, GetCoreSettings<TI83>()); var ti83 = new TI83(ti83BiosAsRom.GameInfo, ti83Bios, GetCoreSettings<TI83>());
ti83.LinkPort.SendFileToCalc(File.OpenRead(path), false); ti83.LinkPort.SendFileToCalc(File.OpenRead(path), false);
nextEmulator = ti83; nextEmulator = ti83;
} }

View File

@ -80,8 +80,6 @@ namespace BizHawk.Emulation.Cores.Calculators
_isLag = false; _isLag = false;
} }
public CoreComm CoreComm { get; }
public void Dispose() public void Dispose()
{ {
} }

View File

@ -14,13 +14,12 @@ namespace BizHawk.Emulation.Cores.Calculators
public partial class TI83 : IEmulator, IVideoProvider, IDebuggable, IInputPollable, ISettable<TI83.TI83Settings, object> public partial class TI83 : IEmulator, IVideoProvider, IDebuggable, IInputPollable, ISettable<TI83.TI83Settings, object>
{ {
[CoreConstructor("TI83")] [CoreConstructor("TI83")]
public TI83(CoreComm comm, GameInfo game, byte[] rom, object settings) public TI83(GameInfo game, byte[] rom, object settings)
{ {
var ser = new BasicServiceProvider(this); var ser = new BasicServiceProvider(this);
ServiceProvider = ser; ServiceProvider = ser;
PutSettings((TI83Settings)settings ?? new TI83Settings()); PutSettings((TI83Settings)settings ?? new TI83Settings());
CoreComm = comm;
_cpu.FetchMemory = ReadMemory; _cpu.FetchMemory = ReadMemory;
_cpu.ReadMemory = ReadMemory; _cpu.ReadMemory = ReadMemory;
_cpu.WriteMemory = WriteMemory; _cpu.WriteMemory = WriteMemory;

View File

@ -59,8 +59,6 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
_isLag = false; _isLag = false;
} }
public CoreComm CoreComm { get; }
public void Dispose() public void Dispose()
{ {
if (_machine != null) if (_machine != null)

View File

@ -95,6 +95,8 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
SetupMemoryDomains(); SetupMemoryDomains();
} }
internal CoreComm CoreComm { get; }
public Action HardReset; public Action HardReset;
public Action SoftReset; public Action SoftReset;

View File

@ -29,8 +29,6 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
IsLagFrame = false; IsLagFrame = false;
} }
public CoreComm CoreComm { get; }
public void Dispose() public void Dispose()
{ {
} }

View File

@ -32,7 +32,6 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
{ {
var ser = new BasicServiceProvider(this); var ser = new BasicServiceProvider(this);
ServiceProvider = ser; ServiceProvider = ser;
CoreComm = comm;
_tracer = new TraceBuffer _tracer = new TraceBuffer
{ {

View File

@ -91,8 +91,6 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
_frameCycles = 0; _frameCycles = 0;
} }
public CoreComm CoreComm { get; }
public void Dispose() public void Dispose()
{ {
if (_board != null) if (_board != null)

View File

@ -70,6 +70,8 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
SetupMemoryDomains(); SetupMemoryDomains();
} }
private CoreComm CoreComm { get; }
public string RomDetails { get; } public string RomDetails { get; }
// Currently we will require at least one rom. If multiple they MUST be all the same media type in the same format // Currently we will require at least one rom. If multiple they MUST be all the same media type in the same format

View File

@ -150,8 +150,6 @@ namespace BizHawk.Emulation.Cores.Computers.MSX
_isLag = false; _isLag = false;
} }
public CoreComm CoreComm { get; }
public void Dispose() public void Dispose()
{ {
if (MSX_Pntr != IntPtr.Zero) if (MSX_Pntr != IntPtr.Zero)

View File

@ -18,7 +18,6 @@ namespace BizHawk.Emulation.Cores.Computers.MSX
ServiceProvider = new BasicServiceProvider(this); ServiceProvider = new BasicServiceProvider(this);
Settings = (MSXSettings)settings ?? new MSXSettings(); Settings = (MSXSettings)settings ?? new MSXSettings();
SyncSettings = (MSXSyncSettings)syncSettings ?? new MSXSyncSettings(); SyncSettings = (MSXSyncSettings)syncSettings ?? new MSXSyncSettings();
CoreComm = comm;
RomData = rom; RomData = rom;
int size = RomData.Length; int size = RomData.Length;

View File

@ -59,8 +59,6 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
_isLag = false; _isLag = false;
} }
public CoreComm CoreComm { get; }
public void Dispose() public void Dispose()
{ {
if (_machine != null) if (_machine != null)

View File

@ -180,6 +180,8 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
}; };
private int diagIndex = 1; private int diagIndex = 1;
internal CoreComm CoreComm { get; }
private byte[] GetFirmware(int length, params string[] names) private byte[] GetFirmware(int length, params string[] names)
{ {
if (DiagRom & File.Exists(Directory.GetCurrentDirectory() + diagRoms[diagIndex])) if (DiagRom & File.Exists(Directory.GetCurrentDirectory() + diagRoms[diagIndex]))