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