From 00f46b0e7dc212f46c0b3836d3384a9ba1f9ea39 Mon Sep 17 00:00:00 2001 From: Asnivor Date: Thu, 26 Apr 2018 15:00:54 +0100 Subject: [PATCH] Fix edge-case issue where non-rom games have a header offset detected in RomGame.cs (leading to system detection issues further down the line) --- BizHawk.Client.Common/RomGame.cs | 7 +++++++ BizHawk.Emulation.Common/Database/Database.cs | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/BizHawk.Client.Common/RomGame.cs b/BizHawk.Client.Common/RomGame.cs index a30e3b64c4..13eaf5b94f 100644 --- a/BizHawk.Client.Common/RomGame.cs +++ b/BizHawk.Client.Common/RomGame.cs @@ -66,6 +66,13 @@ namespace BizHawk.Client.Common { RomData = FileData; } + else if (file.Extension == ".DSK" || file.Extension == ".TAP" || file.Extension == ".TZX") + { + // these are not roms. unforunately if treated as such there are certain edge-cases + // where a header offset is detected. This should mitigate this issue until a cleaner solution is found + // (-Asnivor) + RomData = FileData; + } else { // if there was a header offset, read the whole file into FileData and then copy it into RomData (this is unfortunate, in case RomData isnt needed) diff --git a/BizHawk.Emulation.Common/Database/Database.cs b/BizHawk.Emulation.Common/Database/Database.cs index 8f0af8194d..5f37e91711 100644 --- a/BizHawk.Emulation.Common/Database/Database.cs +++ b/BizHawk.Emulation.Common/Database/Database.cs @@ -341,8 +341,9 @@ namespace BizHawk.Emulation.Common case ".DSK": byte[] head2 = romData.Take(20).ToArray(); - if (System.Text.Encoding.Default.GetString(head2).ToUpper().Contains("EXTENDED CPC DSK") || - System.Text.Encoding.Default.GetString(head2).ToUpper().Contains("MV - CPCEMU")) + string ident = System.Text.Encoding.Default.GetString(head2); + if (ident.ToUpper().Contains("EXTENDED CPC DSK") || + ident.ToUpper().Contains("MV - CPCEMU")) game.System = "ZXSpectrum"; else game.System = "AppleII";