diff --git a/BizHawk.MultiClient/RomGame.cs b/BizHawk.MultiClient/RomGame.cs index 6f049c4236..f44e784fe0 100644 --- a/BizHawk.MultiClient/RomGame.cs +++ b/BizHawk.MultiClient/RomGame.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Globalization; namespace BizHawk.MultiClient { @@ -37,6 +38,7 @@ namespace BizHawk.MultiClient name = info.Name; System = info.System; options = new List(info.GetOptions()); + CheckForPatchOptions(); } if (patch != null) @@ -74,6 +76,27 @@ namespace BizHawk.MultiClient return output; } + private void CheckForPatchOptions() + { + try + { + foreach (var opt in options) + { + if (opt.StartsWith("PatchBytes")) + { + var split1 = opt.Split('='); + foreach (var val in split1[1].Split(',')) + { + var split3 = val.Split(':'); + int offset = int.Parse(split3[0], NumberStyles.HexNumber); + byte value = byte.Parse(split3[1], NumberStyles.HexNumber); + RomData[offset] = value; + } + } + } + } catch (Exception) { } // No need for errors in patching to propagate. + } + public byte[] GetRomData() { return RomData; } public IList GetOptions() { return options; } public string Name { get { return name; } } diff --git a/BizHawk.MultiClient/output/gamedb.txt b/BizHawk.MultiClient/output/gamedb.txt index 699b26ff15..3116fbc56b 100644 --- a/BizHawk.MultiClient/output/gamedb.txt +++ b/BizHawk.MultiClient/output/gamedb.txt @@ -1165,7 +1165,7 @@ EC7CF033 O Wonder Boy (2x overdump) SMS F374ECBA F Wonder Boy (2x overdump) (f) SMS F F1EE83CF F Wonder Boy (2x overdump) (h) [A] SMS 9C7A70F5 F Wonder Boy (2x overdump) (h) [B] SMS -679E1676 Wonder Boy III - The Dragon's Trap SMS FM +679E1676 Wonder Boy III - The Dragon's Trap SMS FM;PatchBytes=25B:00,25C:00 C999F353 F Wonder Boy III - The Dragon's Trap (f) SMS F FM 79EC738B T Wonder Boy III - The Dragon's Trap (FR) SMS FM 42012B7D T Wonder Boy III - The Dragon's Trap (SE) SMS Metalhead? FM