Hex Editor - fix wrapping logic when incrementing/decrementing frozen addresses

This commit is contained in:
adelikat 2014-08-16 14:44:40 +00:00
parent 3303652d99
commit db0dd17676
2 changed files with 32 additions and 0 deletions

View File

@ -297,6 +297,11 @@ namespace BizHawk.Client.Common
if (!IsSeparator)
{
_val++;
if (_val > _watch.MaxValue)
{
_val = 0;
}
Pulse();
Changes();
}
@ -307,6 +312,11 @@ namespace BizHawk.Client.Common
if (!IsSeparator)
{
_val--;
if ((uint)_val > _watch.MaxValue)
{
_val = (int)_watch.MaxValue;
}
Pulse();
Changes();
}

View File

@ -52,6 +52,8 @@ namespace BizHawk.Client.Common
public abstract string ValueString { get; }
public abstract WatchSize Size { get; }
public abstract uint MaxValue { get; }
public abstract int? Previous { get; }
public abstract string PreviousStr { get; }
public abstract void ResetPrevious();
@ -400,6 +402,11 @@ namespace BizHawk.Client.Common
public override string Diff { get { return string.Empty; } }
public override uint MaxValue
{
get { return 0; }
}
public override void Update() { return; }
}
@ -488,6 +495,11 @@ namespace BizHawk.Client.Common
}
}
public override uint MaxValue
{
get { return byte.MaxValue; }
}
public string FormatValue(byte val)
{
switch (Type)
@ -645,6 +657,11 @@ namespace BizHawk.Client.Common
_changecount = changeCount;
}
public override uint MaxValue
{
get { return ushort.MaxValue; }
}
public override int? Value
{
get { return GetWord(); }
@ -886,6 +903,11 @@ namespace BizHawk.Client.Common
}
}
public override uint MaxValue
{
get { return uint.MaxValue; }
}
public override string ValueString
{
get { return FormatValue(GetDWord()); }