diff --git a/src/BizHawk.Client.Common/tools/Watch/DWordWatch.cs b/src/BizHawk.Client.Common/tools/Watch/DWordWatch.cs index 00426f4e3e..b1b1415a3f 100644 --- a/src/BizHawk.Client.Common/tools/Watch/DWordWatch.cs +++ b/src/BizHawk.Client.Common/tools/Watch/DWordWatch.cs @@ -201,6 +201,16 @@ namespace BizHawk.Client.Common return _float.ToString(); }; + string FormatBinary() + { + var str = Convert.ToString(val, 2).PadLeft(32, '0'); + for (var i = 28; i > 0; i -= 4) + { + str = str.Insert(i, " "); + } + return str; + }; + return Type switch { _ when !IsValid => "-", @@ -210,6 +220,7 @@ namespace BizHawk.Client.Common DisplayType.FixedPoint_20_12 => $"{(int)val / 4096.0:0.######}", DisplayType.FixedPoint_16_16 => $"{(int)val / 65536.0:0.######}", DisplayType.Float => FormatFloat(), + DisplayType.Binary => FormatBinary(), _ => val.ToString() }; } diff --git a/src/BizHawk.Client.EmuHawk/tools/Watch/WatchEditor.cs b/src/BizHawk.Client.EmuHawk/tools/Watch/WatchEditor.cs index 6c5ffbbc8a..74c39e99b9 100644 --- a/src/BizHawk.Client.EmuHawk/tools/Watch/WatchEditor.cs +++ b/src/BizHawk.Client.EmuHawk/tools/Watch/WatchEditor.cs @@ -276,21 +276,18 @@ namespace BizHawk.Client.EmuHawk _ => WatchSize.Byte }; + var displayType = Watch.StringToDisplayType(DisplayTypeDropDown.SelectedItem.ToString()); + Watches[i] = Watch.GenerateWatch( Watches[i].Domain, Watches.Count == 1 ? AddressBox.ToRawInt() ?? 0 : Watches[i].Address, size, - Watches[i].Type, + _changedDisplayType ? displayType : Watches[i].Type, Watches[i].BigEndian, Watches[i].Notes); } } - if (_changedDisplayType) - { - Watches.ForEach(x => x.Type = Watch.StringToDisplayType(DisplayTypeDropDown.SelectedItem.ToString())); - } - if (BigEndianCheckBox.CheckState != CheckState.Indeterminate) { Watches.ForEach(x => x.BigEndian = BigEndianCheckBox.Checked);