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"]];
}
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":
nextEmulator = new ChannelF(
nextComm,
@ -554,15 +535,6 @@ namespace BizHawk.Client.Common
rom.FileData
);
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":
nextEmulator = new MAME(
file.Directory,
@ -692,32 +664,13 @@ namespace BizHawk.Client.Common
nextEmulator = MakeCoreFromXml<AppleII>(game);
return true;
case "C64":
nextEmulator = new C64(
nextComm,
xmlGame.Assets.Select(a => a.Value),
GameInfo.NullInstance,
GetCoreSettings<C64, C64.C64Settings>(),
GetCoreSyncSettings<C64, C64.C64SyncSettings>()
);
nextEmulator = MakeCoreFromXml<C64>(game);
return true;
case "ZXSpectrum":
nextEmulator = new ZXSpectrum(
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
);
nextEmulator = MakeCoreFromXml<ZXSpectrum>(game);
return true;
case "AmstradCPC":
nextEmulator = new AmstradCPC(
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>()
);
nextEmulator = MakeCoreFromXml<AmstradCPC>(game);
return true;
case "PSX":
nextEmulator = MakeCoreFromXml<Octoshock>(game, DiscType.SonyPSX, "PSX");

View File

@ -20,18 +20,19 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
isReleased: false)]
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);
ServiceProvider = ser;
CoreComm = comm;
_gameInfo = game;
CoreComm = lp.Comm;
_gameInfo = lp.Roms.Select(r => r.Game).ToList();
_cpu = new Z80A();
_tracer = new TraceBuffer { Header = _cpu.TraceHeader };
_files = files?.ToList() ?? new List<byte[]>();
_files = lp.Roms.Select(r => r.RomData).ToList();
settings ??= new AmstradCPCSettings();
syncSettings ??= new AmstradCPCSyncSettings();
var settings = lp.Settings ?? new AmstradCPCSettings();
var syncSettings = lp.SyncSettings ?? new AmstradCPCSyncSettings();
PutSyncSettings((AmstradCPCSyncSettings)syncSettings);
PutSettings((AmstradCPCSettings)settings);

View File

@ -16,16 +16,17 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
isReleased: true)]
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());
PutSettings((C64Settings)settings ?? new C64Settings());
PutSyncSettings((C64SyncSettings)lp.SyncSettings ?? new C64SyncSettings());
PutSettings((C64Settings)lp.Settings ?? new C64Settings());
var ser = new BasicServiceProvider(this);
ServiceProvider = ser;
CoreComm = comm;
_roms = roms?.ToList() ?? new List<byte[]>();
CoreComm = lp.Comm;
_roms = lp.Roms.Select(r => r.RomData).ToList();
_currentDisk = 0;
RomSanityCheck();
@ -64,7 +65,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
if (_board.CartPort.IsConnected)
{
// 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();

View File

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

View File

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