diff --git a/src/BizHawk.Emulation.Common/DSKIdentifier.cs b/src/BizHawk.Emulation.Common/DSKIdentifier.cs index 5f1499e028..32b9153211 100644 --- a/src/BizHawk.Emulation.Common/DSKIdentifier.cs +++ b/src/BizHawk.Emulation.Common/DSKIdentifier.cs @@ -17,7 +17,7 @@ namespace BizHawk.Emulation.Common private string _possibleIdent = ""; /// - /// Default fallthrough to AppleII + /// Default fallthrough to AppleII - the AppleII *.dsk format seems to be very simple with no ident strings /// public string IdentifiedSystem { get; set; } = VSystemID.Raw.AppleII; @@ -93,7 +93,7 @@ namespace BizHawk.Emulation.Common // check for bootable status if (trk.Sectors[0].SectorData != null && trk.Sectors[0].SectorData.Length > 0) { - switch (trk.Sectors[0].GetChecksum256()) + switch (trk.Sectors[0].GetModChecksum256()) { case 3: IdentifiedSystem = VSystemID.Raw.ZXSpectrum; @@ -116,13 +116,13 @@ namespace BizHawk.Emulation.Common } // at this point the disk is not standard bootable - // try format analysis + // try format analysis if (trk.Sectors.Length == 9 && trk.Sectors[0].SectorSize == 2) { switch (trk.GetLowestSectorID()) { case 1: - switch (trk.Sectors[0].GetChecksum256()) + switch (trk.Sectors[0].GetModChecksum256()) { case 3: IdentifiedSystem = VSystemID.Raw.ZXSpectrum; @@ -406,7 +406,15 @@ namespace BizHawk.Emulation.Common public byte[] SectorData { get; set; } public bool ContainsMultipleWeakSectors { get; set; } - public int GetChecksum256() => SectorData.Sum(b => b % 256); + public int GetModChecksum256() + { + int res = 0; + for (int i = 0; i < ActualDataByteLength; i++) + { + res = (res + SectorData[i]) % 256; + } + return res; + } } } }