Use CoreLoadParameters on dual gambatte
This commit is contained in:
parent
9d9dd8a0fd
commit
80793836d3
|
@ -38,17 +38,18 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
public class RomLoader
|
||||
{
|
||||
private class DiscGame : IDiscGame
|
||||
private class DiscAsset : IDiscAsset
|
||||
{
|
||||
public Disc DiscData { get; set; }
|
||||
public DiscType DiscType { get; set; }
|
||||
public string DiscName { get; set; }
|
||||
}
|
||||
private class RomGameFake : IRomGame
|
||||
private class RomAsset : IRomAsset
|
||||
{
|
||||
public byte[] RomData { get; set; }
|
||||
public byte[] FileData { get; set; }
|
||||
public string Extension { get; set; }
|
||||
public GameInfo Game { get; set; }
|
||||
}
|
||||
private readonly Config _config;
|
||||
|
||||
|
@ -93,8 +94,8 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
public CoreComm Comm { get; set; }
|
||||
public GameInfo Game { get; set; }
|
||||
public List<IRomGame> Roms { get; set; } = new List<IRomGame>();
|
||||
public List<IDiscGame> Discs { get; set; } = new List<IDiscGame>();
|
||||
public List<IRomAsset> Roms { get; set; } = new List<IRomAsset>();
|
||||
public List<IDiscAsset> Discs { get; set; } = new List<IDiscAsset>();
|
||||
}
|
||||
|
||||
private T MakeCore<T>(CoreLoadParametersShort clps)
|
||||
|
@ -346,7 +347,7 @@ namespace BizHawk.Client.Common
|
|||
Game = g,
|
||||
Discs =
|
||||
{
|
||||
new DiscGame
|
||||
new DiscAsset
|
||||
{
|
||||
DiscData = disc,
|
||||
DiscType = new DiscIdentifier(disc).DetectDiscType(),
|
||||
|
@ -625,7 +626,7 @@ namespace BizHawk.Client.Common
|
|||
var xmlGame = XmlGame.Create(file); // if load fails, are we supposed to retry as a bsnes XML????????
|
||||
game = xmlGame.GI;
|
||||
|
||||
List<IDiscGame> DiscsFromXml(string systemId, DiscType diskType)
|
||||
List<IDiscAsset> DiscsFromXml(string systemId, DiscType diskType)
|
||||
{
|
||||
return xmlGame
|
||||
.AssetFullPaths
|
||||
|
@ -636,7 +637,7 @@ namespace BizHawk.Client.Common
|
|||
p = path,
|
||||
})
|
||||
.Where(a => a.d != null)
|
||||
.Select(a => (IDiscGame)new DiscGame
|
||||
.Select(a => (IDiscAsset)new DiscAsset
|
||||
{
|
||||
DiscData = a.d,
|
||||
DiscType = diskType,
|
||||
|
@ -645,7 +646,7 @@ namespace BizHawk.Client.Common
|
|||
.ToList();
|
||||
}
|
||||
|
||||
TEmulator MakeCoreFromXml<TEmulator>(GameInfo g, DiscType type, string systemId)
|
||||
TEmulator MakeCoreFromXml<TEmulator>(GameInfo g, DiscType? type = null, string systemId = null)
|
||||
where TEmulator : IEmulator
|
||||
{
|
||||
var clps = new CoreLoadParametersShort
|
||||
|
@ -654,14 +655,15 @@ namespace BizHawk.Client.Common
|
|||
Game = g,
|
||||
Roms = xmlGame.Assets
|
||||
.Where(kvp => !Disc.IsValidExtension(kvp.Key))
|
||||
.Select(kvp => (IRomGame)new RomGameFake
|
||||
.Select(kvp => (IRomAsset)new RomAsset
|
||||
{
|
||||
RomData = kvp.Value,
|
||||
FileData = kvp.Value, // TODO: Hope no one needed anything special here
|
||||
Extension = Path.GetExtension(kvp.Key)
|
||||
Extension = Path.GetExtension(kvp.Key),
|
||||
Game = Database.GetGameInfo(kvp.Value, Path.GetFileName(kvp.Key))
|
||||
})
|
||||
.ToList(),
|
||||
Discs = DiscsFromXml(systemId, type),
|
||||
Discs = type.HasValue ? DiscsFromXml(systemId, type.Value) : new List<IDiscAsset>(),
|
||||
};
|
||||
return MakeCore<TEmulator>(clps);
|
||||
}
|
||||
|
@ -691,17 +693,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
else
|
||||
{
|
||||
nextEmulator = new GambatteLink(
|
||||
nextComm,
|
||||
left,
|
||||
leftBytes,
|
||||
right,
|
||||
rightBytes,
|
||||
GetCoreSettings<GambatteLink, GambatteLink.GambatteLinkSettings>(),
|
||||
GetCoreSyncSettings<GambatteLink, GambatteLink.GambatteLinkSyncSettings>(),
|
||||
Deterministic
|
||||
);
|
||||
// other stuff todo
|
||||
nextEmulator = MakeCoreFromXml<GambatteLink>(game);
|
||||
return true;
|
||||
}
|
||||
case "GB3x":
|
||||
|
|
|
@ -11,15 +11,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
public partial class GambatteLink : IEmulator, IVideoProvider, ISoundProvider, IInputPollable, ISaveRam, IStatable, ILinkable,
|
||||
IBoardInfo, IRomInfo, IDebuggable, ISettable<GambatteLink.GambatteLinkSettings, GambatteLink.GambatteLinkSyncSettings>, ICodeDataLogger
|
||||
{
|
||||
public GambatteLink(CoreComm comm, GameInfo leftinfo, byte[] leftrom, GameInfo rightinfo, byte[] rightrom,
|
||||
GambatteLink.GambatteLinkSettings settings, GambatteLink.GambatteLinkSyncSettings syncSettings, bool deterministic)
|
||||
public GambatteLink(CoreLoadParameters<GambatteLink.GambatteLinkSettings, GambatteLink.GambatteLinkSyncSettings> lp)
|
||||
{
|
||||
ServiceProvider = new BasicServiceProvider(this);
|
||||
GambatteLinkSettings linkSettings = (GambatteLinkSettings)settings ?? new GambatteLinkSettings();
|
||||
GambatteLinkSyncSettings linkSyncSettings = (GambatteLinkSyncSettings)syncSettings ?? new GambatteLinkSyncSettings();
|
||||
GambatteLinkSettings linkSettings = (GambatteLinkSettings)lp.Settings ?? new GambatteLinkSettings();
|
||||
GambatteLinkSyncSettings linkSyncSettings = (GambatteLinkSyncSettings)lp.SyncSettings ?? new GambatteLinkSyncSettings();
|
||||
|
||||
L = new Gameboy(comm, leftinfo, leftrom, linkSettings.L, linkSyncSettings.L, deterministic);
|
||||
R = new Gameboy(comm, rightinfo, rightrom, linkSettings.R, linkSyncSettings.R, deterministic);
|
||||
L = new Gameboy(lp.Comm, lp.Roms[0].Game, lp.Roms[0].RomData, linkSettings.L, linkSyncSettings.L, lp.DeterministicEmulationRequested);
|
||||
R = new Gameboy(lp.Comm, lp.Roms[1].Game, lp.Roms[1].RomData, linkSettings.R, linkSyncSettings.R, lp.DeterministicEmulationRequested);
|
||||
|
||||
// connect link cable
|
||||
LibGambatte.gambatte_linkstatus(L.GambatteState, 259);
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace BizHawk.Emulation.Cores
|
|||
|
||||
public class Core
|
||||
{
|
||||
private class RomGameFake : IRomGame
|
||||
private class RomGameFake : IRomAsset
|
||||
{
|
||||
public byte[] RomData { get; set; }
|
||||
public byte[] FileData { get; set; }
|
||||
|
|
|
@ -6,13 +6,19 @@ using BizHawk.Emulation.DiscSystem;
|
|||
|
||||
namespace BizHawk.Emulation.Cores
|
||||
{
|
||||
public interface IRomGame
|
||||
public interface IRomAsset
|
||||
{
|
||||
byte[] RomData { get; }
|
||||
byte[] FileData { get; }
|
||||
string Extension { get; }
|
||||
/// <summary>
|
||||
/// GameInfo for this individual asset. Doesn't make sense a lot of the time;
|
||||
/// only use this if your individual rom assets are full proper games when considered alone.
|
||||
/// Not guaranteed to be set in any other situation.
|
||||
/// </summary>
|
||||
GameInfo Game { get; }
|
||||
}
|
||||
public interface IDiscGame
|
||||
public interface IDiscAsset
|
||||
{
|
||||
Disc DiscData { get; }
|
||||
DiscType DiscType { get; }
|
||||
|
@ -22,7 +28,7 @@ namespace BizHawk.Emulation.Cores
|
|||
{
|
||||
CoreComm Comm { set; }
|
||||
GameInfo Game { set; }
|
||||
List<IRomGame> Roms { get; }
|
||||
List<IRomAsset> Roms { get; }
|
||||
bool DeterministicEmulationRequested { set; }
|
||||
void PutSettings(object settings, object syncSettings);
|
||||
}
|
||||
|
@ -42,13 +48,13 @@ namespace BizHawk.Emulation.Cores
|
|||
/// All roms that should be loaded as part of this core load.
|
||||
/// Order may be significant. Does not include firmwares or other general resources.
|
||||
/// </summary>
|
||||
public List<IRomGame> Roms { get; set; } = new List<IRomGame>();
|
||||
public List<IRomAsset> Roms { get; set; } = new List<IRomAsset>();
|
||||
/// <summary>
|
||||
/// All discs that should be loaded as part of this core load.
|
||||
/// Order may be significant.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public List<IDiscGame> Discs { get; set; } = new List<IDiscGame>();
|
||||
public List<IDiscAsset> Discs { get; set; } = new List<IDiscAsset>();
|
||||
public bool DeterministicEmulationRequested { get; set; }
|
||||
void ICoreLoadParameters<TSettiing, TSync>.PutSettings(object settings, object syncSettings)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue