refactor CoreComm usage in some Gameboy cores

This commit is contained in:
adelikat 2020-03-15 09:28:27 -05:00
parent 5886416cbf
commit 028bc83c88
6 changed files with 3 additions and 15 deletions

View File

@ -52,7 +52,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
ser.Register<IMemoryDomains>(_memoryDomains); ser.Register<IMemoryDomains>(_memoryDomains);
ServiceProvider = ser; ServiceProvider = ser;
CoreComm = comm;
PutSettings(_settings); PutSettings(_settings);
_tracer = new TraceBuffer _tracer = new TraceBuffer
@ -149,8 +148,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
IsLagFrame = false; IsLagFrame = false;
} }
public CoreComm CoreComm { get; }
public void Dispose() public void Dispose()
{ {
if (_core != IntPtr.Zero) if (_core != IntPtr.Zero)

View File

@ -19,9 +19,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
ser.Register<IDisassemblable>(new ArmV4Disassembler()); ser.Register<IDisassemblable>(new ArmV4Disassembler());
ServiceProvider = ser; ServiceProvider = ser;
CoreComm = comm; byte[] biosfile = comm.CoreFileProvider.GetFirmware("GBA", "Bios", true, "GBA bios file is mandatory.");
byte[] biosfile = CoreComm.CoreFileProvider.GetFirmware("GBA", "Bios", true, "GBA bios file is mandatory.");
if (file.Length > 32 * 1024 * 1024) if (file.Length > 32 * 1024 * 1024)
throw new ArgumentException("ROM is too big to be a GBA ROM!"); throw new ArgumentException("ROM is too big to be a GBA ROM!");
if (biosfile.Length != 16 * 1024) if (biosfile.Length != 16 * 1024)
@ -131,8 +129,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
/// </summary> /// </summary>
public string GameCode { get; } public string GameCode { get; }
public CoreComm CoreComm { get; }
public void Dispose() public void Dispose()
{ {
if (Core != IntPtr.Zero) if (Core != IntPtr.Zero)

View File

@ -91,8 +91,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
frameOverflow = 0; frameOverflow = 0;
} }
public CoreComm CoreComm { get; }
public void Dispose() public void Dispose()
{ {
if (GambatteState != IntPtr.Zero) if (GambatteState != IntPtr.Zero)

View File

@ -34,7 +34,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
}; };
ser.Register<ITraceable>(Tracer); ser.Register<ITraceable>(Tracer);
InitMemoryCallbacks(); InitMemoryCallbacks();
CoreComm = comm;
ThrowExceptionForBadRom(file); ThrowExceptionForBadRom(file);
BoardName = MapperName(file); BoardName = MapperName(file);
@ -95,6 +94,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
Bios = comm.CoreFileProvider.GetFirmware("GBC", "World", true, "BIOS Not Found, Cannot Load"); Bios = comm.CoreFileProvider.GetFirmware("GBC", "World", true, "BIOS Not Found, Cannot Load");
IsCgb = true; IsCgb = true;
} }
if (LibGambatte.gambatte_loadbios(GambatteState, Bios, (uint)Bios.Length) != 0) if (LibGambatte.gambatte_loadbios(GambatteState, Bios, (uint)Bios.Length) != 0)
{ {
throw new InvalidOperationException($"{nameof(LibGambatte.gambatte_loadbios)}() returned non-zero (bios error)"); throw new InvalidOperationException($"{nameof(LibGambatte.gambatte_loadbios)}() returned non-zero (bios error)");

View File

@ -166,8 +166,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
IsLagFrame = false; IsLagFrame = false;
} }
public CoreComm CoreComm { get; }
public void Dispose() public void Dispose()
{ {
if (!_disposed) if (!_disposed)

View File

@ -17,7 +17,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
GambatteLinkSettings linkSettings = (GambatteLinkSettings)settings ?? new GambatteLinkSettings(); GambatteLinkSettings linkSettings = (GambatteLinkSettings)settings ?? new GambatteLinkSettings();
GambatteLinkSyncSettings linkSyncSettings = (GambatteLinkSyncSettings)syncSettings ?? new GambatteLinkSyncSettings(); GambatteLinkSyncSettings linkSyncSettings = (GambatteLinkSyncSettings)syncSettings ?? new GambatteLinkSyncSettings();
CoreComm = comm;
L = new Gameboy(comm.Clone(), leftinfo, leftrom, linkSettings.L, linkSyncSettings.L, deterministic); L = new Gameboy(comm.Clone(), leftinfo, leftrom, linkSettings.L, linkSyncSettings.L, deterministic);
R = new Gameboy(comm.Clone(), rightinfo, rightrom, linkSettings.R, linkSyncSettings.R, deterministic); R = new Gameboy(comm.Clone(), rightinfo, rightrom, linkSettings.R, linkSyncSettings.R, deterministic);