Rename BizHawk.Client.Common.DisplayType to WatchDisplayType

we have aonther type with that identifier, BizHawk.Emulation.Common.DisplayType
This commit is contained in:
YoshiRulz 2021-02-14 14:46:49 +10:00
parent 34cb598fe2
commit ba88712b2b
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
25 changed files with 261 additions and 261 deletions

View File

@ -43,7 +43,7 @@ namespace BizHawk.Client.Common.cheats
domain, domain,
result.Address, result.Address,
result.Size, result.Size,
DisplayType.Hex, WatchDisplayType.Hex,
domain.EndianType == MemoryDomain.Endian.Big, domain.EndianType == MemoryDomain.Endian.Big,
description); description);
return result.Compare.HasValue return result.Compare.HasValue

View File

@ -229,7 +229,7 @@ namespace BizHawk.Client.Common
if (emulator.HasRegions()) if (emulator.HasRegions())
{ {
var region = emulator.AsRegionable().Region; var region = emulator.AsRegionable().Region;
if (region == Emulation.Common.DisplayType.PAL) if (region == DisplayType.PAL)
{ {
movie.HeaderEntries.Add(HeaderKeys.Pal, "1"); movie.HeaderEntries.Add(HeaderKeys.Pal, "1");
} }

View File

@ -79,7 +79,7 @@ namespace BizHawk.Client.Common
public char SizeAsChar => _watch.SizeAsChar; public char SizeAsChar => _watch.SizeAsChar;
public DisplayType Type => _watch.Type; public WatchDisplayType Type => _watch.Type;
public char TypeAsChar => _watch.TypeAsChar; public char TypeAsChar => _watch.TypeAsChar;
@ -267,7 +267,7 @@ namespace BizHawk.Client.Common
} }
} }
public void SetType(DisplayType type) public void SetType(WatchDisplayType type)
{ {
if (_watch.IsDisplayTypeAvailable(type)) if (_watch.IsDisplayTypeAvailable(type))
{ {

View File

@ -284,7 +284,7 @@ namespace BizHawk.Client.Common
// Set to hex for saving // Set to hex for saving
var tempCheatType = cheat.Type; var tempCheatType = cheat.Type;
cheat.SetType(DisplayType.Hex); cheat.SetType(WatchDisplayType.Hex);
sb sb
.Append(cheat.AddressStr).Append('\t') .Append(cheat.AddressStr).Append('\t')
@ -349,7 +349,7 @@ namespace BizHawk.Client.Common
{ {
int? compare; int? compare;
var size = WatchSize.Byte; var size = WatchSize.Byte;
var type = DisplayType.Hex; var type = WatchDisplayType.Hex;
var bigEndian = false; var bigEndian = false;
var comparisonType = Cheat.CompareType.None; var comparisonType = Cheat.CompareType.None;

View File

@ -205,7 +205,7 @@ namespace BizHawk.Client.Common.RamSearchEngine
} }
} }
public void SetType(DisplayType type) => _settings.Type = type; public void SetType(WatchDisplayType type) => _settings.Type = type;
public void SetEndian(bool bigEndian) => _settings.BigEndian = bigEndian; public void SetEndian(bool bigEndian) => _settings.BigEndian = bigEndian;
@ -358,33 +358,33 @@ namespace BizHawk.Client.Common.RamSearchEngine
{ {
default: default:
case ComparisonOperator.Equal: case ComparisonOperator.Equal:
return _settings.Type == DisplayType.Float return _settings.Type == WatchDisplayType.Float
? watchList.Where(w => GetValue(w.Address).ToFloat().HawkFloatEquality(w.Previous.ToFloat())) ? watchList.Where(w => GetValue(w.Address).ToFloat().HawkFloatEquality(w.Previous.ToFloat()))
: watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) == SignExtendAsNeeded(w.Previous)); : watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) == SignExtendAsNeeded(w.Previous));
case ComparisonOperator.NotEqual: case ComparisonOperator.NotEqual:
return watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) != SignExtendAsNeeded(w.Previous)); return watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) != SignExtendAsNeeded(w.Previous));
case ComparisonOperator.GreaterThan: case ComparisonOperator.GreaterThan:
return _settings.Type == DisplayType.Float return _settings.Type == WatchDisplayType.Float
? watchList.Where(w => GetValue(w.Address).ToFloat() > w.Previous.ToFloat()) ? watchList.Where(w => GetValue(w.Address).ToFloat() > w.Previous.ToFloat())
: watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) > SignExtendAsNeeded(w.Previous)); : watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) > SignExtendAsNeeded(w.Previous));
case ComparisonOperator.GreaterThanEqual: case ComparisonOperator.GreaterThanEqual:
return _settings.Type == DisplayType.Float return _settings.Type == WatchDisplayType.Float
? watchList.Where(w => GetValue(w.Address).ToFloat() >= w.Previous.ToFloat()) ? watchList.Where(w => GetValue(w.Address).ToFloat() >= w.Previous.ToFloat())
: watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) >= SignExtendAsNeeded(w.Previous)); : watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) >= SignExtendAsNeeded(w.Previous));
case ComparisonOperator.LessThan: case ComparisonOperator.LessThan:
return _settings.Type == DisplayType.Float return _settings.Type == WatchDisplayType.Float
? watchList.Where(w => GetValue(w.Address).ToFloat() < w.Previous.ToFloat()) ? watchList.Where(w => GetValue(w.Address).ToFloat() < w.Previous.ToFloat())
: watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) < SignExtendAsNeeded(w.Previous)); : watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) < SignExtendAsNeeded(w.Previous));
case ComparisonOperator.LessThanEqual: case ComparisonOperator.LessThanEqual:
return _settings.Type == DisplayType.Float return _settings.Type == WatchDisplayType.Float
? watchList.Where(w => GetValue(w.Address).ToFloat() <= w.Previous.ToFloat()) ? watchList.Where(w => GetValue(w.Address).ToFloat() <= w.Previous.ToFloat())
: watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) <= SignExtendAsNeeded(w.Previous)); : watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) <= SignExtendAsNeeded(w.Previous));
case ComparisonOperator.DifferentBy: case ComparisonOperator.DifferentBy:
if (DifferentBy.HasValue) if (DifferentBy.HasValue)
{ {
var differentBy = DifferentBy.Value; var differentBy = DifferentBy.Value;
if (_settings.Type == DisplayType.Float) if (_settings.Type == WatchDisplayType.Float)
{ {
return watchList.Where(w => (GetValue(w.Address).ToFloat() + differentBy).HawkFloatEquality(w.Previous.ToFloat()) return watchList.Where(w => (GetValue(w.Address).ToFloat() + differentBy).HawkFloatEquality(w.Previous.ToFloat())
|| (GetValue(w.Address).ToFloat() - differentBy).HawkFloatEquality(w.Previous.ToFloat())); || (GetValue(w.Address).ToFloat() - differentBy).HawkFloatEquality(w.Previous.ToFloat()));
@ -414,28 +414,28 @@ namespace BizHawk.Client.Common.RamSearchEngine
{ {
default: default:
case ComparisonOperator.Equal: case ComparisonOperator.Equal:
return _settings.Type == DisplayType.Float return _settings.Type == WatchDisplayType.Float
? watchList.Where(w => GetValue(w.Address).ToFloat().HawkFloatEquality(compareValue.ToFloat())) ? watchList.Where(w => GetValue(w.Address).ToFloat().HawkFloatEquality(compareValue.ToFloat()))
: watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) == SignExtendAsNeeded(compareValue)); : watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) == SignExtendAsNeeded(compareValue));
case ComparisonOperator.NotEqual: case ComparisonOperator.NotEqual:
return _settings.Type == DisplayType.Float return _settings.Type == WatchDisplayType.Float
? watchList.Where(w => !GetValue(w.Address).ToFloat().HawkFloatEquality(compareValue.ToFloat())) ? watchList.Where(w => !GetValue(w.Address).ToFloat().HawkFloatEquality(compareValue.ToFloat()))
: watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) != SignExtendAsNeeded(compareValue)); : watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) != SignExtendAsNeeded(compareValue));
case ComparisonOperator.GreaterThan: case ComparisonOperator.GreaterThan:
return _settings.Type == DisplayType.Float return _settings.Type == WatchDisplayType.Float
? watchList.Where(w => GetValue(w.Address).ToFloat() > compareValue.ToFloat()) ? watchList.Where(w => GetValue(w.Address).ToFloat() > compareValue.ToFloat())
: watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) > SignExtendAsNeeded(compareValue)); : watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) > SignExtendAsNeeded(compareValue));
case ComparisonOperator.GreaterThanEqual: case ComparisonOperator.GreaterThanEqual:
return _settings.Type == DisplayType.Float return _settings.Type == WatchDisplayType.Float
? watchList.Where(w => GetValue(w.Address).ToFloat() >= compareValue.ToFloat()) ? watchList.Where(w => GetValue(w.Address).ToFloat() >= compareValue.ToFloat())
: watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) >= SignExtendAsNeeded(compareValue)); : watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) >= SignExtendAsNeeded(compareValue));
case ComparisonOperator.LessThan: case ComparisonOperator.LessThan:
return _settings.Type == DisplayType.Float return _settings.Type == WatchDisplayType.Float
? watchList.Where(w => GetValue(w.Address).ToFloat() < compareValue.ToFloat()) ? watchList.Where(w => GetValue(w.Address).ToFloat() < compareValue.ToFloat())
: watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) < SignExtendAsNeeded(compareValue)); : watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) < SignExtendAsNeeded(compareValue));
case ComparisonOperator.LessThanEqual: case ComparisonOperator.LessThanEqual:
return _settings.Type == DisplayType.Float return _settings.Type == WatchDisplayType.Float
? watchList.Where(w => GetValue(w.Address).ToFloat() <= compareValue.ToFloat()) ? watchList.Where(w => GetValue(w.Address).ToFloat() <= compareValue.ToFloat())
: watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) <= SignExtendAsNeeded(compareValue)); : watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) <= SignExtendAsNeeded(compareValue));
@ -443,7 +443,7 @@ namespace BizHawk.Client.Common.RamSearchEngine
if (DifferentBy.HasValue) if (DifferentBy.HasValue)
{ {
var differentBy = DifferentBy.Value; var differentBy = DifferentBy.Value;
if (_settings.Type == DisplayType.Float) if (_settings.Type == WatchDisplayType.Float)
{ {
return watchList.Where(w => (GetValue(w.Address).ToFloat() + differentBy).HawkFloatEquality(compareValue) return watchList.Where(w => (GetValue(w.Address).ToFloat() + differentBy).HawkFloatEquality(compareValue)
|| (GetValue(w.Address).ToFloat() - differentBy).HawkFloatEquality(compareValue)); || (GetValue(w.Address).ToFloat() - differentBy).HawkFloatEquality(compareValue));
@ -552,34 +552,34 @@ namespace BizHawk.Client.Common.RamSearchEngine
{ {
default: default:
case ComparisonOperator.Equal: case ComparisonOperator.Equal:
return _settings.Type == DisplayType.Float return _settings.Type == WatchDisplayType.Float
? watchList.Where(w => (GetValue(w.Address).ToFloat() - w.Previous.ToFloat()).HawkFloatEquality(compareValue)) ? watchList.Where(w => (GetValue(w.Address).ToFloat() - w.Previous.ToFloat()).HawkFloatEquality(compareValue))
: watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) - SignExtendAsNeeded(w.Previous) == compareValue); : watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) - SignExtendAsNeeded(w.Previous) == compareValue);
case ComparisonOperator.NotEqual: case ComparisonOperator.NotEqual:
return _settings.Type == DisplayType.Float return _settings.Type == WatchDisplayType.Float
? watchList.Where(w => !(GetValue(w.Address).ToFloat() - w.Previous.ToFloat()).HawkFloatEquality(compareValue)) ? watchList.Where(w => !(GetValue(w.Address).ToFloat() - w.Previous.ToFloat()).HawkFloatEquality(compareValue))
: watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) - SignExtendAsNeeded(w.Previous) != compareValue); : watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) - SignExtendAsNeeded(w.Previous) != compareValue);
case ComparisonOperator.GreaterThan: case ComparisonOperator.GreaterThan:
return _settings.Type == DisplayType.Float return _settings.Type == WatchDisplayType.Float
? watchList.Where(w => GetValue(w.Address).ToFloat() - w.Previous.ToFloat() > compareValue) ? watchList.Where(w => GetValue(w.Address).ToFloat() - w.Previous.ToFloat() > compareValue)
: watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) - SignExtendAsNeeded(w.Previous) > compareValue); : watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) - SignExtendAsNeeded(w.Previous) > compareValue);
case ComparisonOperator.GreaterThanEqual: case ComparisonOperator.GreaterThanEqual:
return _settings.Type == DisplayType.Float return _settings.Type == WatchDisplayType.Float
? watchList.Where(w => GetValue(w.Address).ToFloat() - w.Previous.ToFloat() >= compareValue) ? watchList.Where(w => GetValue(w.Address).ToFloat() - w.Previous.ToFloat() >= compareValue)
: watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) - SignExtendAsNeeded(w.Previous) >= compareValue); : watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) - SignExtendAsNeeded(w.Previous) >= compareValue);
case ComparisonOperator.LessThan: case ComparisonOperator.LessThan:
return _settings.Type == DisplayType.Float return _settings.Type == WatchDisplayType.Float
? watchList.Where(w => GetValue(w.Address).ToFloat() - w.Previous.ToFloat() < compareValue) ? watchList.Where(w => GetValue(w.Address).ToFloat() - w.Previous.ToFloat() < compareValue)
: watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) - SignExtendAsNeeded(w.Previous) < compareValue); : watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) - SignExtendAsNeeded(w.Previous) < compareValue);
case ComparisonOperator.LessThanEqual: case ComparisonOperator.LessThanEqual:
return _settings.Type == DisplayType.Float return _settings.Type == WatchDisplayType.Float
? watchList.Where(w => GetValue(w.Address).ToFloat() - w.Previous.ToFloat() <= compareValue) ? watchList.Where(w => GetValue(w.Address).ToFloat() - w.Previous.ToFloat() <= compareValue)
: watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) - SignExtendAsNeeded(w.Previous) <= compareValue); : watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) - SignExtendAsNeeded(w.Previous) <= compareValue);
case ComparisonOperator.DifferentBy: case ComparisonOperator.DifferentBy:
if (DifferentBy.HasValue) if (DifferentBy.HasValue)
{ {
var differentBy = DifferentBy.Value; var differentBy = DifferentBy.Value;
if (_settings.Type == DisplayType.Float) if (_settings.Type == WatchDisplayType.Float)
{ {
return watchList.Where(w => (GetValue(w.Address).ToFloat() - w.Previous.ToFloat() + differentBy).HawkFloatEquality(compareValue) return watchList.Where(w => (GetValue(w.Address).ToFloat() - w.Previous.ToFloat() + differentBy).HawkFloatEquality(compareValue)
|| (GetValue(w.Address).ToFloat() - w.Previous.ToFloat() - differentBy).HawkFloatEquality(w.Previous)); || (GetValue(w.Address).ToFloat() - w.Previous.ToFloat() - differentBy).HawkFloatEquality(w.Previous));
@ -599,7 +599,7 @@ namespace BizHawk.Client.Common.RamSearchEngine
private long SignExtendAsNeeded(long val) private long SignExtendAsNeeded(long val)
{ {
if (_settings.Type != DisplayType.Signed) if (_settings.Type != WatchDisplayType.Signed)
{ {
return val; return val;
} }

View File

@ -8,7 +8,7 @@ namespace BizHawk.Client.Common.RamSearchEngine
{ {
BigEndian = memoryDomains.MainMemory.EndianType == MemoryDomain.Endian.Big; BigEndian = memoryDomains.MainMemory.EndianType == MemoryDomain.Endian.Big;
Size = (WatchSize)memoryDomains.MainMemory.WordSize; Size = (WatchSize)memoryDomains.MainMemory.WordSize;
Type = DisplayType.Unsigned; Type = WatchDisplayType.Unsigned;
Mode = memoryDomains.MainMemory.Size > 1024 * 1024 Mode = memoryDomains.MainMemory.Size > 1024 * 1024
? SearchMode.Fast ? SearchMode.Fast
: SearchMode.Detailed; : SearchMode.Detailed;
@ -26,7 +26,7 @@ namespace BizHawk.Client.Common.RamSearchEngine
public bool CheckMisAligned { get; set; } public bool CheckMisAligned { get; set; }
/*Can be changed mid-search*/ /*Can be changed mid-search*/
public DisplayType Type { get; set; } public WatchDisplayType Type { get; set; }
public bool BigEndian { get; set; } public bool BigEndian { get; set; }
public PreviousType PreviousType { get; set; } public PreviousType PreviousType { get; set; }
public bool UseUndoHistory { get; set; } public bool UseUndoHistory { get; set; }

View File

@ -20,14 +20,14 @@ namespace BizHawk.Client.Common
/// </summary> /// </summary>
/// <param name="domain"><see cref="MemoryDomain"/> where you want to track</param> /// <param name="domain"><see cref="MemoryDomain"/> where you want to track</param>
/// <param name="address">The address you want to track</param> /// <param name="address">The address you want to track</param>
/// <param name="type">How you you want to display the value See <see cref="DisplayType"/></param> /// <param name="type">How you you want to display the value See <see cref="WatchDisplayType"/></param>
/// <param name="bigEndian">Specify the endianess. true for big endian</param> /// <param name="bigEndian">Specify the endianess. true for big endian</param>
/// <param name="note">A custom note about the <see cref="Watch"/></param> /// <param name="note">A custom note about the <see cref="Watch"/></param>
/// <param name="value">Current value</param> /// <param name="value">Current value</param>
/// <param name="previous">Previous value</param> /// <param name="previous">Previous value</param>
/// <param name="changeCount">How many times value has changed</param> /// <param name="changeCount">How many times value has changed</param>
/// <exception cref="ArgumentException">Occurs when a <see cref="DisplayType"/> is incompatible with <see cref="WatchSize.Byte"/></exception> /// <exception cref="ArgumentException">Occurs when a <see cref="WatchDisplayType"/> is incompatible with <see cref="WatchSize.Byte"/></exception>
internal ByteWatch(MemoryDomain domain, long address, DisplayType type, bool bigEndian, string note, byte value, byte previous, int changeCount) internal ByteWatch(MemoryDomain domain, long address, WatchDisplayType type, bool bigEndian, string note, byte value, byte previous, int changeCount)
: base(domain, address, WatchSize.Byte, type, bigEndian, note) : base(domain, address, WatchSize.Byte, type, bigEndian, note)
{ {
_value = value == 0 ? GetByte() : value; _value = value == 0 ? GetByte() : value;
@ -36,24 +36,24 @@ namespace BizHawk.Client.Common
} }
/// <summary> /// <summary>
/// Gets an enumeration of <see cref="DisplayType"/> that are valid for a <see cref="ByteWatch"/> /// Gets an enumeration of <see cref="WatchDisplayType"/> that are valid for a <see cref="ByteWatch"/>
/// </summary> /// </summary>
public static IEnumerable<DisplayType> ValidTypes public static IEnumerable<WatchDisplayType> ValidTypes
{ {
get get
{ {
yield return DisplayType.Unsigned; yield return WatchDisplayType.Unsigned;
yield return DisplayType.Signed; yield return WatchDisplayType.Signed;
yield return DisplayType.Hex; yield return WatchDisplayType.Hex;
yield return DisplayType.Binary; yield return WatchDisplayType.Binary;
} }
} }
/// <summary> /// <summary>
/// Get a list a <see cref="DisplayType"/> that can be used for this <see cref="ByteWatch"/> /// Get a list a <see cref="WatchDisplayType"/> that can be used for this <see cref="ByteWatch"/>
/// </summary> /// </summary>
/// <returns>An enumeration that contains all valid <see cref="DisplayType"/></returns> /// <returns>An enumeration that contains all valid <see cref="WatchDisplayType"/></returns>
public override IEnumerable<DisplayType> AvailableTypes() public override IEnumerable<WatchDisplayType> AvailableTypes()
{ {
return ValidTypes; return ValidTypes;
} }
@ -79,7 +79,7 @@ namespace BizHawk.Client.Common
byte val = 0; byte val = 0;
switch (Type) switch (Type)
{ {
case DisplayType.Unsigned: case WatchDisplayType.Unsigned:
if (value.IsUnsigned()) if (value.IsUnsigned())
{ {
val = (byte)int.Parse(value); val = (byte)int.Parse(value);
@ -90,7 +90,7 @@ namespace BizHawk.Client.Common
} }
break; break;
case DisplayType.Signed: case WatchDisplayType.Signed:
if (value.IsSigned()) if (value.IsSigned())
{ {
val = (byte)(sbyte)int.Parse(value); val = (byte)(sbyte)int.Parse(value);
@ -101,7 +101,7 @@ namespace BizHawk.Client.Common
} }
break; break;
case DisplayType.Hex: case WatchDisplayType.Hex:
if (value.IsHex()) if (value.IsHex())
{ {
val = (byte)int.Parse(value, NumberStyles.HexNumber); val = (byte)int.Parse(value, NumberStyles.HexNumber);
@ -112,7 +112,7 @@ namespace BizHawk.Client.Common
} }
break; break;
case DisplayType.Binary: case WatchDisplayType.Binary:
if (value.IsBinary()) if (value.IsBinary())
{ {
val = (byte)Convert.ToInt32(value, 2); val = (byte)Convert.ToInt32(value, 2);
@ -171,10 +171,10 @@ namespace BizHawk.Client.Common
return Type switch return Type switch
{ {
_ when !IsValid => "-", _ when !IsValid => "-",
DisplayType.Unsigned => val.ToString(), WatchDisplayType.Unsigned => val.ToString(),
DisplayType.Signed => ((sbyte) val).ToString(), WatchDisplayType.Signed => ((sbyte) val).ToString(),
DisplayType.Hex => $"{val:X2}", WatchDisplayType.Hex => $"{val:X2}",
DisplayType.Binary => Convert.ToString(val, 2).PadLeft(8, '0').Insert(4, " "), WatchDisplayType.Binary => Convert.ToString(val, 2).PadLeft(8, '0').Insert(4, " "),
_ => val.ToString() _ => val.ToString()
}; };
} }

View File

@ -20,14 +20,14 @@ namespace BizHawk.Client.Common
/// </summary> /// </summary>
/// <param name="domain"><see cref="MemoryDomain"/> where you want to track</param> /// <param name="domain"><see cref="MemoryDomain"/> where you want to track</param>
/// <param name="address">The address you want to track</param> /// <param name="address">The address you want to track</param>
/// <param name="type">How you you want to display the value See <see cref="DisplayType"/></param> /// <param name="type">How you you want to display the value See <see cref="WatchDisplayType"/></param>
/// <param name="bigEndian">Specify the endianess. true for big endian</param> /// <param name="bigEndian">Specify the endianess. true for big endian</param>
/// <param name="note">A custom note about the <see cref="Watch"/></param> /// <param name="note">A custom note about the <see cref="Watch"/></param>
/// <param name="value">Current value</param> /// <param name="value">Current value</param>
/// <param name="previous">Previous value</param> /// <param name="previous">Previous value</param>
/// <param name="changeCount">How many times value has changed</param> /// <param name="changeCount">How many times value has changed</param>
/// <exception cref="ArgumentException">Occurs when a <see cref="DisplayType"/> is incompatible with <see cref="WatchSize.DWord"/></exception> /// <exception cref="ArgumentException">Occurs when a <see cref="WatchDisplayType"/> is incompatible with <see cref="WatchSize.DWord"/></exception>
internal DWordWatch(MemoryDomain domain, long address, DisplayType type, bool bigEndian, string note, uint value, uint previous, int changeCount) internal DWordWatch(MemoryDomain domain, long address, WatchDisplayType type, bool bigEndian, string note, uint value, uint previous, int changeCount)
: base(domain, address, WatchSize.DWord, type, bigEndian, note) : base(domain, address, WatchSize.DWord, type, bigEndian, note)
{ {
_value = value == 0 ? GetDWord() : value; _value = value == 0 ? GetDWord() : value;
@ -36,27 +36,27 @@ namespace BizHawk.Client.Common
} }
/// <summary> /// <summary>
/// Gets a list of <see cref="DisplayType"/> for a <see cref="DWordWatch"/> /// Gets a list of <see cref="WatchDisplayType"/> for a <see cref="DWordWatch"/>
/// </summary> /// </summary>
public static IEnumerable<DisplayType> ValidTypes public static IEnumerable<WatchDisplayType> ValidTypes
{ {
get get
{ {
yield return DisplayType.Unsigned; yield return WatchDisplayType.Unsigned;
yield return DisplayType.Signed; yield return WatchDisplayType.Signed;
yield return DisplayType.Hex; yield return WatchDisplayType.Hex;
yield return DisplayType.Binary; yield return WatchDisplayType.Binary;
yield return DisplayType.FixedPoint_20_12; yield return WatchDisplayType.FixedPoint_20_12;
yield return DisplayType.FixedPoint_16_16; yield return WatchDisplayType.FixedPoint_16_16;
yield return DisplayType.Float; yield return WatchDisplayType.Float;
} }
} }
/// <summary> /// <summary>
/// Get a list of <see cref="DisplayType"/> that can be used for a <see cref="DWordWatch"/> /// Get a list of <see cref="WatchDisplayType"/> that can be used for a <see cref="DWordWatch"/>
/// </summary> /// </summary>
/// <returns>An enumeration that contains all valid <see cref="DisplayType"/></returns> /// <returns>An enumeration that contains all valid <see cref="WatchDisplayType"/></returns>
public override IEnumerable<DisplayType> AvailableTypes() public override IEnumerable<WatchDisplayType> AvailableTypes()
{ {
return ValidTypes; return ValidTypes;
} }
@ -82,7 +82,7 @@ namespace BizHawk.Client.Common
uint val = 0; uint val = 0;
switch (Type) switch (Type)
{ {
case DisplayType.Unsigned: case WatchDisplayType.Unsigned:
if (value.IsUnsigned()) if (value.IsUnsigned())
{ {
val = (uint)int.Parse(value); val = (uint)int.Parse(value);
@ -93,7 +93,7 @@ namespace BizHawk.Client.Common
} }
break; break;
case DisplayType.Signed: case WatchDisplayType.Signed:
if (value.IsSigned()) if (value.IsSigned())
{ {
val = (uint)int.Parse(value); val = (uint)int.Parse(value);
@ -104,7 +104,7 @@ namespace BizHawk.Client.Common
} }
break; break;
case DisplayType.Hex: case WatchDisplayType.Hex:
if (value.IsHex()) if (value.IsHex())
{ {
val = (uint)int.Parse(value, NumberStyles.HexNumber); val = (uint)int.Parse(value, NumberStyles.HexNumber);
@ -115,7 +115,7 @@ namespace BizHawk.Client.Common
} }
break; break;
case DisplayType.FixedPoint_20_12: case WatchDisplayType.FixedPoint_20_12:
if (value.IsFixedPoint()) if (value.IsFixedPoint())
{ {
val = (uint)(int)(double.Parse(value) * 4096.0); val = (uint)(int)(double.Parse(value) * 4096.0);
@ -126,7 +126,7 @@ namespace BizHawk.Client.Common
} }
break; break;
case DisplayType.FixedPoint_16_16: case WatchDisplayType.FixedPoint_16_16:
if (value.IsFixedPoint()) if (value.IsFixedPoint())
{ {
val = (uint)(int)(double.Parse(value) * 65536.0); val = (uint)(int)(double.Parse(value) * 65536.0);
@ -137,7 +137,7 @@ namespace BizHawk.Client.Common
} }
break; break;
case DisplayType.Float: case WatchDisplayType.Float:
if (value.IsFloat()) if (value.IsFloat())
{ {
var bytes = BitConverter.GetBytes(float.Parse(value)); var bytes = BitConverter.GetBytes(float.Parse(value));
@ -214,13 +214,13 @@ namespace BizHawk.Client.Common
return Type switch return Type switch
{ {
_ when !IsValid => "-", _ when !IsValid => "-",
DisplayType.Unsigned => val.ToString(), WatchDisplayType.Unsigned => val.ToString(),
DisplayType.Signed => ((int)val).ToString(), WatchDisplayType.Signed => ((int)val).ToString(),
DisplayType.Hex => $"{val:X8}", WatchDisplayType.Hex => $"{val:X8}",
DisplayType.FixedPoint_20_12 => $"{(int)val / 4096.0:0.######}", WatchDisplayType.FixedPoint_20_12 => $"{(int)val / 4096.0:0.######}",
DisplayType.FixedPoint_16_16 => $"{(int)val / 65536.0:0.######}", WatchDisplayType.FixedPoint_16_16 => $"{(int)val / 65536.0:0.######}",
DisplayType.Float => FormatFloat(), WatchDisplayType.Float => FormatFloat(),
DisplayType.Binary => FormatBinary(), WatchDisplayType.Binary => FormatBinary(),
_ => val.ToString() _ => val.ToString()
}; };
} }

View File

@ -12,7 +12,7 @@ namespace BizHawk.Client.Common
/// Initializes a new instance of the <see cref="SeparatorWatch"/> class. /// Initializes a new instance of the <see cref="SeparatorWatch"/> class.
/// </summary> /// </summary>
internal SeparatorWatch() internal SeparatorWatch()
: base(null, 0, WatchSize.Separator, DisplayType.Separator, true, "") : base(null, 0, WatchSize.Separator, WatchDisplayType.Separator, true, "")
{ {
} }
@ -30,12 +30,12 @@ namespace BizHawk.Client.Common
} }
/// <summary> /// <summary>
/// Get the appropriate DisplayType /// Get the appropriate WatchDisplayType
/// </summary> /// </summary>
/// <returns>DisplayType.Separator nothing else</returns> /// <returns>WatchDisplayType.Separator nothing else</returns>
public override IEnumerable<DisplayType> AvailableTypes() public override IEnumerable<WatchDisplayType> AvailableTypes()
{ {
yield return DisplayType.Separator; yield return WatchDisplayType.Separator;
} }
/// <summary> /// <summary>

View File

@ -21,7 +21,7 @@ namespace BizHawk.Client.Common
IComparable<Watch> IComparable<Watch>
{ {
private MemoryDomain _domain; private MemoryDomain _domain;
private DisplayType _type; private WatchDisplayType _type;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="Watch"/> class /// Initializes a new instance of the <see cref="Watch"/> class
@ -29,11 +29,11 @@ namespace BizHawk.Client.Common
/// <param name="domain"><see cref="MemoryDomain"/> where you want to track</param> /// <param name="domain"><see cref="MemoryDomain"/> where you want to track</param>
/// <param name="address">The address you want to track</param> /// <param name="address">The address you want to track</param>
/// <param name="size">A <see cref="WatchSize"/> (byte, word, double word)</param> /// <param name="size">A <see cref="WatchSize"/> (byte, word, double word)</param>
/// <param name="type">How you you want to display the value See <see cref="DisplayType"/></param> /// <param name="type">How you you want to display the value See <see cref="WatchDisplayType"/></param>
/// <param name="bigEndian">Specify the endianess. true for big endian</param> /// <param name="bigEndian">Specify the endianess. true for big endian</param>
/// <param name="note">A custom note about the <see cref="Watch"/></param> /// <param name="note">A custom note about the <see cref="Watch"/></param>
/// <exception cref="ArgumentException">Occurs when a <see cref="DisplayType"/> is incompatible with the <see cref="WatchSize"/></exception> /// <exception cref="ArgumentException">Occurs when a <see cref="WatchDisplayType"/> is incompatible with the <see cref="WatchSize"/></exception>
protected Watch(MemoryDomain domain, long address, WatchSize size, DisplayType type, bool bigEndian, string note) protected Watch(MemoryDomain domain, long address, WatchSize size, WatchDisplayType type, bool bigEndian, string note)
{ {
if (IsDisplayTypeAvailable(type)) if (IsDisplayTypeAvailable(type))
{ {
@ -46,7 +46,7 @@ namespace BizHawk.Client.Common
} }
else else
{ {
throw new ArgumentException($"{nameof(DisplayType)} {type} is invalid for this type of {nameof(Watch)}", nameof(type)); throw new ArgumentException($"{nameof(WatchDisplayType)} {type} is invalid for this type of {nameof(Watch)}", nameof(type));
} }
} }
@ -64,7 +64,7 @@ namespace BizHawk.Client.Common
/// <term>b,w or d</term> /// <term>b,w or d</term>
/// <description>The <see cref="WatchSize"/>, byte, word or double word</description> /// <description>The <see cref="WatchSize"/>, byte, word or double word</description>
/// <term>s, u, h, b, 1, 2, 3, f</term> /// <term>s, u, h, b, 1, 2, 3, f</term>
/// <description>The <see cref="DisplayType"/> signed, unsigned,etc...</description> /// <description>The <see cref="WatchDisplayType"/> signed, unsigned,etc...</description>
/// </item> /// </item>
/// <item> /// <item>
/// <term>0 or 1</term> /// <term>0 or 1</term>
@ -99,7 +99,7 @@ namespace BizHawk.Client.Common
if (long.TryParse(parts[0], NumberStyles.HexNumber, CultureInfo.CurrentCulture, out var address)) if (long.TryParse(parts[0], NumberStyles.HexNumber, CultureInfo.CurrentCulture, out var address))
{ {
WatchSize size = SizeFromChar(parts[1][0]); WatchSize size = SizeFromChar(parts[1][0]);
DisplayType type = DisplayTypeFromChar(parts[2][0]); WatchDisplayType type = DisplayTypeFromChar(parts[2][0]);
bool bigEndian = parts[3] != "0"; bool bigEndian = parts[3] != "0";
MemoryDomain domain = domains[parts[4]]; MemoryDomain domain = domains[parts[4]];
string notes = parts[5].Trim('\r', '\n'); string notes = parts[5].Trim('\r', '\n');
@ -130,7 +130,7 @@ namespace BizHawk.Client.Common
/// <param name="prev">Previous value</param> /// <param name="prev">Previous value</param>
/// <param name="changeCount">Number of changes occurs in current <see cref="Watch"/></param> /// <param name="changeCount">Number of changes occurs in current <see cref="Watch"/></param>
/// <returns>New <see cref="Watch"/> instance. True type is depending of size parameter</returns> /// <returns>New <see cref="Watch"/> instance. True type is depending of size parameter</returns>
public static Watch GenerateWatch(MemoryDomain domain, long address, WatchSize size, DisplayType type, bool bigEndian, string note = "", long value = 0, long prev = 0, int changeCount = 0) public static Watch GenerateWatch(MemoryDomain domain, long address, WatchSize size, WatchDisplayType type, bool bigEndian, string note = "", long value = 0, long prev = 0, int changeCount = 0)
{ {
return size switch return size switch
{ {
@ -250,10 +250,10 @@ namespace BizHawk.Client.Common
} }
/// <summary> /// <summary>
/// Gets a list a <see cref="DisplayType"/> that can be used for this <see cref="Watch"/> /// Gets a list a <see cref="WatchDisplayType"/> that can be used for this <see cref="Watch"/>
/// </summary> /// </summary>
/// <returns>An enumeration that contains all valid <see cref="DisplayType"/></returns> /// <returns>An enumeration that contains all valid <see cref="WatchDisplayType"/></returns>
public abstract IEnumerable<DisplayType> AvailableTypes(); public abstract IEnumerable<WatchDisplayType> AvailableTypes();
/// <summary> /// <summary>
/// Resets the previous value; set it to the current one /// Resets the previous value; set it to the current one
@ -405,11 +405,11 @@ namespace BizHawk.Client.Common
} }
/// <summary> /// <summary>
/// Determines if the specified <see cref="DisplayType"/> can be /// Determines if the specified <see cref="WatchDisplayType"/> can be
/// used for the current <see cref="Watch"/> /// used for the current <see cref="Watch"/>
/// </summary> /// </summary>
/// <param name="type"><see cref="DisplayType"/> you want to check</param> /// <param name="type"><see cref="WatchDisplayType"/> you want to check</param>
public bool IsDisplayTypeAvailable(DisplayType type) public bool IsDisplayTypeAvailable(WatchDisplayType type)
{ {
return AvailableTypes().Any(d => d == type); return AvailableTypes().Any(d => d == type);
} }
@ -502,8 +502,8 @@ namespace BizHawk.Client.Common
/// <summary> /// <summary>
/// Gets or sets the way current <see cref="Watch"/> is displayed /// Gets or sets the way current <see cref="Watch"/> is displayed
/// </summary> /// </summary>
/// <exception cref="ArgumentException">Occurs when a <see cref="DisplayType"/> is incompatible with the <see cref="WatchSize"/></exception> /// <exception cref="ArgumentException">Occurs when a <see cref="WatchDisplayType"/> is incompatible with the <see cref="WatchSize"/></exception>
public DisplayType Type public WatchDisplayType Type
{ {
get => _type; get => _type;
set set
@ -514,7 +514,7 @@ namespace BizHawk.Client.Common
} }
else else
{ {
throw new ArgumentException($"DisplayType {value} is invalid for this type of Watch"); throw new ArgumentException($"WatchDisplayType {value} is invalid for this type of Watch");
} }
} }
} }
@ -553,25 +553,25 @@ namespace BizHawk.Client.Common
public WatchSize Size { get; } public WatchSize Size { get; }
// TODO: Replace all the following stuff by implementing ISerializable // TODO: Replace all the following stuff by implementing ISerializable
public static string DisplayTypeToString(DisplayType type) public static string DisplayTypeToString(WatchDisplayType type)
{ {
return type switch return type switch
{ {
DisplayType.FixedPoint_12_4 => "Fixed Point 12.4", WatchDisplayType.FixedPoint_12_4 => "Fixed Point 12.4",
DisplayType.FixedPoint_20_12 => "Fixed Point 20.12", WatchDisplayType.FixedPoint_20_12 => "Fixed Point 20.12",
DisplayType.FixedPoint_16_16 => "Fixed Point 16.16", WatchDisplayType.FixedPoint_16_16 => "Fixed Point 16.16",
_ => type.ToString() _ => type.ToString()
}; };
} }
public static DisplayType StringToDisplayType(string name) public static WatchDisplayType StringToDisplayType(string name)
{ {
return name switch return name switch
{ {
"Fixed Point 12.4" => DisplayType.FixedPoint_12_4, "Fixed Point 12.4" => WatchDisplayType.FixedPoint_12_4,
"Fixed Point 20.12" => DisplayType.FixedPoint_20_12, "Fixed Point 20.12" => WatchDisplayType.FixedPoint_20_12,
"Fixed Point 16.16" => DisplayType.FixedPoint_16_16, "Fixed Point 16.16" => WatchDisplayType.FixedPoint_16_16,
_ => (DisplayType) Enum.Parse(typeof(DisplayType), name) _ => (WatchDisplayType) Enum.Parse(typeof(WatchDisplayType), name)
}; };
} }
@ -608,34 +608,34 @@ namespace BizHawk.Client.Common
{ {
return Type switch return Type switch
{ {
DisplayType.Separator => '_', WatchDisplayType.Separator => '_',
DisplayType.Unsigned => 'u', WatchDisplayType.Unsigned => 'u',
DisplayType.Signed => 's', WatchDisplayType.Signed => 's',
DisplayType.Hex => 'h', WatchDisplayType.Hex => 'h',
DisplayType.Binary => 'b', WatchDisplayType.Binary => 'b',
DisplayType.FixedPoint_12_4 => '1', WatchDisplayType.FixedPoint_12_4 => '1',
DisplayType.FixedPoint_20_12 => '2', WatchDisplayType.FixedPoint_20_12 => '2',
DisplayType.FixedPoint_16_16 => '3', WatchDisplayType.FixedPoint_16_16 => '3',
DisplayType.Float => 'f', WatchDisplayType.Float => 'f',
_ => '_' _ => '_'
}; };
} }
} }
public static DisplayType DisplayTypeFromChar(char c) public static WatchDisplayType DisplayTypeFromChar(char c)
{ {
return c switch return c switch
{ {
'_' => DisplayType.Separator, '_' => WatchDisplayType.Separator,
'u' => DisplayType.Unsigned, 'u' => WatchDisplayType.Unsigned,
's' => DisplayType.Signed, 's' => WatchDisplayType.Signed,
'h' => DisplayType.Hex, 'h' => WatchDisplayType.Hex,
'b' => DisplayType.Binary, 'b' => WatchDisplayType.Binary,
'1' => DisplayType.FixedPoint_12_4, '1' => WatchDisplayType.FixedPoint_12_4,
'2' => DisplayType.FixedPoint_20_12, '2' => WatchDisplayType.FixedPoint_20_12,
'3' => DisplayType.FixedPoint_16_16, '3' => WatchDisplayType.FixedPoint_16_16,
'f' => DisplayType.Float, 'f' => WatchDisplayType.Float,
_ => DisplayType.Separator _ => WatchDisplayType.Separator
}; };
} }
} }

View File

@ -3,7 +3,7 @@
/// <summary> /// <summary>
/// This enum is used to specify how you want your <see cref="Watch"/> to be displayed /// This enum is used to specify how you want your <see cref="Watch"/> to be displayed
/// </summary> /// </summary>
public enum DisplayType public enum WatchDisplayType
{ {
/// <summary> /// <summary>
/// Separator, only used by <see cref="SeparatorWatch"/> /// Separator, only used by <see cref="SeparatorWatch"/>

View File

@ -29,7 +29,7 @@ namespace BizHawk.Client.Common
int xValue; int xValue;
int yValue; int yValue;
if (x.Type == DisplayType.Signed) if (x.Type == WatchDisplayType.Signed)
{ {
int.TryParse(x.ValueString, out xValue); int.TryParse(x.ValueString, out xValue);
} }
@ -38,7 +38,7 @@ namespace BizHawk.Client.Common
xValue = x.Value; xValue = x.Value;
} }
if (y.Type == DisplayType.Signed) if (y.Type == WatchDisplayType.Signed)
{ {
int.TryParse(y.ValueString, out yValue); int.TryParse(y.ValueString, out yValue);
} }

View File

@ -20,14 +20,14 @@ namespace BizHawk.Client.Common
/// </summary> /// </summary>
/// <param name="domain"><see cref="MemoryDomain"/> where you want to track</param> /// <param name="domain"><see cref="MemoryDomain"/> where you want to track</param>
/// <param name="address">The address you want to track</param> /// <param name="address">The address you want to track</param>
/// <param name="type">How you you want to display the value See <see cref="DisplayType"/></param> /// <param name="type">How you you want to display the value See <see cref="WatchDisplayType"/></param>
/// <param name="bigEndian">Specify the endianess. true for big endian</param> /// <param name="bigEndian">Specify the endianess. true for big endian</param>
/// <param name="note">A custom note about the <see cref="Watch"/></param> /// <param name="note">A custom note about the <see cref="Watch"/></param>
/// <param name="value">Current value</param> /// <param name="value">Current value</param>
/// <param name="previous">Previous value</param> /// <param name="previous">Previous value</param>
/// <param name="changeCount">How many times value has changed</param> /// <param name="changeCount">How many times value has changed</param>
/// <exception cref="ArgumentException">Occurs when a <see cref="DisplayType"/> is incompatible with <see cref="WatchSize.Word"/></exception> /// <exception cref="ArgumentException">Occurs when a <see cref="WatchDisplayType"/> is incompatible with <see cref="WatchSize.Word"/></exception>
internal WordWatch(MemoryDomain domain, long address, DisplayType type, bool bigEndian, string note, ushort value, ushort previous, int changeCount) internal WordWatch(MemoryDomain domain, long address, WatchDisplayType type, bool bigEndian, string note, ushort value, ushort previous, int changeCount)
: base(domain, address, WatchSize.Word, type, bigEndian, note) : base(domain, address, WatchSize.Word, type, bigEndian, note)
{ {
_value = value == 0 ? GetWord() : value; _value = value == 0 ? GetWord() : value;
@ -36,25 +36,25 @@ namespace BizHawk.Client.Common
} }
/// <summary> /// <summary>
/// Gets an Enumeration of <see cref="DisplayType"/>s that are valid for a <see cref="WordWatch"/> /// Gets an Enumeration of <see cref="WatchDisplayType"/>s that are valid for a <see cref="WordWatch"/>
/// </summary> /// </summary>
public static IEnumerable<DisplayType> ValidTypes public static IEnumerable<WatchDisplayType> ValidTypes
{ {
get get
{ {
yield return DisplayType.Unsigned; yield return WatchDisplayType.Unsigned;
yield return DisplayType.Signed; yield return WatchDisplayType.Signed;
yield return DisplayType.Hex; yield return WatchDisplayType.Hex;
yield return DisplayType.Binary; yield return WatchDisplayType.Binary;
yield return DisplayType.FixedPoint_12_4; yield return WatchDisplayType.FixedPoint_12_4;
} }
} }
/// <summary> /// <summary>
/// Get a list a <see cref="DisplayType"/> that can be used for this <see cref="WordWatch"/> /// Get a list a <see cref="WatchDisplayType"/> that can be used for this <see cref="WordWatch"/>
/// </summary> /// </summary>
/// <returns>An enumeration that contains all valid <see cref="DisplayType"/></returns> /// <returns>An enumeration that contains all valid <see cref="WatchDisplayType"/></returns>
public override IEnumerable<DisplayType> AvailableTypes() => ValidTypes; public override IEnumerable<WatchDisplayType> AvailableTypes() => ValidTypes;
/// <summary> /// <summary>
/// Reset the previous value; set it to the current one /// Reset the previous value; set it to the current one
@ -77,7 +77,7 @@ namespace BizHawk.Client.Common
ushort val = 0; ushort val = 0;
switch (Type) switch (Type)
{ {
case DisplayType.Unsigned: case WatchDisplayType.Unsigned:
if (value.IsUnsigned()) if (value.IsUnsigned())
{ {
val = (ushort)int.Parse(value); val = (ushort)int.Parse(value);
@ -88,7 +88,7 @@ namespace BizHawk.Client.Common
} }
break; break;
case DisplayType.Signed: case WatchDisplayType.Signed:
if (value.IsSigned()) if (value.IsSigned())
{ {
val = (ushort)(short)int.Parse(value); val = (ushort)(short)int.Parse(value);
@ -99,7 +99,7 @@ namespace BizHawk.Client.Common
} }
break; break;
case DisplayType.Hex: case WatchDisplayType.Hex:
if (value.IsHex()) if (value.IsHex())
{ {
val = (ushort)int.Parse(value, NumberStyles.HexNumber); val = (ushort)int.Parse(value, NumberStyles.HexNumber);
@ -110,7 +110,7 @@ namespace BizHawk.Client.Common
} }
break; break;
case DisplayType.Binary: case WatchDisplayType.Binary:
if (value.IsBinary()) if (value.IsBinary())
{ {
val = (ushort)Convert.ToInt32(value, 2); val = (ushort)Convert.ToInt32(value, 2);
@ -121,7 +121,7 @@ namespace BizHawk.Client.Common
} }
break; break;
case DisplayType.FixedPoint_12_4: case WatchDisplayType.FixedPoint_12_4:
if (value.IsFixedPoint()) if (value.IsFixedPoint())
{ {
val = (ushort)(double.Parse(value) * 16.0); val = (ushort)(double.Parse(value) * 16.0);
@ -181,10 +181,10 @@ namespace BizHawk.Client.Common
return Type switch return Type switch
{ {
_ when !IsValid => "-", _ when !IsValid => "-",
DisplayType.Unsigned => val.ToString(), WatchDisplayType.Unsigned => val.ToString(),
DisplayType.Signed => ((short) val).ToString(), DisplayType.Hex => $"{val:X4}", WatchDisplayType.Signed => ((short) val).ToString(), WatchDisplayType.Hex => $"{val:X4}",
DisplayType.FixedPoint_12_4 => $"{val / 16.0:F4}", WatchDisplayType.FixedPoint_12_4 => $"{val / 16.0:F4}",
DisplayType.Binary => Convert WatchDisplayType.Binary => Convert
.ToString(val, 2) .ToString(val, 2)
.PadLeft(16, '0') .PadLeft(16, '0')
.Insert(8, " ") .Insert(8, " ")

View File

@ -308,7 +308,7 @@
this.StopOnFrameTextBox.Nullable = true; this.StopOnFrameTextBox.Nullable = true;
this.StopOnFrameTextBox.Size = new System.Drawing.Size(54, 20); this.StopOnFrameTextBox.Size = new System.Drawing.Size(54, 20);
this.StopOnFrameTextBox.TabIndex = 58; this.StopOnFrameTextBox.TabIndex = 58;
this.StopOnFrameTextBox.Type = BizHawk.Client.Common.DisplayType.Unsigned; this.StopOnFrameTextBox.Type = BizHawk.Client.Common.WatchDisplayType.Unsigned;
this.StopOnFrameTextBox.TextChanged += new System.EventHandler(this.StopOnFrameTextBox_TextChanged_1); this.StopOnFrameTextBox.TextChanged += new System.EventHandler(this.StopOnFrameTextBox_TextChanged_1);
// //
// MovieCount // MovieCount

View File

@ -211,7 +211,7 @@
this.CompareBox.Nullable = true; this.CompareBox.Nullable = true;
this.CompareBox.Size = new System.Drawing.Size(65, 31); this.CompareBox.Size = new System.Drawing.Size(65, 31);
this.CompareBox.TabIndex = 15; this.CompareBox.TabIndex = 15;
this.CompareBox.Type = BizHawk.Client.Common.DisplayType.Hex; this.CompareBox.Type = BizHawk.Client.Common.WatchDisplayType.Hex;
this.CompareBox.TextChanged += new System.EventHandler(this.CompareBox_TextChanged); this.CompareBox.TextChanged += new System.EventHandler(this.CompareBox_TextChanged);
// //
// ValueBox // ValueBox
@ -225,7 +225,7 @@
this.ValueBox.Size = new System.Drawing.Size(65, 31); this.ValueBox.Size = new System.Drawing.Size(65, 31);
this.ValueBox.TabIndex = 12; this.ValueBox.TabIndex = 12;
this.ValueBox.Text = "00"; this.ValueBox.Text = "00";
this.ValueBox.Type = BizHawk.Client.Common.DisplayType.Hex; this.ValueBox.Type = BizHawk.Client.Common.WatchDisplayType.Hex;
// //
// CompareTypeDropDown // CompareTypeDropDown
// //

View File

@ -73,7 +73,7 @@ namespace BizHawk.Client.EmuHawk
ValueHexIndLabel.Text = ValueHexIndLabel.Text =
CompareHexIndLabel.Text = CompareHexIndLabel.Text =
_cheat.Type == DisplayType.Hex ? HexInd : ""; _cheat.Type == WatchDisplayType.Hex ? HexInd : "";
BigEndianCheckBox.Checked = _cheat.BigEndian ?? false; BigEndianCheckBox.Checked = _cheat.BigEndian ?? false;
@ -119,7 +119,7 @@ namespace BizHawk.Client.EmuHawk
ValueBox.Type = ValueBox.Type =
CompareBox.Type = CompareBox.Type =
DisplayType.Hex; WatchDisplayType.Hex;
ValueBox.ResetText(); ValueBox.ResetText();
CompareBox.ResetText(); CompareBox.ResetText();
@ -130,7 +130,7 @@ namespace BizHawk.Client.EmuHawk
BigEndianCheckBox.Checked = false; BigEndianCheckBox.Checked = false;
SetTypeSelected(DisplayType.Hex); SetTypeSelected(WatchDisplayType.Hex);
CheckFormState(); CheckFormState();
CompareBox.Text = ""; // TODO: A needed hack until WatchValueBox.ToRawInt() becomes nullable CompareBox.Text = ""; // TODO: A needed hack until WatchValueBox.ToRawInt() becomes nullable
@ -154,7 +154,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
private void SetTypeSelected(DisplayType type) private void SetTypeSelected(WatchDisplayType type)
{ {
foreach (var item in DisplayTypeDropDown.Items) foreach (var item in DisplayTypeDropDown.Items)
{ {
@ -185,21 +185,21 @@ namespace BizHawk.Client.EmuHawk
{ {
default: default:
case 0: case 0:
foreach (DisplayType t in ByteWatch.ValidTypes) foreach (WatchDisplayType t in ByteWatch.ValidTypes)
{ {
DisplayTypeDropDown.Items.Add(Watch.DisplayTypeToString(t)); DisplayTypeDropDown.Items.Add(Watch.DisplayTypeToString(t));
} }
break; break;
case 1: case 1:
foreach (DisplayType t in WordWatch.ValidTypes) foreach (WatchDisplayType t in WordWatch.ValidTypes)
{ {
DisplayTypeDropDown.Items.Add(Watch.DisplayTypeToString(t)); DisplayTypeDropDown.Items.Add(Watch.DisplayTypeToString(t));
} }
break; break;
case 2: case 2:
foreach (DisplayType t in DWordWatch.ValidTypes) foreach (WatchDisplayType t in DWordWatch.ValidTypes)
{ {
DisplayTypeDropDown.Items.Add(Watch.DisplayTypeToString(t)); DisplayTypeDropDown.Items.Add(Watch.DisplayTypeToString(t));
} }

View File

@ -788,11 +788,11 @@ namespace BizHawk.Client.EmuHawk
{ {
default: default:
case 1: case 1:
return Watch.GenerateWatch(_domain, address, WatchSize.Byte, Common.DisplayType.Hex, BigEndian); return Watch.GenerateWatch(_domain, address, WatchSize.Byte, Common.WatchDisplayType.Hex, BigEndian);
case 2: case 2:
return Watch.GenerateWatch(_domain, address, WatchSize.Word, Common.DisplayType.Hex, BigEndian); return Watch.GenerateWatch(_domain, address, WatchSize.Word, Common.WatchDisplayType.Hex, BigEndian);
case 4: case 4:
return Watch.GenerateWatch(_domain, address, WatchSize.DWord, Common.DisplayType.Hex, BigEndian); return Watch.GenerateWatch(_domain, address, WatchSize.DWord, Common.WatchDisplayType.Hex, BigEndian);
} }
} }
@ -814,7 +814,7 @@ namespace BizHawk.Client.EmuHawk
_domain, _domain,
_highlightedAddress.Value, _highlightedAddress.Value,
WatchSize, WatchSize,
Common.DisplayType.Hex, Common.WatchDisplayType.Hex,
BigEndian); BigEndian);
MainForm.CheatList.Add(new Cheat( MainForm.CheatList.Add(new Cheat(
@ -831,7 +831,7 @@ namespace BizHawk.Client.EmuHawk
_domain, _domain,
address, address,
WatchSize, WatchSize,
Common.DisplayType.Hex, Common.WatchDisplayType.Hex,
BigEndian); BigEndian);
cheats.Add(new Cheat( cheats.Add(new Cheat(
@ -1670,7 +1670,7 @@ namespace BizHawk.Client.EmuHawk
_domain, _domain,
address, address,
(WatchSize)DataSize, (WatchSize)DataSize,
Common.DisplayType.Hex, Common.WatchDisplayType.Hex,
BigEndian)); BigEndian));
using var poke = new RamPoke(watches, MainForm.CheatList) using var poke = new RamPoke(watches, MainForm.CheatList)

View File

@ -74,7 +74,7 @@
this.NumFramesBox.Size = new System.Drawing.Size(51, 20); this.NumFramesBox.Size = new System.Drawing.Size(51, 20);
this.NumFramesBox.TabIndex = 3; this.NumFramesBox.TabIndex = 3;
this.NumFramesBox.Text = "1"; this.NumFramesBox.Text = "1";
this.NumFramesBox.Type = BizHawk.Client.Common.DisplayType.Unsigned; this.NumFramesBox.Type = BizHawk.Client.Common.WatchDisplayType.Unsigned;
// //
// FramesPrompt // FramesPrompt
// //

View File

@ -98,7 +98,7 @@ namespace BizHawk.Client.EmuHawk
this.ValueBox.Size = new System.Drawing.Size(116, 20); this.ValueBox.Size = new System.Drawing.Size(116, 20);
this.ValueBox.TabIndex = 10; this.ValueBox.TabIndex = 10;
this.ValueBox.Text = "00"; this.ValueBox.Text = "00";
this.ValueBox.Type = BizHawk.Client.Common.DisplayType.Hex; this.ValueBox.Type = BizHawk.Client.Common.WatchDisplayType.Hex;
// //
// ValueHexLabel // ValueHexLabel
// //

View File

@ -67,7 +67,7 @@ namespace BizHawk.Client.EmuHawk
ValueBox.ByteSize = _watchList[0].Size; ValueBox.ByteSize = _watchList[0].Size;
ValueBox.Type = _watchList[0].Type; ValueBox.Type = _watchList[0].Type;
ValueHexLabel.Text = _watchList[0].Type == DisplayType.Hex ? "0x" : ""; ValueHexLabel.Text = _watchList[0].Type == WatchDisplayType.Hex ? "0x" : "";
ValueBox.Text = _watchList[0].ValueString.Replace(" ", ""); ValueBox.Text = _watchList[0].ValueString.Replace(" ", "");
DomainLabel.Text = _watchList[0].Domain.Name; DomainLabel.Text = _watchList[0].Domain.Name;
SizeLabel.Text = _watchList[0].Size.ToString(); SizeLabel.Text = _watchList[0].Size.ToString();

View File

@ -603,7 +603,7 @@ namespace BizHawk.Client.EmuHawk
this.DifferenceBox.Nullable = false; this.DifferenceBox.Nullable = false;
this.DifferenceBox.Size = new System.Drawing.Size(72, 20); this.DifferenceBox.Size = new System.Drawing.Size(72, 20);
this.DifferenceBox.TabIndex = 45; this.DifferenceBox.TabIndex = 45;
this.DifferenceBox.Type = BizHawk.Client.Common.DisplayType.Hex; this.DifferenceBox.Type = BizHawk.Client.Common.WatchDisplayType.Hex;
this.DifferenceBox.TextChanged += new System.EventHandler(this.CompareToValue_TextChanged); this.DifferenceBox.TextChanged += new System.EventHandler(this.CompareToValue_TextChanged);
// //
// DifferenceRadio // DifferenceRadio
@ -659,7 +659,7 @@ namespace BizHawk.Client.EmuHawk
this.SpecificValueBox.Size = new System.Drawing.Size(72, 20); this.SpecificValueBox.Size = new System.Drawing.Size(72, 20);
this.SpecificValueBox.TabIndex = 15; this.SpecificValueBox.TabIndex = 15;
this.SpecificValueBox.Text = "00"; this.SpecificValueBox.Text = "00";
this.SpecificValueBox.Type = BizHawk.Client.Common.DisplayType.Hex; this.SpecificValueBox.Type = BizHawk.Client.Common.WatchDisplayType.Hex;
this.SpecificValueBox.TextChanged += new System.EventHandler(this.CompareToValue_TextChanged); this.SpecificValueBox.TextChanged += new System.EventHandler(this.CompareToValue_TextChanged);
// //
// NumberOfChangesRadio // NumberOfChangesRadio
@ -878,7 +878,7 @@ namespace BizHawk.Client.EmuHawk
this.DifferentByBox.Nullable = false; this.DifferentByBox.Nullable = false;
this.DifferentByBox.Size = new System.Drawing.Size(55, 20); this.DifferentByBox.Size = new System.Drawing.Size(55, 20);
this.DifferentByBox.TabIndex = 85; this.DifferentByBox.TabIndex = 85;
this.DifferentByBox.Type = BizHawk.Client.Common.DisplayType.Hex; this.DifferentByBox.Type = BizHawk.Client.Common.WatchDisplayType.Hex;
this.DifferentByBox.TextChanged += new System.EventHandler(this.DifferentByBox_TextChanged); this.DifferentByBox.TextChanged += new System.EventHandler(this.DifferentByBox_TextChanged);
// //
// DifferentByRadio // DifferentByRadio

View File

@ -107,7 +107,7 @@ namespace BizHawk.Client.EmuHawk
[ConfigPersist] [ConfigPersist]
public RamSearchSettings Settings { get; set; } public RamSearchSettings Settings { get; set; }
private void HardSetDisplayTypeDropDown(Common.DisplayType type) private void HardSetDisplayTypeDropDown(Common.WatchDisplayType type)
{ {
foreach (var item in DisplayTypeDropdown.Items) foreach (var item in DisplayTypeDropdown.Items)
{ {
@ -152,8 +152,8 @@ namespace BizHawk.Client.EmuHawk
LoadConfigSettings(); LoadConfigSettings();
SpecificValueBox.ByteSize = _settings.Size; SpecificValueBox.ByteSize = _settings.Size;
SpecificValueBox.Type = _settings.Type; SpecificValueBox.Type = _settings.Type;
DifferentByBox.Type = Common.DisplayType.Unsigned; DifferentByBox.Type = Common.WatchDisplayType.Unsigned;
DifferenceBox.Type = Common.DisplayType.Unsigned; DifferenceBox.Type = Common.WatchDisplayType.Unsigned;
MessageLabel.Text = ""; MessageLabel.Text = "";
SpecificAddressBox.MaxLength = (MemoryDomains.MainMemory.Size - 1).NumHexDigits(); SpecificAddressBox.MaxLength = (MemoryDomains.MainMemory.Size - 1).NumHexDigits();
@ -594,7 +594,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
private void DoDisplayTypeClick(Common.DisplayType type) private void DoDisplayTypeClick(Common.WatchDisplayType type)
{ {
if (_settings.Type != type) if (_settings.Type != type)
{ {
@ -666,7 +666,7 @@ namespace BizHawk.Client.EmuHawk
if (!isTypeCompatible) if (!isTypeCompatible)
{ {
_settings.Type = Common.DisplayType.Unsigned; _settings.Type = Common.WatchDisplayType.Unsigned;
} }
_dropdownDontfire = true; _dropdownDontfire = true;
@ -689,7 +689,7 @@ namespace BizHawk.Client.EmuHawk
WatchSize.Byte => ByteWatch.ValidTypes, WatchSize.Byte => ByteWatch.ValidTypes,
WatchSize.Word => WordWatch.ValidTypes, WatchSize.Word => WordWatch.ValidTypes,
WatchSize.DWord => DWordWatch.ValidTypes, WatchSize.DWord => DWordWatch.ValidTypes,
_ => new List<Common.DisplayType>() _ => new List<Common.WatchDisplayType>()
}; };
foreach (var type in types) foreach (var type in types)
@ -1066,7 +1066,7 @@ namespace BizHawk.Client.EmuHawk
WatchSize.Byte => ByteWatch.ValidTypes, WatchSize.Byte => ByteWatch.ValidTypes,
WatchSize.Word => WordWatch.ValidTypes, WatchSize.Word => WordWatch.ValidTypes,
WatchSize.DWord => DWordWatch.ValidTypes, WatchSize.DWord => DWordWatch.ValidTypes,
_ => new List<Common.DisplayType>() _ => new List<Common.WatchDisplayType>()
}; };
foreach (var type in types) foreach (var type in types)

View File

@ -446,28 +446,28 @@ namespace BizHawk.Client.EmuHawk
string s = w.Size == WatchSize.Byte ? "1" : (w.Size == WatchSize.Word ? "2" : "4"); string s = w.Size == WatchSize.Byte ? "1" : (w.Size == WatchSize.Word ? "2" : "4");
switch (w.Type) switch (w.Type)
{ {
case Common.DisplayType.Binary: case Common.WatchDisplayType.Binary:
s += "b"; s += "b";
break; break;
case Common.DisplayType.FixedPoint_12_4: case Common.WatchDisplayType.FixedPoint_12_4:
s += "F"; s += "F";
break; break;
case Common.DisplayType.FixedPoint_16_16: case Common.WatchDisplayType.FixedPoint_16_16:
s += "F6"; s += "F6";
break; break;
case Common.DisplayType.FixedPoint_20_12: case Common.WatchDisplayType.FixedPoint_20_12:
s += "F2"; s += "F2";
break; break;
case Common.DisplayType.Float: case Common.WatchDisplayType.Float:
s += "f"; s += "f";
break; break;
case Common.DisplayType.Hex: case Common.WatchDisplayType.Hex:
s += "h"; s += "h";
break; break;
case Common.DisplayType.Signed: case Common.WatchDisplayType.Signed:
s += "s"; s += "s";
break; break;
case Common.DisplayType.Unsigned: case Common.WatchDisplayType.Unsigned:
s += "u"; s += "u";
break; break;
} }

View File

@ -143,19 +143,19 @@ namespace BizHawk.Client.EmuHawk
{ {
default: default:
case 0: case 0:
foreach (DisplayType t in ByteWatch.ValidTypes) foreach (WatchDisplayType t in ByteWatch.ValidTypes)
{ {
DisplayTypeDropDown.Items.Add(Watch.DisplayTypeToString(t)); DisplayTypeDropDown.Items.Add(Watch.DisplayTypeToString(t));
} }
break; break;
case 1: case 1:
foreach (DisplayType t in WordWatch.ValidTypes) foreach (WatchDisplayType t in WordWatch.ValidTypes)
{ {
DisplayTypeDropDown.Items.Add(Watch.DisplayTypeToString(t)); DisplayTypeDropDown.Items.Add(Watch.DisplayTypeToString(t));
} }
break; break;
case 2: case 2:
foreach (DisplayType t in DWordWatch.ValidTypes) foreach (WatchDisplayType t in DWordWatch.ValidTypes)
{ {
DisplayTypeDropDown.Items.Add(Watch.DisplayTypeToString(t)); DisplayTypeDropDown.Items.Add(Watch.DisplayTypeToString(t));
} }

View File

@ -12,7 +12,7 @@ namespace BizHawk.Client.EmuHawk
public class WatchValueBox : TextBox, INumberBox public class WatchValueBox : TextBox, INumberBox
{ {
private WatchSize _size = WatchSize.Byte; private WatchSize _size = WatchSize.Byte;
private DisplayType _type = DisplayType.Hex; private WatchDisplayType _type = WatchDisplayType.Hex;
public WatchValueBox() public WatchValueBox()
{ {
@ -43,7 +43,7 @@ namespace BizHawk.Client.EmuHawk
if (!isTypeCompatible) if (!isTypeCompatible)
{ {
_type = DisplayType.Unsigned; _type = WatchDisplayType.Unsigned;
} }
ResetText(); ResetText();
@ -51,7 +51,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
public DisplayType Type public WatchDisplayType Type
{ {
get => _type; get => _type;
set set
@ -110,20 +110,20 @@ namespace BizHawk.Client.EmuHawk
switch (Type) switch (Type)
{ {
default: default:
case DisplayType.Signed: case WatchDisplayType.Signed:
case DisplayType.Unsigned: case WatchDisplayType.Unsigned:
Text = "0"; Text = "0";
break; break;
case DisplayType.Hex: case WatchDisplayType.Hex:
Text = 0.ToHexString(MaxLength); Text = 0.ToHexString(MaxLength);
break; break;
case DisplayType.FixedPoint_12_4: case WatchDisplayType.FixedPoint_12_4:
case DisplayType.FixedPoint_20_12: case WatchDisplayType.FixedPoint_20_12:
case DisplayType.FixedPoint_16_16: case WatchDisplayType.FixedPoint_16_16:
case DisplayType.Float: case WatchDisplayType.Float:
Text = "0.0"; Text = "0.0";
break; break;
case DisplayType.Binary: case WatchDisplayType.Binary:
Text = "0".PadLeft(((int)_size) * 8); Text = "0".PadLeft(((int)_size) * 8);
break; break;
} }
@ -137,7 +137,7 @@ namespace BizHawk.Client.EmuHawk
default: default:
MaxLength = 8; MaxLength = 8;
break; break;
case DisplayType.Binary: case WatchDisplayType.Binary:
MaxLength = _size switch MaxLength = _size switch
{ {
WatchSize.Byte => 8, WatchSize.Byte => 8,
@ -145,7 +145,7 @@ namespace BizHawk.Client.EmuHawk
_ => 8 _ => 8
}; };
break; break;
case DisplayType.Hex: case WatchDisplayType.Hex:
MaxLength = _size switch MaxLength = _size switch
{ {
WatchSize.Byte => 2, WatchSize.Byte => 2,
@ -154,7 +154,7 @@ namespace BizHawk.Client.EmuHawk
_ => 2 _ => 2
}; };
break; break;
case DisplayType.Signed: case WatchDisplayType.Signed:
MaxLength = _size switch MaxLength = _size switch
{ {
WatchSize.Byte => 4, WatchSize.Byte => 4,
@ -163,7 +163,7 @@ namespace BizHawk.Client.EmuHawk
_ => 4 _ => 4
}; };
break; break;
case DisplayType.Unsigned: case WatchDisplayType.Unsigned:
MaxLength = _size switch MaxLength = _size switch
{ {
WatchSize.Byte => 3, WatchSize.Byte => 3,
@ -172,14 +172,14 @@ namespace BizHawk.Client.EmuHawk
_ => 3 _ => 3
}; };
break; break;
case DisplayType.FixedPoint_12_4: case WatchDisplayType.FixedPoint_12_4:
MaxLength = 9; MaxLength = 9;
break; break;
case DisplayType.Float: case WatchDisplayType.Float:
MaxLength = 21; MaxLength = 21;
break; break;
case DisplayType.FixedPoint_20_12: case WatchDisplayType.FixedPoint_20_12:
case DisplayType.FixedPoint_16_16: case WatchDisplayType.FixedPoint_16_16:
MaxLength = 64; MaxLength = 64;
break; break;
} }
@ -212,44 +212,44 @@ namespace BizHawk.Client.EmuHawk
switch (_type) switch (_type)
{ {
default: default:
case DisplayType.Binary: case WatchDisplayType.Binary:
if (!e.KeyChar.IsBinary()) if (!e.KeyChar.IsBinary())
{ {
e.Handled = true; e.Handled = true;
} }
break; break;
case DisplayType.FixedPoint_12_4: case WatchDisplayType.FixedPoint_12_4:
case DisplayType.FixedPoint_20_12: case WatchDisplayType.FixedPoint_20_12:
case DisplayType.FixedPoint_16_16: case WatchDisplayType.FixedPoint_16_16:
if (!e.KeyChar.IsFixedPoint()) if (!e.KeyChar.IsFixedPoint())
{ {
e.Handled = true; e.Handled = true;
} }
break; break;
case DisplayType.Float: case WatchDisplayType.Float:
if (!e.KeyChar.IsFloat()) if (!e.KeyChar.IsFloat())
{ {
e.Handled = true; e.Handled = true;
} }
break; break;
case DisplayType.Hex: case WatchDisplayType.Hex:
if (!e.KeyChar.IsHex()) if (!e.KeyChar.IsHex())
{ {
e.Handled = true; e.Handled = true;
} }
break; break;
case DisplayType.Signed: case WatchDisplayType.Signed:
if (!e.KeyChar.IsSigned()) if (!e.KeyChar.IsSigned())
{ {
e.Handled = true; e.Handled = true;
} }
break; break;
case DisplayType.Unsigned: case WatchDisplayType.Unsigned:
if (!e.KeyChar.IsUnsigned()) if (!e.KeyChar.IsUnsigned())
{ {
e.Handled = true; e.Handled = true;
@ -267,7 +267,7 @@ namespace BizHawk.Client.EmuHawk
switch (_type) switch (_type)
{ {
default: default:
case DisplayType.Signed: case WatchDisplayType.Signed:
int? val = ToRawInt() ?? 0; int? val = ToRawInt() ?? 0;
if (val == MaxSignedInt) if (val == MaxSignedInt)
{ {
@ -280,7 +280,7 @@ namespace BizHawk.Client.EmuHawk
Text = val.ToString(); Text = val.ToString();
break; break;
case DisplayType.Unsigned: case WatchDisplayType.Unsigned:
var uval = (uint)(ToRawInt() ?? 0); var uval = (uint)(ToRawInt() ?? 0);
if (uval == MaxUnsignedInt) if (uval == MaxUnsignedInt)
{ {
@ -293,7 +293,7 @@ namespace BizHawk.Client.EmuHawk
Text = uval.ToString(); Text = uval.ToString();
break; break;
case DisplayType.Binary: case WatchDisplayType.Binary:
var bVal = (uint)(ToRawInt() ?? 0); var bVal = (uint)(ToRawInt() ?? 0);
if (bVal == MaxUnsignedInt) if (bVal == MaxUnsignedInt)
{ {
@ -307,7 +307,7 @@ namespace BizHawk.Client.EmuHawk
var numBits = ((int)ByteSize) * 8; var numBits = ((int)ByteSize) * 8;
Text = Convert.ToString(bVal, 2).PadLeft(numBits, '0'); Text = Convert.ToString(bVal, 2).PadLeft(numBits, '0');
break; break;
case DisplayType.Hex: case WatchDisplayType.Hex:
var hexVal = (uint)(ToRawInt() ?? 0); var hexVal = (uint)(ToRawInt() ?? 0);
if (hexVal == MaxUnsignedInt) if (hexVal == MaxUnsignedInt)
{ {
@ -320,7 +320,7 @@ namespace BizHawk.Client.EmuHawk
Text = hexVal.ToHexString(MaxLength); Text = hexVal.ToHexString(MaxLength);
break; break;
case DisplayType.FixedPoint_12_4: case WatchDisplayType.FixedPoint_12_4:
var f12val = double.Parse(text); var f12val = double.Parse(text);
if (f12val > Max12_4 - _12_4_Unit) if (f12val > Max12_4 - _12_4_Unit)
{ {
@ -333,7 +333,7 @@ namespace BizHawk.Client.EmuHawk
Text = f12val.ToString(); Text = f12val.ToString();
break; break;
case DisplayType.FixedPoint_20_12: case WatchDisplayType.FixedPoint_20_12:
var f24val = double.Parse(text); var f24val = double.Parse(text);
if (f24val >= Max20_12 - _20_12_Unit) if (f24val >= Max20_12 - _20_12_Unit)
{ {
@ -346,7 +346,7 @@ namespace BizHawk.Client.EmuHawk
Text = f24val.ToString(); Text = f24val.ToString();
break; break;
case DisplayType.FixedPoint_16_16: case WatchDisplayType.FixedPoint_16_16:
var f16val = double.Parse(text); var f16val = double.Parse(text);
if (f16val >= Max16_16 - _16_16_Unit) if (f16val >= Max16_16 - _16_16_Unit)
{ {
@ -359,7 +359,7 @@ namespace BizHawk.Client.EmuHawk
Text = f16val.ToString(); Text = f16val.ToString();
break; break;
case DisplayType.Float: case WatchDisplayType.Float:
var dVal = double.Parse(text); var dVal = double.Parse(text);
if (dVal > double.MaxValue - 1) if (dVal > double.MaxValue - 1)
{ {
@ -379,7 +379,7 @@ namespace BizHawk.Client.EmuHawk
switch (_type) switch (_type)
{ {
default: default:
case DisplayType.Signed: case WatchDisplayType.Signed:
var val = ToRawInt(); var val = ToRawInt();
if (!val.HasValue) if (!val.HasValue)
{ {
@ -396,7 +396,7 @@ namespace BizHawk.Client.EmuHawk
Text = val.ToString(); Text = val.ToString();
break; break;
case DisplayType.Unsigned: case WatchDisplayType.Unsigned:
var uval = (uint)(ToRawInt() ?? 0); var uval = (uint)(ToRawInt() ?? 0);
if (uval == 0) if (uval == 0)
{ {
@ -409,7 +409,7 @@ namespace BizHawk.Client.EmuHawk
Text = uval.ToString(); Text = uval.ToString();
break; break;
case DisplayType.Binary: case WatchDisplayType.Binary:
var bVal = (uint)(ToRawInt() ?? 0); var bVal = (uint)(ToRawInt() ?? 0);
if (bVal == 0) if (bVal == 0)
{ {
@ -423,7 +423,7 @@ namespace BizHawk.Client.EmuHawk
var numBits = ((int)ByteSize) * 8; var numBits = ((int)ByteSize) * 8;
Text = Convert.ToString(bVal, 2).PadLeft(numBits, '0'); Text = Convert.ToString(bVal, 2).PadLeft(numBits, '0');
break; break;
case DisplayType.Hex: case WatchDisplayType.Hex:
var hexVal = (uint)(ToRawInt() ?? 0); var hexVal = (uint)(ToRawInt() ?? 0);
if (hexVal == 0) if (hexVal == 0)
{ {
@ -436,7 +436,7 @@ namespace BizHawk.Client.EmuHawk
Text = hexVal.ToHexString(MaxLength); Text = hexVal.ToHexString(MaxLength);
break; break;
case DisplayType.FixedPoint_12_4: case WatchDisplayType.FixedPoint_12_4:
var f12val = double.Parse(text); var f12val = double.Parse(text);
if (f12val < 0 + _12_4_Unit) if (f12val < 0 + _12_4_Unit)
{ {
@ -449,7 +449,7 @@ namespace BizHawk.Client.EmuHawk
Text = f12val.ToString(); Text = f12val.ToString();
break; break;
case DisplayType.FixedPoint_20_12: case WatchDisplayType.FixedPoint_20_12:
var f24val = double.Parse(text); var f24val = double.Parse(text);
if (f24val < 0 + _20_12_Unit) if (f24val < 0 + _20_12_Unit)
{ {
@ -462,7 +462,7 @@ namespace BizHawk.Client.EmuHawk
Text = f24val.ToString(); Text = f24val.ToString();
break; break;
case DisplayType.FixedPoint_16_16: case WatchDisplayType.FixedPoint_16_16:
var f16val = double.Parse(text); var f16val = double.Parse(text);
if (f16val < 0 + _16_16_Unit) if (f16val < 0 + _16_16_Unit)
{ {
@ -475,7 +475,7 @@ namespace BizHawk.Client.EmuHawk
Text = f16val.ToString(); Text = f16val.ToString();
break; break;
case DisplayType.Float: case WatchDisplayType.Float:
var dval = double.Parse(text); var dval = double.Parse(text);
if (dval > double.MaxValue - 1) if (dval > double.MaxValue - 1)
{ {
@ -507,24 +507,24 @@ namespace BizHawk.Client.EmuHawk
switch (_type) switch (_type)
{ {
case DisplayType.Signed: case WatchDisplayType.Signed:
Text = Text.OnlySigned(); Text = Text.OnlySigned();
break; break;
case DisplayType.Unsigned: case WatchDisplayType.Unsigned:
Text = Text.OnlyUnsigned(); Text = Text.OnlyUnsigned();
break; break;
case DisplayType.Binary: case WatchDisplayType.Binary:
Text = Text.OnlyBinary(); Text = Text.OnlyBinary();
break; break;
case DisplayType.Hex: case WatchDisplayType.Hex:
Text = Text.OnlyHex(); Text = Text.OnlyHex();
break; break;
case DisplayType.FixedPoint_12_4: case WatchDisplayType.FixedPoint_12_4:
case DisplayType.FixedPoint_20_12: case WatchDisplayType.FixedPoint_20_12:
case DisplayType.FixedPoint_16_16: case WatchDisplayType.FixedPoint_16_16:
Text = Text.OnlyFixedPoint(); Text = Text.OnlyFixedPoint();
break; break;
case DisplayType.Float: case WatchDisplayType.Float:
Text = Text.OnlyFloat(); Text = Text.OnlyFloat();
break; break;
} }
@ -546,56 +546,56 @@ namespace BizHawk.Client.EmuHawk
switch (_type) switch (_type)
{ {
case DisplayType.Signed: case WatchDisplayType.Signed:
if (Text.IsSigned()) if (Text.IsSigned())
{ {
return Text == "-" ? 0 : int.Parse(Text); return Text == "-" ? 0 : int.Parse(Text);
} }
break; break;
case DisplayType.Unsigned: case WatchDisplayType.Unsigned:
if (Text.IsUnsigned()) if (Text.IsUnsigned())
{ {
return (int)uint.Parse(Text); return (int)uint.Parse(Text);
} }
break; break;
case DisplayType.Binary: case WatchDisplayType.Binary:
if (Text.IsBinary()) if (Text.IsBinary())
{ {
return Convert.ToInt32(Text, 2); return Convert.ToInt32(Text, 2);
} }
break; break;
case DisplayType.Hex: case WatchDisplayType.Hex:
if (Text.IsHex()) if (Text.IsHex())
{ {
return int.Parse(Text, NumberStyles.HexNumber); return int.Parse(Text, NumberStyles.HexNumber);
} }
break; break;
case DisplayType.FixedPoint_12_4: case WatchDisplayType.FixedPoint_12_4:
if (Text.IsFixedPoint()) if (Text.IsFixedPoint())
{ {
return (int)(double.Parse(Text) * 16.0); return (int)(double.Parse(Text) * 16.0);
} }
break; break;
case DisplayType.FixedPoint_20_12: case WatchDisplayType.FixedPoint_20_12:
if (Text.IsFixedPoint()) if (Text.IsFixedPoint())
{ {
return (int)(double.Parse(Text) * 4096.0); return (int)(double.Parse(Text) * 4096.0);
} }
break; break;
case DisplayType.FixedPoint_16_16: case WatchDisplayType.FixedPoint_16_16:
if (Text.IsFixedPoint()) if (Text.IsFixedPoint())
{ {
return (int)(double.Parse(Text) * 65536.0); return (int)(double.Parse(Text) * 65536.0);
} }
break; break;
case DisplayType.Float: case WatchDisplayType.Float:
if (Text.IsFloat()) if (Text.IsFloat())
{ {
if (Text == "-" || Text == ".") if (Text == "-" || Text == ".")
@ -621,31 +621,31 @@ namespace BizHawk.Client.EmuHawk
switch (_type) switch (_type)
{ {
default: default:
case DisplayType.Signed: case WatchDisplayType.Signed:
Text = val.ToString(); Text = val.ToString();
break; break;
case DisplayType.Unsigned: case WatchDisplayType.Unsigned:
var uval = (uint)val.Value; var uval = (uint)val.Value;
Text = uval.ToString(); Text = uval.ToString();
break; break;
case DisplayType.Binary: case WatchDisplayType.Binary:
var bVal = (uint)val.Value; var bVal = (uint)val.Value;
var numBits = ((int)ByteSize) * 8; var numBits = ((int)ByteSize) * 8;
Text = Convert.ToString(bVal, 2).PadLeft(numBits, '0'); Text = Convert.ToString(bVal, 2).PadLeft(numBits, '0');
break; break;
case DisplayType.Hex: case WatchDisplayType.Hex:
Text = val.Value.ToHexString(MaxLength); Text = val.Value.ToHexString(MaxLength);
break; break;
case DisplayType.FixedPoint_12_4: case WatchDisplayType.FixedPoint_12_4:
Text = $"{val.Value / 16.0:F5}"; Text = $"{val.Value / 16.0:F5}";
break; break;
case DisplayType.FixedPoint_20_12: case WatchDisplayType.FixedPoint_20_12:
Text = $"{val.Value / 4096.0:F5}"; Text = $"{val.Value / 4096.0:F5}";
break; break;
case DisplayType.FixedPoint_16_16: case WatchDisplayType.FixedPoint_16_16:
Text = $"{val.Value / 65536.0:F5}"; Text = $"{val.Value / 65536.0:F5}";
break; break;
case DisplayType.Float: case WatchDisplayType.Float:
var bytes = BitConverter.GetBytes(val.Value); var bytes = BitConverter.GetBytes(val.Value);
float _float = BitConverter.ToSingle(bytes, 0); float _float = BitConverter.ToSingle(bytes, 0);
Text = $"{_float:F6}"; Text = $"{_float:F6}";