Implemented multi bundler functionlity and multiple tape controls
This commit is contained in:
parent
50d28c9627
commit
90c1e293bf
|
@ -661,7 +661,8 @@ namespace BizHawk.Client.Common
|
||||||
case "ZXSpectrum":
|
case "ZXSpectrum":
|
||||||
nextEmulator = new ZXSpectrum(
|
nextEmulator = new ZXSpectrum(
|
||||||
nextComm,
|
nextComm,
|
||||||
xmlGame.Assets.Select(a => a.Value).First(),
|
xmlGame.Assets.Select(a => a.Value), //.First(),
|
||||||
|
GameInfo.NullInstance,
|
||||||
(ZXSpectrum.ZXSpectrumSettings)GetCoreSettings<ZXSpectrum>(),
|
(ZXSpectrum.ZXSpectrumSettings)GetCoreSettings<ZXSpectrum>(),
|
||||||
(ZXSpectrum.ZXSpectrumSyncSettings)GetCoreSyncSettings<ZXSpectrum>());
|
(ZXSpectrum.ZXSpectrumSyncSettings)GetCoreSyncSettings<ZXSpectrum>());
|
||||||
break;
|
break;
|
||||||
|
@ -999,7 +1000,7 @@ namespace BizHawk.Client.Common
|
||||||
nextEmulator = c64;
|
nextEmulator = c64;
|
||||||
break;
|
break;
|
||||||
case "ZXSpectrum":
|
case "ZXSpectrum":
|
||||||
var zx = new ZXSpectrum(nextComm, rom.FileData, GetCoreSettings<ZXSpectrum>(), GetCoreSyncSettings<ZXSpectrum>());
|
var zx = new ZXSpectrum(nextComm, Enumerable.Repeat(rom.RomData, 1), rom.GameInfo, GetCoreSettings<ZXSpectrum>(), GetCoreSyncSettings<ZXSpectrum>());
|
||||||
nextEmulator = zx;
|
nextEmulator = zx;
|
||||||
break;
|
break;
|
||||||
case "GBA":
|
case "GBA":
|
||||||
|
|
|
@ -143,7 +143,8 @@
|
||||||
"GB",
|
"GB",
|
||||||
"PCFX",
|
"PCFX",
|
||||||
"PSX",
|
"PSX",
|
||||||
"SAT"});
|
"SAT",
|
||||||
|
"ZXSpectrum"});
|
||||||
this.SystemDropDown.Location = new System.Drawing.Point(425, 75);
|
this.SystemDropDown.Location = new System.Drawing.Point(425, 75);
|
||||||
this.SystemDropDown.Name = "SystemDropDown";
|
this.SystemDropDown.Name = "SystemDropDown";
|
||||||
this.SystemDropDown.Size = new System.Drawing.Size(69, 21);
|
this.SystemDropDown.Size = new System.Drawing.Size(69, 21);
|
||||||
|
|
|
@ -233,7 +233,24 @@ namespace BizHawk.Client.EmuHawk
|
||||||
Icon = Properties.Resources.BackMore,
|
Icon = Properties.Resources.BackMore,
|
||||||
Location = new Point(83, 22),
|
Location = new Point(83, 22),
|
||||||
Type = PadSchema.PadInputType.Boolean
|
Type = PadSchema.PadInputType.Boolean
|
||||||
}
|
},
|
||||||
|
new PadSchema.ButtonSchema
|
||||||
|
{
|
||||||
|
Name = "Insert Next Tape",
|
||||||
|
DisplayName = "NEXT TAPE",
|
||||||
|
//Icon = Properties.Resources.MoveRight,
|
||||||
|
Location = new Point(23, 52),
|
||||||
|
Type = PadSchema.PadInputType.Boolean
|
||||||
|
},
|
||||||
|
new PadSchema.ButtonSchema
|
||||||
|
{
|
||||||
|
Name = "Insert Previous Tape",
|
||||||
|
DisplayName = "PREV TAPE",
|
||||||
|
//Icon = Properties.Resources.MoveLeft,
|
||||||
|
Location = new Point(100, 52),
|
||||||
|
Type = PadSchema.PadInputType.Boolean
|
||||||
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1378,6 +1378,7 @@
|
||||||
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum48K\ZX48.Keyboard.cs" />
|
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum48K\ZX48.Keyboard.cs" />
|
||||||
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum48K\ZX48.Port.cs" />
|
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum48K\ZX48.Port.cs" />
|
||||||
<None Include="Computers\SinclairSpectrum\readme.md" />
|
<None Include="Computers\SinclairSpectrum\readme.md" />
|
||||||
|
<Compile Include="Computers\SinclairSpectrum\Machine\SpectrumBase.Media.cs" />
|
||||||
<None Include="Consoles\Atari\docs\stella.pdf" />
|
<None Include="Consoles\Atari\docs\stella.pdf" />
|
||||||
<None Include="Consoles\Coleco\docs\colecovision tech1.pdf" />
|
<None Include="Consoles\Coleco\docs\colecovision tech1.pdf" />
|
||||||
<None Include="Consoles\Coleco\docs\colecovision tech2.pdf" />
|
<None Include="Consoles\Coleco\docs\colecovision tech2.pdf" />
|
||||||
|
|
|
@ -401,6 +401,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
ser.Sync("currentState", ref currentState);
|
ser.Sync("currentState", ref currentState);
|
||||||
|
|
||||||
//_dataBlocks
|
//_dataBlocks
|
||||||
|
/*
|
||||||
ser.BeginSection("Datablocks");
|
ser.BeginSection("Datablocks");
|
||||||
|
|
||||||
if (ser.IsWriter)
|
if (ser.IsWriter)
|
||||||
|
@ -417,11 +418,11 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
{
|
{
|
||||||
ser.Sync("_tempBlockCount", ref _tempBlockCount);
|
ser.Sync("_tempBlockCount", ref _tempBlockCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ser.EndSection();
|
ser.EndSection();
|
||||||
|
*/
|
||||||
|
|
||||||
ser.EndSection();
|
ser.EndSection();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
string Stop = "Stop Tape";
|
string Stop = "Stop Tape";
|
||||||
string RTZ = "RTZ Tape";
|
string RTZ = "RTZ Tape";
|
||||||
string Record = "Record Tape";
|
string Record = "Record Tape";
|
||||||
|
string NextTape = "Insert Next Tape";
|
||||||
|
string PrevTape = "Insert Previous Tape";
|
||||||
|
|
||||||
public void PollInput()
|
public void PollInput()
|
||||||
{
|
{
|
||||||
|
@ -69,6 +71,14 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (Spectrum._controller.IsPressed(NextTape))
|
||||||
|
{
|
||||||
|
TapeMediaIndex++;
|
||||||
|
}
|
||||||
|
if (Spectrum._controller.IsPressed(PrevTape))
|
||||||
|
{
|
||||||
|
TapeMediaIndex--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,191 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
|
{
|
||||||
|
public abstract partial class SpectrumBase
|
||||||
|
{
|
||||||
|
// until +3 disk drive is emulated, we assume that incoming files are tape images
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The tape or disk image(s) that are passed in from the main ZXSpectrum class
|
||||||
|
/// </summary>
|
||||||
|
protected List<byte[]> mediaImages { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tape images
|
||||||
|
/// </summary>
|
||||||
|
protected List<byte[]> tapeImages { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Disk images
|
||||||
|
/// </summary>
|
||||||
|
protected List<byte[]> diskImages { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The index of the currently 'loaded' tape or disk image
|
||||||
|
/// </summary>
|
||||||
|
protected int tapeMediaIndex;
|
||||||
|
public int TapeMediaIndex
|
||||||
|
{
|
||||||
|
get { return tapeMediaIndex; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
int tmp = value;
|
||||||
|
int result = value;
|
||||||
|
|
||||||
|
if (tapeImages == null || tapeImages.Count() == 0)
|
||||||
|
{
|
||||||
|
// no tape images found
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value >= tapeImages.Count())
|
||||||
|
{
|
||||||
|
// media at this index does not exist - loop back to 0
|
||||||
|
result = 0;
|
||||||
|
}
|
||||||
|
else if (value < 0)
|
||||||
|
{
|
||||||
|
// negative index not allowed - move to last item in the collection
|
||||||
|
result = tapeImages.Count() - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// load the media into the tape device
|
||||||
|
tapeMediaIndex = result;
|
||||||
|
LoadTapeMedia();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The index of the currently 'loaded' tape or disk image
|
||||||
|
/// </summary>
|
||||||
|
protected int diskMediaIndex;
|
||||||
|
public int DiskMediaIndex
|
||||||
|
{
|
||||||
|
get { return diskMediaIndex; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
int tmp = value;
|
||||||
|
int result = value;
|
||||||
|
|
||||||
|
if (diskImages == null || diskImages.Count() == 0)
|
||||||
|
{
|
||||||
|
// no tape images found
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value >= diskImages.Count())
|
||||||
|
{
|
||||||
|
// media at this index does not exist - loop back to 0
|
||||||
|
result = 0;
|
||||||
|
}
|
||||||
|
else if (value < 0)
|
||||||
|
{
|
||||||
|
// negative index not allowed - move to last item in the collection
|
||||||
|
result = diskImages.Count() - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// load the media into the disk device
|
||||||
|
diskMediaIndex = result;
|
||||||
|
LoadDiskMedia();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called on first instantiation (and subsequent core reboots)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="files"></param>
|
||||||
|
protected void InitializeMedia(List<byte[]> files)
|
||||||
|
{
|
||||||
|
mediaImages = files;
|
||||||
|
LoadAllMedia();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attempts to load all media into the relevant structures
|
||||||
|
/// </summary>
|
||||||
|
protected void LoadAllMedia()
|
||||||
|
{
|
||||||
|
tapeImages = new List<byte[]>();
|
||||||
|
diskImages = new List<byte[]>();
|
||||||
|
|
||||||
|
foreach (var m in mediaImages)
|
||||||
|
{
|
||||||
|
switch (IdentifyMedia(m))
|
||||||
|
{
|
||||||
|
case SpectrumMediaType.Tape:
|
||||||
|
tapeImages.Add(m);
|
||||||
|
break;
|
||||||
|
case SpectrumMediaType.Disk:
|
||||||
|
diskImages.Add(m);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tapeImages.Count > 0)
|
||||||
|
LoadTapeMedia();
|
||||||
|
|
||||||
|
if (diskImages.Count > 0)
|
||||||
|
LoadDiskMedia();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attempts to load a tape into the tape device based on tapeMediaIndex
|
||||||
|
/// </summary>
|
||||||
|
protected void LoadTapeMedia()
|
||||||
|
{
|
||||||
|
TapeDevice.LoadTape(tapeImages[tapeMediaIndex]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attempts to load a disk into the disk device based on diskMediaIndex
|
||||||
|
/// </summary>
|
||||||
|
protected void LoadDiskMedia()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException("+3 disk drive device not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies and sorts the various media types
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
private SpectrumMediaType IdentifyMedia(byte[] data)
|
||||||
|
{
|
||||||
|
// get first 16 bytes as a string
|
||||||
|
string hdr = Encoding.ASCII.GetString(data.Take(16).ToArray());
|
||||||
|
|
||||||
|
// disk checking first
|
||||||
|
if (hdr.ToUpper().Contains("EXTENDED CPC DSK"))
|
||||||
|
{
|
||||||
|
// spectrum .dsk disk file
|
||||||
|
return SpectrumMediaType.Disk;
|
||||||
|
}
|
||||||
|
if (hdr.ToUpper().StartsWith("FDI"))
|
||||||
|
{
|
||||||
|
// spectrum .fdi disk file
|
||||||
|
return SpectrumMediaType.Disk;
|
||||||
|
}
|
||||||
|
|
||||||
|
// tape checking
|
||||||
|
if (hdr.ToUpper().StartsWith("ZXTAPE!"))
|
||||||
|
{
|
||||||
|
// spectrum .tzx tape file
|
||||||
|
return SpectrumMediaType.Tape;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if we get this far, assume a .tap file
|
||||||
|
return SpectrumMediaType.Tape;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum SpectrumMediaType
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
Tape,
|
||||||
|
Disk
|
||||||
|
}
|
||||||
|
}
|
|
@ -208,6 +208,12 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
if (AYDevice != null)
|
if (AYDevice != null)
|
||||||
AYDevice.SyncState(ser);
|
AYDevice.SyncState(ser);
|
||||||
|
|
||||||
|
ser.Sync("tapeMediaIndex", ref tapeMediaIndex);
|
||||||
|
TapeMediaIndex = tapeMediaIndex;
|
||||||
|
|
||||||
|
ser.Sync("diskMediaIndex", ref diskMediaIndex);
|
||||||
|
DiskMediaIndex = diskMediaIndex;
|
||||||
|
|
||||||
TapeDevice.SyncState(ser);
|
TapeDevice.SyncState(ser);
|
||||||
|
|
||||||
ser.EndSection();
|
ser.EndSection();
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="spectrum"></param>
|
/// <param name="spectrum"></param>
|
||||||
/// <param name="cpu"></param>
|
/// <param name="cpu"></param>
|
||||||
public ZX128(ZXSpectrum spectrum, Z80A cpu, ZXSpectrum.BorderType borderType, byte[] file)
|
public ZX128(ZXSpectrum spectrum, Z80A cpu, ZXSpectrum.BorderType borderType, List<byte[]> files)
|
||||||
{
|
{
|
||||||
Spectrum = spectrum;
|
Spectrum = spectrum;
|
||||||
CPU = cpu;
|
CPU = cpu;
|
||||||
|
@ -40,11 +40,10 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
KeyboardDevice = new Keyboard48(this);
|
KeyboardDevice = new Keyboard48(this);
|
||||||
KempstonDevice = new KempstonJoystick(this);
|
KempstonDevice = new KempstonJoystick(this);
|
||||||
|
|
||||||
//TapeProvider = new DefaultTapeProvider(file);
|
|
||||||
|
|
||||||
TapeDevice = new DatacorderDevice();
|
TapeDevice = new DatacorderDevice();
|
||||||
TapeDevice.Init(this);
|
TapeDevice.Init(this);
|
||||||
TapeDevice.LoadTape(file);
|
|
||||||
|
InitializeMedia(files);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -20,8 +20,8 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="spectrum"></param>
|
/// <param name="spectrum"></param>
|
||||||
/// <param name="cpu"></param>
|
/// <param name="cpu"></param>
|
||||||
public ZX128Plus2(ZXSpectrum spectrum, Z80A cpu, ZXSpectrum.BorderType borderType, byte[] file)
|
public ZX128Plus2(ZXSpectrum spectrum, Z80A cpu, ZXSpectrum.BorderType borderType, List<byte[]> files)
|
||||||
: base(spectrum, cpu, borderType, file)
|
: base(spectrum, cpu, borderType, files)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="spectrum"></param>
|
/// <param name="spectrum"></param>
|
||||||
/// <param name="cpu"></param>
|
/// <param name="cpu"></param>
|
||||||
public ZX128Plus3(ZXSpectrum spectrum, Z80A cpu, ZXSpectrum.BorderType borderType, byte[] file)
|
public ZX128Plus3(ZXSpectrum spectrum, Z80A cpu, ZXSpectrum.BorderType borderType, List<byte[]> files)
|
||||||
{
|
{
|
||||||
Spectrum = spectrum;
|
Spectrum = spectrum;
|
||||||
CPU = cpu;
|
CPU = cpu;
|
||||||
|
@ -40,11 +40,10 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
KeyboardDevice = new Keyboard48(this);
|
KeyboardDevice = new Keyboard48(this);
|
||||||
KempstonDevice = new KempstonJoystick(this);
|
KempstonDevice = new KempstonJoystick(this);
|
||||||
|
|
||||||
//TapeProvider = new DefaultTapeProvider(file);
|
|
||||||
|
|
||||||
TapeDevice = new DatacorderDevice();
|
TapeDevice = new DatacorderDevice();
|
||||||
TapeDevice.Init(this);
|
TapeDevice.Init(this);
|
||||||
TapeDevice.LoadTape(file);
|
|
||||||
|
InitializeMedia(files);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -16,8 +16,8 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="spectrum"></param>
|
/// <param name="spectrum"></param>
|
||||||
/// <param name="cpu"></param>
|
/// <param name="cpu"></param>
|
||||||
public ZX16(ZXSpectrum spectrum, Z80A cpu, ZXSpectrum.BorderType borderType, byte[] file)
|
public ZX16(ZXSpectrum spectrum, Z80A cpu, ZXSpectrum.BorderType borderType, List<byte[]> files)
|
||||||
: base(spectrum, cpu, borderType, file)
|
: base(spectrum, cpu, borderType, files)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="spectrum"></param>
|
/// <param name="spectrum"></param>
|
||||||
/// <param name="cpu"></param>
|
/// <param name="cpu"></param>
|
||||||
public ZX48(ZXSpectrum spectrum, Z80A cpu, ZXSpectrum.BorderType borderType, byte[] file)
|
public ZX48(ZXSpectrum spectrum, Z80A cpu, ZXSpectrum.BorderType borderType, List<byte[]> files)
|
||||||
{
|
{
|
||||||
Spectrum = spectrum;
|
Spectrum = spectrum;
|
||||||
CPU = cpu;
|
CPU = cpu;
|
||||||
|
@ -31,11 +31,12 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
KeyboardDevice = new Keyboard48(this);
|
KeyboardDevice = new Keyboard48(this);
|
||||||
KempstonDevice = new KempstonJoystick(this);
|
KempstonDevice = new KempstonJoystick(this);
|
||||||
|
|
||||||
//TapeProvider = new DefaultTapeProvider(file);
|
|
||||||
|
|
||||||
TapeDevice = new DatacorderDevice();
|
TapeDevice = new DatacorderDevice();
|
||||||
TapeDevice.Init(this);
|
TapeDevice.Init(this);
|
||||||
TapeDevice.LoadTape(file);
|
|
||||||
|
InitializeMedia(files);
|
||||||
|
|
||||||
|
//TapeDevice.LoadTape(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
// Keyboard - row 5
|
// Keyboard - row 5
|
||||||
"Key Symbol Shift", "Key Semi-Colon", "Key Quote", "Key Left Cursor", "Key Right Cursor", "Key Space", "Key Up Cursor", "Key Down Cursor", "Key Comma",
|
"Key Symbol Shift", "Key Semi-Colon", "Key Quote", "Key Left Cursor", "Key Right Cursor", "Key Space", "Key Up Cursor", "Key Down Cursor", "Key Comma",
|
||||||
// Tape functions
|
// Tape functions
|
||||||
"Play Tape", "Stop Tape", "RTZ Tape", "Record Tape"
|
"Play Tape", "Stop Tape", "RTZ Tape", "Record Tape", "Insert Next Tape", "Insert Previous Tape"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
public partial class ZXSpectrum : IDebuggable, IInputPollable, IStatable, IRegionable
|
public partial class ZXSpectrum : IDebuggable, IInputPollable, IStatable, IRegionable
|
||||||
{
|
{
|
||||||
[CoreConstructor("ZXSpectrum")]
|
[CoreConstructor("ZXSpectrum")]
|
||||||
public ZXSpectrum(CoreComm comm, byte[] file, object settings, object syncSettings)
|
public ZXSpectrum(CoreComm comm, IEnumerable<byte[]> files, GameInfo game, object settings, object syncSettings)
|
||||||
{
|
{
|
||||||
PutSyncSettings((ZXSpectrumSyncSettings)syncSettings ?? new ZXSpectrumSyncSettings());
|
PutSyncSettings((ZXSpectrumSyncSettings)syncSettings ?? new ZXSpectrumSyncSettings());
|
||||||
PutSettings((ZXSpectrumSettings)settings ?? new ZXSpectrumSettings());
|
PutSettings((ZXSpectrumSettings)settings ?? new ZXSpectrumSettings());
|
||||||
|
@ -34,29 +34,30 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
|
|
||||||
_tracer = new TraceBuffer { Header = _cpu.TraceHeader };
|
_tracer = new TraceBuffer { Header = _cpu.TraceHeader };
|
||||||
|
|
||||||
_file = file;
|
//_file = file;
|
||||||
|
_files = files?.ToList() ?? new List<byte[]>();
|
||||||
|
|
||||||
switch (SyncSettings.MachineType)
|
switch (SyncSettings.MachineType)
|
||||||
{
|
{
|
||||||
case MachineType.ZXSpectrum16:
|
case MachineType.ZXSpectrum16:
|
||||||
ControllerDefinition = ZXSpectrumControllerDefinition;
|
ControllerDefinition = ZXSpectrumControllerDefinition;
|
||||||
Init(MachineType.ZXSpectrum16, SyncSettings.BorderType, SyncSettings.TapeLoadSpeed, _file);
|
Init(MachineType.ZXSpectrum16, SyncSettings.BorderType, SyncSettings.TapeLoadSpeed, _files);
|
||||||
break;
|
break;
|
||||||
case MachineType.ZXSpectrum48:
|
case MachineType.ZXSpectrum48:
|
||||||
ControllerDefinition = ZXSpectrumControllerDefinition;
|
ControllerDefinition = ZXSpectrumControllerDefinition;
|
||||||
Init(MachineType.ZXSpectrum48, SyncSettings.BorderType, SyncSettings.TapeLoadSpeed, _file);
|
Init(MachineType.ZXSpectrum48, SyncSettings.BorderType, SyncSettings.TapeLoadSpeed, _files);
|
||||||
break;
|
break;
|
||||||
case MachineType.ZXSpectrum128:
|
case MachineType.ZXSpectrum128:
|
||||||
ControllerDefinition = ZXSpectrumControllerDefinition;
|
ControllerDefinition = ZXSpectrumControllerDefinition;
|
||||||
Init(MachineType.ZXSpectrum128, SyncSettings.BorderType, SyncSettings.TapeLoadSpeed, _file);
|
Init(MachineType.ZXSpectrum128, SyncSettings.BorderType, SyncSettings.TapeLoadSpeed, _files);
|
||||||
break;
|
break;
|
||||||
case MachineType.ZXSpectrum128Plus2:
|
case MachineType.ZXSpectrum128Plus2:
|
||||||
ControllerDefinition = ZXSpectrumControllerDefinition;
|
ControllerDefinition = ZXSpectrumControllerDefinition;
|
||||||
Init(MachineType.ZXSpectrum128Plus2, SyncSettings.BorderType, SyncSettings.TapeLoadSpeed, _file);
|
Init(MachineType.ZXSpectrum128Plus2, SyncSettings.BorderType, SyncSettings.TapeLoadSpeed, _files);
|
||||||
break;
|
break;
|
||||||
case MachineType.ZXSpectrum128Plus3:
|
case MachineType.ZXSpectrum128Plus3:
|
||||||
ControllerDefinition = ZXSpectrumControllerDefinition;
|
ControllerDefinition = ZXSpectrumControllerDefinition;
|
||||||
Init(MachineType.ZXSpectrum128Plus3, SyncSettings.BorderType, SyncSettings.TapeLoadSpeed, _file);
|
Init(MachineType.ZXSpectrum128Plus3, SyncSettings.BorderType, SyncSettings.TapeLoadSpeed, _files);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new InvalidOperationException("Machine not yet emulated");
|
throw new InvalidOperationException("Machine not yet emulated");
|
||||||
|
@ -104,7 +105,8 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
|
|
||||||
private DCFilter dcf;
|
private DCFilter dcf;
|
||||||
|
|
||||||
private byte[] _file;
|
//private byte[] _file;
|
||||||
|
private readonly List<byte[]> _files;
|
||||||
|
|
||||||
public bool DiagRom = false;
|
public bool DiagRom = false;
|
||||||
|
|
||||||
|
@ -152,37 +154,37 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void Init(MachineType machineType, BorderType borderType, TapeLoadSpeed tapeLoadSpeed, byte[] file)
|
private void Init(MachineType machineType, BorderType borderType, TapeLoadSpeed tapeLoadSpeed, List<byte[]> files)
|
||||||
{
|
{
|
||||||
// setup the emulated model based on the MachineType
|
// setup the emulated model based on the MachineType
|
||||||
switch (machineType)
|
switch (machineType)
|
||||||
{
|
{
|
||||||
case MachineType.ZXSpectrum16:
|
case MachineType.ZXSpectrum16:
|
||||||
_machine = new ZX16(this, _cpu, borderType, file);
|
_machine = new ZX16(this, _cpu, borderType, files);
|
||||||
var _systemRom16 = GetFirmware(0x4000, "48ROM");
|
var _systemRom16 = GetFirmware(0x4000, "48ROM");
|
||||||
var romData16 = RomData.InitROM(machineType, _systemRom16);
|
var romData16 = RomData.InitROM(machineType, _systemRom16);
|
||||||
_machine.InitROM(romData16);
|
_machine.InitROM(romData16);
|
||||||
break;
|
break;
|
||||||
case MachineType.ZXSpectrum48:
|
case MachineType.ZXSpectrum48:
|
||||||
_machine = new ZX48(this, _cpu, borderType, file);
|
_machine = new ZX48(this, _cpu, borderType, files);
|
||||||
var _systemRom = GetFirmware(0x4000, "48ROM");
|
var _systemRom = GetFirmware(0x4000, "48ROM");
|
||||||
var romData = RomData.InitROM(machineType, _systemRom);
|
var romData = RomData.InitROM(machineType, _systemRom);
|
||||||
_machine.InitROM(romData);
|
_machine.InitROM(romData);
|
||||||
break;
|
break;
|
||||||
case MachineType.ZXSpectrum128:
|
case MachineType.ZXSpectrum128:
|
||||||
_machine = new ZX128(this, _cpu, borderType, file);
|
_machine = new ZX128(this, _cpu, borderType, files);
|
||||||
var _systemRom128 = GetFirmware(0x8000, "128ROM");
|
var _systemRom128 = GetFirmware(0x8000, "128ROM");
|
||||||
var romData128 = RomData.InitROM(machineType, _systemRom128);
|
var romData128 = RomData.InitROM(machineType, _systemRom128);
|
||||||
_machine.InitROM(romData128);
|
_machine.InitROM(romData128);
|
||||||
break;
|
break;
|
||||||
case MachineType.ZXSpectrum128Plus2:
|
case MachineType.ZXSpectrum128Plus2:
|
||||||
_machine = new ZX128Plus2(this, _cpu, borderType, file);
|
_machine = new ZX128Plus2(this, _cpu, borderType, files);
|
||||||
var _systemRomP2 = GetFirmware(0x8000, "PLUS2ROM");
|
var _systemRomP2 = GetFirmware(0x8000, "PLUS2ROM");
|
||||||
var romDataP2 = RomData.InitROM(machineType, _systemRomP2);
|
var romDataP2 = RomData.InitROM(machineType, _systemRomP2);
|
||||||
_machine.InitROM(romDataP2);
|
_machine.InitROM(romDataP2);
|
||||||
break;
|
break;
|
||||||
case MachineType.ZXSpectrum128Plus3:
|
case MachineType.ZXSpectrum128Plus3:
|
||||||
_machine = new ZX128Plus3(this, _cpu, borderType, file);
|
_machine = new ZX128Plus3(this, _cpu, borderType, files);
|
||||||
var _systemRomP3 = GetFirmware(0x10000, "PLUS3ROM");
|
var _systemRomP3 = GetFirmware(0x10000, "PLUS3ROM");
|
||||||
var romDataP3 = RomData.InitROM(machineType, _systemRomP3);
|
var romDataP3 = RomData.InitROM(machineType, _systemRomP3);
|
||||||
_machine.InitROM(romDataP3);
|
_machine.InitROM(romDataP3);
|
||||||
|
|
Loading…
Reference in New Issue