add patch ability to gamedb

This commit is contained in:
beirich 2011-01-29 04:52:50 +00:00
parent 4f7fb11b2c
commit 507da48f92
2 changed files with 24 additions and 1 deletions

View File

@ -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<string>(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<string> GetOptions() { return options; }
public string Name { get { return name; } }

View File

@ -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