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>
|
||||
/// ZXHawk: Core Class
|
||||
/// * IDebugggable *
|
||||
/// * IDebuggable *
|
||||
/// </summary>
|
||||
public partial class ZXSpectrum : IDebuggable
|
||||
{
|
||||
|
|
|
@ -46,24 +46,11 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
return true;
|
||||
}
|
||||
|
||||
public int Frame
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_machine == null)
|
||||
return 0;
|
||||
else
|
||||
return _machine.FrameCount;
|
||||
}
|
||||
}
|
||||
public int Frame => _machine?.FrameCount ?? 0;
|
||||
|
||||
public string SystemId => "ZXSpectrum";
|
||||
|
||||
private bool deterministicEmulation;
|
||||
public bool DeterministicEmulation
|
||||
{
|
||||
get { return deterministicEmulation; }
|
||||
}
|
||||
public bool DeterministicEmulation { get; }
|
||||
|
||||
public void ResetCounters()
|
||||
{
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
using BizHawk.Emulation.Cores.Sound;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||
{
|
||||
|
@ -17,31 +16,25 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
internal ZXSpectrumSettings Settings = new ZXSpectrumSettings();
|
||||
internal ZXSpectrumSyncSettings SyncSettings = new ZXSpectrumSyncSettings();
|
||||
|
||||
public ZXSpectrumSettings GetSettings()
|
||||
{
|
||||
return Settings.Clone();
|
||||
}
|
||||
public ZXSpectrumSettings GetSettings() => Settings.Clone();
|
||||
|
||||
public ZXSpectrumSyncSettings GetSyncSettings()
|
||||
{
|
||||
return SyncSettings.Clone();
|
||||
}
|
||||
public ZXSpectrumSyncSettings GetSyncSettings() => SyncSettings.Clone();
|
||||
|
||||
public bool PutSettings(ZXSpectrumSettings o)
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
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;
|
||||
|
@ -100,7 +93,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
|
||||
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 OtherMisc { get; set; }
|
||||
|
||||
Dictionary<string, string> Data = new Dictionary<string, string>();
|
||||
private Dictionary<string, string> Data = new Dictionary<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// Detailed info to be displayed within the settings UIs
|
||||
/// </summary>
|
||||
public static ZXMachineMetaData GetMetaObject(MachineType type)
|
||||
{
|
||||
ZXMachineMetaData m = new ZXMachineMetaData();
|
||||
m.MachineType = type;
|
||||
ZXMachineMetaData m = new ZXMachineMetaData { MachineType = type };
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
@ -350,13 +342,13 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
}
|
||||
|
||||
/// <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>
|
||||
public static string GetMetaString(MachineType type)
|
||||
{
|
||||
var m = GetMetaObject(type);
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
var sb = new StringBuilder();
|
||||
|
||||
// get longest title
|
||||
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(' ');
|
||||
//int cnt = 0;
|
||||
|
||||
List<string> builder = new List<string>();
|
||||
var builder = new List<string>();
|
||||
string working = "";
|
||||
foreach (var s in arr)
|
||||
{
|
||||
|
|
|
@ -39,28 +39,35 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
_files = files?.ToList() ?? new List<byte[]>();
|
||||
|
||||
if (settings == null)
|
||||
{
|
||||
settings = new ZXSpectrumSettings();
|
||||
}
|
||||
|
||||
if (syncSettings == null)
|
||||
{
|
||||
syncSettings = new ZXSpectrumSyncSettings();
|
||||
}
|
||||
|
||||
PutSyncSettings((ZXSpectrumSyncSettings)syncSettings ?? new ZXSpectrumSyncSettings());
|
||||
PutSettings((ZXSpectrumSettings)settings ?? new ZXSpectrumSettings());
|
||||
PutSyncSettings((ZXSpectrumSyncSettings)syncSettings);
|
||||
PutSettings((ZXSpectrumSettings)settings);
|
||||
|
||||
List<JoystickType> joysticks = new List<JoystickType>();
|
||||
joysticks.Add(((ZXSpectrumSyncSettings)syncSettings).JoystickType1);
|
||||
joysticks.Add(((ZXSpectrumSyncSettings)syncSettings).JoystickType2);
|
||||
joysticks.Add(((ZXSpectrumSyncSettings)syncSettings).JoystickType3);
|
||||
var joysticks = new List<JoystickType>
|
||||
{
|
||||
((ZXSpectrumSyncSettings)syncSettings).JoystickType1,
|
||||
((ZXSpectrumSyncSettings)syncSettings).JoystickType2,
|
||||
((ZXSpectrumSyncSettings)syncSettings).JoystickType3
|
||||
};
|
||||
|
||||
deterministicEmulation = ((ZXSpectrumSyncSettings)syncSettings).DeterministicEmulation;
|
||||
DeterministicEmulation = ((ZXSpectrumSyncSettings)syncSettings).DeterministicEmulation;
|
||||
|
||||
if (deterministic != null && deterministic == true)
|
||||
{
|
||||
if (deterministicEmulation == false)
|
||||
if (!DeterministicEmulation)
|
||||
{
|
||||
CoreComm.Notify("Forcing Deterministic Emulation");
|
||||
}
|
||||
|
||||
deterministicEmulation = deterministic.Value;
|
||||
DeterministicEmulation = deterministic.Value;
|
||||
}
|
||||
|
||||
MachineType = SyncSettings.MachineType;
|
||||
|
@ -270,7 +277,6 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
var _systemRomP3 = GetFirmware(0x10000, "PLUS3ROM");
|
||||
var romDataP3 = RomData.InitROM(machineType, _systemRomP3);
|
||||
_machine.InitROM(romDataP3);
|
||||
//System.Windows.Forms.MessageBox.Show("+3 is not working at all yet :/");
|
||||
break;
|
||||
case MachineType.Pentagon128:
|
||||
_machine = new Pentagon128(this, _cpu, borderType, files, joys);
|
||||
|
@ -291,26 +297,11 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
|
||||
#region IDriveLight
|
||||
|
||||
public bool DriveLightEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public bool DriveLightEnabled => true;
|
||||
|
||||
public bool DriveLightOn
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_machine != null &&
|
||||
(_machine.TapeDevice != null && _machine.TapeDevice.TapeIsPlaying) ||
|
||||
(_machine.UPDDiskDevice != null && _machine.UPDDiskDevice.DriveLight))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public bool DriveLightOn =>
|
||||
_machine?.TapeDevice?.TapeIsPlaying == true
|
||||
|| _machine?.UPDDiskDevice?.DriveLight == true;
|
||||
|
||||
#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/=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/=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/=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>
|
||||
|
@ -434,6 +435,7 @@
|
|||
<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/=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/=winforms/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Wndx/@EntryIndexedValue">True</s:Boolean>
|
||||
|
|
Loading…
Reference in New Issue