misc cleanups in ZXSpectrum class files
This commit is contained in:
parent
b03b6eb9de
commit
384f514445
|
@ -6,7 +6,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ZXHawk: Core Class
|
/// ZXHawk: Core Class
|
||||||
/// * IDebugggable *
|
/// * IDebuggable *
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class ZXSpectrum : IDebuggable
|
public partial class ZXSpectrum : IDebuggable
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,24 +46,11 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Frame
|
public int Frame => _machine?.FrameCount ?? 0;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_machine == null)
|
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
return _machine.FrameCount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string SystemId => "ZXSpectrum";
|
public string SystemId => "ZXSpectrum";
|
||||||
|
|
||||||
private bool deterministicEmulation;
|
public bool DeterministicEmulation { get; }
|
||||||
public bool DeterministicEmulation
|
|
||||||
{
|
|
||||||
get { return deterministicEmulation; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ResetCounters()
|
public void ResetCounters()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
using BizHawk.Common;
|
using System.Collections.Generic;
|
||||||
using BizHawk.Emulation.Common;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using BizHawk.Emulation.Cores.Sound;
|
|
||||||
|
using BizHawk.Common;
|
||||||
|
using BizHawk.Emulation.Common;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
{
|
{
|
||||||
|
@ -17,31 +16,25 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
internal ZXSpectrumSettings Settings = new ZXSpectrumSettings();
|
internal ZXSpectrumSettings Settings = new ZXSpectrumSettings();
|
||||||
internal ZXSpectrumSyncSettings SyncSettings = new ZXSpectrumSyncSettings();
|
internal ZXSpectrumSyncSettings SyncSettings = new ZXSpectrumSyncSettings();
|
||||||
|
|
||||||
public ZXSpectrumSettings GetSettings()
|
public ZXSpectrumSettings GetSettings() => Settings.Clone();
|
||||||
{
|
|
||||||
return Settings.Clone();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ZXSpectrumSyncSettings GetSyncSettings()
|
public ZXSpectrumSyncSettings GetSyncSettings() => SyncSettings.Clone();
|
||||||
{
|
|
||||||
return SyncSettings.Clone();
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool PutSettings(ZXSpectrumSettings o)
|
public bool PutSettings(ZXSpectrumSettings o)
|
||||||
{
|
{
|
||||||
// restore user settings to devices
|
// restore user settings to devices
|
||||||
if (_machine != null && _machine.AYDevice != null)
|
if (_machine?.AYDevice != null)
|
||||||
{
|
{
|
||||||
((AY38912)_machine.AYDevice as AY38912).PanningConfiguration = o.AYPanConfig;
|
((AY38912)_machine.AYDevice).PanningConfiguration = o.AYPanConfig;
|
||||||
_machine.AYDevice.Volume = o.AYVolume;
|
_machine.AYDevice.Volume = o.AYVolume;
|
||||||
}
|
}
|
||||||
if (_machine != null && _machine.BuzzerDevice != null)
|
if (_machine?.BuzzerDevice != null)
|
||||||
{
|
{
|
||||||
((OneBitBeeper)_machine.BuzzerDevice as OneBitBeeper).Volume = o.EarVolume;
|
_machine.BuzzerDevice.Volume = o.EarVolume;
|
||||||
}
|
}
|
||||||
if (_machine != null && _machine.TapeBuzzer != null)
|
if (_machine?.TapeBuzzer != null)
|
||||||
{
|
{
|
||||||
((OneBitBeeper)_machine.TapeBuzzer as OneBitBeeper).Volume = o.TapeVolume;
|
_machine.TapeBuzzer.Volume = o.TapeVolume;
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings = o;
|
Settings = o;
|
||||||
|
@ -100,7 +93,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
|
|
||||||
public ZXSpectrumSettings()
|
public ZXSpectrumSettings()
|
||||||
{
|
{
|
||||||
BizHawk.Common.SettingsUtil.SetDefaultValues(this);
|
SettingsUtil.SetDefaultValues(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,15 +234,14 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
public string Media { get; set; }
|
public string Media { get; set; }
|
||||||
public string OtherMisc { get; set; }
|
public string OtherMisc { get; set; }
|
||||||
|
|
||||||
Dictionary<string, string> Data = new Dictionary<string, string>();
|
private Dictionary<string, string> Data = new Dictionary<string, string>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Detailed info to be displayed within the settings UIs
|
/// Detailed info to be displayed within the settings UIs
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static ZXMachineMetaData GetMetaObject(MachineType type)
|
public static ZXMachineMetaData GetMetaObject(MachineType type)
|
||||||
{
|
{
|
||||||
ZXMachineMetaData m = new ZXMachineMetaData();
|
ZXMachineMetaData m = new ZXMachineMetaData { MachineType = type };
|
||||||
m.MachineType = type;
|
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
@ -350,13 +342,13 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns machine metadata as a formatted string (to be displayed in a textbox)
|
/// Returns machine metadata as a formatted string (to be displayed in a TextBox)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string GetMetaString(MachineType type)
|
public static string GetMetaString(MachineType type)
|
||||||
{
|
{
|
||||||
var m = GetMetaObject(type);
|
var m = GetMetaObject(type);
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
|
|
||||||
// get longest title
|
// get longest title
|
||||||
int titleLen = 0;
|
int titleLen = 0;
|
||||||
|
@ -385,11 +377,11 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// output the data splitting and tabbing as neccessary
|
// output the data splitting and tabbing as necessary
|
||||||
var arr = d.Value.Split(' ');
|
var arr = d.Value.Split(' ');
|
||||||
//int cnt = 0;
|
//int cnt = 0;
|
||||||
|
|
||||||
List<string> builder = new List<string>();
|
var builder = new List<string>();
|
||||||
string working = "";
|
string working = "";
|
||||||
foreach (var s in arr)
|
foreach (var s in arr)
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,28 +39,35 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
_files = files?.ToList() ?? new List<byte[]>();
|
_files = files?.ToList() ?? new List<byte[]>();
|
||||||
|
|
||||||
if (settings == null)
|
if (settings == null)
|
||||||
|
{
|
||||||
settings = new ZXSpectrumSettings();
|
settings = new ZXSpectrumSettings();
|
||||||
|
}
|
||||||
|
|
||||||
if (syncSettings == null)
|
if (syncSettings == null)
|
||||||
|
{
|
||||||
syncSettings = new ZXSpectrumSyncSettings();
|
syncSettings = new ZXSpectrumSyncSettings();
|
||||||
|
}
|
||||||
|
|
||||||
PutSyncSettings((ZXSpectrumSyncSettings)syncSettings ?? new ZXSpectrumSyncSettings());
|
PutSyncSettings((ZXSpectrumSyncSettings)syncSettings);
|
||||||
PutSettings((ZXSpectrumSettings)settings ?? new ZXSpectrumSettings());
|
PutSettings((ZXSpectrumSettings)settings);
|
||||||
|
|
||||||
List<JoystickType> joysticks = new List<JoystickType>();
|
var joysticks = new List<JoystickType>
|
||||||
joysticks.Add(((ZXSpectrumSyncSettings)syncSettings).JoystickType1);
|
{
|
||||||
joysticks.Add(((ZXSpectrumSyncSettings)syncSettings).JoystickType2);
|
((ZXSpectrumSyncSettings)syncSettings).JoystickType1,
|
||||||
joysticks.Add(((ZXSpectrumSyncSettings)syncSettings).JoystickType3);
|
((ZXSpectrumSyncSettings)syncSettings).JoystickType2,
|
||||||
|
((ZXSpectrumSyncSettings)syncSettings).JoystickType3
|
||||||
|
};
|
||||||
|
|
||||||
deterministicEmulation = ((ZXSpectrumSyncSettings)syncSettings).DeterministicEmulation;
|
DeterministicEmulation = ((ZXSpectrumSyncSettings)syncSettings).DeterministicEmulation;
|
||||||
|
|
||||||
if (deterministic != null && deterministic == true)
|
if (deterministic != null && deterministic == true)
|
||||||
{
|
{
|
||||||
if (deterministicEmulation == false)
|
if (!DeterministicEmulation)
|
||||||
{
|
{
|
||||||
CoreComm.Notify("Forcing Deterministic Emulation");
|
CoreComm.Notify("Forcing Deterministic Emulation");
|
||||||
}
|
}
|
||||||
|
|
||||||
deterministicEmulation = deterministic.Value;
|
DeterministicEmulation = deterministic.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
MachineType = SyncSettings.MachineType;
|
MachineType = SyncSettings.MachineType;
|
||||||
|
@ -270,7 +277,6 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
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);
|
||||||
//System.Windows.Forms.MessageBox.Show("+3 is not working at all yet :/");
|
|
||||||
break;
|
break;
|
||||||
case MachineType.Pentagon128:
|
case MachineType.Pentagon128:
|
||||||
_machine = new Pentagon128(this, _cpu, borderType, files, joys);
|
_machine = new Pentagon128(this, _cpu, borderType, files, joys);
|
||||||
|
@ -291,26 +297,11 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
|
|
||||||
#region IDriveLight
|
#region IDriveLight
|
||||||
|
|
||||||
public bool DriveLightEnabled
|
public bool DriveLightEnabled => true;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool DriveLightOn
|
public bool DriveLightOn =>
|
||||||
{
|
_machine?.TapeDevice?.TapeIsPlaying == true
|
||||||
get
|
|| _machine?.UPDDiskDevice?.DriveLight == true;
|
||||||
{
|
|
||||||
if (_machine != null &&
|
|
||||||
(_machine.TapeDevice != null && _machine.TapeDevice.TapeIsPlaying) ||
|
|
||||||
(_machine.UPDDiskDevice != null && _machine.UPDDiskDevice.DriveLight))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
|
@ -121,6 +121,7 @@
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=UI/@EntryIndexedValue">UI</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=UI/@EntryIndexedValue">UI</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=VBA/@EntryIndexedValue">VBA</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=VBA/@EntryIndexedValue">VBA</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ROM/@EntryIndexedValue">ROM</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ROM/@EntryIndexedValue">ROM</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ZX/@EntryIndexedValue">ZX</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=MethodPropertyEvent/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb_AaBb" /></s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=MethodPropertyEvent/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb_AaBb" /></s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateConstants/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB"><ExtraRule Prefix="" Suffix="" Style="AaBb" /></Policy></s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateConstants/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB"><ExtraRule Prefix="" Suffix="" Style="AaBb" /></Policy></s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue"><Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /></s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue"><Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /></s:String>
|
||||||
|
@ -434,6 +435,7 @@
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=vram/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=vram/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Vsync/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Vsync/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Waterbox/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Waterbox/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Widescreen/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Winform/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Winform/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=winforms/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=winforms/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Wndx/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Wndx/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
|
Loading…
Reference in New Issue