romloader cleanup

This commit is contained in:
nattthebear 2020-07-12 08:09:50 -04:00
parent d354faeec1
commit 9072614dfb
6 changed files with 32 additions and 101 deletions

View File

@ -672,23 +672,9 @@ namespace BizHawk.Client.Common
{
case "GB":
case "DGB":
// adelikat: remove need for tags to be hardcoded to left and right, we should clean this up, also maybe the DGB core should just take the xml file and handle it itself
var leftBytes = xmlGame.Assets[0].Value;
var rightBytes = xmlGame.Assets[1].Value;
var left = Database.GetGameInfo(leftBytes, "left.gb");
var right = Database.GetGameInfo(rightBytes, "right.gb");
if (_config.PreferredCores["GB"] == CoreNames.GbHawk)
{
nextEmulator = new GBHawkLink(
nextComm,
left,
leftBytes,
right,
rightBytes,
GetCoreSettings<GBHawkLink, GBHawkLink.GBLinkSettings>(),
GetCoreSyncSettings<GBHawkLink, GBHawkLink.GBLinkSyncSettings>()
);
// other stuff todo
nextEmulator = MakeCoreFromXml<GBHawkLink>(game);
return true;
}
else
@ -697,53 +683,13 @@ namespace BizHawk.Client.Common
return true;
}
case "GB3x":
var leftBytes3x = xmlGame.Assets[0].Value;
var centerBytes3x = xmlGame.Assets[1].Value;
var rightBytes3x = xmlGame.Assets[2].Value;
var left3x = Database.GetGameInfo(leftBytes3x, "left.gb");
var center3x = Database.GetGameInfo(centerBytes3x, "center.gb");
var right3x = Database.GetGameInfo(rightBytes3x, "right.gb");
nextEmulator = new GBHawkLink3x(
nextComm,
left3x,
leftBytes3x,
center3x,
centerBytes3x,
right3x,
rightBytes3x,
GetCoreSettings<GBHawkLink3x, GBHawkLink3x.GBLink3xSettings>(),
GetCoreSyncSettings<GBHawkLink3x, GBHawkLink3x.GBLink3xSyncSettings>()
);
nextEmulator = MakeCoreFromXml<GBHawkLink3x>(game);
return true;
case "GB4x":
var A_Bytes4x = xmlGame.Assets[0].Value;
var B_Bytes4x = xmlGame.Assets[1].Value;
var C_Bytes4x = xmlGame.Assets[2].Value;
var D_Bytes4x = xmlGame.Assets[3].Value;
var A_4x = Database.GetGameInfo(A_Bytes4x, "A.gb");
var B_4x = Database.GetGameInfo(B_Bytes4x, "B.gb");
var C_4x = Database.GetGameInfo(C_Bytes4x, "C.gb");
var D_4x = Database.GetGameInfo(D_Bytes4x, "D.gb");
nextEmulator = new GBHawkLink4x(
nextComm,
A_4x,
A_Bytes4x,
B_4x,
B_Bytes4x,
C_4x,
C_Bytes4x,
D_4x,
D_Bytes4x,
GetCoreSettings<GBHawkLink4x, GBHawkLink4x.GBLink4xSettings>(),
GetCoreSyncSettings<GBHawkLink4x, GBHawkLink4x.GBLink4xSyncSettings>()
);
nextEmulator = MakeCoreFromXml<GBHawkLink4x>(game);
return true;
case "AppleII":
nextEmulator = new AppleII(
nextComm,
xmlGame.Assets.Select(a => a.Value),
GetCoreSettings<AppleII, AppleII.Settings>()
);
nextEmulator = MakeCoreFromXml<AppleII>(game);
return true;
case "C64":
nextEmulator = new C64(
@ -786,19 +732,7 @@ namespace BizHawk.Client.Common
nextEmulator = MakeCoreFromXml<GPGX>(game, DiscType.MegaCD, "GEN");
return true;
case "Game Gear":
var leftBytesGG = xmlGame.Assets[0].Value;
var rightBytesGG = xmlGame.Assets[1].Value;
var leftGG = Database.GetGameInfo(leftBytesGG, "left.gg");
var rightGG = Database.GetGameInfo(rightBytesGG, "right.gg");
nextEmulator = new GGHawkLink(
nextComm,
leftGG,
leftBytesGG,
rightGG,
rightBytesGG,
GetCoreSettings<GGHawkLink, GGHawkLink.GGLinkSettings>(),
GetCoreSyncSettings<GGHawkLink, GGHawkLink.GGLinkSyncSettings>()
);
nextEmulator = MakeCoreFromXml<GGHawkLink>(game);
return true;
}
return false;

