From 3e79e68d1da61e7cf020053a2e0a7d34f3629cba Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Wed, 2 Nov 2022 01:05:12 +1000 Subject: [PATCH] Dedup in `CheatEdit.GetCheat` --- .../tools/Cheats/CheatEdit.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs b/src/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs index f64ab4f1db..2ab34a1048 100644 --- a/src/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs +++ b/src/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs @@ -299,11 +299,11 @@ namespace BizHawk.Client.EmuHawk if (address < domain.Size) { var watch = Watch.GenerateWatch( - MemoryDomains[DomainDropDown.SelectedItem.ToString()], - AddressBox.ToRawInt().Value, + domain, + address: address, GetCurrentSize(), Watch.StringToDisplayType(DisplayTypeDropDown.SelectedItem.ToString()), - BigEndianCheckBox.Checked, + bigEndian: BigEndianCheckBox.Checked, NameBox.Text); var comparisonType = CompareTypeDropDown.SelectedItem.ToString() switch @@ -318,11 +318,12 @@ namespace BizHawk.Client.EmuHawk _ => Cheat.CompareType.None }; + var compare = CompareBox.ToRawInt(); return new Cheat( watch, - ValueBox.ToRawInt().Value, - CompareBox.ToRawInt() == null ? null : (int?)CompareBox.ToRawInt().Value, - true, + value: ValueBox.ToRawInt().Value, + compare: compare, + enabled: true, comparisonType); }