remove CoreComm.Clone(), it is now safe to pass around into subcores

This commit is contained in:
adelikat 2020-03-15 10:12:20 -05:00
parent 3c519b0249
commit d3f37a5beb
7 changed files with 13 additions and 14 deletions

View File

@ -6,6 +6,7 @@ namespace BizHawk.Emulation.Common
/// This object facilitates communications between client and core
/// The primary use is to provide a client => core communication, such as providing client-side callbacks for a core to use
/// Any communications that can be described as purely a Core -> Client system, should be provided as an <seealso cref="IEmulatorService"/> instead
/// It is important that by design this class stay immutable
/// </summary>
public class CoreComm
{
@ -19,8 +20,6 @@ namespace BizHawk.Emulation.Common
CoreFileProvider = coreFileProvider;
}
public CoreComm Clone() => (CoreComm)MemberwiseClone();
public ICoreFileProvider CoreFileProvider { get; }
/// <summary>

View File

@ -55,8 +55,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
temp_sync_L.RTCOffset = linkSyncSettings.RTCOffset_L;
temp_sync_R.RTCOffset = linkSyncSettings.RTCOffset_R;
L = new GBHawk.GBHawk(comm.Clone(), game_L, rom_L, temp_set_L, temp_sync_L);
R = new GBHawk.GBHawk(comm.Clone(), game_R, rom_R, temp_set_R, temp_sync_R);
L = new GBHawk.GBHawk(comm, game_L, rom_L, temp_set_L, temp_sync_L);
R = new GBHawk.GBHawk(comm, game_R, rom_R, temp_set_R, temp_sync_R);
ser.Register<IVideoProvider>(this);
ser.Register<ISoundProvider>(this);

View File

@ -88,10 +88,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink4x
tempSyncC.RTCOffset = Link4xSyncSettings.RTCOffset_C;
tempSyncD.RTCOffset = Link4xSyncSettings.RTCOffset_D;
A = new GBHawk.GBHawk(comm.Clone(), game_A, rom_A, tempSetA, tempSyncA);
B = new GBHawk.GBHawk(comm.Clone(), game_B, rom_B, tempSetB, tempSyncB);
C = new GBHawk.GBHawk(comm.Clone(), game_C, rom_C, tempSetC, tempSyncC);
D = new GBHawk.GBHawk(comm.Clone(), game_D, rom_D, tempSetD, tempSyncD);
A = new GBHawk.GBHawk(comm, game_A, rom_A, tempSetA, tempSyncA);
B = new GBHawk.GBHawk(comm, game_B, rom_B, tempSetB, tempSyncB);
C = new GBHawk.GBHawk(comm, game_C, rom_C, tempSetC, tempSyncC);
D = new GBHawk.GBHawk(comm, game_D, rom_D, tempSetD, tempSyncD);
ser.Register<IVideoProvider>(this);
ser.Register<ISoundProvider>(this);

View File

@ -17,8 +17,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
GambatteLinkSettings linkSettings = (GambatteLinkSettings)settings ?? new GambatteLinkSettings();
GambatteLinkSyncSettings linkSyncSettings = (GambatteLinkSyncSettings)syncSettings ?? new GambatteLinkSyncSettings();
L = new Gameboy(comm.Clone(), leftinfo, leftrom, linkSettings.L, linkSyncSettings.L, deterministic);
R = new Gameboy(comm.Clone(), rightinfo, rightrom, linkSettings.R, linkSyncSettings.R, deterministic);
L = new Gameboy(comm, leftinfo, leftrom, linkSettings.L, linkSyncSettings.L, deterministic);
R = new Gameboy(comm, rightinfo, rightrom, linkSettings.R, linkSyncSettings.R, deterministic);
// connect link cable
LibGambatte.gambatte_linkstatus(L.GambatteState, 259);

View File

@ -19,7 +19,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubGBHawk
var subGBSettings = (GBHawk.GBHawk.GBSettings)settings ?? new GBHawk.GBHawk.GBSettings();
var subGBSyncSettings = (GBHawk.GBHawk.GBSyncSettings)syncSettings ?? new GBHawk.GBHawk.GBSyncSettings();
_GBCore = new GBHawk.GBHawk(comm.Clone(), game, rom, subGBSettings, subGBSyncSettings);
_GBCore = new GBHawk.GBHawk(comm, game, rom, subGBSettings, subGBSyncSettings);
HardReset();
current_cycle = 0;

View File

@ -18,7 +18,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
var subNesSettings = (NES.NES.NESSettings)settings ?? new NES.NES.NESSettings();
var subNesSyncSettings = (NES.NES.NESSyncSettings)syncSettings ?? new NES.NES.NESSyncSettings();
_nesCore = new NES.NES(comm.Clone(), game, rom, subNesSettings, subNesSyncSettings)
_nesCore = new NES.NES(comm, game, rom, subNesSettings, subNesSyncSettings)
{
using_reset_timing = true
};

View File

@ -38,8 +38,8 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink
var temp_sync_L = new SMS.SmsSyncSettings();
var temp_sync_R = new SMS.SmsSyncSettings();
L = new SMS(comm.Clone(), game_L, rom_L, temp_set_L, temp_sync_L);
R = new SMS(comm.Clone(), game_R, rom_R, temp_set_R, temp_sync_R);
L = new SMS(comm, game_L, rom_L, temp_set_L, temp_sync_L);
R = new SMS(comm, game_R, rom_R, temp_set_R, temp_sync_R);
ser.Register<IVideoProvider>(this);
ser.Register<ISoundProvider>(this);