cleanup DSKIDentifier.cs, misc cleanups in Emulation.Common
This commit is contained in:
parent
f5e9e8eecd
commit
2c9d8bba40
|
@ -65,12 +65,7 @@ namespace BizHawk.Emulation.Common
|
||||||
|
|
||||||
public object GetService(Type t)
|
public object GetService(Type t)
|
||||||
{
|
{
|
||||||
if (_services.TryGetValue(t, out var service))
|
return _services.TryGetValue(t, out var service) ? service : null;
|
||||||
{
|
|
||||||
return service;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasService<T>()
|
public bool HasService<T>()
|
||||||
|
|
|
@ -61,10 +61,7 @@ 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) => ContainsKey(blockName);
|
||||||
{
|
|
||||||
return ContainsKey(blockName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is just a hook, if needed, to readily suspend logging, without having to rewire the core
|
/// This is just a hook, if needed, to readily suspend logging, without having to rewire the core
|
||||||
|
@ -195,17 +192,16 @@ namespace BizHawk.Emulation.Common
|
||||||
{
|
{
|
||||||
var br = new BinaryReader(s);
|
var br = new BinaryReader(s);
|
||||||
string id = br.ReadString();
|
string id = br.ReadString();
|
||||||
if (id == "BIZHAWK-CDL-1")
|
switch (id)
|
||||||
{
|
{
|
||||||
SubType = "PCE";
|
case "BIZHAWK-CDL-1":
|
||||||
}
|
SubType = "PCE";
|
||||||
else if (id == "BIZHAWK-CDL-2")
|
break;
|
||||||
{
|
case "BIZHAWK-CDL-2":
|
||||||
SubType = br.ReadString().TrimEnd(' ');
|
SubType = br.ReadString().TrimEnd(' ');
|
||||||
}
|
break;
|
||||||
else
|
default:
|
||||||
{
|
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();
|
||||||
|
@ -216,9 +212,7 @@ namespace BizHawk.Emulation.Common
|
||||||
byte[] data = br.ReadBytes(len);
|
byte[] data = br.ReadBytes(len);
|
||||||
this[key] = data;
|
this[key] = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace BizHawk.Emulation.Common
|
||||||
|
|
||||||
public bool Has(string name)
|
public bool Has(string name)
|
||||||
{
|
{
|
||||||
return this.FirstOrDefault((md) => md.Name == name) != null;
|
return this.Any(md => md.Name == name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MemoryDomainList(IList<MemoryDomain> domains)
|
public MemoryDomainList(IList<MemoryDomain> domains)
|
||||||
|
@ -28,16 +28,7 @@ namespace BizHawk.Emulation.Common
|
||||||
|
|
||||||
public MemoryDomain MainMemory
|
public MemoryDomain MainMemory
|
||||||
{
|
{
|
||||||
get
|
get => _mainMemory ?? this.First();
|
||||||
{
|
|
||||||
if (_mainMemory != null)
|
|
||||||
{
|
|
||||||
return _mainMemory;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.First();
|
|
||||||
}
|
|
||||||
|
|
||||||
set => _mainMemory = value;
|
set => _mainMemory = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,9 +74,7 @@ namespace BizHawk.Emulation.Common
|
||||||
private static void TryMerge<T>(MemoryDomain dest, MemoryDomain src, Action<T, T> func)
|
private static void TryMerge<T>(MemoryDomain dest, MemoryDomain src, Action<T, T> func)
|
||||||
where T : MemoryDomain
|
where T : MemoryDomain
|
||||||
{
|
{
|
||||||
var d1 = dest as T;
|
if (dest is T d1 && src is T s1)
|
||||||
var s1 = src as T;
|
|
||||||
if (d1 != null && s1 != null)
|
|
||||||
{
|
{
|
||||||
func(d1, s1);
|
func(d1, s1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,15 +7,15 @@ namespace BizHawk.Emulation.Common
|
||||||
/// 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.Emulation.Common
|
/// to BizHawk.Emulation.Cores from BizHawk.Emulation.Common
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DSKIdentifier
|
public class DskIdentifier
|
||||||
{
|
{
|
||||||
|
private readonly byte[] _data;
|
||||||
|
private string _possibleIdent = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Default fallthrough to AppleII
|
/// Default fallthrough to AppleII
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string IdentifiedSystem = "AppleII";
|
public string IdentifiedSystem { get; set; } = "AppleII";
|
||||||
private string PossibleIdent = "";
|
|
||||||
|
|
||||||
private readonly byte[] data;
|
|
||||||
|
|
||||||
// dsk header
|
// dsk header
|
||||||
public byte NumberOfTracks { get; set; }
|
public byte NumberOfTracks { get; set; }
|
||||||
|
@ -23,28 +23,27 @@ namespace BizHawk.Emulation.Common
|
||||||
public int[] TrackSizes { get; set; }
|
public int[] TrackSizes { get; set; }
|
||||||
|
|
||||||
// state
|
// state
|
||||||
public int CylinderCount;
|
public int SideCount { get; set; }
|
||||||
public int SideCount;
|
public int BytesPerTrack { get; set; }
|
||||||
public int BytesPerTrack;
|
|
||||||
|
|
||||||
public Track[] Tracks = null;
|
public Track[] Tracks { get; set; }
|
||||||
|
|
||||||
public DSKIdentifier(byte[] imageData)
|
public DskIdentifier(byte[] imageData)
|
||||||
{
|
{
|
||||||
data = imageData;
|
_data = imageData;
|
||||||
ParseDskImage();
|
ParseDskImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ParseDskImage()
|
private void ParseDskImage()
|
||||||
{
|
{
|
||||||
string ident = Encoding.ASCII.GetString(data, 0, 16).ToUpper();
|
string ident = Encoding.ASCII.GetString(_data, 0, 16).ToUpper();
|
||||||
if (ident.Contains("MV - CPC"))
|
if (ident.Contains("MV - CPC"))
|
||||||
{
|
{
|
||||||
ParseDSK();
|
ParseDsk();
|
||||||
}
|
}
|
||||||
else if (ident.Contains("EXTENDED CPC DSK"))
|
else if (ident.Contains("EXTENDED CPC DSK"))
|
||||||
{
|
{
|
||||||
ParseEDSK();
|
ParseEDsk();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -66,7 +65,7 @@ namespace BizHawk.Emulation.Common
|
||||||
if (trk.Sectors[0].SectorData[0] == 0 && trk.Sectors[0].SectorData[1] == 0
|
if (trk.Sectors[0].SectorData[0] == 0 && trk.Sectors[0].SectorData[1] == 0
|
||||||
&& trk.Sectors[0].SectorData[2] == 40)
|
&& trk.Sectors[0].SectorData[2] == 40)
|
||||||
{
|
{
|
||||||
PossibleIdent = "ZXSpectrum";
|
_possibleIdent = "ZXSpectrum";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,9 +89,7 @@ namespace BizHawk.Emulation.Common
|
||||||
// check for bootable status
|
// check for bootable status
|
||||||
if (trk.Sectors[0].SectorData != null && trk.Sectors[0].SectorData.Length > 0)
|
if (trk.Sectors[0].SectorData != null && trk.Sectors[0].SectorData.Length > 0)
|
||||||
{
|
{
|
||||||
int chksm = trk.Sectors[0].GetChecksum256();
|
switch (trk.Sectors[0].GetChecksum256())
|
||||||
|
|
||||||
switch (chksm)
|
|
||||||
{
|
{
|
||||||
case 3:
|
case 3:
|
||||||
IdentifiedSystem = "ZXSpectrum";
|
IdentifiedSystem = "ZXSpectrum";
|
||||||
|
@ -155,7 +152,7 @@ namespace BizHawk.Emulation.Common
|
||||||
case 65:
|
case 65:
|
||||||
case 193:
|
case 193:
|
||||||
// possible CPC custom
|
// possible CPC custom
|
||||||
PossibleIdent = "AmstradCPC";
|
_possibleIdent = "AmstradCPC";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,13 +174,13 @@ namespace BizHawk.Emulation.Common
|
||||||
IdentifiedSystem = "ZXSpectrum";
|
IdentifiedSystem = "ZXSpectrum";
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
PossibleIdent = "ZXSpectrum";
|
_possibleIdent = "ZXSpectrum";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PossibleIdent = "ZXSpectrum";
|
_possibleIdent = "ZXSpectrum";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -199,7 +196,7 @@ namespace BizHawk.Emulation.Common
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PossibleIdent = "ZXSpectrum";
|
_possibleIdent = "ZXSpectrum";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -216,56 +213,59 @@ namespace BizHawk.Emulation.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
// last chance. use the possible value
|
// last chance. use the possible value
|
||||||
if (IdentifiedSystem == "AppleII" && PossibleIdent != "")
|
if (IdentifiedSystem == "AppleII" && _possibleIdent != "")
|
||||||
{
|
{
|
||||||
IdentifiedSystem = "ZXSpectrum";
|
IdentifiedSystem = "ZXSpectrum";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ParseDSK()
|
private void ParseDsk()
|
||||||
{
|
{
|
||||||
NumberOfTracks = data[0x30];
|
NumberOfTracks = _data[0x30];
|
||||||
NumberOfSides = data[0x31];
|
NumberOfSides = _data[0x31];
|
||||||
TrackSizes = new int[NumberOfTracks * NumberOfSides];
|
TrackSizes = new int[NumberOfTracks * NumberOfSides];
|
||||||
Tracks = new Track[NumberOfTracks * NumberOfSides];
|
Tracks = new Track[NumberOfTracks * NumberOfSides];
|
||||||
int pos = 0x32;
|
int pos = 0x32;
|
||||||
for (int i = 0; i < NumberOfTracks * NumberOfSides; i++)
|
for (int i = 0; i < NumberOfTracks * NumberOfSides; i++)
|
||||||
{
|
{
|
||||||
TrackSizes[i] = (ushort)(data[pos] | data[pos + 1] << 8);
|
TrackSizes[i] = (ushort)(_data[pos] | _data[pos + 1] << 8);
|
||||||
}
|
}
|
||||||
pos = 0x100;
|
pos = 0x100;
|
||||||
for (int i = 0; i < NumberOfTracks * NumberOfSides; i++)
|
for (int i = 0; i < NumberOfTracks * NumberOfSides; i++)
|
||||||
{
|
{
|
||||||
if (TrackSizes[i] == 0)
|
if (TrackSizes[i] == 0)
|
||||||
{
|
{
|
||||||
Tracks[i] = new Track();
|
Tracks[i] = new Track { Sectors = new Sector[0] };
|
||||||
Tracks[i].Sectors = new Sector[0];
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int p = pos;
|
int p = pos;
|
||||||
Tracks[i] = new Track();
|
Tracks[i] = new Track
|
||||||
Tracks[i].TrackIdent = Encoding.ASCII.GetString(data, p, 12);
|
{
|
||||||
|
TrackIdent = Encoding.ASCII.GetString(_data, p, 12)
|
||||||
|
};
|
||||||
p += 16;
|
p += 16;
|
||||||
Tracks[i].TrackNumber = data[p++];
|
Tracks[i].TrackNumber = _data[p++];
|
||||||
Tracks[i].SideNumber = data[p++];
|
Tracks[i].SideNumber = _data[p++];
|
||||||
p += 2;
|
p += 2;
|
||||||
Tracks[i].SectorSize = data[p++];
|
Tracks[i].SectorSize = _data[p++];
|
||||||
Tracks[i].NumberOfSectors = data[p++];
|
Tracks[i].NumberOfSectors = _data[p++];
|
||||||
Tracks[i].GAP3Length = data[p++];
|
Tracks[i].Gap3Length = _data[p++];
|
||||||
Tracks[i].FillerByte = data[p++];
|
Tracks[i].FillerByte = _data[p++];
|
||||||
int dpos = pos + 0x100;
|
int dPos = pos + 0x100;
|
||||||
Tracks[i].Sectors = new Sector[Tracks[i].NumberOfSectors];
|
Tracks[i].Sectors = new Sector[Tracks[i].NumberOfSectors];
|
||||||
for (int s = 0; s < Tracks[i].NumberOfSectors; s++)
|
for (int s = 0; s < Tracks[i].NumberOfSectors; s++)
|
||||||
{
|
{
|
||||||
Tracks[i].Sectors[s] = new Sector();
|
Tracks[i].Sectors[s] = new Sector
|
||||||
|
{
|
||||||
|
TrackNumber = _data[p++],
|
||||||
|
SideNumber = _data[p++],
|
||||||
|
SectorID = _data[p++],
|
||||||
|
SectorSize = _data[p++],
|
||||||
|
Status1 = _data[p++],
|
||||||
|
Status2 = _data[p++],
|
||||||
|
ActualDataByteLength = (ushort) (_data[p] | _data[p + 1] << 8)
|
||||||
|
};
|
||||||
|
|
||||||
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;
|
p += 2;
|
||||||
if (Tracks[i].Sectors[s].SectorSize == 0)
|
if (Tracks[i].Sectors[s].SectorSize == 0)
|
||||||
{
|
{
|
||||||
|
@ -286,64 +286,64 @@ namespace BizHawk.Emulation.Common
|
||||||
Tracks[i].Sectors[s].SectorData = new byte[Tracks[i].Sectors[s].ActualDataByteLength];
|
Tracks[i].Sectors[s].SectorData = new byte[Tracks[i].Sectors[s].ActualDataByteLength];
|
||||||
for (int b = 0; b < Tracks[i].Sectors[s].ActualDataByteLength; b++)
|
for (int b = 0; b < Tracks[i].Sectors[s].ActualDataByteLength; b++)
|
||||||
{
|
{
|
||||||
Tracks[i].Sectors[s].SectorData[b] = data[dpos + b];
|
Tracks[i].Sectors[s].SectorData[b] = _data[dPos + b];
|
||||||
}
|
}
|
||||||
dpos += Tracks[i].Sectors[s].ActualDataByteLength;
|
dPos += Tracks[i].Sectors[s].ActualDataByteLength;
|
||||||
}
|
}
|
||||||
pos += TrackSizes[i];
|
pos += TrackSizes[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ParseEDSK()
|
private void ParseEDsk()
|
||||||
{
|
{
|
||||||
NumberOfTracks = data[0x30];
|
NumberOfTracks = _data[0x30];
|
||||||
NumberOfSides = data[0x31];
|
NumberOfSides = _data[0x31];
|
||||||
TrackSizes = new int[NumberOfTracks * NumberOfSides];
|
TrackSizes = new int[NumberOfTracks * NumberOfSides];
|
||||||
Tracks = new Track[NumberOfTracks * NumberOfSides];
|
Tracks = new Track[NumberOfTracks * NumberOfSides];
|
||||||
int pos = 0x34;
|
int pos = 0x34;
|
||||||
for (int i = 0; i < NumberOfTracks * NumberOfSides; i++)
|
for (int i = 0; i < NumberOfTracks * NumberOfSides; i++)
|
||||||
{
|
{
|
||||||
TrackSizes[i] = data[pos++] * 256;
|
TrackSizes[i] = _data[pos++] * 256;
|
||||||
}
|
}
|
||||||
pos = 0x100;
|
pos = 0x100;
|
||||||
for (int i = 0; i < NumberOfTracks * NumberOfSides; i++)
|
for (int i = 0; i < NumberOfTracks * NumberOfSides; i++)
|
||||||
{
|
{
|
||||||
if (TrackSizes[i] == 0)
|
if (TrackSizes[i] == 0)
|
||||||
{
|
{
|
||||||
Tracks[i] = new Track();
|
Tracks[i] = new Track { Sectors = new Sector[0] };
|
||||||
Tracks[i].Sectors = new Sector[0];
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int p = pos;
|
int p = pos;
|
||||||
Tracks[i] = new Track();
|
Tracks[i] = new Track { TrackIdent = Encoding.ASCII.GetString(_data, p, 12) };
|
||||||
Tracks[i].TrackIdent = Encoding.ASCII.GetString(data, p, 12);
|
|
||||||
p += 16;
|
p += 16;
|
||||||
Tracks[i].TrackNumber = data[p++];
|
Tracks[i].TrackNumber = _data[p++];
|
||||||
Tracks[i].SideNumber = data[p++];
|
Tracks[i].SideNumber = _data[p++];
|
||||||
Tracks[i].DataRate = data[p++];
|
Tracks[i].DataRate = _data[p++];
|
||||||
Tracks[i].RecordingMode = data[p++];
|
Tracks[i].RecordingMode = _data[p++];
|
||||||
Tracks[i].SectorSize = data[p++];
|
Tracks[i].SectorSize = _data[p++];
|
||||||
Tracks[i].NumberOfSectors = data[p++];
|
Tracks[i].NumberOfSectors = _data[p++];
|
||||||
Tracks[i].GAP3Length = data[p++];
|
Tracks[i].Gap3Length = _data[p++];
|
||||||
Tracks[i].FillerByte = data[p++];
|
Tracks[i].FillerByte = _data[p++];
|
||||||
int dpos = pos + 0x100;
|
int dPos = pos + 0x100;
|
||||||
Tracks[i].Sectors = new Sector[Tracks[i].NumberOfSectors];
|
Tracks[i].Sectors = new Sector[Tracks[i].NumberOfSectors];
|
||||||
for (int s = 0; s < Tracks[i].NumberOfSectors; s++)
|
for (int s = 0; s < Tracks[i].NumberOfSectors; s++)
|
||||||
{
|
{
|
||||||
Tracks[i].Sectors[s] = new Sector();
|
Tracks[i].Sectors[s] = new Sector
|
||||||
|
{
|
||||||
|
TrackNumber = _data[p++],
|
||||||
|
SideNumber = _data[p++],
|
||||||
|
SectorID = _data[p++],
|
||||||
|
SectorSize = _data[p++],
|
||||||
|
Status1 = _data[p++],
|
||||||
|
Status2 = _data[p++],
|
||||||
|
ActualDataByteLength = (ushort) (_data[p] | _data[p + 1] << 8)
|
||||||
|
};
|
||||||
|
|
||||||
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;
|
p += 2;
|
||||||
Tracks[i].Sectors[s].SectorData = new byte[Tracks[i].Sectors[s].ActualDataByteLength];
|
Tracks[i].Sectors[s].SectorData = new byte[Tracks[i].Sectors[s].ActualDataByteLength];
|
||||||
for (int b = 0; b < Tracks[i].Sectors[s].ActualDataByteLength; b++)
|
for (int b = 0; b < Tracks[i].Sectors[s].ActualDataByteLength; b++)
|
||||||
{
|
{
|
||||||
Tracks[i].Sectors[s].SectorData[b] = data[dpos + b];
|
Tracks[i].Sectors[s].SectorData[b] = _data[dPos + b];
|
||||||
}
|
}
|
||||||
if (Tracks[i].Sectors[s].SectorSize <= 7)
|
if (Tracks[i].Sectors[s].SectorSize <= 7)
|
||||||
{
|
{
|
||||||
|
@ -356,7 +356,7 @@ namespace BizHawk.Emulation.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dpos += Tracks[i].Sectors[s].ActualDataByteLength;
|
dPos += Tracks[i].Sectors[s].ActualDataByteLength;
|
||||||
}
|
}
|
||||||
pos += TrackSizes[i];
|
pos += TrackSizes[i];
|
||||||
}
|
}
|
||||||
|
@ -373,7 +373,7 @@ namespace BizHawk.Emulation.Common
|
||||||
public byte RecordingMode { get; set; }
|
public byte RecordingMode { get; set; }
|
||||||
public byte SectorSize { get; set; }
|
public byte SectorSize { get; set; }
|
||||||
public byte NumberOfSectors { get; set; }
|
public byte NumberOfSectors { get; set; }
|
||||||
public byte GAP3Length { get; set; }
|
public byte Gap3Length { get; set; }
|
||||||
public byte FillerByte { get; set; }
|
public byte FillerByte { get; set; }
|
||||||
public Sector[] Sectors { get; set; }
|
public Sector[] Sectors { get; set; }
|
||||||
|
|
||||||
|
@ -383,8 +383,11 @@ namespace BizHawk.Emulation.Common
|
||||||
foreach (var s in Sectors)
|
foreach (var s in Sectors)
|
||||||
{
|
{
|
||||||
if (s.SectorID < res)
|
if (s.SectorID < res)
|
||||||
|
{
|
||||||
res = s.SectorID;
|
res = s.SectorID;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -404,10 +407,11 @@ namespace BizHawk.Emulation.Common
|
||||||
public int GetChecksum256()
|
public int GetChecksum256()
|
||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
for (int i = 0; i < SectorData.Length; i++)
|
foreach (var b in SectorData)
|
||||||
{
|
{
|
||||||
res += SectorData[i] % 256;
|
res += b % 256;
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,36 +140,19 @@ namespace BizHawk.Emulation.Common
|
||||||
};
|
};
|
||||||
|
|
||||||
// remove a hash type identifier. well don't really need them for indexing (they're 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())
|
game.Status = items[1].Trim()
|
||||||
|
switch
|
||||||
{
|
{
|
||||||
case "B":
|
"B" => RomStatus.BadDump,
|
||||||
game.Status = RomStatus.BadDump;
|
"V" => RomStatus.BadDump,
|
||||||
break;
|
"T" => RomStatus.TranslatedRom,
|
||||||
case "V":
|
"O" => RomStatus.Overdump,
|
||||||
game.Status = RomStatus.BadDump;
|
"I" => RomStatus.Bios,
|
||||||
break;
|
"D" => RomStatus.Homebrew,
|
||||||
case "T":
|
"H" => RomStatus.Hack,
|
||||||
game.Status = RomStatus.TranslatedRom;
|
"U" => RomStatus.Unknown,
|
||||||
break;
|
_ => RomStatus.GoodDump
|
||||||
case "O":
|
};
|
||||||
game.Status = RomStatus.Overdump;
|
|
||||||
break;
|
|
||||||
case "I":
|
|
||||||
game.Status = RomStatus.Bios;
|
|
||||||
break;
|
|
||||||
case "D":
|
|
||||||
game.Status = RomStatus.Homebrew;
|
|
||||||
break;
|
|
||||||
case "H":
|
|
||||||
game.Status = RomStatus.Hack;
|
|
||||||
break;
|
|
||||||
case "U":
|
|
||||||
game.Status = RomStatus.Unknown;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
game.Status = RomStatus.GoodDump;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
game.Name = items[2];
|
game.Name = items[2];
|
||||||
game.System = items[3];
|
game.System = items[3];
|
||||||
|
@ -342,7 +325,7 @@ 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;
|
||||||
|
|
||||||
|
|
|
@ -82,12 +82,7 @@ namespace BizHawk.Emulation.Common
|
||||||
|
|
||||||
public string OptionValue(string option)
|
public string OptionValue(string option)
|
||||||
{
|
{
|
||||||
if (Options.ContainsKey(option))
|
return Options.ContainsKey(option) ? Options[option] : null;
|
||||||
{
|
|
||||||
return Options[option];
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetIntValue(string option)
|
public int GetIntValue(string option)
|
||||||
|
|
|
@ -188,12 +188,7 @@ namespace BizHawk.Emulation.Common
|
||||||
|
|
||||||
public static bool CanDisassemble(this IEmulator core)
|
public static bool CanDisassemble(this IEmulator core)
|
||||||
{
|
{
|
||||||
if (core == null)
|
return core != null && core.ServiceProvider.HasService<IDisassemblable>();
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return core.ServiceProvider.HasService<IDisassemblable>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IDisassemblable AsDisassembler(this IEmulator core)
|
public static IDisassemblable AsDisassembler(this IEmulator core)
|
||||||
|
|
|
@ -126,6 +126,6 @@ namespace BizHawk.Emulation.Common
|
||||||
AccessExecute = 0x04 << 12,
|
AccessExecute = 0x04 << 12,
|
||||||
CPUUnknown = 0x00 << 8,
|
CPUUnknown = 0x00 << 8,
|
||||||
CPUZero = 0x01 << 8,
|
CPUZero = 0x01 << 8,
|
||||||
DomainUnknown = 0x00,
|
DomainUnknown = 0x00
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace BizHawk.Emulation.Common
|
||||||
|
|
||||||
// returns the number of samples actually supplied, which may not match the number requested
|
// returns the number of samples actually supplied, which may not match the number requested
|
||||||
// ^^ what the hell is that supposed to mean.
|
// ^^ what the hell is that supposed to mean.
|
||||||
// the entire point of an ISynchronzingAudioBuffer
|
// the entire point of an ISynchronizingAudioBuffer
|
||||||
// is to provide exact amounts of output samples,
|
// is to provide exact amounts of output samples,
|
||||||
// even when the input provided varies....
|
// even when the input provided varies....
|
||||||
int OutputSamples(short[] buf, int samplesRequested);
|
int OutputSamples(short[] buf, int samplesRequested);
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace BizHawk.Emulation.Common
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SpeexResampler : IDisposable, ISoundProvider
|
public class SpeexResampler : IDisposable, ISoundProvider
|
||||||
{
|
{
|
||||||
// to accept an ISyncSoundProvder input
|
// to accept an ISyncSoundProvider input
|
||||||
private readonly ISoundProvider _input;
|
private readonly ISoundProvider _input;
|
||||||
|
|
||||||
// function to call to dispatch output
|
// function to call to dispatch output
|
||||||
|
@ -28,7 +28,7 @@ namespace BizHawk.Emulation.Common
|
||||||
QUALITY_MIN = 0,
|
QUALITY_MIN = 0,
|
||||||
QUALITY_DEFAULT = 4,
|
QUALITY_DEFAULT = 4,
|
||||||
QUALITY_VOIP = 3,
|
QUALITY_VOIP = 3,
|
||||||
QUALITY_DESKTOP = 5,
|
QUALITY_DESKTOP = 5
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class LibSpeexDSP
|
private static class LibSpeexDSP
|
||||||
|
|
|
@ -113,10 +113,10 @@ namespace BizHawk.Emulation.Common
|
||||||
{
|
{
|
||||||
return new TextStateFPtrs
|
return new TextStateFPtrs
|
||||||
{
|
{
|
||||||
Save = new TextStateFPtrs.DataFunction(Save),
|
Save = Save,
|
||||||
Load = null,
|
Load = null,
|
||||||
EnterSection = new TextStateFPtrs.SectionFunction(EnterSectionSave),
|
EnterSection = EnterSectionSave,
|
||||||
ExitSection = new TextStateFPtrs.SectionFunction(ExitSection)
|
ExitSection = ExitSection
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,9 +125,9 @@ namespace BizHawk.Emulation.Common
|
||||||
return new TextStateFPtrs
|
return new TextStateFPtrs
|
||||||
{
|
{
|
||||||
Save = null,
|
Save = null,
|
||||||
Load = new TextStateFPtrs.DataFunction(Load),
|
Load = Load,
|
||||||
EnterSection = new TextStateFPtrs.SectionFunction(EnterSectionLoad),
|
EnterSection = EnterSectionLoad,
|
||||||
ExitSection = new TextStateFPtrs.SectionFunction(ExitSection)
|
ExitSection = ExitSection
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,6 +220,8 @@
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=blitter/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=blitter/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=bolden/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=bolden/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bools/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bools/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=bootable/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=bootstart/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=botting/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=botting/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Boyee/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Boyee/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=bsnes/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=bsnes/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
@ -492,6 +494,7 @@
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=xinput/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=xinput/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Xjin/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Xjin/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Yabause/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Yabause/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Zeromus/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Zipheader/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Zipheader/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=ZSNES/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=ZSNES/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||||
|
|
Loading…
Reference in New Issue