Move Global.CheatList to GlobalWin.CheatList
This commit is contained in:
parent
1ce8a368d4
commit
c9241c3fc5
|
@ -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<string, object> UserBag { get; set; } = new Dictionary<string, object>();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -236,7 +236,7 @@ namespace BizHawk.Client.EmuHawk.ToolExtensions
|
|||
|
||||
public static void FreezeAll(this IEnumerable<Watch> 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<Watch> watches)
|
||||
{
|
||||
Global.CheatList.RemoveRange(watches.Where(watch => !watch.IsSeparator));
|
||||
GlobalWin.CheatList.RemoveRange(watches.Where(watch => !watch.IsSeparator));
|
||||
}
|
||||
|
||||
public static IEnumerable<ToolStripItem> MenuItems(this IMemoryDomains domains, Action<string> setCallback, string selected = "", int? maxSize = null)
|
||||
|
|
|
@ -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();
|
||||
|
||||
/// <summary>
|
||||
/// the IGL to be used for rendering
|
||||
/// </summary>
|
||||
|
|
|
@ -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; }
|
||||
|
||||
|
|
|
@ -64,16 +64,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// </summary>
|
||||
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<int> SelectedIndices => CheatListView.SelectedRows;
|
||||
|
||||
private IEnumerable<Cheat> SelectedItems => SelectedIndices.Select(index => Global.CheatList[index]);
|
||||
private IEnumerable<Cheat> SelectedItems => SelectedIndices.Select(index => MainForm.CheatList[index]);
|
||||
|
||||
private IEnumerable<Cheat> 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)
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -486,7 +486,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
// If Cheat tool is loaded, restarting will restart the list too anyway
|
||||
if (!Has<Cheats>())
|
||||
{
|
||||
Global.CheatList.NewList(GenerateDefaultCheatFilename(), autosave: true);
|
||||
_owner.CheatList.NewList(GenerateDefaultCheatFilename(), autosave: true);
|
||||
}
|
||||
|
||||
var unavailable = new List<IToolForm>();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue