swish swish

This commit is contained in:
nattthebear 2020-07-12 09:06:20 -04:00
parent f5efbff1d3
commit f41a70ef32
5 changed files with 32 additions and 81 deletions

View File

@ -528,25 +528,6 @@ namespace BizHawk.Client.Common
core = CoreInventory.Instance["GB", _config.PreferredCores["GB"]]; core = CoreInventory.Instance["GB", _config.PreferredCores["GB"]];
} }
break; break;
case "C64":
nextEmulator = new C64(
nextComm,
new[] { rom.FileData },
rom.GameInfo,
GetCoreSettings<C64, C64.C64Settings>(),
GetCoreSyncSettings<C64, C64.C64SyncSettings>()
);
return;
case "ZXSpectrum":
nextEmulator = new ZXSpectrum(
nextComm,
new[] { rom.RomData },
new List<GameInfo> { rom.GameInfo },
GetCoreSettings<ZXSpectrum, ZXSpectrum.ZXSpectrumSettings>(),
GetCoreSyncSettings<ZXSpectrum, ZXSpectrum.ZXSpectrumSyncSettings>(),
Deterministic
);
return;
case "ChannelF": case "ChannelF":
nextEmulator = new ChannelF( nextEmulator = new ChannelF(
nextComm, nextComm,
@ -554,15 +535,6 @@ namespace BizHawk.Client.Common
rom.FileData rom.FileData
); );
return; return;
case "AmstradCPC":
nextEmulator = new AmstradCPC(
nextComm,
new[] { rom.RomData },
new List<GameInfo> { rom.GameInfo },
GetCoreSettings<AmstradCPC, AmstradCPC.AmstradCPCSettings>(),
GetCoreSyncSettings<AmstradCPC, AmstradCPC.AmstradCPCSyncSettings>()
);
return;
case "Arcade": case "Arcade":
nextEmulator = new MAME( nextEmulator = new MAME(
file.Directory, file.Directory,
@ -692,32 +664,13 @@ namespace BizHawk.Client.Common
nextEmulator = MakeCoreFromXml<AppleII>(game); nextEmulator = MakeCoreFromXml<AppleII>(game);
return true; return true;
case "C64": case "C64":
nextEmulator = new C64( nextEmulator = MakeCoreFromXml<C64>(game);
nextComm,
xmlGame.Assets.Select(a => a.Value),
GameInfo.NullInstance,
GetCoreSettings<C64, C64.C64Settings>(),
GetCoreSyncSettings<C64, C64.C64SyncSettings>()
);
return true; return true;
case "ZXSpectrum": case "ZXSpectrum":
nextEmulator = new ZXSpectrum( nextEmulator = MakeCoreFromXml<ZXSpectrum>(game);
nextComm,
xmlGame.Assets.Select(kvp => kvp.Value),
xmlGame.Assets.Select(kvp => new GameInfo { Name = Path.GetFileNameWithoutExtension(kvp.Key) }).ToList(),
GetCoreSettings<ZXSpectrum, ZXSpectrum.ZXSpectrumSettings>(),
GetCoreSyncSettings<ZXSpectrum, ZXSpectrum.ZXSpectrumSyncSettings>(),
Deterministic
);
return true; return true;
case "AmstradCPC": case "AmstradCPC":
nextEmulator = new AmstradCPC( nextEmulator = MakeCoreFromXml<AmstradCPC>(game);
nextComm,
xmlGame.Assets.Select(kvp => kvp.Value),
xmlGame.Assets.Select(kvp => new GameInfo { Name = Path.GetFileNameWithoutExtension(kvp.Key) }).ToList(),
GetCoreSettings<AmstradCPC, AmstradCPC.AmstradCPCSettings>(),
GetCoreSyncSettings<AmstradCPC, AmstradCPC.AmstradCPCSyncSettings>()
);
return true; return true;
case "PSX": case "PSX":
nextEmulator = MakeCoreFromXml<Octoshock>(game, DiscType.SonyPSX, "PSX"); nextEmulator = MakeCoreFromXml<Octoshock>(game, DiscType.SonyPSX, "PSX");

View File

@ -20,18 +20,19 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
isReleased: false)] isReleased: false)]
public partial class AmstradCPC : IRegionable, IDriveLight public partial class AmstradCPC : IRegionable, IDriveLight
{ {
public AmstradCPC(CoreComm comm, IEnumerable<byte[]> files, List<GameInfo> game, AmstradCPCSettings settings, AmstradCPCSyncSettings syncSettings) [CoreConstructor("AmstradCPC")]
public AmstradCPC(CoreLoadParameters<AmstradCPCSettings, AmstradCPCSyncSettings> lp)
{ {
var ser = new BasicServiceProvider(this); var ser = new BasicServiceProvider(this);
ServiceProvider = ser; ServiceProvider = ser;
CoreComm = comm; CoreComm = lp.Comm;
_gameInfo = game; _gameInfo = lp.Roms.Select(r => r.Game).ToList();
_cpu = new Z80A(); _cpu = new Z80A();
_tracer = new TraceBuffer { Header = _cpu.TraceHeader }; _tracer = new TraceBuffer { Header = _cpu.TraceHeader };
_files = files?.ToList() ?? new List<byte[]>(); _files = lp.Roms.Select(r => r.RomData).ToList();
settings ??= new AmstradCPCSettings(); var settings = lp.Settings ?? new AmstradCPCSettings();
syncSettings ??= new AmstradCPCSyncSettings(); var syncSettings = lp.SyncSettings ?? new AmstradCPCSyncSettings();
PutSyncSettings((AmstradCPCSyncSettings)syncSettings); PutSyncSettings((AmstradCPCSyncSettings)syncSettings);
PutSettings((AmstradCPCSettings)settings); PutSettings((AmstradCPCSettings)settings);

View File

@ -16,16 +16,17 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
isReleased: true)] isReleased: true)]
public sealed partial class C64 : IEmulator, IRegionable, IBoardInfo, IRomInfo public sealed partial class C64 : IEmulator, IRegionable, IBoardInfo, IRomInfo
{ {
public C64(CoreComm comm, IEnumerable<byte[]> roms, GameInfo game, C64Settings settings, C64SyncSettings syncSettings) [CoreConstructor("C64")]
public C64(CoreLoadParameters<C64Settings, C64SyncSettings> lp)
{ {
PutSyncSettings((C64SyncSettings)syncSettings ?? new C64SyncSettings()); PutSyncSettings((C64SyncSettings)lp.SyncSettings ?? new C64SyncSettings());
PutSettings((C64Settings)settings ?? new C64Settings()); PutSettings((C64Settings)lp.Settings ?? new C64Settings());
var ser = new BasicServiceProvider(this); var ser = new BasicServiceProvider(this);
ServiceProvider = ser; ServiceProvider = ser;
CoreComm = comm; CoreComm = lp.Comm;
_roms = roms?.ToList() ?? new List<byte[]>(); _roms = lp.Roms.Select(r => r.RomData).ToList();
_currentDisk = 0; _currentDisk = 0;
RomSanityCheck(); RomSanityCheck();
@ -64,7 +65,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
if (_board.CartPort.IsConnected) if (_board.CartPort.IsConnected)
{ {
// There are no multi-cart cart games, so just hardcode .First() // There are no multi-cart cart games, so just hardcode .First()
RomDetails = $"{game.Name}\r\nSHA1:{_roms.First().HashSHA1()}\r\nMD5:{roms.First().HashMD5()}\r\nMapper Impl \"{_board.CartPort.CartridgeType}\""; RomDetails = $"{lp.Game.Name}\r\nSHA1:{_roms.First().HashSHA1()}\r\nMD5:{_roms.First().HashMD5()}\r\nMapper Impl \"{_board.CartPort.CartridgeType}\"";
} }
SetupMemoryDomains(); SetupMemoryDomains();

View File

@ -21,32 +21,27 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
isReleased: true)] isReleased: true)]
public partial class ZXSpectrum : IRegionable, IDriveLight public partial class ZXSpectrum : IRegionable, IDriveLight
{ {
public ZXSpectrum(CoreComm comm, IEnumerable<byte[]> files, List<GameInfo> game, ZXSpectrumSettings settings, ZXSpectrumSyncSettings syncSettings, bool? deterministic) [CoreConstructor("ZXSpectrum")]
public ZXSpectrum(
CoreLoadParameters<ZXSpectrumSettings, ZXSpectrumSyncSettings> lp)
{ {
var ser = new BasicServiceProvider(this); var ser = new BasicServiceProvider(this);
ServiceProvider = ser; ServiceProvider = ser;
CoreComm = comm; CoreComm = lp.Comm;
_gameInfo = game; _gameInfo = lp.Roms.Select(r => r.Game).ToList();
_cpu = new Z80A(); _cpu = new Z80A();
_tracer = new TraceBuffer { Header = _cpu.TraceHeader }; _tracer = new TraceBuffer { Header = _cpu.TraceHeader };
_files = files?.ToList() ?? new List<byte[]>(); _files = lp.Roms.Select(r => r.RomData).ToList();
if (settings == null) var settings = lp.Settings ?? new ZXSpectrumSettings();
{ var syncSettings = lp.SyncSettings ?? new ZXSpectrumSyncSettings();
settings = new ZXSpectrumSettings();
}
if (syncSettings == null) PutSyncSettings(lp.SyncSettings);
{ PutSettings(lp.Settings);
syncSettings = new ZXSpectrumSyncSettings();
}
PutSyncSettings((ZXSpectrumSyncSettings)syncSettings);
PutSettings((ZXSpectrumSettings)settings);
var joysticks = new List<JoystickType> var joysticks = new List<JoystickType>
{ {
@ -57,14 +52,14 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
DeterministicEmulation = ((ZXSpectrumSyncSettings)syncSettings).DeterministicEmulation; DeterministicEmulation = ((ZXSpectrumSyncSettings)syncSettings).DeterministicEmulation;
if (deterministic != null && deterministic == true) if (lp.DeterministicEmulationRequested)
{ {
if (!DeterministicEmulation) if (!DeterministicEmulation)
{ {
CoreComm.Notify("Forcing Deterministic Emulation"); CoreComm.Notify("Forcing Deterministic Emulation");
} }
DeterministicEmulation = deterministic.Value; DeterministicEmulation = lp.DeterministicEmulationRequested;
} }
MachineType = SyncSettings.MachineType; MachineType = SyncSettings.MachineType;

View File

@ -20,7 +20,7 @@ namespace BizHawk.Emulation.Cores
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 => null; public GameInfo Game { get; set; }
} }
// expected names and types of the parameters // expected names and types of the parameters
private static readonly Dictionary<string, Type> ParamTypes = new Dictionary<string, Type>(); private static readonly Dictionary<string, Type> ParamTypes = new Dictionary<string, Type>();
@ -123,7 +123,8 @@ namespace BizHawk.Emulation.Cores
{ {
RomData = rom, RomData = rom,
FileData = file, FileData = file,
Extension = extension Extension = extension,
Game = game,
}); });
param.DeterministicEmulationRequested = deterministic; param.DeterministicEmulationRequested = deterministic;
return (IEmulator)CTor.Invoke(new object[] { param }); return (IEmulator)CTor.Invoke(new object[] { param });