View File

@ -21,10 +21,10 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
AppleIIController.BoolButtons.AddRange(ExtraButtons);
}
public AppleII(CoreComm comm, IEnumerable<byte[]> romSet, Settings settings)
: this(comm, romSet.First(), settings)
public AppleII(CoreLoadParameters<Settings, object> lp)
: this(lp.Comm, lp.Roms.First().RomData, lp.Settings)
{
_romSet = romSet.ToList();
_romSet = lp.Roms.Select(r => r.RomData).ToList();
}
[CoreConstructor("AppleII")]
@ -39,6 +39,7 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
};
_disk1 = rom;
// TODO: Doesn't this add the first rom twice in the case of multirom?
_romSet.Add(rom);
_appleIIRom = comm.CoreFileProvider.GetFirmware(

View File

@ -30,14 +30,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
public bool do_frame_fill;
//[CoreConstructor("GB", "GBC")]
public GBHawkLink(CoreComm comm, GameInfo game_L, byte[] rom_L, GameInfo game_R, byte[] rom_R, /*string gameDbFn,*/
GBHawkLink.GBLinkSettings settings, GBHawkLink.GBLinkSyncSettings syncSettings)
public GBHawkLink(CoreLoadParameters<GBHawkLink.GBLinkSettings, GBHawkLink.GBLinkSyncSettings> lp)
{
var ser = new BasicServiceProvider(this);
ServiceProvider = ser;
linkSettings = (GBLinkSettings)settings ?? new GBLinkSettings();
linkSyncSettings = (GBLinkSyncSettings)syncSettings ?? new GBLinkSyncSettings();
linkSettings = (GBLinkSettings)lp.Settings ?? new GBLinkSettings();
linkSyncSettings = (GBLinkSyncSettings)lp.SyncSettings ?? new GBLinkSyncSettings();
_controllerDeck = new GBHawkLinkControllerDeck(GBHawkLinkControllerDeck.DefaultControllerName, GBHawkLinkControllerDeck.DefaultControllerName);
var temp_set_L = new GBHawk.GBHawk.GBSettings();
@ -57,8 +56,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, 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);
L = new GBHawk.GBHawk(lp.Comm, lp.Roms[0].Game, lp.Roms[0].RomData, temp_set_L, temp_sync_L);
R = new GBHawk.GBHawk(lp.Comm, lp.Roms[1].Game, lp.Roms[1].RomData, temp_set_R, temp_sync_R);
ser.Register<IVideoProvider>(this);
ser.Register<ISoundProvider>(this);

View File

@ -30,14 +30,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
public bool do_frame_fill;
//[CoreConstructor("GB", "GBC")]
public GBHawkLink3x(CoreComm comm, GameInfo game_L, byte[] rom_L, GameInfo game_C, byte[] rom_C, GameInfo game_R, byte[] rom_R,
/*string gameDbFn,*/ GBHawkLink3x.GBLink3xSettings settings, GBHawkLink3x.GBLink3xSyncSettings syncSettings)
public GBHawkLink3x(CoreLoadParameters<GBLink3xSettings, GBLink3xSyncSettings> lp)
{
var ser = new BasicServiceProvider(this);
ServiceProvider = ser;
Link3xSettings = (GBLink3xSettings)settings ?? new GBLink3xSettings();
Link3xSyncSettings = (GBLink3xSyncSettings)syncSettings ?? new GBLink3xSyncSettings();
Link3xSettings = (GBLink3xSettings)lp.Settings ?? new GBLink3xSettings();
Link3xSyncSettings = (GBLink3xSyncSettings)lp.SyncSettings ?? new GBLink3xSyncSettings();
_controllerDeck = new GBHawkLink3xControllerDeck(GBHawkLink3xControllerDeck.DefaultControllerName, GBHawkLink3xControllerDeck.DefaultControllerName, GBHawkLink3xControllerDeck.DefaultControllerName);
var tempSetL = new GBHawk.GBHawk.GBSettings();
@ -63,9 +62,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
tempSyncC.RTCOffset = Link3xSyncSettings.RTCOffset_C;
tempSyncR.RTCOffset = Link3xSyncSettings.RTCOffset_R;
L = new GBHawk.GBHawk(comm, game_L, rom_L, tempSetL, tempSyncL);
C = new GBHawk.GBHawk(comm, game_C, rom_C, tempSetC, tempSyncC);
R = new GBHawk.GBHawk(comm, game_R, rom_R, tempSetR, tempSyncR);
L = new GBHawk.GBHawk(lp.Comm, lp.Roms[0].Game, lp.Roms[0].RomData, tempSetL, tempSyncL);
C = new GBHawk.GBHawk(lp.Comm, lp.Roms[1].Game, lp.Roms[1].RomData, tempSetC, tempSyncC);
R = new GBHawk.GBHawk(lp.Comm, lp.Roms[2].Game, lp.Roms[2].RomData, tempSetR, tempSyncR);
ser.Register<IVideoProvider>(this);
ser.Register<ISoundProvider>(this);

View File

@ -51,13 +51,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink4x
public bool do_frame_fill;
//[CoreConstructor("GB", "GBC")]
public GBHawkLink4x(CoreComm comm, GameInfo game_A, byte[] rom_A, GameInfo game_B, byte[] rom_B, GameInfo game_C, byte[] rom_C, GameInfo game_D, byte[] rom_D, /*string gameDbFn,*/
GBHawkLink4x.GBLink4xSettings settings, GBHawkLink4x.GBLink4xSyncSettings syncSettings)
public GBHawkLink4x(CoreLoadParameters<GBLink4xSettings, GBLink4xSyncSettings> lp)
{
var ser = new BasicServiceProvider(this);
Link4xSettings = (GBLink4xSettings)settings ?? new GBLink4xSettings();
Link4xSyncSettings = (GBLink4xSyncSettings)syncSettings ?? new GBLink4xSyncSettings();
Link4xSettings = (GBLink4xSettings)lp.Settings ?? new GBLink4xSettings();
Link4xSyncSettings = (GBLink4xSyncSettings)lp.SyncSettings ?? new GBLink4xSyncSettings();
_controllerDeck = new GBHawkLink4xControllerDeck(GBHawkLink4xControllerDeck.DefaultControllerName, GBHawkLink4xControllerDeck.DefaultControllerName,
GBHawkLink4xControllerDeck.DefaultControllerName, GBHawkLink4xControllerDeck.DefaultControllerName);
@ -90,10 +89,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink4x
tempSyncC.RTCOffset = Link4xSyncSettings.RTCOffset_C;
tempSyncD.RTCOffset = Link4xSyncSettings.RTCOffset_D;
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);
A = new GBHawk.GBHawk(lp.Comm, lp.Roms[0].Game, lp.Roms[0].RomData, tempSetA, tempSyncA);
B = new GBHawk.GBHawk(lp.Comm, lp.Roms[1].Game, lp.Roms[1].RomData, tempSetB, tempSyncB);
C = new GBHawk.GBHawk(lp.Comm, lp.Roms[2].Game, lp.Roms[2].RomData, tempSetC, tempSyncC);
D = new GBHawk.GBHawk(lp.Comm, lp.Roms[3].Game, lp.Roms[3].RomData, tempSetD, tempSyncD);
ser.Register<IVideoProvider>(this);
ser.Register<ISoundProvider>(this);

View File

@ -25,13 +25,12 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink
private bool do_r_next = false;
public GGHawkLink(CoreComm comm, GameInfo game_L, byte[] rom_L, GameInfo game_R, byte[] rom_R, /*string gameDbFn,*/
GGLinkSettings settings, GGLinkSyncSettings syncSettings)
public GGHawkLink(CoreLoadParameters<GGLinkSettings, GGLinkSyncSettings> lp)
{
var ser = new BasicServiceProvider(this);
linkSettings = (GGLinkSettings)settings ?? new GGLinkSettings();
linkSyncSettings = (GGLinkSyncSettings)syncSettings ?? new GGLinkSyncSettings();
linkSettings = (GGLinkSettings)lp.Settings ?? new GGLinkSettings();
linkSyncSettings = (GGLinkSyncSettings)lp.SyncSettings ?? new GGLinkSyncSettings();
_controllerDeck = new GGHawkLinkControllerDeck(GGHawkLinkControllerDeck.DefaultControllerName, GGHawkLinkControllerDeck.DefaultControllerName);
var temp_set_L = new SMS.SmsSettings();
@ -40,8 +39,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, game_L, rom_L, temp_set_L, temp_sync_L);
R = new SMS(comm, game_R, rom_R, temp_set_R, temp_sync_R);
L = new SMS(lp.Comm, lp.Roms[0].Game, lp.Roms[0].RomData, temp_set_L, temp_sync_L);
R = new SMS(lp.Comm, lp.Roms[1].Game, lp.Roms[1].RomData, temp_set_R, temp_sync_R);
ser.Register<IVideoProvider>(this);
ser.Register<ISoundProvider>(this);