From 2cdeabfcf3f594055258d54e38bc9119746576fd Mon Sep 17 00:00:00 2001 From: goyuken Date: Mon, 22 Oct 2012 18:33:34 +0000 Subject: [PATCH] mainform: detect and recover from a particular bad FDS bios dump that is exactly 40976 bytes long --- BizHawk.MultiClient/MainForm.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index 17f145b1aa..e9f535d82d 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -1471,7 +1471,17 @@ namespace BizHawk.MultiClient string biosPath = PathManager.MakeAbsolutePath(Global.Config.PathFDSBios, "NES"); byte[] bios = null; if (File.Exists(biosPath)) + { bios = File.ReadAllBytes(biosPath); + // ines header + 24KB of garbage + actual bios + 8KB of garbage + if (bios.Length == 40976) + { + MessageBox.Show(this, "Your FDS BIOS is a bad dump. BizHawk will attempt to use it, but no guarantees! You should find a new one."); + byte[] tmp = new byte[8192]; + Buffer.BlockCopy(bios, 16 + 8192 * 3, tmp, 0, 8192); + bios = tmp; + } + } NES nes = new NES(game, rom.FileData, bios); nes.SoundOn = Global.Config.SoundEnabled;