use ToolFormBase properties instead of globals

This commit is contained in:
adelikat 2019-12-22 10:56:53 -06:00
parent c76dbbb977
commit 1aa318d7e1
12 changed files with 208 additions and 240 deletions

View File

@ -481,7 +481,7 @@ namespace BizHawk.Client.EmuHawk
{
var file = OpenFileDialog(
CurrentFileName,
PathManager.MakeAbsolutePath(Global.Config.PathEntries.ToolsPathFragment, null),
PathManager.MakeAbsolutePath(Config.PathEntries.ToolsPathFragment, null),
"Bot files",
"bot"
);
@ -504,7 +504,7 @@ namespace BizHawk.Client.EmuHawk
{
var file = SaveFileDialog(
CurrentFileName,
PathManager.MakeAbsolutePath(Global.Config.PathEntries.ToolsPathFragment, null),
PathManager.MakeAbsolutePath(Config.PathEntries.ToolsPathFragment, null),
"Bot files",
"bot"
);

View File

@ -1,14 +1,11 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Client.Common;
using BizHawk.Client.EmuHawk.ToolExtensions;
using BizHawk.Common;
//TODO - select which memorydomains go out to the CDL file. will this cause a problem when re-importing it?
//perhaps missing domains shouldnt fail a check
@ -27,20 +24,16 @@ namespace BizHawk.Client.EmuHawk
[ConfigPersist]
private RecentFiles _recent
{
get
{ return _recent_fld; }
set
{
_recent_fld = value;
}
get => _recent_fld;
set => _recent_fld = value;
}
void SetCurrentFilename(string fname)
{
_currentFilename = fname;
if (_currentFilename == null)
Text = "Code Data Logger";
else Text = $"Code Data Logger - {fname}";
Text = _currentFilename == null
? "Code Data Logger"
: $"Code Data Logger - {fname}";
}
[RequiredService]
@ -194,12 +187,12 @@ namespace BizHawk.Client.EmuHawk
public bool AskSaveChanges()
{
//nothing to fear:
// nothing to fear:
if (_cdl == null)
return true;
//try auto-saving if appropriate
if (Global.Config.CDLAutoSave)
// try auto-saving if appropriate
if (Config.CDLAutoSave)
{
if (_currentFilename != null)
{
@ -209,7 +202,7 @@ namespace BizHawk.Client.EmuHawk
}
}
//TODO - I dont like this system. It's hard to figure out how to use it. It should be done in multiple passes.
// TODO - I don't like this system. It's hard to figure out how to use it. It should be done in multiple passes.
var result = MessageBox.Show("Save changes to CDL session?", "CDL Auto Save", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.No)
{
@ -224,29 +217,17 @@ namespace BizHawk.Client.EmuHawk
ShutdownCDL();
return true;
}
else
{
ShutdownCDL();
return false;
}
}
else
{
RunSave();
ShutdownCDL();
return true;
return false;
}
RunSave();
ShutdownCDL();
return true;
}
public bool UpdateBefore
{
get { return false; }
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
}
public bool UpdateBefore => false;
bool autoloading = false;
public void LoadFile(string path)
@ -269,7 +250,7 @@ namespace BizHawk.Client.EmuHawk
//ok, it's all good:
_cdl = newCDL;
CodeDataLogger.SetCDL(null);
if (tsbLoggingActive.Checked || Global.Config.CDLAutoStart)
if (tsbLoggingActive.Checked || Config.CDLAutoStart)
{
tsbLoggingActive.Checked = true;
CodeDataLogger.SetCDL(_cdl);
@ -290,9 +271,9 @@ namespace BizHawk.Client.EmuHawk
DisassembleMenuItem.Enabled =
_cdl != null;
miAutoSave.Checked = Global.Config.CDLAutoSave;
miAutoStart.Checked = Global.Config.CDLAutoStart;
miAutoResume.Checked = Global.Config.CDLAutoResume;
miAutoSave.Checked = Config.CDLAutoSave;
miAutoStart.Checked = Config.CDLAutoStart;
miAutoResume.Checked = Config.CDLAutoResume;
}
private void RecentSubMenu_DropDownOpened(object sender, EventArgs e)
@ -306,7 +287,7 @@ namespace BizHawk.Client.EmuHawk
_cdl = new CodeDataLog();
CodeDataLogger.NewCDL(_cdl);
if (tsbLoggingActive.Checked || Global.Config.CDLAutoStart)
if (tsbLoggingActive.Checked || Config.CDLAutoStart)
CodeDataLogger.SetCDL(_cdl);
else CodeDataLogger.SetCDL(null);
@ -332,7 +313,7 @@ namespace BizHawk.Client.EmuHawk
{
var file = OpenFileDialog(
_currentFilename,
PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPathFragment, null),
PathManager.MakeAbsolutePath(Config.PathEntries.LogPathFragment, null),
"Code Data Logger Files",
"cdl");
@ -353,10 +334,8 @@ namespace BizHawk.Client.EmuHawk
void RunSave()
{
_recent.Add(_currentFilename);
using (var fs = new FileStream(_currentFilename, FileMode.Create, FileAccess.Write))
{
_cdl.Save(fs);
}
using var fs = new FileStream(_currentFilename, FileMode.Create, FileAccess.Write);
_cdl.Save(fs);
}
private void SaveMenuItem_Click(object sender, EventArgs e)
@ -383,7 +362,7 @@ namespace BizHawk.Client.EmuHawk
{
var file = SaveFileDialog(
_currentFilename,
PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPathFragment, null),
PathManager.MakeAbsolutePath(Config.PathEntries.LogPathFragment, null),
"Code Data Logger Files",
"cdl");
@ -410,24 +389,22 @@ namespace BizHawk.Client.EmuHawk
{
var file = ToolFormBase.OpenFileDialog(
_currentFilename,
PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPathFragment, null),
PathManager.MakeAbsolutePath(Config.PathEntries.LogPathFragment, null),
"Code Data Logger Files",
"cdl");
if (file != null)
{
using (var fs = new FileStream(file.FullName, FileMode.Open, FileAccess.Read))
using var fs = new FileStream(file.FullName, FileMode.Open, FileAccess.Read);
var newCDL = new CodeDataLog();
newCDL.Load(fs);
if (!_cdl.Check(newCDL))
{
var newCDL = new CodeDataLog();
newCDL.Load(fs);
if (!_cdl.Check(newCDL))
{
MessageBox.Show(this, "CDL file does not match emulator's current memory map!");
return;
}
_cdl.LogicalOrFrom(newCDL);
UpdateDisplay(true);
MessageBox.Show(this, "CDL file does not match emulator's current memory map!");
return;
}
_cdl.LogicalOrFrom(newCDL);
UpdateDisplay(true);
}
}
}
@ -461,10 +438,8 @@ namespace BizHawk.Client.EmuHawk
var result = sfd.ShowDialog(this);
if (result == DialogResult.OK)
{
using (var fs = new FileStream(sfd.FileName, FileMode.Create, FileAccess.Write))
{
CodeDataLogger.DisassembleCDL(fs, _cdl);
}
using var fs = new FileStream(sfd.FileName, FileMode.Create, FileAccess.Write);
CodeDataLogger.DisassembleCDL(fs, _cdl);
}
}
@ -489,7 +464,7 @@ namespace BizHawk.Client.EmuHawk
protected override void OnShown(EventArgs e)
{
if (Global.Config.CDLAutoStart)
if (Config.CDLAutoStart)
{
if (_cdl == null)
NewFileLogic();
@ -499,20 +474,18 @@ namespace BizHawk.Client.EmuHawk
protected override void OnClosed(EventArgs e)
{
//deactivate logger
if (CodeDataLogger != null) //just in case...
CodeDataLogger.SetCDL(null);
CodeDataLogger?.SetCDL(null);
}
private void CDL_Load(object sender, EventArgs e)
{
if (Global.Config.CDLAutoResume)
if (Config.CDLAutoResume)
{
try
{
autoloading = true;
var autoresume_file = $"{PathManager.FilesystemSafeName(Global.Game)}.cdl";
var autoresume_dir = PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPathFragment, null);
var autoresume_dir = PathManager.MakeAbsolutePath(Config.PathEntries.LogPathFragment, null);
var autoresume_path = Path.Combine(autoresume_dir, autoresume_file);
if (File.Exists(autoresume_path))
LoadFile(autoresume_path);
@ -596,17 +569,17 @@ namespace BizHawk.Client.EmuHawk
private void miAutoSave_Click(object sender, EventArgs e)
{
Global.Config.CDLAutoSave ^= true;
Config.CDLAutoSave ^= true;
}
private void miAutoStart_Click(object sender, EventArgs e)
{
Global.Config.CDLAutoStart ^= true;
Config.CDLAutoStart ^= true;
}
private void miAutoResume_Click(object sender, EventArgs e)
{
Global.Config.CDLAutoResume ^= true;
Config.CDLAutoResume ^= true;
}
}
}

View File

@ -91,11 +91,11 @@ namespace BizHawk.Client.EmuHawk
var loadResult = Global.CheatList.Load(path, append: false);
if (!loadResult)
{
Global.Config.RecentCheats.HandleLoadError(path);
Config.RecentCheats.HandleLoadError(path);
}
else
{
Global.Config.RecentCheats.Add(path);
Config.RecentCheats.Add(path);
UpdateDialog();
UpdateMessageLabel();
}
@ -131,7 +131,7 @@ namespace BizHawk.Client.EmuHawk
Global.CheatList.Load(file.FullName, append);
UpdateDialog();
UpdateMessageLabel();
Global.Config.RecentCheats.Add(Global.CheatList.CurrentFileName);
Config.RecentCheats.Add(Global.CheatList.CurrentFileName);
}
}
}
@ -185,7 +185,7 @@ namespace BizHawk.Client.EmuHawk
{
GameGenieToolbarSeparator.Visible =
LoadGameGenieToolbarItem.Visible =
GlobalWin.Tools.IsAvailable<GameShark>();
Tools.IsAvailable<GameShark>();
}
private void AddCheat()
@ -352,7 +352,7 @@ namespace BizHawk.Client.EmuHawk
var result = !Global.CheatList.Changes || AskSaveChanges();
if (result)
{
Global.CheatList.NewList(GlobalWin.Tools.GenerateDefaultCheatFilename());
Global.CheatList.NewList(Tools.GenerateDefaultCheatFilename());
UpdateDialog();
UpdateMessageLabel();
ToggleGameGenieButton();
@ -381,7 +381,7 @@ namespace BizHawk.Client.EmuHawk
{
RecentSubMenu.DropDownItems.Clear();
RecentSubMenu.DropDownItems.AddRange(
Global.Config.RecentCheats.RecentMenu(LoadFileFromRecent));
Config.RecentCheats.RecentMenu(LoadFileFromRecent));
}
private void NewMenuItem_Click(object sender, EventArgs e)
@ -445,7 +445,7 @@ namespace BizHawk.Client.EmuHawk
GameGenieSeparator.Visible =
OpenGameGenieEncoderDecoderMenuItem.Visible =
GlobalWin.Tools.IsAvailable<GameShark>();
Tools.IsAvailable<GameShark>();
}
private void RemoveCheatMenuItem_Click(object sender, EventArgs e)
@ -554,7 +554,7 @@ namespace BizHawk.Client.EmuHawk
private void OpenGameGenieEncoderDecoderMenuItem_Click(object sender, EventArgs e)
{
GlobalWin.Tools.LoadGameGenieEc();
Tools.LoadGameGenieEc();
}
#endregion
@ -563,10 +563,10 @@ namespace BizHawk.Client.EmuHawk
private void OptionsSubMenu_DropDownOpened(object sender, EventArgs e)
{
AlwaysLoadCheatsMenuItem.Checked = Global.Config.LoadCheatFileByGame;
AutoSaveCheatsMenuItem.Checked = Global.Config.CheatsAutoSaveOnClose;
DisableCheatsOnLoadMenuItem.Checked = Global.Config.DisableCheatsOnLoad;
AutoloadMenuItem.Checked = Global.Config.RecentCheats.AutoLoad;
AlwaysLoadCheatsMenuItem.Checked = Config.LoadCheatFileByGame;
AutoSaveCheatsMenuItem.Checked = Config.CheatsAutoSaveOnClose;
DisableCheatsOnLoadMenuItem.Checked = Config.DisableCheatsOnLoad;
AutoloadMenuItem.Checked = Config.RecentCheats.AutoLoad;
SaveWindowPositionMenuItem.Checked = Settings.SaveWindowPosition;
AlwaysOnTopMenuItem.Checked = Settings.TopMost;
FloatingWindowMenuItem.Checked = Settings.FloatingWindow;
@ -574,22 +574,22 @@ namespace BizHawk.Client.EmuHawk
private void AlwaysLoadCheatsMenuItem_Click(object sender, EventArgs e)
{
Global.Config.LoadCheatFileByGame ^= true;
Config.LoadCheatFileByGame ^= true;
}
private void AutoSaveCheatsMenuItem_Click(object sender, EventArgs e)
{
Global.Config.CheatsAutoSaveOnClose ^= true;
Config.CheatsAutoSaveOnClose ^= true;
}
private void CheatsOnOffLoadMenuItem_Click(object sender, EventArgs e)
{
Global.Config.DisableCheatsOnLoad ^= true;
Config.DisableCheatsOnLoad ^= true;
}
private void AutoloadMenuItem_Click(object sender, EventArgs e)
{
Global.Config.RecentCheats.AutoLoad ^= true;
Config.RecentCheats.AutoLoad ^= true;
}
private void SaveWindowPositionMenuItem_Click(object sender, EventArgs e)
@ -620,9 +620,9 @@ namespace BizHawk.Client.EmuHawk
CheatsMenu.Items.Add(CheatListView.ToColumnsMenu(ColumnToggleCallback));
Global.Config.DisableCheatsOnLoad = false;
Global.Config.LoadCheatFileByGame = true;
Global.Config.CheatsAutoSaveOnClose = true;
Config.DisableCheatsOnLoad = false;
Config.LoadCheatFileByGame = true;
Config.CheatsAutoSaveOnClose = true;
RefreshFloatingWindowControl(Settings.FloatingWindow);
CheatListView.AllColumns.Clear();
@ -700,7 +700,7 @@ namespace BizHawk.Client.EmuHawk
var selected = SelectedCheats.ToList();
if (selected.Any())
{
GlobalWin.Tools.Load<HexEditor>();
Tools.Load<HexEditor>();
if (selected.Select(x => x.Domain).Distinct().Count() > 1)
{

View File

@ -169,9 +169,9 @@ namespace BizHawk.Client.EmuHawk
_maxRow = _domain.Size / 2;
// Don't reset scroll bar if restarting the same rom
if (_lastRom != GlobalWin.MainForm.CurrentlyOpenRom)
if (_lastRom != MainForm.CurrentlyOpenRom)
{
_lastRom = GlobalWin.MainForm.CurrentlyOpenRom;
_lastRom = MainForm.CurrentlyOpenRom;
ResetScrollBar();
}
@ -365,9 +365,9 @@ namespace BizHawk.Client.EmuHawk
return (char)val;
}
private static bool CurrentRomIsArchive()
private bool CurrentRomIsArchive()
{
var path = GlobalWin.MainForm.CurrentlyOpenRom;
var path = MainForm.CurrentlyOpenRom;
if (path == null)
{
return false;
@ -384,9 +384,9 @@ namespace BizHawk.Client.EmuHawk
return file.IsArchive;
}
private static byte[] GetRomBytes()
private byte[] GetRomBytes()
{
var path = GlobalWin.MainForm.CurrentlyOpenRomArgs.OpenAdvanced.SimplePath;
var path = MainForm.CurrentlyOpenRomArgs.OpenAdvanced.SimplePath;
if (string.IsNullOrEmpty(path))
{
return new byte[] { 0xFF };
@ -460,11 +460,11 @@ namespace BizHawk.Client.EmuHawk
private void LoadConfigSettings()
{
HexMenuStrip.BackColor = Global.Config.HexMenubarColor;
MemoryViewerBox.BackColor = Global.Config.HexBackgrndColor;
MemoryViewerBox.ForeColor = Global.Config.HexForegrndColor;
Header.BackColor = Global.Config.HexBackgrndColor;
Header.ForeColor = Global.Config.HexForegrndColor;
HexMenuStrip.BackColor = Config.HexMenubarColor;
MemoryViewerBox.BackColor = Config.HexBackgrndColor;
MemoryViewerBox.ForeColor = Config.HexForegrndColor;
Header.BackColor = Config.HexBackgrndColor;
Header.ForeColor = Config.HexForegrndColor;
}
private void CloseHexFind()
@ -842,7 +842,7 @@ namespace BizHawk.Client.EmuHawk
{
get
{
string path = Global.Config.RecentRoms.MostRecent;
string path = Config.RecentRoms.MostRecent;
if (string.IsNullOrWhiteSpace(path))
{
@ -862,7 +862,7 @@ namespace BizHawk.Client.EmuHawk
{
get
{
string path = Global.Config.RecentRoms.MostRecent;
string path = Config.RecentRoms.MostRecent;
if (string.IsNullOrWhiteSpace(path))
{
@ -1213,7 +1213,7 @@ namespace BizHawk.Client.EmuHawk
{
if (!CurrentRomIsArchive())
{
SaveFileBinary(GlobalWin.MainForm.CurrentlyOpenRom);
SaveFileBinary(MainForm.CurrentlyOpenRom);
}
}
@ -1281,10 +1281,10 @@ namespace BizHawk.Client.EmuHawk
private void LoadTableFileMenuItem_Click(object sender, EventArgs e)
{
string initialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.ToolsPathFragment, null);
var romName = Global.Config.RecentRoms.MostRecent.Contains('|')
? Global.Config.RecentRoms.MostRecent.Split('|').Last()
: Global.Config.RecentRoms.MostRecent;
string initialDirectory = PathManager.MakeAbsolutePath(Config.PathEntries.ToolsPathFragment, null);
var romName = Config.RecentRoms.MostRecent.Contains('|')
? Config.RecentRoms.MostRecent.Split('|').Last()
: Config.RecentRoms.MostRecent;
using var ofd = new OpenFileDialog
{
@ -1587,16 +1587,16 @@ namespace BizHawk.Client.EmuHawk
{
if (_highlightedAddress.HasValue || _secondaryHighlightedAddresses.Any())
{
GlobalWin.Tools.LoadRamWatch(true);
Tools.LoadRamWatch(true);
}
if (_highlightedAddress.HasValue)
{
GlobalWin.Tools.RamWatch.AddWatch(MakeWatch(_highlightedAddress.Value));
Tools.RamWatch.AddWatch(MakeWatch(_highlightedAddress.Value));
}
_secondaryHighlightedAddresses.ForEach(addr =>
GlobalWin.Tools.RamWatch.AddWatch(MakeWatch(addr)));
Tools.RamWatch.AddWatch(MakeWatch(addr)));
}
private void FreezeAddressMenuItem_Click(object sender, EventArgs e)
@ -1684,15 +1684,15 @@ namespace BizHawk.Client.EmuHawk
{
MemoryViewerBox.BackColor = Color.FromName("Control");
MemoryViewerBox.ForeColor = Color.FromName("ControlText");
this.HexMenuStrip.BackColor = Color.FromName("Control");
HexMenuStrip.BackColor = Color.FromName("Control");
Header.BackColor = Color.FromName("Control");
Header.ForeColor = Color.FromName("ControlText");
Global.Config.HexMenubarColor = Color.FromName("Control");
Global.Config.HexForegrndColor = Color.FromName("ControlText");
Global.Config.HexBackgrndColor = Color.FromName("Control");
Global.Config.HexFreezeColor = Color.LightBlue;
Global.Config.HexHighlightColor = Color.Pink;
Global.Config.HexHighlightFreezeColor = Color.Violet;
Config.HexMenubarColor = Color.FromName("Control");
Config.HexForegrndColor = Color.FromName("ControlText");
Config.HexBackgrndColor = Color.FromName("Control");
Config.HexFreezeColor = Color.LightBlue;
Config.HexHighlightColor = Color.Pink;
Config.HexHighlightFreezeColor = Color.Violet;
}
#endregion
@ -2097,7 +2097,7 @@ namespace BizHawk.Client.EmuHawk
var rect = new Rectangle(GetAddressCoordinates(cheat.Address ?? 0), new Size(width, _fontHeight));
e.Graphics.DrawRectangle(_blackPen, rect);
_freezeBrush.Color = Global.Config.HexFreezeColor;
_freezeBrush.Color = Config.HexFreezeColor;
e.Graphics.FillRectangle(_freezeBrush, rect);
}
}
@ -2119,13 +2119,13 @@ namespace BizHawk.Client.EmuHawk
if (Global.CheatList.IsActive(_domain, addressHighlighted))
{
_freezeHighlightBrush.Color = Global.Config.HexHighlightFreezeColor;
_freezeHighlightBrush.Color = Config.HexHighlightFreezeColor;
e.Graphics.FillRectangle(_freezeHighlightBrush, rect);
e.Graphics.FillRectangle(_freezeHighlightBrush, textRect);
}
else
{
_highlightBrush.Color = Global.Config.HexHighlightColor;
_highlightBrush.Color = Config.HexHighlightColor;
e.Graphics.FillRectangle(_highlightBrush, rect);
e.Graphics.FillRectangle(_highlightBrush, textRect);
}
@ -2146,13 +2146,13 @@ namespace BizHawk.Client.EmuHawk
if (Global.CheatList.IsActive(_domain, address))
{
_freezeHighlightBrush.Color = Global.Config.HexHighlightFreezeColor;
_freezeHighlightBrush.Color = Config.HexHighlightFreezeColor;
e.Graphics.FillRectangle(_freezeHighlightBrush, rect);
e.Graphics.FillRectangle(_freezeHighlightBrush, textRect);
}
else
{
_secondaryHighlightBrush.Color = Color.FromArgb(0x44, Global.Config.HexHighlightColor);
_secondaryHighlightBrush.Color = Color.FromArgb(0x44, Config.HexHighlightColor);
e.Graphics.FillRectangle(_secondaryHighlightBrush, rect);
e.Graphics.FillRectangle(_secondaryHighlightBrush, textRect);
}

View File

@ -74,13 +74,13 @@ namespace BizHawk.Client.EmuHawk
if (GlobalWin.DisplayManager.ClientExtraPadding != Padding.Empty)
{
GlobalWin.DisplayManager.ClientExtraPadding = new Padding(0);
GlobalWin.MainForm.FrameBufferResized();
MainForm.FrameBufferResized();
}
if (GlobalWin.DisplayManager.GameExtraPadding != Padding.Empty)
{
GlobalWin.DisplayManager.GameExtraPadding = new Padding(0);
GlobalWin.MainForm.FrameBufferResized();
MainForm.FrameBufferResized();
}
LuaImp.GuiLibrary.DrawFinish();
@ -131,15 +131,15 @@ namespace BizHawk.Client.EmuHawk
LuaImp.ScriptList.ChangedCallback = SessionChangedCallback;
LuaImp.ScriptList.LoadCallback = ClearOutputWindow;
if (Global.Config.RecentLuaSession.AutoLoad && !Global.Config.RecentLuaSession.Empty)
if (Config.RecentLuaSession.AutoLoad && !Config.RecentLuaSession.Empty)
{
LoadSessionFromRecent(Global.Config.RecentLuaSession.MostRecent);
LoadSessionFromRecent(Config.RecentLuaSession.MostRecent);
}
else if (Global.Config.RecentLua.AutoLoad)
else if (Config.RecentLua.AutoLoad)
{
if (!Global.Config.RecentLua.Empty)
if (!Config.RecentLua.Empty)
{
LoadLuaFile(Global.Config.RecentLua.MostRecent);
LoadLuaFile(Config.RecentLua.MostRecent);
}
}
@ -234,7 +234,7 @@ namespace BizHawk.Client.EmuHawk
private void AddFileWatches()
{
if (Global.Config.LuaReloadOnScriptFileChange)
if (Config.LuaReloadOnScriptFileChange)
{
_watches.Clear();
foreach (var item in LuaImp.ScriptList.Where(s => !s.IsSeparator))
@ -285,7 +285,7 @@ namespace BizHawk.Client.EmuHawk
foreach (var file in LuaImp.ScriptList
.Where(file => processedPath == file.Path
&& file.Enabled == false
&& !Global.Config.DisableLuaScriptsOnLoad))
&& !Config.DisableLuaScriptsOnLoad))
{
if (file.Thread != null)
{
@ -303,9 +303,9 @@ namespace BizHawk.Client.EmuHawk
LuaImp.ScriptList.Add(luaFile);
LuaListView.RowCount = LuaImp.ScriptList.Count;
Global.Config.RecentLua.Add(processedPath);
Config.RecentLua.Add(processedPath);
if (!Global.Config.DisableLuaScriptsOnLoad)
if (!Config.DisableLuaScriptsOnLoad)
{
luaFile.State = LuaFile.RunState.Running;
EnableLuaFile(luaFile);
@ -315,7 +315,7 @@ namespace BizHawk.Client.EmuHawk
luaFile.State = LuaFile.RunState.Disabled;
}
if (Global.Config.LuaReloadOnScriptFileChange)
if (Config.LuaReloadOnScriptFileChange)
{
CreateFileWatcher(processedPath);
}
@ -612,7 +612,7 @@ namespace BizHawk.Client.EmuHawk
{
if (!LuaImp.ScriptList.LoadLuaSession(path))
{
Global.Config.RecentLuaSession.HandleLoadError(path);
Config.RecentLuaSession.HandleLoadError(path);
}
else
{
@ -682,14 +682,14 @@ namespace BizHawk.Client.EmuHawk
{
RecentSessionsSubMenu.DropDownItems.Clear();
RecentSessionsSubMenu.DropDownItems.AddRange(
Global.Config.RecentLuaSession.RecentMenu(LoadSessionFromRecent, true));
Config.RecentLuaSession.RecentMenu(LoadSessionFromRecent, true));
}
private void RecentScriptsSubMenu_DropDownOpened(object sender, EventArgs e)
{
RecentScriptsSubMenu.DropDownItems.Clear();
RecentScriptsSubMenu.DropDownItems.AddRange(
Global.Config.RecentLua.RecentMenu(LoadLuaFile, true));
Config.RecentLua.RecentMenu(LoadLuaFile, true));
}
private void NewSessionMenuItem_Click(object sender, EventArgs e)
@ -784,7 +784,7 @@ namespace BizHawk.Client.EmuHawk
{
InitialDirectory = !string.IsNullOrWhiteSpace(LuaImp.ScriptList.Filename) ?
Path.GetDirectoryName(LuaImp.ScriptList.Filename) :
PathManager.MakeAbsolutePath(Global.Config.PathEntries.LuaPathFragment, null),
PathManager.MakeAbsolutePath(Config.PathEntries.LuaPathFragment, null),
DefaultExt = ".lua",
FileName = !string.IsNullOrWhiteSpace(LuaImp.ScriptList.Filename) ?
Path.GetFileNameWithoutExtension(LuaImp.ScriptList.Filename) :
@ -839,7 +839,7 @@ namespace BizHawk.Client.EmuHawk
private void ToggleScriptMenuItem_Click(object sender, EventArgs e)
{
var files = !SelectedFiles.Any() && Global.Config.ToggleAllIfNoneSelected
var files = !SelectedFiles.Any() && Config.ToggleAllIfNoneSelected
? LuaImp.ScriptList
: SelectedFiles;
foreach (var file in files)
@ -870,7 +870,7 @@ namespace BizHawk.Client.EmuHawk
// Shenanigans
// We want any gui.text messages from a script to immediately update even when paused
GlobalWin.OSD.ClearGuiText();
GlobalWin.Tools.UpdateToolsAfter();
Tools.UpdateToolsAfter();
LuaImp.EndLuaDrawing();
LuaImp.StartLuaDrawing();
}
@ -1066,26 +1066,26 @@ namespace BizHawk.Client.EmuHawk
private void OptionsSubMenu_DropDownOpened(object sender, EventArgs e)
{
DisableScriptsOnLoadMenuItem.Checked = Global.Config.DisableLuaScriptsOnLoad;
ReturnAllIfNoneSelectedMenuItem.Checked = Global.Config.ToggleAllIfNoneSelected;
ReloadWhenScriptFileChangesMenuItem.Checked = Global.Config.LuaReloadOnScriptFileChange;
DisableScriptsOnLoadMenuItem.Checked = Config.DisableLuaScriptsOnLoad;
ReturnAllIfNoneSelectedMenuItem.Checked = Config.ToggleAllIfNoneSelected;
ReloadWhenScriptFileChangesMenuItem.Checked = Config.LuaReloadOnScriptFileChange;
}
private void DisableScriptsOnLoadMenuItem_Click(object sender, EventArgs e)
{
Global.Config.DisableLuaScriptsOnLoad ^= true;
Config.DisableLuaScriptsOnLoad ^= true;
}
private void ToggleAllIfNoneSelectedMenuItem_Click(object sender, EventArgs e)
{
Global.Config.ToggleAllIfNoneSelected ^= true;
Config.ToggleAllIfNoneSelected ^= true;
}
private void ReloadWhenScriptFileChangesMenuItem_Click(object sender, EventArgs e)
{
Global.Config.LuaReloadOnScriptFileChange ^= true;
Config.LuaReloadOnScriptFileChange ^= true;
if (Global.Config.LuaReloadOnScriptFileChange)
if (Config.LuaReloadOnScriptFileChange)
{
AddFileWatches();
}

View File

@ -20,10 +20,7 @@ namespace BizHawk.Client.EmuHawk
private readonly List<int> _unsavedZones = new List<int>();
private bool _selecting = false;
private IMovie CurrentMovie
{
get { return Global.MovieSession.Movie; }
}
private IMovie CurrentMovie => Global.MovieSession.Movie;
// Still need to make sure the user can't load and use macros that
// have options only available for TasMovie

View File

@ -60,7 +60,7 @@ namespace BizHawk.Client.EmuHawk
var ofd = new OpenFileDialog
{
FileName = filename,
InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null),
InitialDirectory = PathManager.MakeAbsolutePath(Config.PathEntries.MoviesPathFragment, null),
Filter = string.Format(
"All Available Files ({0})|{0}|TAS Project Files (*.{1})|*.{1}|Movie Files (*.{2})|*.{2}|All Files|*.*",
all, TasMovie.Extension, MovieService.DefaultExtension)
@ -145,7 +145,7 @@ namespace BizHawk.Client.EmuHawk
var file = SaveFileDialog(
filename,
PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null),
PathManager.MakeAbsolutePath(Config.PathEntries.MoviesPathFragment, null),
"Tas Project Files",
"tasproj");
@ -264,7 +264,7 @@ namespace BizHawk.Client.EmuHawk
private void RecentMacrosMenuItem_DropDownOpened(object sender, EventArgs e)
{
recentMacrosToolStripMenuItem.DropDownItems.Clear();
recentMacrosToolStripMenuItem.DropDownItems.AddRange(Global.Config.RecentMacros.RecentMenu(DummyLoadMacro));
recentMacrosToolStripMenuItem.DropDownItems.AddRange(Config.RecentMacros.RecentMenu(DummyLoadMacro));
}
private void ToBk2MenuItem_Click(object sender, EventArgs e)
@ -357,16 +357,16 @@ namespace BizHawk.Client.EmuHawk
StateHistoryIntegrityCheckMenuItem.Visible =
VersionInfo.DeveloperBuild;
UndoMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Undo"].Bindings;
RedoMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Redo"].Bindings;
SelectBetweenMarkersMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Select between Markers"].Bindings;
SelectAllMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Select All"].Bindings;
ReselectClipboardMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Reselect Clip."].Bindings;
ClearFramesMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Clear Frames"].Bindings;
InsertFrameMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Insert Frame"].Bindings;
InsertNumFramesMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Insert # Frames"].Bindings;
DeleteFramesMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Delete Frames"].Bindings;
CloneFramesMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Clone Frames"].Bindings;
UndoMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Undo"].Bindings;
RedoMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Redo"].Bindings;
SelectBetweenMarkersMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Select between Markers"].Bindings;
SelectAllMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Select All"].Bindings;
ReselectClipboardMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Reselect Clip."].Bindings;
ClearFramesMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Clear Frames"].Bindings;
InsertFrameMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Insert Frame"].Bindings;
InsertNumFramesMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Insert # Frames"].Bindings;
DeleteFramesMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Delete Frames"].Bindings;
CloneFramesMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Clone Frames"].Bindings;
}
public void ClearFramesExternal()
@ -1491,12 +1491,12 @@ namespace BizHawk.Client.EmuHawk
CancelSeekContextMenuItem.Enabled = MainForm.PauseOnFrame.HasValue;
BranchContextMenuItem.Visible = TasView.CurrentCell?.RowIndex == Emulator.Frame;
SelectBetweenMarkersContextMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Sel. bet. Markers"].Bindings;
InsertNumFramesContextMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Insert # Frames"].Bindings;
ClearContextMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Clear Frames"].Bindings;
InsertFrameContextMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Insert Frame"].Bindings;
DeleteFramesContextMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Delete Frames"].Bindings;
CloneContextMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Clone Frames"].Bindings;
SelectBetweenMarkersContextMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Sel. bet. Markers"].Bindings;
InsertNumFramesContextMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Insert # Frames"].Bindings;
ClearContextMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Clear Frames"].Bindings;
InsertFrameContextMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Insert Frame"].Bindings;
DeleteFramesContextMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Delete Frames"].Bindings;
CloneContextMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Clone Frames"].Bindings;
}
private void CancelSeekContextMenuItem_Click(object sender, EventArgs e)

View File

@ -23,7 +23,7 @@ namespace BizHawk.Client.EmuHawk
public TasMovie CurrentTasMovie => Global.MovieSession.Movie as TasMovie;
public bool IsInMenuLoop { get; private set; }
public string StatesPath => PathManager.MakeAbsolutePath(Global.Config.PathEntries["Global", "TAStudio states"].Path, null);
public string StatesPath => PathManager.MakeAbsolutePath(Config.PathEntries["Global", "TAStudio states"].Path, null);
private readonly List<TasClipboardEntry> _tasClipboard = new List<TasClipboardEntry>();
private const string CursorColumnName = "CursorColumn";
@ -488,7 +488,7 @@ namespace BizHawk.Client.EmuHawk
BoolPatterns[BoolPatterns.Length - 2] = new AutoPatternBool(1, 0);
BoolPatterns[BoolPatterns.Length - 1] = new AutoPatternBool(
Global.Config.AutofireOn, Global.Config.AutofireOff);
Config.AutofireOn, Config.AutofireOff);
for (int i = fStart; i < FloatPatterns.Length - 2; i++)
{
@ -497,7 +497,7 @@ namespace BizHawk.Client.EmuHawk
FloatPatterns[FloatPatterns.Length - 2] = new AutoPatternFloat(new[] { 1f });
FloatPatterns[FloatPatterns.Length - 1] = new AutoPatternFloat(
1f, Global.Config.AutofireOn, 0f, Global.Config.AutofireOff);
1f, Config.AutofireOn, 0f, Config.AutofireOff);
SetUpToolStripColumns();
}
@ -522,13 +522,13 @@ namespace BizHawk.Client.EmuHawk
private void EngageTastudio()
{
GlobalWin.OSD.AddMessage("TAStudio engaged");
MainForm.AddOnScreenMessage("TAStudio engaged");
SetTasMovieCallbacks();
SetTextProperty();
MainForm.RelinquishControl(this);
_originalEndAction = Global.Config.MovieEndAction;
_originalEndAction = Config.MovieEndAction;
MainForm.ClearRewindData();
Global.Config.MovieEndAction = MovieEndAction.Record;
Config.MovieEndAction = MovieEndAction.Record;
MainForm.SetMainformMovieInfo();
Global.MovieSession.ReadOnly = true;
SetSplicer();
@ -752,7 +752,7 @@ namespace BizHawk.Client.EmuHawk
MainForm.AddOnScreenMessage("TAStudio disengaged");
Global.MovieSession.Movie = MovieService.DefaultInstance;
MainForm.TakeBackControl();
Global.Config.MovieEndAction = _originalEndAction;
Config.MovieEndAction = _originalEndAction;
MainForm.SetMainformMovieInfo();
// Do not keep TAStudio's disk save states.
@ -930,8 +930,8 @@ namespace BizHawk.Client.EmuHawk
}
_hackyDontUpdate = true;
GlobalWin.Tools.UpdateBefore();
GlobalWin.Tools.UpdateAfter();
Tools.UpdateBefore();
Tools.UpdateAfter();
_hackyDontUpdate = false;
}
@ -948,8 +948,8 @@ namespace BizHawk.Client.EmuHawk
private void UpdateOtherTools() // a hack probably, surely there is a better way to do this
{
_hackyDontUpdate = true;
GlobalWin.Tools.UpdateBefore();
GlobalWin.Tools.UpdateAfter();
Tools.UpdateBefore();
Tools.UpdateAfter();
_hackyDontUpdate = false;
}

View File

@ -14,22 +14,22 @@ namespace BizHawk.Client.EmuHawk
public TI83KeyPad()
{
InitializeComponent();
TopMost = Global.Config.TI83KeypadSettings.TopMost;
TopMost = Config.TI83KeypadSettings.TopMost;
Closing += (o, e) =>
{
Global.Config.TI83KeypadSettings.Wndx = Location.X;
Global.Config.TI83KeypadSettings.Wndy = Location.Y;
Config.TI83KeypadSettings.Wndx = Location.X;
Config.TI83KeypadSettings.Wndy = Location.Y;
};
}
private void TI83KeyPad_Load(object sender, EventArgs e)
{
if (Global.Config.TI83KeypadSettings.UseWindowPosition && IsOnScreen(Global.Config.TI83KeypadSettings.TopLeft))
if (Config.TI83KeypadSettings.UseWindowPosition && IsOnScreen(Config.TI83KeypadSettings.TopLeft))
{
Location = Global.Config.TI83KeypadSettings.WindowPosition;
Location = Config.TI83KeypadSettings.WindowPosition;
}
if (Global.Config.TI83ToolTips)
if (Config.TI83ToolTips)
{
SetToolTips();
}
@ -62,7 +62,7 @@ namespace BizHawk.Client.EmuHawk
private void SetToolTips()
{
// Set button hotkey mapping into tooltips
var mappings = Global.Config.AllTrollers["TI83 Controller"];
var mappings = Config.AllTrollers["TI83 Controller"];
KeyPadToolTips.SetToolTip(ZeroButton, mappings["0"]);
KeyPadToolTips.SetToolTip(OneButton, mappings["1"]);
KeyPadToolTips.SetToolTip(TwoButton, mappings["2"]);
@ -131,17 +131,17 @@ namespace BizHawk.Client.EmuHawk
private void OptionsSubMenu_DropDownOpened(object sender, EventArgs e)
{
ShowHotkeysMenuItem.Checked = Global.Config.TI83ToolTips;
SaveWindowPositionMenuItem.Checked = Global.Config.TI83KeypadSettings.SaveWindowPosition;
AlwaysOnTopMenuItem.Checked = Global.Config.TI83KeypadSettings.TopMost;
FloatingWindowMenuItem.Checked = Global.Config.TI83KeypadSettings.FloatingWindow;
ShowHotkeysMenuItem.Checked = Config.TI83ToolTips;
SaveWindowPositionMenuItem.Checked = Config.TI83KeypadSettings.SaveWindowPosition;
AlwaysOnTopMenuItem.Checked = Config.TI83KeypadSettings.TopMost;
FloatingWindowMenuItem.Checked = Config.TI83KeypadSettings.FloatingWindow;
}
private void ShowHotkeysMenuItem_Click(object sender, EventArgs e)
{
Global.Config.TI83ToolTips ^= true;
Config.TI83ToolTips ^= true;
if (Global.Config.TI83ToolTips)
if (Config.TI83ToolTips)
{
SetToolTips();
}
@ -153,19 +153,19 @@ namespace BizHawk.Client.EmuHawk
private void SaveWindowPositionMenuItem_Click(object sender, EventArgs e)
{
Global.Config.TI83KeypadSettings.SaveWindowPosition ^= true;
Config.TI83KeypadSettings.SaveWindowPosition ^= true;
}
private void AlwaysOnTopMenuItem_Click(object sender, EventArgs e)
{
Global.Config.TI83KeypadSettings.TopMost ^= true;
TopMost = Global.Config.TI83KeypadSettings.TopMost;
Config.TI83KeypadSettings.TopMost ^= true;
TopMost = Config.TI83KeypadSettings.TopMost;
}
private void FloatingWindowMenuItem_Click(object sender, EventArgs e)
{
Global.Config.TI83KeypadSettings.FloatingWindow ^= true;
RefreshFloatingWindowControl(Global.Config.TI83KeypadSettings.FloatingWindow);
Config.TI83KeypadSettings.FloatingWindow ^= true;
RefreshFloatingWindowControl(Config.TI83KeypadSettings.FloatingWindow);
}
#endregion
@ -424,7 +424,7 @@ namespace BizHawk.Client.EmuHawk
protected override void OnShown(EventArgs e)
{
RefreshFloatingWindowControl(Global.Config.TI83KeypadSettings.FloatingWindow);
RefreshFloatingWindowControl(Config.TI83KeypadSettings.FloatingWindow);
base.OnShown(e);
}

View File

@ -6,8 +6,6 @@ using System.Reflection;
using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Client.ApiHawk;
using BizHawk.Common;
namespace BizHawk.Client.EmuHawk
{
@ -31,8 +29,8 @@ namespace BizHawk.Client.EmuHawk
public void NewUpdate(ToolFormUpdateType type) { }
public bool AskSaveChanges() { return true; }
public bool UpdateBefore { get { return false; } }
public bool AskSaveChanges() => true;
public bool UpdateBefore => false;
public void UpdateValues() { }
public void FastUpdate()

View File

@ -882,8 +882,8 @@ namespace BizHawk.Client.EmuHawk
var watches = SelectedWatches.ToList();
if (watches.Any())
{
GlobalWin.Tools.LoadRamWatch(true);
watches.ForEach(GlobalWin.Tools.RamWatch.AddWatch);
Tools.LoadRamWatch(true);
watches.ForEach(Tools.RamWatch.AddWatch);
if (Settings.AlwaysExcludeRamWatch)
{
RemoveRamWatchesFromList();
@ -909,9 +909,9 @@ namespace BizHawk.Client.EmuHawk
private void RemoveRamWatchesFromList()
{
if (GlobalWin.Tools.Has<RamWatch>())
if (Tools.Has<RamWatch>())
{
_searches.RemoveSmallWatchRange(GlobalWin.Tools.RamWatch.Watches);
_searches.RemoveSmallWatchRange(Tools.RamWatch.Watches);
UpdateList();
}
}

View File

@ -131,7 +131,7 @@ namespace BizHawk.Client.EmuHawk
else
{
_watches.Save();
Global.Config.RecentWatches.Add(_watches.CurrentFileName);
Config.RecentWatches.Add(_watches.CurrentFileName);
}
}
else if (result == DialogResult.No)
@ -161,11 +161,11 @@ namespace BizHawk.Client.EmuHawk
var loadResult = _watches.Load(path, append: false);
if (!loadResult)
{
Global.Config.RecentWatches.HandleLoadError(path);
Config.RecentWatches.HandleLoadError(path);
}
else
{
Global.Config.RecentWatches.Add(path);
Config.RecentWatches.Add(path);
WatchListView.RowCount = _watches.Count;
UpdateWatchCount();
UpdateValues();
@ -190,7 +190,7 @@ namespace BizHawk.Client.EmuHawk
_watches.Load(file.FullName, append);
WatchListView.RowCount = _watches.Count;
UpdateWatchCount();
Global.Config.RecentWatches.Add(_watches.CurrentFileName);
Config.RecentWatches.Add(_watches.CurrentFileName);
UpdateStatusBar();
UpdateValues();
PokeAddressToolBarItem.Enabled =
@ -203,7 +203,7 @@ namespace BizHawk.Client.EmuHawk
public void Restart()
{
if ((!IsHandleCreated || IsDisposed) && !Global.Config.DisplayRamWatch)
if ((!IsHandleCreated || IsDisposed) && !Config.DisplayRamWatch)
{
return;
}
@ -211,7 +211,7 @@ namespace BizHawk.Client.EmuHawk
if (_watches != null
&& !string.IsNullOrWhiteSpace(_watches.CurrentFileName)
&& _watches.All(w => w.Domain == null || MemoryDomains.Select(m => m.Name).Contains(w.Domain.Name))
&& (Global.Config.RecentWatches.AutoLoad || (IsHandleCreated || !IsDisposed)))
&& (Config.RecentWatches.AutoLoad || (IsHandleCreated || !IsDisposed)))
{
_watches.RefreshDomains(MemoryDomains);
_watches.Reload();
@ -231,7 +231,7 @@ namespace BizHawk.Client.EmuHawk
private void DisplayOnScreenWatches()
{
if (Global.Config.DisplayRamWatch)
if (Config.DisplayRamWatch)
{
for (var i = 0; i < _watches.Count; i++)
{
@ -240,9 +240,9 @@ namespace BizHawk.Client.EmuHawk
_watches[i].ToDisplayString(),
new MessagePosition
{
X = Global.Config.RamWatches.X,
Y = Global.Config.RamWatches.Y + (i * 14),
Anchor = Global.Config.RamWatches.Anchor
X = Config.RamWatches.X,
Y = Config.RamWatches.Y + (i * 14),
Anchor = Config.RamWatches.Anchor
},
Color.Black,
frozen ? Color.Cyan : Color.White);
@ -257,7 +257,7 @@ namespace BizHawk.Client.EmuHawk
return;
}
if ((!IsHandleCreated || IsDisposed) && !Global.Config.DisplayRamWatch)
if ((!IsHandleCreated || IsDisposed) && !Config.DisplayRamWatch)
{
return;
}
@ -284,7 +284,7 @@ namespace BizHawk.Client.EmuHawk
return;
}
if ((!IsHandleCreated || IsDisposed) && !Global.Config.DisplayRamWatch)
if ((!IsHandleCreated || IsDisposed) && !Config.DisplayRamWatch)
{
return;
}
@ -522,7 +522,7 @@ namespace BizHawk.Client.EmuHawk
if (result)
{
UpdateStatusBar(saved: true);
Global.Config.RecentWatches.Add(_watches.CurrentFileName);
Config.RecentWatches.Add(_watches.CurrentFileName);
}
}
@ -670,7 +670,7 @@ namespace BizHawk.Client.EmuHawk
{
if (_watches.Save())
{
Global.Config.RecentWatches.Add(_watches.CurrentFileName);
Config.RecentWatches.Add(_watches.CurrentFileName);
UpdateStatusBar(saved: true);
}
}
@ -689,7 +689,7 @@ namespace BizHawk.Client.EmuHawk
{
RecentSubMenu.DropDownItems.Clear();
RecentSubMenu.DropDownItems.AddRange(
Global.Config.RecentWatches.RecentMenu(LoadFileFromRecent, true));
Config.RecentWatches.RecentMenu(LoadFileFromRecent, true));
}
private void ExitMenuItem_Click(object sender, EventArgs e)
@ -964,7 +964,7 @@ namespace BizHawk.Client.EmuHawk
private void OptionsSubMenu_DropDownOpened(object sender, EventArgs e)
{
WatchesOnScreenMenuItem.Checked = Global.Config.DisplayRamWatch;
WatchesOnScreenMenuItem.Checked = Config.DisplayRamWatch;
SaveWindowPositionMenuItem.Checked = Settings.SaveWindowPosition;
AlwaysOnTopMenuItem.Checked = Settings.TopMost;
FloatingWindowMenuItem.Checked = Settings.FloatingWindow;
@ -972,31 +972,31 @@ namespace BizHawk.Client.EmuHawk
private void DefinePreviousValueSubMenu_DropDownOpened(object sender, EventArgs e)
{
PreviousFrameMenuItem.Checked = Global.Config.RamWatchDefinePrevious == PreviousType.LastFrame;
LastChangeMenuItem.Checked = Global.Config.RamWatchDefinePrevious == PreviousType.LastChange;
OriginalMenuItem.Checked = Global.Config.RamWatchDefinePrevious == PreviousType.Original;
PreviousFrameMenuItem.Checked = Config.RamWatchDefinePrevious == PreviousType.LastFrame;
LastChangeMenuItem.Checked = Config.RamWatchDefinePrevious == PreviousType.LastChange;
OriginalMenuItem.Checked = Config.RamWatchDefinePrevious == PreviousType.Original;
}
private void PreviousFrameMenuItem_Click(object sender, EventArgs e)
{
Global.Config.RamWatchDefinePrevious = PreviousType.LastFrame;
Config.RamWatchDefinePrevious = PreviousType.LastFrame;
}
private void LastChangeMenuItem_Click(object sender, EventArgs e)
{
Global.Config.RamWatchDefinePrevious = PreviousType.LastChange;
Config.RamWatchDefinePrevious = PreviousType.LastChange;
}
private void OriginalMenuItem_Click(object sender, EventArgs e)
{
Global.Config.RamWatchDefinePrevious = PreviousType.Original;
Config.RamWatchDefinePrevious = PreviousType.Original;
}
private void WatchesOnScreenMenuItem_Click(object sender, EventArgs e)
{
Global.Config.DisplayRamWatch ^= true;
Config.DisplayRamWatch ^= true;
if (!Global.Config.DisplayRamWatch)
if (!Config.DisplayRamWatch)
{
GlobalWin.OSD.ClearGuiText();
}
@ -1034,7 +1034,7 @@ namespace BizHawk.Client.EmuHawk
RamWatchMenu.Items.Add(WatchListView.ToColumnsMenu(ColumnToggleCallback));
Global.Config.DisplayRamWatch = false;
Config.DisplayRamWatch = false;
RefreshFloatingWindowControl(Settings.FloatingWindow);
@ -1076,7 +1076,7 @@ namespace BizHawk.Client.EmuHawk
if (Path.GetExtension(filePaths[0]) == ".wch")
{
_watches.Load(filePaths[0], append: false);
Global.Config.RecentWatches.Add(_watches.CurrentFileName);
Config.RecentWatches.Add(_watches.CurrentFileName);
WatchListView.RowCount = _watches.Count;
UpdateValues();
}
@ -1145,7 +1145,7 @@ namespace BizHawk.Client.EmuHawk
var selected = SelectedWatches.ToList();
if (selected.Any())
{
GlobalWin.Tools.Load<HexEditor>();
Tools.Load<HexEditor>();
if (selected.Select(x => x.Domain).Distinct().Count() > 1)
{
@ -1164,7 +1164,7 @@ namespace BizHawk.Client.EmuHawk
if (selected.Any())
{
var debugger = GlobalWin.Tools.Load<GenericDebugger>();
var debugger = Tools.Load<GenericDebugger>();
foreach (var watch in selected)
{
@ -1179,7 +1179,7 @@ namespace BizHawk.Client.EmuHawk
if (selected.Any())
{
var debugger = GlobalWin.Tools.Load<GenericDebugger>();
var debugger = Tools.Load<GenericDebugger>();
foreach (var watch in selected)
{