diff --git a/src/BizHawk.Client.Common/Global.cs b/src/BizHawk.Client.Common/Global.cs index 252978535a..d3dfe0c59e 100644 --- a/src/BizHawk.Client.Common/Global.cs +++ b/src/BizHawk.Client.Common/Global.cs @@ -8,13 +8,9 @@ namespace BizHawk.Client.Common { public static Config Config { get; set; } public static GameInfo Game { get; set; } - public static CheatCollection CheatList { get; set; } = new CheatCollection(); public static FirmwareManager FirmwareManager { get; set; } - public static IMovieSession MovieSession { get; set; } - public static InputManager InputManager { get; } = new InputManager(); - public static Dictionary UserBag { get; set; } = new Dictionary(); } } diff --git a/src/BizHawk.Client.EmuHawk/Extensions/ToolExtensions.cs b/src/BizHawk.Client.EmuHawk/Extensions/ToolExtensions.cs index 4aed117569..0111a5ec78 100644 --- a/src/BizHawk.Client.EmuHawk/Extensions/ToolExtensions.cs +++ b/src/BizHawk.Client.EmuHawk/Extensions/ToolExtensions.cs @@ -236,7 +236,7 @@ namespace BizHawk.Client.EmuHawk.ToolExtensions public static void FreezeAll(this IEnumerable watches) { - Global.CheatList.AddRange( + GlobalWin.CheatList.AddRange( watches .Where(w => !w.IsSeparator) .Select(w => new Cheat(w, w.Value))); @@ -244,7 +244,7 @@ namespace BizHawk.Client.EmuHawk.ToolExtensions public static void UnfreezeAll(this IEnumerable watches) { - Global.CheatList.RemoveRange(watches.Where(watch => !watch.IsSeparator)); + GlobalWin.CheatList.RemoveRange(watches.Where(watch => !watch.IsSeparator)); } public static IEnumerable MenuItems(this IMemoryDomains domains, Action setCallback, string selected = "", int? maxSize = null) diff --git a/src/BizHawk.Client.EmuHawk/GlobalWin.cs b/src/BizHawk.Client.EmuHawk/GlobalWin.cs index 874847f140..ef37fbf67a 100644 --- a/src/BizHawk.Client.EmuHawk/GlobalWin.cs +++ b/src/BizHawk.Client.EmuHawk/GlobalWin.cs @@ -1,4 +1,5 @@ using BizHawk.Bizware.BizwareGL; +using BizHawk.Client.Common; using BizHawk.Emulation.Common; // ReSharper disable StyleCop.SA1401 @@ -11,6 +12,8 @@ namespace BizHawk.Client.EmuHawk public static IEmulator Emulator { get; set; } + public static CheatCollection CheatList { get; set; } = new CheatCollection(); + /// /// the IGL to be used for rendering /// diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index 9070498098..a5d10be889 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -817,7 +817,7 @@ namespace BizHawk.Client.EmuHawk } private Sound Sound => GlobalWin.Sound; - private CheatCollection CheatList => Global.CheatList; + public CheatCollection CheatList => GlobalWin.CheatList; private Rewinder Rewinder { get; } diff --git a/src/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs b/src/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs index 8669b73e86..b237683e81 100644 --- a/src/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs +++ b/src/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs @@ -64,16 +64,16 @@ namespace BizHawk.Client.EmuHawk /// protected override void GeneralUpdate() { - CheatListView.RowCount = Global.CheatList.Count; - TotalLabel.Text = $"{Global.CheatList.CheatCount} {(Global.CheatList.CheatCount == 1 ? "cheat" : "cheats")} {Global.CheatList.ActiveCount} active"; + CheatListView.RowCount = MainForm.CheatList.Count; + TotalLabel.Text = $"{MainForm.CheatList.CheatCount} {(MainForm.CheatList.CheatCount == 1 ? "cheat" : "cheats")} {MainForm.CheatList.ActiveCount} active"; } private void LoadFileFromRecent(string path) { - var askResult = !Global.CheatList.Changes || AskSaveChanges(); + var askResult = !MainForm.CheatList.Changes || AskSaveChanges(); if (askResult) { - var loadResult = Global.CheatList.Load(Core, path, Config.DisableCheatsOnLoad, append: false); + var loadResult = MainForm.CheatList.Load(Core, path, Config.DisableCheatsOnLoad, append: false); if (!loadResult) { Config.RecentCheats.HandleLoadError(path); @@ -90,10 +90,10 @@ namespace BizHawk.Client.EmuHawk private void UpdateMessageLabel(bool saved = false) { MessageLabel.Text = saved - ? $"{Path.GetFileName(Global.CheatList.CurrentFileName)} saved." - : Global.CheatList.Changes - ? $"{Path.GetFileName(Global.CheatList.CurrentFileName)} *" - : Path.GetFileName(Global.CheatList.CurrentFileName); + ? $"{Path.GetFileName(MainForm.CheatList.CurrentFileName)} saved." + : MainForm.CheatList.Changes + ? $"{Path.GetFileName(MainForm.CheatList.CurrentFileName)} *" + : Path.GetFileName(MainForm.CheatList.CurrentFileName); } private void LoadFile(FileSystemInfo file, bool append) @@ -101,17 +101,17 @@ namespace BizHawk.Client.EmuHawk if (file != null) { var result = true; - if (Global.CheatList.Changes) + if (MainForm.CheatList.Changes) { result = AskSaveChanges(); } if (result) { - Global.CheatList.Load(Core, file.FullName, Config.DisableCheatsOnLoad, append); + MainForm.CheatList.Load(Core, file.FullName, Config.DisableCheatsOnLoad, append); GeneralUpdate(); UpdateMessageLabel(); - Config.RecentCheats.Add(Global.CheatList.CurrentFileName); + Config.RecentCheats.Add(MainForm.CheatList.CurrentFileName); } } } @@ -119,12 +119,12 @@ namespace BizHawk.Client.EmuHawk private bool SaveAs() { var file = SaveFileDialog( - Global.CheatList.CurrentFileName, + MainForm.CheatList.CurrentFileName, Config.PathEntries.CheatsAbsolutePath(Global.Game.System), "Cheat Files", "cht"); - return file != null && Global.CheatList.SaveFile(file.FullName); + return file != null && MainForm.CheatList.SaveFile(file.FullName); } private void Cheats_Load(object sender, EventArgs e) @@ -170,7 +170,7 @@ namespace BizHawk.Client.EmuHawk private void AddCheat() { - Global.CheatList.Add(CheatEditor.GetCheat()); + MainForm.CheatList.Add(CheatEditor.GetCheat()); GeneralUpdate(); UpdateMessageLabel(); } @@ -181,7 +181,7 @@ namespace BizHawk.Client.EmuHawk if (!newCheat.IsSeparator) // If a separator comes from the cheat editor something must have been invalid { - Global.CheatList.Exchange(CheatEditor.OriginalCheat, newCheat); + MainForm.CheatList.Exchange(CheatEditor.OriginalCheat, newCheat); GeneralUpdate(); UpdateMessageLabel(); } @@ -222,7 +222,7 @@ namespace BizHawk.Client.EmuHawk private void CheatListView_QueryItemText(int index, RollColumn column, out string text, ref int offsetX, ref int offsetY) { text = ""; - if (index >= Global.CheatList.Count || Global.CheatList[index].IsSeparator) + if (index >= MainForm.CheatList.Count || MainForm.CheatList[index].IsSeparator) { return; } @@ -232,34 +232,34 @@ namespace BizHawk.Client.EmuHawk switch (columnName) { case NameColumn: - text = Global.CheatList[index].Name; + text = MainForm.CheatList[index].Name; break; case AddressColumn: - text = Global.CheatList[index].AddressStr; + text = MainForm.CheatList[index].AddressStr; break; case ValueColumn: - text = Global.CheatList[index].ValueStr; + text = MainForm.CheatList[index].ValueStr; break; case CompareColumn: - text = Global.CheatList[index].CompareStr; + text = MainForm.CheatList[index].CompareStr; break; case OnColumn: - text = Global.CheatList[index].Enabled ? "*" : ""; + text = MainForm.CheatList[index].Enabled ? "*" : ""; break; case DomainColumn: - text = Global.CheatList[index].Domain.Name; + text = MainForm.CheatList[index].Domain.Name; break; case SizeColumn: - text = Global.CheatList[index].Size.ToString(); + text = MainForm.CheatList[index].Size.ToString(); break; case EndianColumn: - text = (Global.CheatList[index].BigEndian ?? false) ? "Big" : "Little"; + text = (MainForm.CheatList[index].BigEndian ?? false) ? "Big" : "Little"; break; case TypeColumn: - text = Watch.DisplayTypeToString(Global.CheatList[index].Type); + text = Watch.DisplayTypeToString(MainForm.CheatList[index].Type); break; case ComparisonTypeColumn: - text = Global.CheatList[index].ComparisonType switch + text = MainForm.CheatList[index].ComparisonType switch { Cheat.CompareType.None => "", Cheat.CompareType.Equal => "=", @@ -277,13 +277,13 @@ namespace BizHawk.Client.EmuHawk private void CheatListView_QueryItemBkColor(int index, RollColumn column, ref Color color) { - if (index < Global.CheatList.Count) + if (index < MainForm.CheatList.Count) { - if (Global.CheatList[index].IsSeparator) + if (MainForm.CheatList[index].IsSeparator) { color = BackColor; } - else if (Global.CheatList[index].Enabled) + else if (MainForm.CheatList[index].Enabled) { color = Color.LightCyan; } @@ -292,7 +292,7 @@ namespace BizHawk.Client.EmuHawk private IEnumerable SelectedIndices => CheatListView.SelectedRows; - private IEnumerable SelectedItems => SelectedIndices.Select(index => Global.CheatList[index]); + private IEnumerable SelectedItems => SelectedIndices.Select(index => MainForm.CheatList[index]); private IEnumerable SelectedCheats => SelectedItems.Where(x => !x.IsSeparator); @@ -313,10 +313,10 @@ namespace BizHawk.Client.EmuHawk private void StartNewList() { - var result = !Global.CheatList.Changes || AskSaveChanges(); + var result = !MainForm.CheatList.Changes || AskSaveChanges(); if (result) { - Global.CheatList.NewList(Tools.GenerateDefaultCheatFilename()); + MainForm.CheatList.NewList(Tools.GenerateDefaultCheatFilename()); GeneralUpdate(); UpdateMessageLabel(); ToggleGameGenieButton(); @@ -325,7 +325,7 @@ namespace BizHawk.Client.EmuHawk private void NewList() { - var result = !Global.CheatList.Changes || AskSaveChanges(); + var result = !MainForm.CheatList.Changes || AskSaveChanges(); if (result) { StartNewList(); @@ -334,7 +334,7 @@ namespace BizHawk.Client.EmuHawk private void FileSubMenu_DropDownOpened(object sender, EventArgs e) { - SaveMenuItem.Enabled = Global.CheatList.Changes; + SaveMenuItem.Enabled = MainForm.CheatList.Changes; } private void RecentSubMenu_DropDownOpened(object sender, EventArgs e) @@ -351,7 +351,7 @@ namespace BizHawk.Client.EmuHawk private void OpenMenuItem_Click(object sender, EventArgs e) { var file = OpenFileDialog( - Global.CheatList.CurrentFileName, + MainForm.CheatList.CurrentFileName, Config.PathEntries.CheatsAbsolutePath(Global.Game.System), "Cheat Files", "cht"); @@ -361,9 +361,9 @@ namespace BizHawk.Client.EmuHawk private void SaveMenuItem_Click(object sender, EventArgs e) { - if (Global.CheatList.Changes) + if (MainForm.CheatList.Changes) { - if (Global.CheatList.Save()) + if (MainForm.CheatList.Save()) { UpdateMessageLabel(saved: true); } @@ -396,7 +396,7 @@ namespace BizHawk.Client.EmuHawk SelectedIndices.Any(); // Always leave enabled even if no cheats enabled. This way the hotkey will always work however a new cheat is enabled - // DisableAllCheatsMenuItem.Enabled = Global.CheatList.ActiveCount > 0; + // DisableAllCheatsMenuItem.Enabled = MainForm.CheatList.ActiveCount > 0; GameGenieSeparator.Visible = OpenGameGenieEncoderDecoderMenuItem.Visible = @@ -410,7 +410,7 @@ namespace BizHawk.Client.EmuHawk { foreach (var item in items) { - Global.CheatList.Remove(item); + MainForm.CheatList.Remove(item); } CheatListView.DeselectAll(); @@ -422,11 +422,11 @@ namespace BizHawk.Client.EmuHawk { if (SelectedIndices.Any()) { - Global.CheatList.Insert(SelectedIndices.Max(), Cheat.Separator); + MainForm.CheatList.Insert(SelectedIndices.Max(), Cheat.Separator); } else { - Global.CheatList.Add(Cheat.Separator); + MainForm.CheatList.Add(Cheat.Separator); } GeneralUpdate(); @@ -443,9 +443,9 @@ namespace BizHawk.Client.EmuHawk foreach (var index in indices) { - var cheat = Global.CheatList[index]; - Global.CheatList.Remove(cheat); - Global.CheatList.Insert(index - 1, cheat); + var cheat = MainForm.CheatList[index]; + MainForm.CheatList.Remove(cheat); + MainForm.CheatList.Insert(index - 1, cheat); } var newIndices = indices.Select(t => t - 1); @@ -463,16 +463,16 @@ namespace BizHawk.Client.EmuHawk private void MoveDownMenuItem_Click(object sender, EventArgs e) { var indices = SelectedIndices.ToList(); - if (indices.Count == 0 || indices.Last() == Global.CheatList.Count - 1) + if (indices.Count == 0 || indices.Last() == MainForm.CheatList.Count - 1) { return; } for (var i = indices.Count - 1; i >= 0; i--) { - var cheat = Global.CheatList[indices[i]]; - Global.CheatList.Remove(cheat); - Global.CheatList.Insert(indices[i] + 1, cheat); + var cheat = MainForm.CheatList[indices[i]]; + MainForm.CheatList.Remove(cheat); + MainForm.CheatList.Insert(indices[i] + 1, cheat); } UpdateMessageLabel(); @@ -504,7 +504,7 @@ namespace BizHawk.Client.EmuHawk private void DisableAllCheatsMenuItem_Click(object sender, EventArgs e) { - Global.CheatList.DisableAll(); + MainForm.CheatList.DisableAll(); } private void OpenGameGenieEncoderDecoderMenuItem_Click(object sender, EventArgs e) @@ -610,7 +610,7 @@ namespace BizHawk.Client.EmuHawk _sortReverse = false; } - Global.CheatList.Sort(column.Name, _sortReverse); + MainForm.CheatList.Sort(column.Name, _sortReverse); _sortedColumn = column.Name; _sortReverse ^= true; @@ -639,7 +639,7 @@ namespace BizHawk.Client.EmuHawk RemoveContextMenuItem.Enabled = SelectedCheats.Any(); - DisableAllContextMenuItem.Enabled = Global.CheatList.ActiveCount > 0; + DisableAllContextMenuItem.Enabled = MainForm.CheatList.ActiveCount > 0; } private void ViewInHexEditorContextMenuItem_Click(object sender, EventArgs e) diff --git a/src/BizHawk.Client.EmuHawk/tools/GameShark.cs b/src/BizHawk.Client.EmuHawk/tools/GameShark.cs index dc6c3ca387..809d906fc0 100644 --- a/src/BizHawk.Client.EmuHawk/tools/GameShark.cs +++ b/src/BizHawk.Client.EmuHawk/tools/GameShark.cs @@ -47,7 +47,7 @@ namespace BizHawk.Client.EmuHawk var description = !string.IsNullOrWhiteSpace(txtDescription.Text) ? txtDescription.Text : code; - Global.CheatList.Add(result.ToCheat(domain, description)); + MainForm.CheatList.Add(result.ToCheat(domain, description)); } else { diff --git a/src/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs b/src/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs index 8b744b3420..a8d7f0969f 100644 --- a/src/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs +++ b/src/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs @@ -771,7 +771,7 @@ namespace BizHawk.Client.EmuHawk private bool IsFrozen(long address) { - return Global.CheatList.IsActive(_domain, address); + return MainForm.CheatList.IsActive(_domain, address); } private void FreezeHighlighted() @@ -790,7 +790,7 @@ namespace BizHawk.Client.EmuHawk Common.DisplayType.Hex, BigEndian); - Global.CheatList.Add(new Cheat( + MainForm.CheatList.Add(new Cheat( watch, watch.Value)); } @@ -812,7 +812,7 @@ namespace BizHawk.Client.EmuHawk watch.Value)); } - Global.CheatList.AddRange(cheats); + MainForm.CheatList.AddRange(cheats); } MemoryViewerBox.Refresh(); @@ -827,13 +827,13 @@ namespace BizHawk.Client.EmuHawk if (_highlightedAddress >= 0) { - Global.CheatList.RemoveRange(Global.CheatList.Where(x => x.Contains(_highlightedAddress.Value))); + MainForm.CheatList.RemoveRange(MainForm.CheatList.Where(x => x.Contains(_highlightedAddress.Value))); } if (_secondaryHighlightedAddresses.Any()) { - Global.CheatList.RemoveRange( - Global.CheatList.Where( + MainForm.CheatList.RemoveRange( + MainForm.CheatList.Where( cheat => !cheat.IsSeparator && cheat.Domain == _domain && _secondaryHighlightedAddresses.Contains(cheat.Address ?? 0))); } @@ -1071,10 +1071,10 @@ namespace BizHawk.Client.EmuHawk private void IncrementAddress(long address) { - if (Global.CheatList.IsActive(_domain, address)) + if (MainForm.CheatList.IsActive(_domain, address)) { // TODO: Increment should be intelligent since IsActive is. If this address is part of a multi-byte cheat it should intelligently increment just that byte - Global.CheatList.First(x => x.Domain == _domain && x.Address == address).Increment(); + MainForm.CheatList.First(x => x.Domain == _domain && x.Address == address).Increment(); } else { @@ -1104,10 +1104,10 @@ namespace BizHawk.Client.EmuHawk private void DecrementAddress(long address) { - if (Global.CheatList.IsActive(_domain, address)) + if (MainForm.CheatList.IsActive(_domain, address)) { // TODO: Increment should be intelligent since IsActive is. If this address is part of a multi-byte cheat it should intelligently increment just that byte - Global.CheatList.First(x => x.Domain == _domain && x.Address == address).Decrement(); + MainForm.CheatList.First(x => x.Domain == _domain && x.Address == address).Decrement(); } else { @@ -1631,7 +1631,7 @@ namespace BizHawk.Client.EmuHawk private void UnfreezeAllMenuItem_Click(object sender, EventArgs e) { - Global.CheatList.RemoveAll(); + MainForm.CheatList.RemoveAll(); } private void PokeAddressMenuItem_Click(object sender, EventArgs e) @@ -1878,7 +1878,7 @@ namespace BizHawk.Client.EmuHawk case Keys.Delete: if (e.Modifiers == Keys.Shift) { - Global.CheatList.RemoveAll(); + MainForm.CheatList.RemoveAll(); } else { @@ -1966,7 +1966,7 @@ namespace BizHawk.Client.EmuHawk (_highlightedAddress.HasValue || _secondaryHighlightedAddresses.Any()) && _domain.Writable; - UnfreezeAllContextItem.Visible = Global.CheatList.ActiveCount > 0; + UnfreezeAllContextItem.Visible = MainForm.CheatList.ActiveCount > 0; PasteContextItem.Visible = _domain.Writable && data != null && data.GetDataPresent(DataFormats.Text); ContextSeparator1.Visible = @@ -2055,7 +2055,7 @@ namespace BizHawk.Client.EmuHawk private void MemoryViewerBox_Paint(object sender, PaintEventArgs e) { - var activeCheats = Global.CheatList.Where(x => x.Enabled); + var activeCheats = MainForm.CheatList.Where(x => x.Enabled); foreach (var cheat in activeCheats) { if (IsVisible(cheat.Address ?? 0)) @@ -2095,7 +2095,7 @@ namespace BizHawk.Client.EmuHawk var textRect = new Rectangle(textPoint, new Size(_fontWidth * DataSize, _fontHeight)); - if (Global.CheatList.IsActive(_domain, addressHighlighted)) + if (MainForm.CheatList.IsActive(_domain, addressHighlighted)) { _freezeHighlightBrush.Color = Colors.HighlightFreeze; e.Graphics.FillRectangle(_freezeHighlightBrush, rect); @@ -2122,7 +2122,7 @@ namespace BizHawk.Client.EmuHawk var textRect = new Rectangle(textPoint, new Size(_fontWidth * DataSize, _fontHeight)); - if (Global.CheatList.IsActive(_domain, address)) + if (MainForm.CheatList.IsActive(_domain, address)) { _freezeHighlightBrush.Color = Colors.HighlightFreeze; e.Graphics.FillRectangle(_freezeHighlightBrush, rect); diff --git a/src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/ClientLuaLibrary.cs b/src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/ClientLuaLibrary.cs index 1b9b5c2758..af19a08a25 100644 --- a/src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/ClientLuaLibrary.cs +++ b/src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/ClientLuaLibrary.cs @@ -487,7 +487,7 @@ namespace BizHawk.Client.EmuHawk if (result.IsValid) { var domain = decoder.CheatDomain(); - Global.CheatList.Add(result.ToCheat(domain, code)); + MainForm.CheatList.Add(result.ToCheat(domain, code)); } else { @@ -515,8 +515,8 @@ namespace BizHawk.Client.EmuHawk if (result.IsValid) { - Global.CheatList.RemoveRange( - Global.CheatList.Where(c => c.Address == result.Address)); + MainForm.CheatList.RemoveRange( + MainForm.CheatList.Where(c => c.Address == result.Address)); } else { diff --git a/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs b/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs index f470fe743a..0c40d62db3 100644 --- a/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs +++ b/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs @@ -486,7 +486,7 @@ namespace BizHawk.Client.EmuHawk // If Cheat tool is loaded, restarting will restart the list too anyway if (!Has()) { - Global.CheatList.NewList(GenerateDefaultCheatFilename(), autosave: true); + _owner.CheatList.NewList(GenerateDefaultCheatFilename(), autosave: true); } var unavailable = new List(); diff --git a/src/BizHawk.Client.EmuHawk/tools/Watch/RamPoke.cs b/src/BizHawk.Client.EmuHawk/tools/Watch/RamPoke.cs index e365d40f9f..1a268b6eba 100644 --- a/src/BizHawk.Client.EmuHawk/tools/Watch/RamPoke.cs +++ b/src/BizHawk.Client.EmuHawk/tools/Watch/RamPoke.cs @@ -97,7 +97,7 @@ namespace BizHawk.Client.EmuHawk var result = watch.Poke(ValueBox.Text); if (result) { - var cheat = Global.CheatList.FirstOrDefault(c => c.Address == watch.Address && c.Domain == watch.Domain); + var cheat = GlobalWin.CheatList.FirstOrDefault(c => c.Address == watch.Address && c.Domain == watch.Domain); if (cheat != (Cheat)null) { cheat.PokeValue(watch.Value); diff --git a/src/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs b/src/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs index 7369749c8f..797f8f4ec3 100644 --- a/src/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs +++ b/src/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs @@ -155,7 +155,7 @@ namespace BizHawk.Client.EmuHawk { var nextColor = Color.White; - var isCheat = Global.CheatList.IsActive(_settings.Domain, _searches[index].Address); + var isCheat = MainForm.CheatList.IsActive(_settings.Domain, _searches[index].Address); var isWeeded = Settings.PreviewMode && !_forcePreviewClear && _searches.Preview(_searches[index].Address); if (_searches[index].Address >= _searches[index].Domain.Size) @@ -1253,7 +1253,7 @@ namespace BizHawk.Client.EmuHawk private void FreezeAddressMenuItem_Click(object sender, EventArgs e) { - var allCheats = SelectedWatches.All(x => Global.CheatList.IsActive(x.Domain, x.Address)); + var allCheats = SelectedWatches.All(x => MainForm.CheatList.IsActive(x.Domain, x.Address)); if (allCheats) { SelectedWatches.UnfreezeAll(); @@ -1380,14 +1380,14 @@ namespace BizHawk.Client.EmuHawk SelectedIndices.Any() && SelectedWatches.All(w => w.Domain.Writable); - UnfreezeAllContextMenuItem.Visible = Global.CheatList.ActiveCount > 0; + UnfreezeAllContextMenuItem.Visible = MainForm.CheatList.ActiveCount > 0; - ContextMenuSeparator3.Visible = SelectedIndices.Any() || (Global.CheatList.ActiveCount > 0); + ContextMenuSeparator3.Visible = SelectedIndices.Any() || (MainForm.CheatList.ActiveCount > 0); var allCheats = true; foreach (var index in SelectedIndices) { - if (!Global.CheatList.IsActive(_settings.Domain, _searches[index].Address)) + if (!MainForm.CheatList.IsActive(_settings.Domain, _searches[index].Address)) { allCheats = false; } @@ -1407,7 +1407,7 @@ namespace BizHawk.Client.EmuHawk private void UnfreezeAllContextMenuItem_Click(object sender, EventArgs e) { - Global.CheatList.RemoveAll(); + MainForm.CheatList.RemoveAll(); } private void ViewInHexEditorContextMenuItem_Click(object sender, EventArgs e) diff --git a/src/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs b/src/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs index dfd0a6680f..714e8519f6 100644 --- a/src/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs +++ b/src/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs @@ -274,7 +274,7 @@ namespace BizHawk.Client.EmuHawk { for (var i = 0; i < _watches.Count; i++) { - var frozen = !_watches[i].IsSeparator && Global.CheatList.IsActive(_watches[i].Domain, _watches[i].Address); + var frozen = !_watches[i].IsSeparator && MainForm.CheatList.IsActive(_watches[i].Domain, _watches[i].Address); GlobalWin.OSD.AddRamWatch( _watches[i].ToDisplayString(), new MessagePosition @@ -574,7 +574,7 @@ namespace BizHawk.Client.EmuHawk { color = Color.PeachPuff; } - else if (Global.CheatList.IsActive(_watches[index].Domain, _watches[index].Address)) + else if (MainForm.CheatList.IsActive(_watches[index].Domain, _watches[index].Address)) { color = Color.LightCyan; } @@ -777,7 +777,7 @@ namespace BizHawk.Client.EmuHawk private void FreezeAddressMenuItem_Click(object sender, EventArgs e) { - var allCheats = SelectedWatches.All(x => Global.CheatList.IsActive(x.Domain, x.Address)); + var allCheats = SelectedWatches.All(x => MainForm.CheatList.IsActive(x.Domain, x.Address)); if (allCheats) { SelectedWatches.UnfreezeAll(); @@ -1078,7 +1078,7 @@ namespace BizHawk.Client.EmuHawk SelectedIndices.Any() && SelectedWatches.All(w => w.Domain.Writable); - var allCheats = SelectedWatches.All(x => Global.CheatList.IsActive(x.Domain, x.Address)); + var allCheats = SelectedWatches.All(x => MainForm.CheatList.IsActive(x.Domain, x.Address)); if (allCheats) { @@ -1091,7 +1091,7 @@ namespace BizHawk.Client.EmuHawk FreezeContextMenuItem.Image = Properties.Resources.Freeze; } - UnfreezeAllContextMenuItem.Visible = Global.CheatList.ActiveCount > 0; + UnfreezeAllContextMenuItem.Visible = MainForm.CheatList.ActiveCount > 0; ViewInHexEditorContextMenuItem.Visible = SelectedWatches.Count() == 1; @@ -1100,7 +1100,7 @@ namespace BizHawk.Client.EmuHawk private void UnfreezeAllContextMenuItem_Click(object sender, EventArgs e) { - Global.CheatList.RemoveAll(); + MainForm.CheatList.RemoveAll(); } private void ViewInHexEditorContextMenuItem_Click(object sender, EventArgs e)