BizHawk.Emulation.Common - cleanups -> C#6/7isms, fix some typos, variable naming, spaces to tabs

This commit is contained in:
adelikat 2019-10-29 13:59:08 -05:00
parent c78b6df363
commit 2b7cb1bb7d
28 changed files with 550 additions and 681 deletions

View File

@ -66,8 +66,7 @@ namespace BizHawk.Emulation.Common
public object GetService(Type t) public object GetService(Type t)
{ {
object service; if (_services.TryGetValue(t, out var service))
if (_services.TryGetValue(t, out service))
{ {
return service; return service;
} }
@ -86,12 +85,6 @@ namespace BizHawk.Emulation.Common
return _services.ContainsKey(t); return _services.ContainsKey(t);
} }
public IEnumerable<Type> AvailableServices public IEnumerable<Type> AvailableServices =>_services.Select(d => d.Key);
{
get
{
return _services.Select(d => d.Key);
}
}
} }
} }

View File

@ -62,9 +62,9 @@ namespace BizHawk.Emulation.Common
/// <summary> /// <summary>
/// Whether the CDL is tracking a block with the given name /// Whether the CDL is tracking a block with the given name
/// </summary> /// </summary>
public bool Has(string blockname) public bool Has(string blockName)
{ {
return ContainsKey(blockname); return ContainsKey(blockName);
} }
/// <summary> /// <summary>
@ -121,17 +121,17 @@ namespace BizHawk.Emulation.Common
foreach (var kvp in other) foreach (var kvp in other)
{ {
byte[] fromdata = kvp.Value; byte[] fromData = kvp.Value;
byte[] todata = this[kvp.Key]; byte[] toData = this[kvp.Key];
if (fromdata.Length != todata.Length) if (fromData.Length != toData.Length)
{ {
throw new InvalidDataException("Memory regions must be the same size!"); throw new InvalidDataException("Memory regions must be the same size!");
} }
for (int i = 0; i < todata.Length; i++) for (int i = 0; i < toData.Length; i++)
{ {
todata[i] |= fromdata[i]; toData[i] |= fromData[i];
} }
} }
} }
@ -201,7 +201,7 @@ namespace BizHawk.Emulation.Common
} }
else else
{ {
throw new InvalidDataException("File is not a Bizhawk CDL file!"); throw new InvalidDataException("File is not a BizHawk CDL file!");
} }
int count = br.ReadInt32(); int count = br.ReadInt32();

View File

