New Cheat List - support saving and loading of size,display type, and endian, while still supporting pre-existing .cht files

This commit is contained in:
adelikat 2013-10-05 22:16:45 +00:00
parent b59ac97d5f
commit 0d278bb67f
2 changed files with 28 additions and 5 deletions

View File

@ -215,6 +215,10 @@ namespace BizHawk.MultiClient
MemoryDomain DOMAIN;
bool ENABLED;
string NAME;
Watch.WatchSize SIZE = Watch.WatchSize.Byte;
Watch.DisplayType TYPE = Watch.DisplayType.Hex;
bool BIGENDIAN = false;
if (s.Length < 6) continue;
//NewCheat c = new NewCheat(
@ -234,13 +238,21 @@ namespace BizHawk.MultiClient
ENABLED = vals[4] == "1";
NAME = vals[5];
//For backwards compatibility, don't assume these values exist
if (vals.Length > 6)
{
SIZE = Watch.SizeFromChar(vals[6][0]);
TYPE = Watch.DisplayTypeFromChar(vals[7][0]);
BIGENDIAN = vals[8] == "1";
}
Watch w = Watch.GenerateWatch(
DOMAIN,
ADDR,
Watch.WatchSize.Byte,
Watch.DisplayType.Hex,
SIZE,
TYPE,
NAME,
false
BIGENDIAN
);
NewCheat c = new NewCheat(w, COMPARE, Global.Config.DisableCheatsOnLoad ? false : ENABLED);
@ -480,9 +492,10 @@ namespace BizHawk.MultiClient
.Append(cheat.Domain != null ? cheat.Domain.Name : String.Empty).Append('\t')
.Append(cheat.Enabled ? '1' : '0').Append('\t')
.Append(cheat.Name)
.Append(cheat.SizeAsChar).Append('\t')
.Append(cheat.SizeAsChar).Append('\t')
.Append(cheat.BigEndian.Value ? '1' : '0').Append('\t')
.AppendLine();
//TODO: save big endian, size, and display type
}
}

View File

@ -94,11 +94,21 @@ namespace BizHawk.MultiClient
get { return _watch.Size; }
}
public char SizeAsChar
{
get { return _watch.SizeAsChar; }
}
public Watch.DisplayType Type
{
get { return _watch.Type; }
}
public char TypeAsChar
{
get { return _watch.TypeAsChar; }
}
public string Name
{
get { if (IsSeparator) return String.Empty; else return _watch.Notes; }