@ -82,23 +82,23 @@ namespace BizHawk.Emulation.Common
{ {
case AxisConstraintType.Circular: case AxisConstraintType.Circular:
{ {
string xaxis = constraint.Params[0] as string; string xAxis = constraint.Params[0] as string ?? "";
string yaxis = constraint.Params[1] as string; string yAxis = constraint.Params[1] as string ?? "";
float range = (float)constraint.Params[2]; float range = (float)constraint.Params[2];
if (!floatButtons.ContainsKey(xaxis)) break; if (!floatButtons.ContainsKey(xAxis)) break;
if (!floatButtons.ContainsKey(yaxis)) break; if (!floatButtons.ContainsKey(yAxis)) break;
double xval = floatButtons[xaxis]; double xVal = floatButtons[xAxis];
double yval = floatButtons[yaxis]; double yVal = floatButtons[yAxis];
double length = Math.Sqrt((xval * xval) + (yval * yval)); double length = Math.Sqrt((xVal * xVal) + (yVal * yVal));
if (length > range) if (length > range)
{ {
double ratio = range / length; double ratio = range / length;
xval *= ratio; xVal *= ratio;
yval *= ratio; yVal *= ratio;
} }
floatButtons[xaxis] = (float)xval; floatButtons[xAxis] = (float)xVal;
floatButtons[yaxis] = (float)yval; floatButtons[yAxis] = (float)yVal;
break; break;
} }
} }
@ -167,7 +167,7 @@ namespace BizHawk.Emulation.Common
List<string> list = new List<string>(FloatControls); List<string> list = new List<string>(FloatControls);
list.AddRange(BoolButtons); list.AddRange(BoolButtons);
// starts with console buttons, then each plasyer's buttons individually // starts with console buttons, then each player's buttons individually
List<string>[] ret = new List<string>[PlayerCount + 1]; List<string>[] ret = new List<string>[PlayerCount + 1];
for (int i = 0; i < ret.Length; i++) for (int i = 0; i < ret.Length; i++)
{ {

View File

@ -70,11 +70,11 @@ namespace BizHawk.Emulation.Common
private static void Call(ObservableCollection<IMemoryCallback> cbs, uint addr, uint value, uint flags, string scope) private static void Call(ObservableCollection<IMemoryCallback> cbs, uint addr, uint value, uint flags, string scope)
{ {
for (int i = 0; i < cbs.Count; i++) foreach (var cb in cbs)
{ {
if (!cbs[i].Address.HasValue || (cbs[i].Scope == scope && cbs[i].Address == (addr & cbs[i].AddressMask))) if (!cb.Address.HasValue || (cb.Scope == scope && cb.Address == (addr & cb.AddressMask)))
{ {
cbs[i].Callback(addr, value, flags); cb.Callback(addr, value, flags);
} }
} }
} }
@ -134,17 +134,17 @@ namespace BizHawk.Emulation.Common
public bool HasReadsForScope(string scope) public bool HasReadsForScope(string scope)
{ {
return _reads.Where(e => e.Scope == scope).Any(); return _reads.Any(e => e.Scope == scope);
} }
public bool HasWritesForScope(string scope) public bool HasWritesForScope(string scope)
{ {
return _writes.Where(e => e.Scope == scope).Any(); return _writes.Any(e => e.Scope == scope);
} }
public bool HasExecutesForScope(string scope) public bool HasExecutesForScope(string scope)
{ {
return _execs.Where(e => e.Scope == scope).Any(); return _execs.Any(e => e.Scope == scope);
} }
private bool UpdateHasVariables() private bool UpdateHasVariables()

View File

@ -5,22 +5,13 @@ namespace BizHawk.Emulation.Common
{ {
public class MemoryDomainDelegate : MemoryDomain public class MemoryDomainDelegate : MemoryDomain
{ {
private Func<long, byte> _peek;
private Action<long, byte> _poke; private Action<long, byte> _poke;
public Func<long, byte> Peek public Func<long, byte> Peek { get; set; }
{
get { return _peek; }
set { _peek = value; }
}
public Action<long, byte> Poke public Action<long, byte> Poke
{ {
get get => _poke;
{
return _poke;
}
set set
{ {
_poke = value; _poke = value;
@ -30,7 +21,7 @@ namespace BizHawk.Emulation.Common
public override byte PeekByte(long addr) public override byte PeekByte(long addr)
{ {
return _peek(addr); return Peek(addr);
} }
public override void PokeByte(long addr, byte val) public override void PokeByte(long addr, byte val)
@ -43,7 +34,7 @@ namespace BizHawk.Emulation.Common
Name = name; Name = name;
EndianType = endian; EndianType = endian;
Size = size; Size = size;
_peek = peek; Peek = peek;
_poke = poke; _poke = poke;
Writable = poke != null; Writable = poke != null;
WordSize = wordSize; WordSize = wordSize;
@ -56,11 +47,7 @@ namespace BizHawk.Emulation.Common
public byte[] Data public byte[] Data
{ {
get get => _data;
{
return _data;
}
set set
{ {
_data = value; _data = value;

View File

@ -24,13 +24,7 @@ namespace BizHawk.Emulation.Common
{ {
} }
public MemoryDomain this[string name] public MemoryDomain this[string name] => this.FirstOrDefault(x => x.Name == name);
{
get
{
return this.FirstOrDefault(x => x.Name == name);
}
}
public MemoryDomain MainMemory public MemoryDomain MainMemory
{ {
@ -44,24 +38,10 @@ namespace BizHawk.Emulation.Common
return this.First(); return this.First();
} }
set set => _mainMemory = value;
{
_mainMemory = value;
}
} }
public bool HasSystemBus public bool HasSystemBus => _systemBus != null || this.Any(x => x.Name == "System Bus");
{
get
{
if (_systemBus != null)
{
return true;
}
return this.Any(x => x.Name == "System Bus");
}
}
public MemoryDomain SystemBus public MemoryDomain SystemBus
{ {
@ -82,10 +62,7 @@ namespace BizHawk.Emulation.Common
return MainMemory; return MainMemory;
} }
set set => _systemBus = value;
{
_systemBus = value;
}
} }
/// <summary> /// <summary>
@ -96,8 +73,7 @@ namespace BizHawk.Emulation.Common
var domains = this.ToDictionary(m => m.Name); var domains = this.ToDictionary(m => m.Name);
foreach (var src in other) foreach (var src in other)
{ {
MemoryDomain dst; if (domains.TryGetValue(src.Name, out var dst))
if (domains.TryGetValue(src.Name, out dst))
{ {
TryMerge<MemoryDomainByteArray>(dst, src, (d, s) => d.Data = s.Data); TryMerge<MemoryDomainByteArray>(dst, src, (d, s) => d.Data = s.Data);
TryMerge<MemoryDomainIntPtr>(dst, src, (d, s) => d.Data = s.Data); TryMerge<MemoryDomainIntPtr>(dst, src, (d, s) => d.Data = s.Data);

View File

@ -33,7 +33,7 @@ namespace BizHawk.Emulation.Common
public ControllerDefinition ControllerDefinition => NullController.Instance.Definition; public ControllerDefinition ControllerDefinition => NullController.Instance.Definition;
public bool FrameAdvance(IController controller, bool render, bool rendersound) public bool FrameAdvance(IController controller, bool render, bool renderSound)
{ {
if (render == false) if (render == false)
{ {
@ -249,7 +249,7 @@ namespace BizHawk.Emulation.Common
var ms = new MemoryStream(); var ms = new MemoryStream();
gz.CopyTo(ms); gz.CopyTo(ms);
_data = ms.ToArray(); _data = ms.ToArray();
for (int i = 0; i < 3800; i++) // compenstate for sample start point for (int i = 0; i < 3800; i++) // compensate for sample start point
{ {
Next(); Next();
} }

View File

@ -27,7 +27,7 @@ namespace BizHawk.Emulation.Common
: this() : this()
{ {
_spfNumerator = spf; _spfNumerator = spf;
_spfDenominator = 1; _spfDenominator = 1;
} }
/// <summary> /// <summary>

View File

@ -6,12 +6,7 @@
/// <seealso cref="ITraceable" /> /// <seealso cref="ITraceable" />
public class TraceBuffer : ITraceable public class TraceBuffer : ITraceable
{ {
public TraceBuffer() public string Header { get; set; } = "Instructions";
{
Header = "Instructions";
}
public string Header { get; set; }
public ITraceSink Sink { private get; set; } public ITraceSink Sink { private get; set; }

View File

@ -23,12 +23,12 @@ namespace BizHawk.Emulation.Common
SingleInstance = singleInstance; SingleInstance = singleInstance;
} }
public string CoreName { get; private set; } public string CoreName { get; }
public string Author { get; private set; } public string Author { get; }
public bool Ported { get; private set; } public bool Ported { get; }
public bool Released { get; private set; } public bool Released { get; }
public string PortedVersion { get; private set; } public string PortedVersion { get; }
public string PortedUrl { get; private set; } public string PortedUrl { get; }
public bool SingleInstance { get; private set; } public bool SingleInstance { get; }
} }
} }

View File

@ -36,16 +36,16 @@ namespace BizHawk.Emulation.Common
/// <summary> /// <summary>
/// Gets a message to show. reasonably annoying (dialog box), shouldn't be used most of the time /// Gets a message to show. reasonably annoying (dialog box), shouldn't be used most of the time
/// </summary> /// </summary>
public Action<string> ShowMessage { get; private set; } public Action<string> ShowMessage { get; }
/// <summary> /// <summary>
/// Gets a message to show. less annoying (OSD message). Should be used for ignorable helpful messages /// Gets a message to show. less annoying (OSD message). Should be used for ignorable helpful messages
/// </summary> /// </summary>
public Action<string> Notify { get; private set; } public Action<string> Notify { get; }
public Func<int, int, bool, object> RequestGLContext { get; set; } public Func<int, int, bool, object> RequestGLContext { get; set; }
public Action<object> ReleaseGLContext { get; set; } public Action<object> ReleaseGLContext { get; set; }
public Action<object> ActivateGLContext { get; set; } public Action<object> ActivateGLContext { get; set; }
public Action DeactivateGLContext { get; set; } // this shouldnt be necessary.. frontend should be changing context before it does anything.. but for now.. public Action DeactivateGLContext { get; set; } // this shouldn't be necessary.. frontend should be changing context before it does anything.. but for now..
} }
} }

View File

@ -1,421 +1,417 @@
 using System.Text;
using System.Linq;
using System.Text;
namespace BizHawk.Emulation.Common namespace BizHawk.Emulation.Common
{ {
/// <summary> /// <summary>
/// A slightly convoluted way of determining the required System based on a *.dsk file /// A slightly convoluted way of determining the required System based on a *.dsk file
/// This is here because (for probably good reason) there does not appear to be a route /// This is here because (for probably good reason) there does not appear to be a route
/// to BizHawk.Emulation.Cores from Bizhawk.Emultion.Common /// to BizHawk.Emulation.Cores from BizHawk.Emulation.Common
/// </summary> /// </summary>
public class DSKIdentifier public class DSKIdentifier
{ {
/// <summary> /// <summary>
/// Default fallthrough to AppleII /// Default fallthrough to AppleII
/// </summary> /// </summary>
public string IdentifiedSystem = "AppleII"; public string IdentifiedSystem = "AppleII";
private string PossibleIdent = ""; private string PossibleIdent = "";
private byte[] data; private readonly byte[] data;
// dsk header
public byte NumberOfTracks { get; set; }
public byte NumberOfSides { get; set; }
public int[] TrackSizes { get; set; }
// state // dsk header
public int CylinderCount; public byte NumberOfTracks { get; set; }
public int SideCount; public byte NumberOfSides { get; set; }
public int BytesPerTrack; public int[] TrackSizes { get; set; }
public Track[] Tracks = null; // state
public int CylinderCount;
public int SideCount;
public int BytesPerTrack;
public DSKIdentifier(byte[] imageData) public Track[] Tracks = null;
{
data = imageData;
ParseDskImage();
}
private void ParseDskImage() public DSKIdentifier(byte[] imageData)
{ {
string ident = Encoding.ASCII.GetString(data, 0, 16).ToUpper(); data = imageData;
if (ident.Contains("MV - CPC")) ParseDskImage();
{ }
ParseDSK();
}
else if (ident.Contains("EXTENDED CPC DSK"))
{
ParseEDSK();
}
else
{
// fall through
return;
}
CalculateFormat(); private void ParseDskImage()
} {
string ident = Encoding.ASCII.GetString(data, 0, 16).ToUpper();
if (ident.Contains("MV - CPC"))
{
ParseDSK();
}
else if (ident.Contains("EXTENDED CPC DSK"))
{
ParseEDSK();
}
else
{
// fall through
return;
}
private void CalculateFormat() CalculateFormat();
{ }
// uses some of the work done here: https://github.com/damieng/DiskImageManager
var trk = Tracks[0];
// look for standard speccy bootstart private void CalculateFormat()
if (trk.Sectors[0].SectorData != null && trk.Sectors[0].SectorData.Length > 0) {
{ // uses some of the work done here: https://github.com/damieng/DiskImageManager
if (trk.Sectors[0].SectorData[0] == 0 && trk.Sectors[0].SectorData[1] == 0 var trk = Tracks[0];
&& trk.Sectors[0].SectorData[2] == 40)
{
PossibleIdent = "ZXSpectrum";
}
}
// search for PLUS3DOS string // look for standard speccy bootstart
foreach (var t in Tracks) if (trk.Sectors[0].SectorData != null && trk.Sectors[0].SectorData.Length > 0)
{ {
foreach (var s in t.Sectors) if (trk.Sectors[0].SectorData[0] == 0 && trk.Sectors[0].SectorData[1] == 0
{ && trk.Sectors[0].SectorData[2] == 40)
if (s.SectorData == null || s.SectorData.Length == 0) {
continue; PossibleIdent = "ZXSpectrum";
}
}
string str = Encoding.ASCII.GetString(s.SectorData, 0, s.SectorData.Length).ToUpper(); // search for PLUS3DOS string
if (str.Contains("PLUS3DOS")) foreach (var t in Tracks)
{ {
IdentifiedSystem = "ZXSpectrum"; foreach (var s in t.Sectors)
return; {
} if (s.SectorData == null || s.SectorData.Length == 0)
} continue;
}
// check for bootable status string str = Encoding.ASCII.GetString(s.SectorData, 0, s.SectorData.Length).ToUpper();
if (trk.Sectors[0].SectorData != null && trk.Sectors[0].SectorData.Length > 0) if (str.Contains("PLUS3DOS"))
{ {
int chksm = trk.Sectors[0].GetChecksum256(); IdentifiedSystem = "ZXSpectrum";
return;
}
}
}
switch(chksm) // check for bootable status
{ if (trk.Sectors[0].SectorData != null && trk.Sectors[0].SectorData.Length > 0)
case 3: {
IdentifiedSystem = "ZXSpectrum"; int chksm = trk.Sectors[0].GetChecksum256();
return;
case 1:
case 255:
// different Amstrad PCW boot records
// just return CPC for now
IdentifiedSystem = "AmstradCPC";
return;
}
switch(trk.GetLowestSectorID()) switch (chksm)
{ {
case 65: case 3:
case 193: IdentifiedSystem = "ZXSpectrum";
IdentifiedSystem = "AmstradCPC"; return;
return; case 1:
} case 255:
} // different Amstrad PCW boot records
// just return CPC for now
IdentifiedSystem = "AmstradCPC";
return;
}
// at this point the disk is not standard bootable switch (trk.GetLowestSectorID())
// try format analysis {
if (trk.Sectors.Length == 9 && trk.Sectors[0].SectorSize == 2) case 65:
{ case 193:
switch(trk.GetLowestSectorID()) IdentifiedSystem = "AmstradCPC";
{ return;
case 1: }
switch(trk.Sectors[0].GetChecksum256()) }
{
case 3:
IdentifiedSystem = "ZXSpectrum";
return;
case 1:
case 255:
// different Amstrad PCW checksums
// just return CPC for now
IdentifiedSystem = "AmstradCPC";
return;
}
break;
case 65:
case 193:
IdentifiedSystem = "AmstradCPC";
return;
}
}
// could be an odd format disk // at this point the disk is not standard bootable
switch (trk.GetLowestSectorID()) // try format analysis
{ if (trk.Sectors.Length == 9 && trk.Sectors[0].SectorSize == 2)
case 1: {
if (trk.Sectors.Length == 8) switch (trk.GetLowestSectorID())
{ {
// CPC IBM case 1:
IdentifiedSystem = "AmstradCPC"; switch (trk.Sectors[0].GetChecksum256())
return; {
} case 3:
break; IdentifiedSystem = "ZXSpectrum";
case 65: return;
case 193: case 1:
// possible CPC custom case 255:
PossibleIdent = "AmstradCPC"; // different Amstrad PCW checksums
break; // just return CPC for now
} IdentifiedSystem = "AmstradCPC";
return;
}
break;
case 65:
case 193:
IdentifiedSystem = "AmstradCPC";
return;
}
}
// other custom ZX Spectrum formats // could be an odd format disk
if (NumberOfSides == 1 && trk.Sectors.Length == 10) switch (trk.GetLowestSectorID())
{ {
if (trk.Sectors[0].SectorData.Length > 10) case 1:
{ if (trk.Sectors.Length == 8)
if (trk.Sectors[0].SectorData[2] == 42 && trk.Sectors[0].SectorData[8] == 12) {
{ // CPC IBM
switch (trk.Sectors[0].SectorData[5]) IdentifiedSystem = "AmstradCPC";
{ return;
case 0: }
if (trk.Sectors[1].SectorID == 8) break;
{ case 65:
switch (Tracks[1].Sectors[0].SectorID) case 193:
{ // possible CPC custom
case 7: PossibleIdent = "AmstradCPC";
IdentifiedSystem = "ZXSpectrum"; break;
return; }
default:
PossibleIdent = "ZXSpectrum";
break;
}
}
else
{
PossibleIdent = "ZXSpectrum";
}
break;
case 1:
if (trk.Sectors[1].SectorID == 8)
{
switch (Tracks[1].Sectors[0].SectorID)
{
case 7:
case 1:
IdentifiedSystem = "ZXSpectrum";
return;
}
}
else
{
PossibleIdent = "ZXSpectrum";
}
break;
}
}
if (trk.Sectors[0].SectorData[7] == 3 && // other custom ZX Spectrum formats
trk.Sectors[0].SectorData[9] == 23 && if (NumberOfSides == 1 && trk.Sectors.Length == 10)
trk.Sectors[0].SectorData[2] == 40) {
{ if (trk.Sectors[0].SectorData.Length > 10)
IdentifiedSystem = "ZXSpectrum"; {
return; if (trk.Sectors[0].SectorData[2] == 42 && trk.Sectors[0].SectorData[8] == 12)
} {
} switch (trk.Sectors[0].SectorData[5])
} {
case 0:
if (trk.Sectors[1].SectorID == 8)
{
switch (Tracks[1].Sectors[0].SectorID)
{
case 7:
IdentifiedSystem = "ZXSpectrum";
return;
default:
PossibleIdent = "ZXSpectrum";
break;
}
}
else
{
PossibleIdent = "ZXSpectrum";
}
break;
case 1:
if (trk.Sectors[1].SectorID == 8)
{
switch (Tracks[1].Sectors[0].SectorID)
{
case 7:
case 1:
IdentifiedSystem = "ZXSpectrum";
return;
}
}
else
{
PossibleIdent = "ZXSpectrum";
}
break;
}
}
// last chance. use the possible value if (trk.Sectors[0].SectorData[7] == 3 &&
if (IdentifiedSystem == "AppleII" && PossibleIdent != "") trk.Sectors[0].SectorData[9] == 23 &&
{ trk.Sectors[0].SectorData[2] == 40)
IdentifiedSystem = "ZXSpectrum"; {
} IdentifiedSystem = "ZXSpectrum";
} return;
}
}
}
private void ParseDSK() // last chance. use the possible value
{ if (IdentifiedSystem == "AppleII" && PossibleIdent != "")
NumberOfTracks = data[0x30]; {
NumberOfSides = data[0x31]; IdentifiedSystem = "ZXSpectrum";
TrackSizes = new int[NumberOfTracks * NumberOfSides]; }
Tracks = new Track[NumberOfTracks * NumberOfSides]; }
int pos = 0x32;
for (int i = 0; i < NumberOfTracks * NumberOfSides; i++)
{
TrackSizes[i] = (ushort)(data[pos] | data[pos + 1] << 8);
}
pos = 0x100;
for (int i = 0; i < NumberOfTracks * NumberOfSides; i++)
{
if (TrackSizes[i] == 0)
{
Tracks[i] = new Track();
Tracks[i].Sectors = new Sector[0];
continue;
}
int p = pos;
Tracks[i] = new Track();
Tracks[i].TrackIdent = Encoding.ASCII.GetString(data, p, 12);
p += 16;
Tracks[i].TrackNumber = data[p++];
Tracks[i].SideNumber = data[p++];
p += 2;
Tracks[i].SectorSize = data[p++];
Tracks[i].NumberOfSectors = data[p++];
Tracks[i].GAP3Length = data[p++];
Tracks[i].FillerByte = data[p++];
int dpos = pos + 0x100;
Tracks[i].Sectors = new Sector[Tracks[i].NumberOfSectors];
for (int s = 0; s < Tracks[i].NumberOfSectors; s++)
{
Tracks[i].Sectors[s] = new Sector();
Tracks[i].Sectors[s].TrackNumber = data[p++]; private void ParseDSK()
Tracks[i].Sectors[s].SideNumber = data[p++]; {
Tracks[i].Sectors[s].SectorID = data[p++]; NumberOfTracks = data[0x30];
Tracks[i].Sectors[s].SectorSize = data[p++]; NumberOfSides = data[0x31];
Tracks[i].Sectors[s].Status1 = data[p++]; TrackSizes = new int[NumberOfTracks * NumberOfSides];
Tracks[i].Sectors[s].Status2 = data[p++]; Tracks = new Track[NumberOfTracks * NumberOfSides];
Tracks[i].Sectors[s].ActualDataByteLength = (ushort)(data[p] | data[p + 1] << 8); int pos = 0x32;
p += 2; for (int i = 0; i < NumberOfTracks * NumberOfSides; i++)
if (Tracks[i].Sectors[s].SectorSize == 0) {
{ TrackSizes[i] = (ushort)(data[pos] | data[pos + 1] << 8);
Tracks[i].Sectors[s].ActualDataByteLength = TrackSizes[i]; }
} pos = 0x100;
else if (Tracks[i].Sectors[s].SectorSize > 6) for (int i = 0; i < NumberOfTracks * NumberOfSides; i++)
{ {
Tracks[i].Sectors[s].ActualDataByteLength = TrackSizes[i]; if (TrackSizes[i] == 0)
} {
else if (Tracks[i].Sectors[s].SectorSize == 6) Tracks[i] = new Track();
{ Tracks[i].Sectors = new Sector[0];
Tracks[i].Sectors[s].ActualDataByteLength = 0x1800; continue;
} }
else int p = pos;
{ Tracks[i] = new Track();
Tracks[i].Sectors[s].ActualDataByteLength = 0x80 << Tracks[i].Sectors[s].SectorSize; Tracks[i].TrackIdent = Encoding.ASCII.GetString(data, p, 12);
} p += 16;
Tracks[i].Sectors[s].SectorData = new byte[Tracks[i].Sectors[s].ActualDataByteLength]; Tracks[i].TrackNumber = data[p++];
for (int b = 0; b < Tracks[i].Sectors[s].ActualDataByteLength; b++) Tracks[i].SideNumber = data[p++];
{ p += 2;
Tracks[i].Sectors[s].SectorData[b] = data[dpos + b]; Tracks[i].SectorSize = data[p++];
} Tracks[i].NumberOfSectors = data[p++];
dpos += Tracks[i].Sectors[s].ActualDataByteLength; Tracks[i].GAP3Length = data[p++];
} Tracks[i].FillerByte = data[p++];
pos += TrackSizes[i]; int dpos = pos + 0x100;
} Tracks[i].Sectors = new Sector[Tracks[i].NumberOfSectors];
} for (int s = 0; s < Tracks[i].NumberOfSectors; s++)
{
Tracks[i].Sectors[s] = new Sector();
private void ParseEDSK() Tracks[i].Sectors[s].TrackNumber = data[p++];
{ Tracks[i].Sectors[s].SideNumber = data[p++];
NumberOfTracks = data[0x30]; Tracks[i].Sectors[s].SectorID = data[p++];
NumberOfSides = data[0x31]; Tracks[i].Sectors[s].SectorSize = data[p++];
TrackSizes = new int[NumberOfTracks * NumberOfSides]; Tracks[i].Sectors[s].Status1 = data[p++];
Tracks = new Track[NumberOfTracks * NumberOfSides]; Tracks[i].Sectors[s].Status2 = data[p++];
int pos = 0x34; Tracks[i].Sectors[s].ActualDataByteLength = (ushort)(data[p] | data[p + 1] << 8);
for (int i = 0; i < NumberOfTracks * NumberOfSides; i++) p += 2;
{ if (Tracks[i].Sectors[s].SectorSize == 0)
TrackSizes[i] = data[pos++] * 256; {
} Tracks[i].Sectors[s].ActualDataByteLength = TrackSizes[i];
pos = 0x100; }
for (int i = 0; i < NumberOfTracks * NumberOfSides; i++) else if (Tracks[i].Sectors[s].SectorSize > 6)
{ {
if (TrackSizes[i] == 0) Tracks[i].Sectors[s].ActualDataByteLength = TrackSizes[i];
{ }
Tracks[i] = new Track(); else if (Tracks[i].Sectors[s].SectorSize == 6)
Tracks[i].Sectors = new Sector[0]; {
continue; Tracks[i].Sectors[s].ActualDataByteLength = 0x1800;
} }
int p = pos; else
Tracks[i] = new Track(); {
Tracks[i].TrackIdent = Encoding.ASCII.GetString(data, p, 12); Tracks[i].Sectors[s].ActualDataByteLength = 0x80 << Tracks[i].Sectors[s].SectorSize;
p += 16; }
Tracks[i].TrackNumber = data[p++]; Tracks[i].Sectors[s].SectorData = new byte[Tracks[i].Sectors[s].ActualDataByteLength];
Tracks[i].SideNumber = data[p++]; for (int b = 0; b < Tracks[i].Sectors[s].ActualDataByteLength; b++)
Tracks[i].DataRate = data[p++]; {
Tracks[i].RecordingMode = data[p++]; Tracks[i].Sectors[s].SectorData[b] = data[dpos + b];
Tracks[i].SectorSize = data[p++]; }
Tracks[i].NumberOfSectors = data[p++]; dpos += Tracks[i].Sectors[s].ActualDataByteLength;
Tracks[i].GAP3Length = data[p++]; }
Tracks[i].FillerByte = data[p++]; pos += TrackSizes[i];
int dpos = pos + 0x100; }
Tracks[i].Sectors = new Sector[Tracks[i].NumberOfSectors]; }
for (int s = 0; s < Tracks[i].NumberOfSectors; s++)
{
Tracks[i].Sectors[s] = new Sector();
Tracks[i].Sectors[s].TrackNumber = data[p++]; private void ParseEDSK()
Tracks[i].Sectors[s].SideNumber = data[p++]; {
Tracks[i].Sectors[s].SectorID = data[p++]; NumberOfTracks = data[0x30];
Tracks[i].Sectors[s].SectorSize = data[p++]; NumberOfSides = data[0x31];
Tracks[i].Sectors[s].Status1 = data[p++]; TrackSizes = new int[NumberOfTracks * NumberOfSides];
Tracks[i].Sectors[s].Status2 = data[p++]; Tracks = new Track[NumberOfTracks * NumberOfSides];
Tracks[i].Sectors[s].ActualDataByteLength = (ushort)(data[p] | data[p + 1] << 8); int pos = 0x34;
p += 2; for (int i = 0; i < NumberOfTracks * NumberOfSides; i++)
Tracks[i].Sectors[s].SectorData = new byte[Tracks[i].Sectors[s].ActualDataByteLength]; {
for (int b = 0; b < Tracks[i].Sectors[s].ActualDataByteLength; b++) TrackSizes[i] = data[pos++] * 256;
{ }
Tracks[i].Sectors[s].SectorData[b] = data[dpos + b]; pos = 0x100;
} for (int i = 0; i < NumberOfTracks * NumberOfSides; i++)
if (Tracks[i].Sectors[s].SectorSize <= 7) {
{ if (TrackSizes[i] == 0)
int specifiedSize = 0x80 << Tracks[i].Sectors[s].SectorSize; {
if (specifiedSize < Tracks[i].Sectors[s].ActualDataByteLength) Tracks[i] = new Track();
{ Tracks[i].Sectors = new Sector[0];
if (Tracks[i].Sectors[s].ActualDataByteLength % specifiedSize != 0) continue;
{ }
Tracks[i].Sectors[s].ContainsMultipleWeakSectors = true; int p = pos;
} Tracks[i] = new Track();
} Tracks[i].TrackIdent = Encoding.ASCII.GetString(data, p, 12);
} p += 16;
dpos += Tracks[i].Sectors[s].ActualDataByteLength; Tracks[i].TrackNumber = data[p++];
} Tracks[i].SideNumber = data[p++];
pos += TrackSizes[i]; Tracks[i].DataRate = data[p++];
} Tracks[i].RecordingMode = data[p++];
} Tracks[i].SectorSize = data[p++];
Tracks[i].NumberOfSectors = data[p++];
Tracks[i].GAP3Length = data[p++];
Tracks[i].FillerByte = data[p++];
int dpos = pos + 0x100;
Tracks[i].Sectors = new Sector[Tracks[i].NumberOfSectors];
for (int s = 0; s < Tracks[i].NumberOfSectors; s++)
{
Tracks[i].Sectors[s] = new Sector();
#region Internal Classes Tracks[i].Sectors[s].TrackNumber = data[p++];
Tracks[i].Sectors[s].SideNumber = data[p++];
Tracks[i].Sectors[s].SectorID = data[p++];
Tracks[i].Sectors[s].SectorSize = data[p++];
Tracks[i].Sectors[s].Status1 = data[p++];
Tracks[i].Sectors[s].Status2 = data[p++];
Tracks[i].Sectors[s].ActualDataByteLength = (ushort)(data[p] | data[p + 1] << 8);
p += 2;
Tracks[i].Sectors[s].SectorData = new byte[Tracks[i].Sectors[s].ActualDataByteLength];
for (int b = 0; b < Tracks[i].Sectors[s].ActualDataByteLength; b++)
{
Tracks[i].Sectors[s].SectorData[b] = data[dpos + b];
}
if (Tracks[i].Sectors[s].SectorSize <= 7)
{
int specifiedSize = 0x80 << Tracks[i].Sectors[s].SectorSize;
if (specifiedSize < Tracks[i].Sectors[s].ActualDataByteLength)
{
if (Tracks[i].Sectors[s].ActualDataByteLength % specifiedSize != 0)
{
Tracks[i].Sectors[s].ContainsMultipleWeakSectors = true;
}
}
}
dpos += Tracks[i].Sectors[s].ActualDataByteLength;
}
pos += TrackSizes[i];
}
}
public class Track #region Internal Classes
{
public string TrackIdent { get; set; }
public byte TrackNumber { get; set; }
public byte SideNumber { get; set; }
public byte DataRate { get; set; }
public byte RecordingMode { get; set; }
public byte SectorSize { get; set; }
public byte NumberOfSectors { get; set; }
public byte GAP3Length { get; set; }
public byte FillerByte { get; set; }
public Sector[] Sectors { get; set; }
public byte GetLowestSectorID() public class Track
{ {
byte res = 0xFF; public string TrackIdent { get; set; }
foreach (var s in Sectors) public byte TrackNumber { get; set; }
{ public byte SideNumber { get; set; }
if (s.SectorID < res) public byte DataRate { get; set; }
res = s.SectorID; public byte RecordingMode { get; set; }
} public byte SectorSize { get; set; }
return res; public byte NumberOfSectors { get; set; }
} public byte GAP3Length { get; set; }
} public byte FillerByte { get; set; }
public Sector[] Sectors { get; set; }
public class Sector public byte GetLowestSectorID()
{ {
public byte TrackNumber { get; set; } byte res = 0xFF;
public byte SideNumber { get; set; } foreach (var s in Sectors)
public byte SectorID { get; set; } {
public byte SectorSize { get; set; } if (s.SectorID < res)
public byte Status1 { get; set; } res = s.SectorID;
public byte Status2 { get; set; } }
public int ActualDataByteLength { get; set; } return res;
public byte[] SectorData { get; set; } }
public bool ContainsMultipleWeakSectors { get; set; } }
public int GetChecksum256() public class Sector
{ {
int res = 0; public byte TrackNumber { get; set; }
for (int i = 0; i < SectorData.Length; i++) public byte SideNumber { get; set; }
{ public byte SectorID { get; set; }
res += SectorData[i] % 256; public byte SectorSize { get; set; }
} public byte Status1 { get; set; }
return res; public byte Status2 { get; set; }
} public int ActualDataByteLength { get; set; }
} public byte[] SectorData { get; set; }
public bool ContainsMultipleWeakSectors { get; set; }
#endregion public int GetChecksum256()
{
int res = 0;
for (int i = 0; i < SectorData.Length; i++)
{
res += SectorData[i] % 256;
}
return res;
}
}
#endregion
} }
} }

View File

@ -117,7 +117,7 @@ namespace BizHawk.Emulation.Common
var line = reader.ReadLine() ?? ""; var line = reader.ReadLine() ?? "";
try try
{ {
if (line.StartsWith(";")) if (line.StartsWith(";"))
{ {
continue; // comment continue; // comment
} }
@ -140,7 +140,7 @@ namespace BizHawk.Emulation.Common
Hash = RemoveHashType(items[0].ToUpper()) Hash = RemoveHashType(items[0].ToUpper())
}; };
// remove a hash type identifier. well don't really need them for indexing (theyre just there for human purposes) // remove a hash type identifier. well don't really need them for indexing (they're just there for human purposes)
switch (items[1].Trim()) switch (items[1].Trim())
{ {
case "B": case "B":
@ -238,8 +238,8 @@ namespace BizHawk.Emulation.Common
break; break;
case ".SFC": case ".SFC":
case ".SMC": case ".SMC":
game.System = "SNES"; game.System = "SNES";
break; break;
case ".GB": case ".GB":
@ -299,30 +299,30 @@ namespace BizHawk.Emulation.Common
case ".D64": case ".D64":
case ".T64": case ".T64":
case ".G64": case ".G64":
case ".CRT": case ".CRT":
game.System = "C64"; game.System = "C64";
break; break;
case ".TZX": case ".TZX":
case ".PZX": case ".PZX":
case ".CSW": case ".CSW":
case ".WAV": case ".WAV":
game.System = "ZXSpectrum"; game.System = "ZXSpectrum";
break; break;
case ".CDT": case ".CDT":
game.System = "AmstradCPC"; game.System = "AmstradCPC";
break; break;
case ".TAP": case ".TAP":
byte[] head = romData.Take(8).ToArray(); byte[] head = romData.Take(8).ToArray();
if (System.Text.Encoding.Default.GetString(head).Contains("C64-TAPE")) if (System.Text.Encoding.Default.GetString(head).Contains("C64-TAPE"))
game.System = "C64"; game.System = "C64";
else else
game.System = "ZXSpectrum"; game.System = "ZXSpectrum";
break; break;
case ".Z64": case ".Z64":
case ".V64": case ".V64":
case ".N64": case ".N64":
game.System = "N64"; game.System = "N64";
@ -346,9 +346,9 @@ namespace BizHawk.Emulation.Common
break; break;
case ".DSK": case ".DSK":
var dId = new DSKIdentifier(romData); var dId = new DSKIdentifier(romData);
game.System = dId.IdentifiedSystem; game.System = dId.IdentifiedSystem;
break; break;
case ".PO": case ".PO":
case ".DO": case ".DO":

View File

@ -20,19 +20,19 @@ namespace BizHawk.Emulation.Common
} }
} }
public class NoAvailableCoreException : Exception public class NoAvailableCoreException : Exception
{ {
public NoAvailableCoreException() public NoAvailableCoreException()
: base("System is currently NOT emulated") : base("System is currently NOT emulated")
{ {
} }
public NoAvailableCoreException(string message) public NoAvailableCoreException(string message)
: base ($"System is currently NOT emulated: {message}") : base($"System is currently NOT emulated: {message}")
{ {
} }
} }
public class CGBNotSupportedException : Exception public class CGBNotSupportedException : Exception
{ {

View File

@ -44,12 +44,7 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
public static bool HasSoundProvider(this IEmulator core) public static bool HasSoundProvider(this IEmulator core)
{ {
if (core == null) return core != null && core.ServiceProvider.HasService<ISoundProvider>();
{
return false;
}
return core.ServiceProvider.HasService<ISoundProvider>();
} }
public static ISoundProvider AsSoundProvider(this IEmulator core) public static ISoundProvider AsSoundProvider(this IEmulator core)
@ -70,12 +65,7 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
public static bool HasMemoryDomains(this IEmulator core) public static bool HasMemoryDomains(this IEmulator core)
{ {
if (core == null) return core != null && core.ServiceProvider.HasService<IMemoryDomains>();
{
return false;
}
return core.ServiceProvider.HasService<IMemoryDomains>();
} }
public static IMemoryDomains AsMemoryDomains(this IEmulator core) public static IMemoryDomains AsMemoryDomains(this IEmulator core)
@ -85,12 +75,7 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
public static bool HasSaveRam(this IEmulator core) public static bool HasSaveRam(this IEmulator core)
{ {
if (core == null) return core != null && core.ServiceProvider.HasService<ISaveRam>();
{
return false;
}
return core.ServiceProvider.HasService<ISaveRam>();
} }
public static ISaveRam AsSaveRam(this IEmulator core) public static ISaveRam AsSaveRam(this IEmulator core)
@ -100,12 +85,7 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
public static bool HasSavestates(this IEmulator core) public static bool HasSavestates(this IEmulator core)
{ {
if (core == null) return core != null && core.ServiceProvider.HasService<IStatable>();
{
return false;
}
return core.ServiceProvider.HasService<IStatable>();
} }
public static IStatable AsStatable(this IEmulator core) public static IStatable AsStatable(this IEmulator core)
@ -115,12 +95,7 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
public static bool CanPollInput(this IEmulator core) public static bool CanPollInput(this IEmulator core)
{ {
if (core == null) return core != null && core.ServiceProvider.HasService<IInputPollable>();
{
return false;
}
return core.ServiceProvider.HasService<IInputPollable>();
} }
public static IInputPollable AsInputPollable(this IEmulator core) public static IInputPollable AsInputPollable(this IEmulator core)
@ -130,13 +105,8 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
public static bool InputCallbacksAvailable(this IEmulator core) public static bool InputCallbacksAvailable(this IEmulator core)
{ {
if (core == null)
{
return false;
}
// TODO: this is a pretty ugly way to handle this // TODO: this is a pretty ugly way to handle this
var pollable = core.ServiceProvider.GetService<IInputPollable>(); var pollable = core?.ServiceProvider.GetService<IInputPollable>();
if (pollable != null) if (pollable != null)
{ {
try try
@ -155,12 +125,7 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
public static bool HasDriveLight(this IEmulator core) public static bool HasDriveLight(this IEmulator core)
{ {
if (core == null) return core != null && core.ServiceProvider.HasService<IDriveLight>();
{
return false;
}
return core.ServiceProvider.HasService<IDriveLight>();
} }
public static IDriveLight AsDriveLight(this IEmulator core) public static IDriveLight AsDriveLight(this IEmulator core)
@ -170,12 +135,7 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
public static bool CanDebug(this IEmulator core) public static bool CanDebug(this IEmulator core)
{ {
if (core == null) return core != null && core.ServiceProvider.HasService<IDebuggable>();
{
return false;
}
return core.ServiceProvider.HasService<IDebuggable>();
} }
public static IDebuggable AsDebuggable(this IEmulator core) public static IDebuggable AsDebuggable(this IEmulator core)
@ -185,12 +145,7 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
public static bool CpuTraceAvailable(this IEmulator core) public static bool CpuTraceAvailable(this IEmulator core)
{ {
if (core == null) return core != null && core.ServiceProvider.HasService<ITraceable>();
{
return false;
}
return core.ServiceProvider.HasService<ITraceable>();
} }
public static ITraceable AsTracer(this IEmulator core) public static ITraceable AsTracer(this IEmulator core)
@ -200,13 +155,8 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
public static bool MemoryCallbacksAvailable(this IEmulator core) public static bool MemoryCallbacksAvailable(this IEmulator core)
{ {
if (core == null)
{
return false;
}
// TODO: this is a pretty ugly way to handle this // TODO: this is a pretty ugly way to handle this
var debuggable = (IDebuggable)core.ServiceProvider.GetService<IDebuggable>(); var debuggable = (IDebuggable) core?.ServiceProvider.GetService<IDebuggable>();
if (debuggable != null) if (debuggable != null)
{ {
try try
@ -251,7 +201,7 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
return core.ServiceProvider.HasService<IDisassemblable>(); return core.ServiceProvider.HasService<IDisassemblable>();
} }
public static IDisassemblable AsDissassembler(this IEmulator core) public static IDisassemblable AsDisassembler(this IEmulator core)
{ {
return core.ServiceProvider.GetService<IDisassemblable>(); return core.ServiceProvider.GetService<IDisassemblable>();
} }
@ -284,12 +234,7 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
public static bool CanCDLog(this IEmulator core) public static bool CanCDLog(this IEmulator core)
{ {
if (core == null) return core != null && core.ServiceProvider.HasService<ICodeDataLogger>();
{
return false;
}
return core.ServiceProvider.HasService<ICodeDataLogger>();
} }
public static ICodeDataLogger AsCodeDataLogger(this IEmulator core) public static ICodeDataLogger AsCodeDataLogger(this IEmulator core)
@ -304,22 +249,12 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
public static bool UsesLinkCable(this IEmulator core) public static bool UsesLinkCable(this IEmulator core)
{ {
if (core == null) return core != null && core.ServiceProvider.HasService<ILinkable>();
{
return false;
}
return core.ServiceProvider.HasService<ILinkable>();
} }
public static bool CanGenerateGameDBEntries(this IEmulator core) public static bool CanGenerateGameDBEntries(this IEmulator core)
{ {
if (core == null) return core != null && core.ServiceProvider.HasService<ICreateGameDBEntries>();
{
return false;
}
return core.ServiceProvider.HasService<ICreateGameDBEntries>();
} }
public static ICreateGameDBEntries AsGameDBEntryGenerator(this IEmulator core) public static ICreateGameDBEntries AsGameDBEntryGenerator(this IEmulator core)
@ -329,12 +264,7 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
public static bool HasBoardInfo(this IEmulator core) public static bool HasBoardInfo(this IEmulator core)
{ {
if (core == null) return core != null && core.ServiceProvider.HasService<IBoardInfo>();
{
return false;
}
return core.ServiceProvider.HasService<IBoardInfo>();
} }
public static IBoardInfo AsBoardInfo(this IEmulator core) public static IBoardInfo AsBoardInfo(this IEmulator core)

View File

@ -1,10 +1,4 @@
using System; namespace BizHawk.Emulation.Common
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Common
{ {
public interface ICycleTiming public interface ICycleTiming
{ {
@ -12,6 +6,7 @@ namespace BizHawk.Emulation.Common
/// Total elapsed emulation time relative to <see cref="ClockRate"/> /// Total elapsed emulation time relative to <see cref="ClockRate"/>
/// </summary> /// </summary>
long CycleCount { get; } long CycleCount { get; }
/// <summary> /// <summary>
/// Clock Rate in hz for <see cref="CycleCount"/> /// Clock Rate in hz for <see cref="CycleCount"/>
/// </summary> /// </summary>

View File

@ -46,8 +46,8 @@ namespace BizHawk.Emulation.Common
public class RegisterValue public class RegisterValue
{ {
public ulong Value { get; private set; } public ulong Value { get; }
public byte BitSize { get; private set; } public byte BitSize { get; }
public RegisterValue(ulong val, byte bitSize) public RegisterValue(ulong val, byte bitSize)
{ {

View File

@ -42,11 +42,7 @@ namespace BizHawk.Emulation.Common
public virtual string Cpu public virtual string Cpu
{ {
get get => _cpu;
{
return _cpu;
}
set set
{ {
if (!AvailableCpus.Contains(value)) if (!AvailableCpus.Contains(value))

View File

@ -22,9 +22,9 @@
/// <summary> /// <summary>
/// Gets a value indicating whether or not SaveRAM has been modified since the last save /// Gets a value indicating whether or not SaveRAM has been modified since the last save
/// TODO: This is not the best interface. What defines a "save"? I suppose a Clone(), right? at least specify that here. /// TODO: This is not the best interface. What defines a "save"? I suppose a Clone(), right? at least specify that here.
/// Clone() should probably take an optionthat says whether to clear the dirty flag. /// Clone() should probably take an option that says whether to clear the dirty flag.
/// And anyway, cores might not know if they can even track a functional dirty flag -- we should convey that fact somehow /// And anyway, cores might not know if they can even track a functional dirty flag -- we should convey that fact somehow
/// (reminder: do that with flags, so we dont have to change the interface 10000 times) /// (reminder: do that with flags, so we don't have to change the interface 10000 times)
/// Dirty SaveRAM can in principle be determined by the frontend in that case, but it could possibly be too slow for the file menu dropdown or other things /// Dirty SaveRAM can in principle be determined by the frontend in that case, but it could possibly be too slow for the file menu dropdown or other things
/// </summary> /// </summary>
bool SaveRamModified { get; } bool SaveRamModified { get; }

View File

@ -71,10 +71,10 @@ namespace BizHawk.Emulation.Common
else else
{ {
var tt = impl.GetGenericArguments(); var tt = impl.GetGenericArguments();
var settingtype = tt[0]; var settingType = tt[0];
var synctype = tt[1]; var syncType = tt[1];
HasSettings = settingtype != typeof(object); // object is used for a placeholder where an emu doesn't have both s and ss HasSettings = settingType != typeof(object); // object is used for a placeholder where an emu doesn't have both s and ss
HasSyncSettings = synctype != typeof(object); HasSyncSettings = syncType != typeof(object);
if (HasSettings) if (HasSettings)
{ {

View File

@ -1,5 +1,4 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following

View File

@ -45,8 +45,8 @@ namespace BizHawk.Emulation.Common
public void DeSerialize(BinaryReader b) public void DeSerialize(BinaryReader b)
{ {
_buttons.Clear(); _buttons.Clear();
int numbuttons = b.ReadInt32(); int numButtons = b.ReadInt32();
for (int i = 0; i < numbuttons; i++) for (int i = 0; i < numButtons; i++)
{ {
string k = b.ReadString(); string k = b.ReadString();
float v = b.ReadSingle(); float v = b.ReadSingle();

View File

@ -28,6 +28,6 @@ namespace BizHawk.Emulation.Common
NotApplicableTypes = types?.AsEnumerable() ?? Enumerable.Empty<Type>(); NotApplicableTypes = types?.AsEnumerable() ?? Enumerable.Empty<Type>();
} }
public IEnumerable<Type> NotApplicableTypes { get; private set; } public IEnumerable<Type> NotApplicableTypes { get; }
} }
} }

View File

@ -18,11 +18,11 @@ namespace BizHawk.Emulation.Common
Type targetType = target.GetType(); Type targetType = target.GetType();
object[] tmp = new object[1]; object[] tmp = new object[1];
foreach (var propinfo in foreach (var propInfo in
targetType.GetPropertiesWithAttrib(typeof(RequiredServiceAttribute)) targetType.GetPropertiesWithAttrib(typeof(RequiredServiceAttribute))
.Concat(targetType.GetPropertiesWithAttrib(typeof(OptionalServiceAttribute)))) .Concat(targetType.GetPropertiesWithAttrib(typeof(OptionalServiceAttribute))))
{ {
propinfo.GetSetMethod(true).Invoke(target, tmp); propInfo.GetSetMethod(true).Invoke(target, tmp);
} }
} }
@ -35,21 +35,21 @@ namespace BizHawk.Emulation.Common
Type targetType = target.GetType(); Type targetType = target.GetType();
object[] tmp = new object[1]; object[] tmp = new object[1];
foreach (var propinfo in targetType.GetPropertiesWithAttrib(typeof(RequiredServiceAttribute))) foreach (var propInfo in targetType.GetPropertiesWithAttrib(typeof(RequiredServiceAttribute)))
{ {
tmp[0] = source.GetService(propinfo.PropertyType); tmp[0] = source.GetService(propInfo.PropertyType);
if (tmp[0] == null) if (tmp[0] == null)
{ {
return false; return false;
} }
propinfo.GetSetMethod(true).Invoke(target, tmp); propInfo.GetSetMethod(true).Invoke(target, tmp);
} }
foreach (var propinfo in targetType.GetPropertiesWithAttrib(typeof(OptionalServiceAttribute))) foreach (var propInfo in targetType.GetPropertiesWithAttrib(typeof(OptionalServiceAttribute)))
{ {
tmp[0] = source.GetService(propinfo.PropertyType); tmp[0] = source.GetService(propInfo.PropertyType);
propinfo.GetSetMethod(true).Invoke(target, tmp); propInfo.GetSetMethod(true).Invoke(target, tmp);
} }
return true; return true;

View File

@ -15,44 +15,44 @@ namespace BizHawk.Emulation.Common
private int _accumL; private int _accumL;
private int _accumR; private int _accumR;
private static int DepthFromFilterwidth(int filterwidth) private static int DepthFromFilterWidth(int filterWidth)
{ {
int ret = -2; int ret = -2;
while (filterwidth > 0) while (filterWidth > 0)
{ {
filterwidth >>= 1; filterWidth >>= 1;
ret++; ret++;
} }
return ret; return ret;
} }
public DCFilter(ISoundProvider input, int filterwidth) public DCFilter(ISoundProvider input, int filterWidth)
{ {
if (input == null) if (input == null)
{ {
throw new ArgumentNullException(); throw new ArgumentNullException();
} }
if (filterwidth < 8 || filterwidth > 65536) if (filterWidth < 8 || filterWidth > 65536)
{ {
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
} }
_depth = DepthFromFilterwidth(filterwidth); _depth = DepthFromFilterWidth(filterWidth);
_soundProvider = input; _soundProvider = input;
} }
// Detached mode // Detached mode
public DCFilter(int filterwidth) public DCFilter(int filterWidth)
{ {
if (filterwidth < 8 || filterwidth > 65536) if (filterWidth < 8 || filterWidth > 65536)
{ {
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
} }
_depth = DepthFromFilterwidth(filterwidth); _depth = DepthFromFilterWidth(filterWidth);
_soundProvider = null; _soundProvider = null;
} }
@ -67,12 +67,12 @@ namespace BizHawk.Emulation.Common
PushThroughSamples(samples, samples, length); PushThroughSamples(samples, samples, length);
} }
private void PushThroughSamples(short[] samplesin, short[] samplesout, int length) private void PushThroughSamples(short[] samplesIn, short[] samplesOut, int length)
{ {
for (int i = 0; i < length; i += 2) for (int i = 0; i < length; i += 2)
{ {
int l = samplesin[i] << 12; int l = samplesIn[i] << 12;
int r = samplesin[i + 1] << 12; int r = samplesIn[i + 1] << 12;
_accumL -= _accumL >> _depth; _accumL -= _accumL >> _depth;
_accumR -= _accumR >> _depth; _accumR -= _accumR >> _depth;
_accumL += l - _latchL; _accumL += l - _latchL;
@ -86,28 +86,28 @@ namespace BizHawk.Emulation.Common
// check for clipping // check for clipping
if (bigL > 32767) if (bigL > 32767)
{ {
samplesout[i] = 32767; samplesOut[i] = 32767;
} }
else if (bigL < -32768) else if (bigL < -32768)
{ {
samplesout[i] = -32768; samplesOut[i] = -32768;
} }
else else
{ {
samplesout[i] = (short)bigL; samplesOut[i] = (short)bigL;
} }
if (bigR > 32767) if (bigR > 32767)
{ {
samplesout[i + 1] = 32767; samplesOut[i + 1] = 32767;
} }
else if (bigR < -32768) else if (bigR < -32768)
{ {
samplesout[i + 1] = -32768; samplesOut[i + 1] = -32768;
} }
else else
{ {
samplesout[i + 1] = (short)bigR; samplesOut[i + 1] = (short)bigR;
} }
} }
} }
@ -125,15 +125,12 @@ namespace BizHawk.Emulation.Common
public void GetSamplesSync(out short[] samples, out int nsamp) public void GetSamplesSync(out short[] samples, out int nsamp)
{ {
short[] sampin; _soundProvider.GetSamplesSync(out var sampIn, out var nsampIn);
int nsampin;
_soundProvider.GetSamplesSync(out sampin, out nsampin); short[] ret = new short[nsampIn * 2];
PushThroughSamples(sampIn, ret, nsampIn * 2);
short[] ret = new short[nsampin * 2];
PushThroughSamples(sampin, ret, nsampin * 2);
samples = ret; samples = ret;
nsamp = nsampin; nsamp = nsampIn;
} }
public SyncSoundMode SyncMode => _soundProvider.SyncMode; public SyncSoundMode SyncMode => _soundProvider.SyncMode;

View File

@ -75,8 +75,7 @@ namespace BizHawk.Emulation.Common
} }
done++; done++;
short left, right; _adjustobuf.Dequeue(out var left, out var right);
_adjustobuf.Dequeue(out left, out right);
buf[ctr++] = left; buf[ctr++] = left;
buf[ctr++] = right; buf[ctr++] = right;
} }

View File

@ -22,19 +22,19 @@ namespace BizHawk.Emulation.Common
new SystemInfo { SystemId = "PSX", FullName = "Playstation" }, new SystemInfo { SystemId = "PSX", FullName = "Playstation" },
new SystemInfo { SystemId = "SMS", FullName = "Sega Master System" }, new SystemInfo { SystemId = "SMS", FullName = "Sega Master System" },
new SystemInfo { SystemId = "GEN", FullName = "Sega Genesis/Megadrive" }, new SystemInfo { SystemId = "GEN", FullName = "Sega Genesis/Mega Drive" },
new SystemInfo { SystemId = "SAT", FullName = "Sega Saturn" }, new SystemInfo { SystemId = "SAT", FullName = "Sega Saturn" },
new SystemInfo { SystemId = "PCE", FullName = "PC Engine/TurboGrafx 16" }, new SystemInfo { SystemId = "PCE", FullName = "PC Engine/TurboGrafx 16" },
new SystemInfo { SystemId = "Coleco", FullName = "Colecovision" }, new SystemInfo { SystemId = "Coleco", FullName = "ColecoVision" },
new SystemInfo { SystemId = "TI83", FullName = "TI-83 Calculator" }, new SystemInfo { SystemId = "TI83", FullName = "TI-83 Calculator" },
new SystemInfo { SystemId = "WSWAN", FullName = "WonderSwan" }, new SystemInfo { SystemId = "WSWAN", FullName = "WonderSwan" },
new SystemInfo { SystemId = "C64", FullName = "Commodore 64" }, new SystemInfo { SystemId = "C64", FullName = "Commodore 64" },
new SystemInfo { SystemId = "AppleII", FullName = "Apple II" }, new SystemInfo { SystemId = "AppleII", FullName = "Apple II" },
new SystemInfo { SystemId = "INTV", FullName = "Intellivision" }, new SystemInfo { SystemId = "INTV", FullName = "IntelliVision" },
new SystemInfo { SystemId = "ZXSpectrum", FullName = "Sinclair ZX Spectrum" }, new SystemInfo { SystemId = "ZXSpectrum", FullName = "Sinclair ZX Spectrum" },
new SystemInfo { SystemId = "AmstradCPC", FullName = "Amstrad CPC" }, new SystemInfo { SystemId = "AmstradCPC", FullName = "Amstrad CPC" },
new SystemInfo { SystemId = "ChannelF", FullName = "Fairchild Channel F"}, new SystemInfo { SystemId = "ChannelF", FullName = "Fairchild Channel F"},
}; };
@ -43,13 +43,7 @@ namespace BizHawk.Emulation.Common
get get
{ {
var system = _systems.FirstOrDefault(s => s.SystemId == systemId); var system = _systems.FirstOrDefault(s => s.SystemId == systemId);
return system ?? new SystemInfo { SystemId = "Unknown", FullName = "Unknown" };
if (system != null)
{
return system;
}
return new SystemInfo { SystemId = "Unknown", FullName = "Unknown" };
} }
} }

View File

@ -183,6 +183,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=autoflushing/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=autoflushing/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=autohold/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=autohold/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=autoload/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=autoload/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=automagically/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=autorestore/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=autorestore/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Autosave/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Autosave/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=backcolor/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=backcolor/@EntryIndexedValue">True</s:Boolean>
@ -194,14 +195,18 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Coalescer/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Coalescer/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Coleco/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Coleco/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=colesced/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=colesced/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Cpus/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=curr/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=curr/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=dearchive/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=dearchive/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Dega/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Dega/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Dendy/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Disasm/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Disasm/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Disassemblable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=disassembly/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=disassembly/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Dontfire/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Dontfire/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Ejin/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Ejin/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Endian/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Endian/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Fairchild/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Famtasia/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Famtasia/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=FCEU/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=FCEU/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=frameadvance/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=frameadvance/@EntryIndexedValue">True</s:Boolean>
@ -212,6 +217,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Frameskipping/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Frameskipping/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Gameboy/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Gameboy/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=gamedb/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=gamedb/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Grafx/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=greenzone/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=greenzone/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=greenzoned/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=greenzoned/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Homebrew/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Homebrew/@EntryIndexedValue">True</s:Boolean>
@ -232,6 +238,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Nametable/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Nametable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Nametables/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Nametables/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Nintendulator/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Nintendulator/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=nsamp/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Numerics/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Numerics/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=nvidia/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=nvidia/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=opengl/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=opengl/@EntryIndexedValue">True</s:Boolean>
@ -241,6 +248,9 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=PCSX/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=PCSX/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Phaser/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Phaser/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Pollable/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Pollable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Regionable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=resizer/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=samp/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=saveram/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=saveram/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=savestate/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=savestate/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=savestates/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=savestates/@EntryIndexedValue">True</s:Boolean>
@ -251,11 +261,13 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Sram/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Sram/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=sSeeki/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=sSeeki/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Statable/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Statable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Stateable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Syncless/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Syncless/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=taseditor/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=taseditor/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=tasproj/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=tasproj/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Tastudio/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Tastudio/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Turboing/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Turboing/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=unmerge/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=unpause/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=unpause/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=unpaused/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=unpaused/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Unpausing/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Unpausing/@EntryIndexedValue">True</s:Boolean>