diff --git a/src/BizHawk.Client.Common/tools/Interfaces/IToolForm.cs b/src/BizHawk.Client.Common/tools/Interfaces/IToolForm.cs
index a12e099781..6ea6a37059 100644
--- a/src/BizHawk.Client.Common/tools/Interfaces/IToolForm.cs
+++ b/src/BizHawk.Client.Common/tools/Interfaces/IToolForm.cs
@@ -2,41 +2,30 @@
{
public enum ToolFormUpdateType
{
- // reserved
- Legacy, LegacyFast,
-
- // reserved concept: we can run other events through here (should probably rename then)
- Reset,
+ ///
+ /// Called by other tools and other events outside of a frame loop
+ ///
+ General,
///
/// Called before a frame emulates
///
PreFrame,
+ FastPreFrame,
///
/// Called after a frame emulates
///
- PostFrame
+ PostFrame,
+ FastPostFrame
}
public interface IToolForm
{
///
- /// Will be called by the client anytime an Update needs to occur, such as after an emulated frame, a loadstate, or a related dialog has made a relevant change
+ /// Directs the tool to update, with an indicator of the type of update
///
- void UpdateValues();
-
- ///
- /// A new extensible update method
- ///
- void NewUpdate(ToolFormUpdateType type);
-
- ///
- /// Will be called by the client when performance is critical,
- /// The tool should only do the minimum to still function,
- /// Drawing should not occur if possible, during a fast update
- ///
- void FastUpdate();
+ void UpdateValues(ToolFormUpdateType type);
///
/// Will be called anytime the dialog needs to be restarted, such as when a new ROM is loaded
@@ -51,14 +40,6 @@
///
bool AskSaveChanges();
- ///
- /// Indicates whether the tool should be updated before a frame loop or after.
- /// In general, tools that draw graphics from the core should update before the loop,
- /// Information tools such as those that display core ram values should be after.
- /// AWESOME! no separate preupdate and postupdate hooks. seriously?
- ///
- bool UpdateBefore { get; }
-
// Necessary winform calls
bool Focus();
bool ContainsFocus { get; }
diff --git a/src/BizHawk.Client.EmuHawk/CoreFeatureAnalysis.cs b/src/BizHawk.Client.EmuHawk/CoreFeatureAnalysis.cs
index 4675e0092b..0c2fec01cf 100644
--- a/src/BizHawk.Client.EmuHawk/CoreFeatureAnalysis.cs
+++ b/src/BizHawk.Client.EmuHawk/CoreFeatureAnalysis.cs
@@ -10,7 +10,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
{
- public partial class CoreFeatureAnalysis : Form, IToolFormAutoConfig
+ public partial class CoreFeatureAnalysis : ToolFormBase, IToolFormAutoConfig
{
#region ConfigPersist
@@ -118,8 +118,6 @@ namespace BizHawk.Client.EmuHawk
KnownCores = new Dictionary();
}
- public void NewUpdate(ToolFormUpdateType type) { }
-
private TreeNode CreateCoreTree(CoreInfo ci)
{
var ret = new TreeNode
@@ -255,16 +253,6 @@ namespace BizHawk.Client.EmuHawk
CoreTree.EndUpdate();
}
- #region IToolForm
-
- public void UpdateValues()
- {
- }
-
- public void FastUpdate()
- {
- }
-
public void Restart()
{
var ci = new CoreInfo(Emulator);
@@ -273,11 +261,5 @@ namespace BizHawk.Client.EmuHawk
DoCurrentCoreTree(ci);
DoAllCoresTree(ci);
}
-
- public bool AskSaveChanges() => true;
-
- public bool UpdateBefore => false;
-
- #endregion
}
}
diff --git a/src/BizHawk.Client.EmuHawk/LogWindow.cs b/src/BizHawk.Client.EmuHawk/LogWindow.cs
index 157177ddb0..12a52ea23b 100644
--- a/src/BizHawk.Client.EmuHawk/LogWindow.cs
+++ b/src/BizHawk.Client.EmuHawk/LogWindow.cs
@@ -34,16 +34,8 @@ namespace BizHawk.Client.EmuHawk
Attach();
}
- public void UpdateValues() { } // TODO
-
- public void NewUpdate(ToolFormUpdateType type) { }
-
- public void FastUpdate() { }
-
public void Restart() { }
- public bool UpdateBefore => true;
-
private void Attach()
{
_logStream = new LogStream();
diff --git a/src/BizHawk.Client.EmuHawk/config/NES/NESSoundConfig.cs b/src/BizHawk.Client.EmuHawk/config/NES/NESSoundConfig.cs
index 4abc6cdf6d..ad433032c7 100644
--- a/src/BizHawk.Client.EmuHawk/config/NES/NESSoundConfig.cs
+++ b/src/BizHawk.Client.EmuHawk/config/NES/NESSoundConfig.cs
@@ -7,7 +7,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
{
- public partial class NESSoundConfig : Form, IToolForm
+ public partial class NESSoundConfig : ToolFormBase, IToolForm
{
[RequiredService]
private NES NES { get; set; }
@@ -15,19 +15,6 @@ namespace BizHawk.Client.EmuHawk
private NES.NESSettings _oldSettings;
private NES.NESSettings _settings;
- public bool AskSaveChanges() { return true; }
- public bool UpdateBefore => false;
-
- public void UpdateValues()
- {
- }
-
- public void NewUpdate(ToolFormUpdateType type) { }
-
- public void FastUpdate()
- {
- }
-
public void Restart()
{
NESSoundConfig_Load(null, null);
diff --git a/src/BizHawk.Client.EmuHawk/tools/BasicBot/BasicBot.cs b/src/BizHawk.Client.EmuHawk/tools/BasicBot/BasicBot.cs
index 5829689f76..30fe963046 100644
--- a/src/BizHawk.Client.EmuHawk/tools/BasicBot/BasicBot.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/BasicBot/BasicBot.cs
@@ -253,26 +253,13 @@ namespace BizHawk.Client.EmuHawk
#endregion
- #region IToolForm Implementation
-
- public bool UpdateBefore => true;
-
- public void NewUpdate(ToolFormUpdateType type) { }
-
- public void UpdateValues()
- {
- Update(fast: false);
- }
-
- public void FastUpdate()
- {
- Update(fast: true);
- }
+ protected override void UpdateBefore() => Update(fast: false);
+ protected override void FastUpdateBefore() => Update(fast: true);
public void Restart()
{
- if (_currentDomain == null ||
- MemoryDomains.Contains(_currentDomain))
+ if (_currentDomain == null
+ || MemoryDomains.Contains(_currentDomain))
{
_currentDomain = MemoryDomains.MainMemory;
_bigEndian = _currentDomain.EndianType == MemoryDomain.Endian.Big;
@@ -296,8 +283,6 @@ namespace BizHawk.Client.EmuHawk
}
}
- #endregion
-
#region Control Events
#region FileMenu
diff --git a/src/BizHawk.Client.EmuHawk/tools/CDL.cs b/src/BizHawk.Client.EmuHawk/tools/CDL.cs
index 0ba9fb9bbf..0bd0297ace 100644
--- a/src/BizHawk.Client.EmuHawk/tools/CDL.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/CDL.cs
@@ -82,17 +82,7 @@ namespace BizHawk.Client.EmuHawk
});
}
- public void NewUpdate(ToolFormUpdateType type) { }
-
- public void UpdateValues()
- {
- UpdateDisplay(false);
- }
-
- public void FastUpdate()
- {
- // Do nothing
- }
+ protected override void UpdateAfter() => UpdateDisplay(false);
public void Restart()
{
@@ -236,8 +226,6 @@ namespace BizHawk.Client.EmuHawk
return true;
}
- public bool UpdateBefore => false;
-
private bool _autoloading;
public void LoadFile(string path)
{
diff --git a/src/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs b/src/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs
index 098ccc4ca9..e180150281 100644
--- a/src/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs
@@ -53,20 +53,6 @@ namespace BizHawk.Client.EmuHawk
[ConfigPersist]
public CheatsSettings Settings { get; set; }
- public bool UpdateBefore => false;
-
- public void NewUpdate(ToolFormUpdateType type) { }
-
- public void UpdateValues()
- {
- // Do nothing
- }
-
- public void FastUpdate()
- {
- // Do nothing
- }
-
public void Restart()
{
CheatEditor.MemoryDomains = Core;
@@ -76,7 +62,7 @@ namespace BizHawk.Client.EmuHawk
///
/// Tools that want to refresh the cheats list should call this, not UpdateValues
///
- public void UpdateDialog()
+ protected override void GeneralUpdate()
{
CheatListView.RowCount = Global.CheatList.Count;
TotalLabel.Text = $"{Global.CheatList.CheatCount} {(Global.CheatList.CheatCount == 1 ? "cheat" : "cheats")} {Global.CheatList.ActiveCount} active";
@@ -95,7 +81,7 @@ namespace BizHawk.Client.EmuHawk
else
{
Config.RecentCheats.Add(path);
- UpdateDialog();
+ GeneralUpdate();
UpdateMessageLabel();
}
}
@@ -123,7 +109,7 @@ namespace BizHawk.Client.EmuHawk
if (result)
{
Global.CheatList.Load(file.FullName, append);
- UpdateDialog();
+ GeneralUpdate();
UpdateMessageLabel();
Config.RecentCheats.Add(Global.CheatList.CurrentFileName);
}
@@ -156,7 +142,7 @@ namespace BizHawk.Client.EmuHawk
ToggleGameGenieButton();
CheatEditor.SetAddEvent(AddCheat);
CheatEditor.SetEditEvent(EditCheat);
- UpdateDialog();
+ GeneralUpdate();
}
private void SetColumns()
@@ -185,7 +171,7 @@ namespace BizHawk.Client.EmuHawk
private void AddCheat()
{
Global.CheatList.Add(CheatEditor.GetCheat());
- UpdateDialog();
+ GeneralUpdate();
UpdateMessageLabel();
}
@@ -196,7 +182,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);
- UpdateDialog();
+ GeneralUpdate();
UpdateMessageLabel();
}
}
@@ -331,7 +317,7 @@ namespace BizHawk.Client.EmuHawk
if (result)
{
Global.CheatList.NewList(Tools.GenerateDefaultCheatFilename());
- UpdateDialog();
+ GeneralUpdate();
UpdateMessageLabel();
ToggleGameGenieButton();
}
@@ -436,7 +422,7 @@ namespace BizHawk.Client.EmuHawk
}
CheatListView.DeselectAll();
- UpdateDialog();
+ GeneralUpdate();
}
}
@@ -451,7 +437,7 @@ namespace BizHawk.Client.EmuHawk
Global.CheatList.Add(Cheat.Separator);
}
- UpdateDialog();
+ GeneralUpdate();
UpdateMessageLabel();
}
@@ -479,7 +465,7 @@ namespace BizHawk.Client.EmuHawk
}
UpdateMessageLabel();
- UpdateDialog();
+ GeneralUpdate();
}
private void MoveDownMenuItem_Click(object sender, EventArgs e)
@@ -507,7 +493,7 @@ namespace BizHawk.Client.EmuHawk
CheatListView.SelectRow(index, true);
}
- UpdateDialog();
+ GeneralUpdate();
}
private void SelectAllMenuItem_Click(object sender, EventArgs e)
@@ -644,7 +630,7 @@ namespace BizHawk.Client.EmuHawk
_sortedColumn = column.Name;
_sortReverse ^= true;
- UpdateDialog();
+ GeneralUpdate();
}
private void NewCheatForm_DragDrop(object sender, DragEventArgs e)
@@ -653,7 +639,7 @@ namespace BizHawk.Client.EmuHawk
if (Path.GetExtension(filePaths[0]) == ".cht")
{
LoadFile(new FileInfo(filePaths[0]), append: false);
- UpdateDialog();
+ GeneralUpdate();
UpdateMessageLabel();
}
}
diff --git a/src/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.IToolForm.cs b/src/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.IToolForm.cs
index 2d53c7b9dd..4f0ca5eff8 100644
--- a/src/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.IToolForm.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.IToolForm.cs
@@ -130,13 +130,6 @@ namespace BizHawk.Client.EmuHawk
#endregion
- public void NewUpdate(ToolFormUpdateType type) { }
-
- public void UpdateValues()
- {
- // Nothing to do
- }
-
private void FullUpdate()
{
RegisterPanel.UpdateValues();
@@ -145,17 +138,10 @@ namespace BizHawk.Client.EmuHawk
BreakPointControl1.UpdateValues();
}
- public void FastUpdate()
- {
- // Nothing to do
- }
-
public void Restart()
{
DisengageDebugger();
EngageDebugger();
}
-
- public bool UpdateBefore => false;
}
}
diff --git a/src/BizHawk.Client.EmuHawk/tools/GB/GBGPUView.cs b/src/BizHawk.Client.EmuHawk/tools/GB/GBGPUView.cs
index e3364ebd5e..5c2a1da4a7 100644
--- a/src/BizHawk.Client.EmuHawk/tools/GB/GBGPUView.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/GB/GBGPUView.cs
@@ -54,8 +54,6 @@ namespace BizHawk.Client.EmuHawk
}
}
- public bool UpdateBefore => true;
-
public GbGpuView()
{
InitializeComponent();
@@ -536,12 +534,7 @@ namespace BizHawk.Client.EmuHawk
// what was last passed to the emu core
private int _cbScanlineEmu = -4; // force refresh
- public void NewUpdate(ToolFormUpdateType type) { }
-
- ///
- /// put me in ToolsBefore
- ///
- public void UpdateValues()
+ protected override void UpdateBefore()
{
if (!IsHandleCreated || IsDisposed)
{
@@ -572,11 +565,6 @@ namespace BizHawk.Client.EmuHawk
}
}
- public void FastUpdate()
- {
- // Do nothing
- }
-
#endregion
#region mouseovers
diff --git a/src/BizHawk.Client.EmuHawk/tools/GB/GBPrinterView.cs b/src/BizHawk.Client.EmuHawk/tools/GB/GBPrinterView.cs
index 8904e25111..648e0c72b2 100644
--- a/src/BizHawk.Client.EmuHawk/tools/GB/GBPrinterView.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/GB/GBPrinterView.cs
@@ -52,16 +52,6 @@ namespace BizHawk.Client.EmuHawk
Gb?.SetPrinterCallback(null);
}
- public bool UpdateBefore => false;
-
- public void FastUpdate()
- {
- }
-
- public void NewUpdate(ToolFormUpdateType type)
- {
- }
-
public void Restart()
{
// Really, there's not necessarily a reason to clear it at all,
@@ -71,7 +61,7 @@ namespace BizHawk.Client.EmuHawk
_connected = false;
}
- public void UpdateValues()
+ protected override void UpdateAfter()
{
// Automatically connect once the game is running
if (!_connected)
diff --git a/src/BizHawk.Client.EmuHawk/tools/GBA/GBAGPUView.cs b/src/BizHawk.Client.EmuHawk/tools/GBA/GBAGPUView.cs
index e003f1511a..0d4844c1b7 100644
--- a/src/BizHawk.Client.EmuHawk/tools/GBA/GBAGPUView.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/GBA/GBAGPUView.cs
@@ -29,8 +29,6 @@ namespace BizHawk.Client.EmuHawk
// MobileDetailView memory;
- public bool UpdateBefore => true;
-
public GbaGpuView()
{
InitializeComponent();
@@ -699,7 +697,6 @@ namespace BizHawk.Client.EmuHawk
}
}
-
public void Restart()
{
var mem = GBA.GetMemoryAreas();
@@ -709,13 +706,10 @@ namespace BizHawk.Client.EmuHawk
_mmio = mem.mmio;
_cbScanlineEmu = 500; // force an update
- UpdateValues();
+ GeneralUpdate();
}
- public void NewUpdate(ToolFormUpdateType type) { }
-
- /// belongs in ToolsBefore
- public void UpdateValues()
+ protected override void UpdateBefore()
{
if (!IsHandleCreated || IsDisposed)
{
@@ -736,11 +730,6 @@ namespace BizHawk.Client.EmuHawk
}
}
- public void FastUpdate()
- {
- // Do nothing
- }
-
private void ShowSelectedWidget()
{
if (listBoxWidgets.SelectedItem != null)
diff --git a/src/BizHawk.Client.EmuHawk/tools/GameShark.cs b/src/BizHawk.Client.EmuHawk/tools/GameShark.cs
index 3f8f5f8a9a..821ced311e 100644
--- a/src/BizHawk.Client.EmuHawk/tools/GameShark.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/GameShark.cs
@@ -27,28 +27,10 @@ namespace BizHawk.Client.EmuHawk
InitializeComponent();
}
- #region IToolForm
-
- public bool UpdateBefore => true;
-
- public void FastUpdate()
- {
- }
-
public void Restart()
{
}
- public void NewUpdate(ToolFormUpdateType type)
- {
- }
-
- public void UpdateValues()
- {
- }
-
- #endregion
-
private void Go_Click(object sender, EventArgs e)
{
foreach (var l in txtCheat.Lines)
diff --git a/src/BizHawk.Client.EmuHawk/tools/Genesis/VDPViewer.cs b/src/BizHawk.Client.EmuHawk/tools/Genesis/VDPViewer.cs
index bde647c8d2..70be5a4d35 100644
--- a/src/BizHawk.Client.EmuHawk/tools/Genesis/VDPViewer.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/Genesis/VDPViewer.cs
@@ -117,9 +117,7 @@ namespace BizHawk.Client.EmuHawk
bmpViewTiles.Refresh();
}
- public void NewUpdate(ToolFormUpdateType type) { }
-
- public unsafe void UpdateValues()
+ protected override unsafe void UpdateBefore()
{
if (Emu == null)
{
@@ -140,24 +138,17 @@ namespace BizHawk.Client.EmuHawk
}
}
- public void FastUpdate()
- {
- // Do nothing
- }
-
public void Restart()
{
- UpdateValues();
+ GeneralUpdate();
}
- public bool UpdateBefore => true;
-
private void bmpViewPal_MouseClick(object sender, MouseEventArgs e)
{
int idx = e.Y / 16;
idx = Math.Min(3, Math.Max(idx, 0));
_palIndex = idx;
- UpdateValues();
+ GeneralUpdate();
}
private void VDPViewer_KeyDown(object sender, KeyEventArgs e)
diff --git a/src/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs b/src/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs
index 583cf91273..b6d5db8fa2 100644
--- a/src/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs
@@ -149,31 +149,22 @@ namespace BizHawk.Client.EmuHawk
LoadFileFromRecent(RecentTables[0]);
}
- FullUpdate();
+ GeneralUpdate();
}
#region API
- public bool UpdateBefore => false;
-
- public void NewUpdate(ToolFormUpdateType type) { }
-
- public void UpdateValues()
+ protected override void UpdateAfter()
{
AddressesLabel.Text = GenerateMemoryViewString(true);
}
- public void FullUpdate()
+ protected override void GeneralUpdate()
{
AddressesLabel.Text = GenerateMemoryViewString(true);
AddressLabel.Text = GenerateAddressString();
}
- public void FastUpdate()
- {
- // Do nothing
- }
-
public void Restart()
{
if (!(MainForm.CurrentlyOpenRomArgs.OpenAdvanced is OpenAdvanced_MAME))
@@ -210,7 +201,7 @@ namespace BizHawk.Client.EmuHawk
SetDataSize(DataSize);
SetHeader();
- FullUpdate();
+ GeneralUpdate();
}
public void SetToAddresses(IEnumerable addresses, MemoryDomain domain, WatchSize size)
@@ -225,7 +216,7 @@ namespace BizHawk.Client.EmuHawk
_secondaryHighlightedAddresses.Clear();
_secondaryHighlightedAddresses.AddRange(addrList.Where(addr => addr != addrList[0]));
ClearNibbles();
- FullUpdate();
+ GeneralUpdate();
MemoryViewerBox.Refresh();
}
}
@@ -691,7 +682,7 @@ namespace BizHawk.Client.EmuHawk
UpdateGroupBoxTitle();
SetHeader();
- FullUpdate();
+ GeneralUpdate();
LastDomain = _domain.Name;
}
@@ -727,7 +718,7 @@ namespace BizHawk.Client.EmuHawk
SetHighlighted(address);
ClearNibbles();
- FullUpdate();
+ GeneralUpdate();
MemoryViewerBox.Refresh();
}
@@ -802,7 +793,7 @@ namespace BizHawk.Client.EmuHawk
_digitFormatString = $"{{0:X{DataSize * 2}}} ";
SetHeader();
UpdateGroupBoxTitle();
- FullUpdate();
+ GeneralUpdate();
_secondaryHighlightedAddresses.Clear();
}
}
@@ -1369,7 +1360,7 @@ namespace BizHawk.Client.EmuHawk
{
LoadTable(ofd.FileName);
RecentTables.Add(ofd.FileName);
- FullUpdate();
+ GeneralUpdate();
}
}
@@ -1389,7 +1380,7 @@ namespace BizHawk.Client.EmuHawk
else
{
RecentTables.Add(path);
- FullUpdate();
+ GeneralUpdate();
}
}
@@ -1519,7 +1510,7 @@ namespace BizHawk.Client.EmuHawk
}
}
- FullUpdate();
+ GeneralUpdate();
}
private bool _lastSearchWasText;
@@ -1631,7 +1622,7 @@ namespace BizHawk.Client.EmuHawk
private void BigEndianMenuItem_Click(object sender, EventArgs e)
{
BigEndian ^= true;
- FullUpdate();
+ GeneralUpdate();
}
private void GoToAddressMenuItem_Click(object sender, EventArgs e)
@@ -1734,7 +1725,7 @@ namespace BizHawk.Client.EmuHawk
poke.SetWatch(watches);
poke.ShowHawkDialog();
- FullUpdate();
+ GeneralUpdate();
}
}
@@ -1765,7 +1756,7 @@ namespace BizHawk.Client.EmuHawk
private void HexEditor_Resize(object sender, EventArgs e)
{
SetUpScrollBar();
- FullUpdate();
+ GeneralUpdate();
}
private void HexEditor_ResizeEnd(object sender, EventArgs e)
@@ -2014,12 +2005,12 @@ namespace BizHawk.Client.EmuHawk
ClearNibbles();
SetHighlighted(currentAddress + DataSize);
- FullUpdate();
+ GeneralUpdate();
Refresh();
}
UpdateGroupBoxTitle();
- FullUpdate();
+ GeneralUpdate();
}
private void ViewerContextMenuStrip_Opening(object sender, CancelEventArgs e)
@@ -2075,7 +2066,7 @@ namespace BizHawk.Client.EmuHawk
_secondaryHighlightedAddresses.ForEach(IncrementAddress);
- FullUpdate();
+ GeneralUpdate();
}
private void DecrementContextItem_Click(object sender, EventArgs e)
@@ -2092,7 +2083,7 @@ namespace BizHawk.Client.EmuHawk
_secondaryHighlightedAddresses.ForEach(DecrementAddress);
- FullUpdate();
+ GeneralUpdate();
}
#endregion
@@ -2289,7 +2280,7 @@ namespace BizHawk.Client.EmuHawk
_programmaticallyChangingValue = false;
}
- FullUpdate();
+ GeneralUpdate();
}
}
diff --git a/src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/TAStudioLuaLibrary.cs b/src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/TAStudioLuaLibrary.cs
index e212f3e041..9d33e93b9a 100644
--- a/src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/TAStudioLuaLibrary.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/TAStudioLuaLibrary.cs
@@ -437,7 +437,7 @@ namespace BizHawk.Client.EmuHawk
if (marker != null)
{
Tastudio.CurrentTasMovie.Markers.Remove(marker);
- Tastudio.UpdateValues();
+ Tastudio.RefreshDialog();
}
}
}
@@ -456,7 +456,7 @@ namespace BizHawk.Client.EmuHawk
else
{
Tastudio.CurrentTasMovie.Markers.Add(frame, message);
- Tastudio.UpdateValues();
+ Tastudio.RefreshDialog();
}
}
}
diff --git a/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs b/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs
index 2592add533..e238fff727 100644
--- a/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs
@@ -113,24 +113,10 @@ namespace BizHawk.Client.EmuHawk
public LuaLibraries LuaImp { get; private set; }
- public bool UpdateBefore => true;
-
private IEnumerable SelectedItems => LuaListView.SelectedRows.Select(index => LuaImp.ScriptList[index]);
private IEnumerable SelectedFiles => SelectedItems.Where(x => !x.IsSeparator);
- public void NewUpdate(ToolFormUpdateType type) { }
-
- public void UpdateValues()
- {
- // Do nothing
- }
-
- public void FastUpdate()
- {
- // Do nothing
- }
-
private void LuaConsole_Load(object sender, EventArgs e)
{
// Hack for previous config settings
diff --git a/src/BizHawk.Client.EmuHawk/tools/Macros/MacroInput.cs b/src/BizHawk.Client.EmuHawk/tools/Macros/MacroInput.cs
index 43a4897671..60d20945e8 100644
--- a/src/BizHawk.Client.EmuHawk/tools/Macros/MacroInput.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/Macros/MacroInput.cs
@@ -87,21 +87,6 @@ namespace BizHawk.Client.EmuHawk
MacroInputTool_Load(null, null);
}
- public void NewUpdate(ToolFormUpdateType type) { }
-
- // These do absolutely nothing.
- public void UpdateValues()
- {
-
- }
-
- public void FastUpdate()
- {
-
- }
-
- public bool UpdateBefore => true;
-
public override bool AskSaveChanges()
{
if (_unsavedZones.Count == 0 || IsDisposed)
diff --git a/src/BizHawk.Client.EmuHawk/tools/Macros/MovieZone.cs b/src/BizHawk.Client.EmuHawk/tools/Macros/MovieZone.cs
index 39a248ca05..b52baf9678 100644
--- a/src/BizHawk.Client.EmuHawk/tools/Macros/MovieZone.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/Macros/MovieZone.cs
@@ -187,7 +187,7 @@ namespace BizHawk.Client.EmuHawk
}
else if (_tools.IsLoaded())
{
- _tools.TAStudio.UpdateValues();
+ _tools.UpdateValues();
}
}
diff --git a/src/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs b/src/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs
index 57295cd5fc..31f49f054e 100644
--- a/src/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs
@@ -61,26 +61,10 @@ namespace BizHawk.Client.EmuHawk
}
}
- #region IToolForm
-
- public void NewUpdate(ToolFormUpdateType type) { }
-
- public void UpdateValues()
- {
- }
-
- public void FastUpdate()
- {
- }
-
public void Restart()
{
}
- public bool UpdateBefore => true;
-
- #endregion
-
private void CancelBtn_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
diff --git a/src/BizHawk.Client.EmuHawk/tools/NES/BarcodeEntry.cs b/src/BizHawk.Client.EmuHawk/tools/NES/BarcodeEntry.cs
index 827f5e4d91..2b056a8695 100644
--- a/src/BizHawk.Client.EmuHawk/tools/NES/BarcodeEntry.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/NES/BarcodeEntry.cs
@@ -7,7 +7,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
{
- public partial class BarcodeEntry : Form, IToolForm
+ public partial class BarcodeEntry : ToolFormBase, IToolForm
{
[RequiredService]
private DatachBarcode Reader { get; set; }
@@ -17,32 +17,11 @@ namespace BizHawk.Client.EmuHawk
InitializeComponent();
}
- #region IToolForm
-
- public void NewUpdate(ToolFormUpdateType type) { }
-
- public void UpdateValues()
- {
- }
-
- public void FastUpdate()
- {
- }
-
public void Restart()
{
textBox1_TextChanged(null, null);
}
- public bool AskSaveChanges()
- {
- return true;
- }
-
- public bool UpdateBefore => false;
-
- #endregion
-
private void textBox1_TextChanged(object sender, EventArgs e)
{
if (!DatachBarcode.ValidString(textBox1.Text, out var why))
diff --git a/src/BizHawk.Client.EmuHawk/tools/NES/NESMusicRipper.cs b/src/BizHawk.Client.EmuHawk/tools/NES/NESMusicRipper.cs
index 2d487e5413..7870b8daa6 100644
--- a/src/BizHawk.Client.EmuHawk/tools/NES/NESMusicRipper.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/NES/NESMusicRipper.cs
@@ -26,23 +26,10 @@ namespace BizHawk.Client.EmuHawk
SyncContents();
}
- public bool UpdateBefore => true;
-
public void Restart()
{
}
- public void NewUpdate(ToolFormUpdateType type) { }
-
- public void UpdateValues()
- {
- }
-
- public void FastUpdate()
- {
- // Do nothing
- }
-
private bool _isRunning;
// http://www.phy.mtu.edu/~suits/notefreqs.html
diff --git a/src/BizHawk.Client.EmuHawk/tools/NES/NESNameTableViewer.cs b/src/BizHawk.Client.EmuHawk/tools/NES/NESNameTableViewer.cs
index 7128ffe8c8..e64819be50 100644
--- a/src/BizHawk.Client.EmuHawk/tools/NES/NESNameTableViewer.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/NES/NESNameTableViewer.cs
@@ -37,29 +37,16 @@ namespace BizHawk.Client.EmuHawk
Generate(true);
}
- #region Public API
-
- public bool UpdateBefore => true;
-
public void Restart()
{
Generate(true);
}
- public void NewUpdate(ToolFormUpdateType type) { }
-
- public void UpdateValues()
+ protected override void UpdateBefore()
{
_ppu.InstallCallback1(() => Generate(), _scanline);
}
- public void FastUpdate()
- {
- // Do nothing
- }
-
- #endregion
-
private unsafe void DrawTile(int* dst, int pitch, byte* pal, byte* tile, int* finalPal)
{
dst += 7;
@@ -213,7 +200,7 @@ namespace BizHawk.Client.EmuHawk
private void RefreshImageContextMenuItem_Click(object sender, EventArgs e)
{
- UpdateValues();
+ GeneralUpdate();
NameTableView.Refresh();
}
diff --git a/src/BizHawk.Client.EmuHawk/tools/NES/NESPPU.cs b/src/BizHawk.Client.EmuHawk/tools/NES/NESPPU.cs
index 1fde857cfa..e2a1f16d72 100644
--- a/src/BizHawk.Client.EmuHawk/tools/NES/NESPPU.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/NES/NESPPU.cs
@@ -57,29 +57,17 @@ namespace BizHawk.Client.EmuHawk
ChrRomViewReload();
}
- #region Public API
-
- public bool UpdateBefore => true;
-
- public void NewUpdate(ToolFormUpdateType type) { }
- public void UpdateValues()
+ protected override void UpdateBefore()
{
_ppu.InstallCallback2(() => Generate(), _scanline);
}
- public void FastUpdate()
- {
- // Do nothing
- }
-
public void Restart()
{
Generate(true);
ChrRomViewReload();
}
- #endregion
-
private byte GetBit(byte[] ppuBus, int address, int bit)
{
return (byte)((ppuBus[address] >> (7 - bit)) & 1);
diff --git a/src/BizHawk.Client.EmuHawk/tools/PCE/PCEBGViewer.cs b/src/BizHawk.Client.EmuHawk/tools/PCE/PCEBGViewer.cs
index 762cbb1cca..35c304788c 100644
--- a/src/BizHawk.Client.EmuHawk/tools/PCE/PCEBGViewer.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/PCE/PCEBGViewer.cs
@@ -30,10 +30,6 @@ namespace BizHawk.Client.EmuHawk
Activated += (o, e) => Generate();
}
- #region Public API
-
- public bool UpdateBefore => true;
-
public unsafe void Generate()
{
if (PCE.Frame % RefreshRate.Value != 0)
@@ -85,19 +81,7 @@ namespace BizHawk.Client.EmuHawk
// Nothing to do
}
- public void NewUpdate(ToolFormUpdateType type) { }
-
- public void UpdateValues()
- {
- Generate();
- }
-
- public void FastUpdate()
- {
- // Do nothing
- }
-
- #endregion
+ protected override void UpdateBefore() => Generate();
#region Events
diff --git a/src/BizHawk.Client.EmuHawk/tools/PCE/PCESoundDebugger.cs b/src/BizHawk.Client.EmuHawk/tools/PCE/PCESoundDebugger.cs
index 55894c2414..0f8081c696 100644
--- a/src/BizHawk.Client.EmuHawk/tools/PCE/PCESoundDebugger.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/PCE/PCESoundDebugger.cs
@@ -38,9 +38,7 @@ namespace BizHawk.Client.EmuHawk
base.OnShown(e);
}
- public void NewUpdate(ToolFormUpdateType type) { }
-
- public void UpdateValues()
+ protected override void UpdateAfter()
{
foreach (var entry in _psgEntries)
{
@@ -147,11 +145,6 @@ namespace BizHawk.Client.EmuHawk
lvChannels.EndUpdate();
}
- public void FastUpdate()
- {
- // Todo
- }
-
private class PsgEntry
{
public int Index { get; set; }
@@ -170,8 +163,6 @@ namespace BizHawk.Client.EmuHawk
{
}
- public bool UpdateBefore => false;
-
// 32*16 samples, 16bit, mono, 8khz (but we'll change the sample rate)
private static readonly byte[] EmptyWav = {
0x52, 0x49, 0x46, 0x46, 0x24, 0x04, 0x00, 0x00, 0x57, 0x41, 0x56, 0x45, 0x66, 0x6D, 0x74, 0x20,
diff --git a/src/BizHawk.Client.EmuHawk/tools/PCE/PCETileViewer.cs b/src/BizHawk.Client.EmuHawk/tools/PCE/PCETileViewer.cs
index 94e9aa9d7a..7e9b7bcbb6 100644
--- a/src/BizHawk.Client.EmuHawk/tools/PCE/PCETileViewer.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/PCE/PCETileViewer.cs
@@ -30,11 +30,7 @@ namespace BizHawk.Client.EmuHawk
bmpViewSPPal.ChangeBitmapSize(256, 256);
}
- #region IToolForm
-
- public void NewUpdate(ToolFormUpdateType type) { }
-
- public void UpdateValues()
+ protected override void UpdateBefore()
{
DrawBacks();
DrawSprites();
@@ -45,11 +41,6 @@ namespace BizHawk.Client.EmuHawk
bmpViewSPPal.Refresh();
}
- public void FastUpdate()
- {
- // Do nothing
- }
-
static unsafe void Draw16x16(byte* src, int* dest, int pitch, int* pal)
{
int inc = pitch - 16;
@@ -164,14 +155,10 @@ namespace BizHawk.Client.EmuHawk
CheckBoxVDC2_CheckedChanged(null, null);
}
- public bool UpdateBefore => true;
-
- #endregion
-
private void CheckBoxVDC2_CheckedChanged(object sender, EventArgs e)
{
_vdc = checkBoxVDC2.Checked ? Emu.VDC2 : Emu.VDC1;
- UpdateValues();
+ GeneralUpdate();
}
private void BmpViewBGPal_MouseClick(object sender, MouseEventArgs e)
diff --git a/src/BizHawk.Client.EmuHawk/tools/SMS/VDPViewer.cs b/src/BizHawk.Client.EmuHawk/tools/SMS/VDPViewer.cs
index 9b5d8054ad..e95a295afa 100644
--- a/src/BizHawk.Client.EmuHawk/tools/SMS/VDPViewer.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/SMS/VDPViewer.cs
@@ -135,9 +135,7 @@ namespace BizHawk.Client.EmuHawk
bmpViewPalette.Refresh();
}
- public void NewUpdate(ToolFormUpdateType type) { }
-
- public void UpdateValues()
+ protected override void UpdateBefore()
{
unsafe
{
@@ -150,18 +148,11 @@ namespace BizHawk.Client.EmuHawk
}
}
- public void FastUpdate()
- {
- // Do nothing
- }
-
public void Restart()
{
- UpdateValues();
+ GeneralUpdate();
}
- public bool UpdateBefore => true;
-
private void bmpViewPalette_MouseClick(object sender, MouseEventArgs e)
{
int p = Math.Min(Math.Max(e.Y / 16, 0), 1);
diff --git a/src/BizHawk.Client.EmuHawk/tools/SNES/SNESGraphicsDebugger.cs b/src/BizHawk.Client.EmuHawk/tools/SNES/SNESGraphicsDebugger.cs
index 0d61167506..3dffee24b6 100644
--- a/src/BizHawk.Client.EmuHawk/tools/SNES/SNESGraphicsDebugger.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/SNES/SNESGraphicsDebugger.cs
@@ -40,8 +40,6 @@ namespace BizHawk.Client.EmuHawk
{
readonly List displayTypeItems = new List();
- public bool UpdateBefore => false;
-
[RequiredService]
private LibsnesCore Emulator { get; set; }
@@ -130,9 +128,7 @@ namespace BizHawk.Client.EmuHawk
: $"@{address:X4} ({address / 1024}K)";
}
- public void NewUpdate(ToolFormUpdateType type) { }
-
- public void UpdateValues()
+ protected override void UpdateAfter()
{
SyncCore();
if (Visible && !checkScanlineControl.Checked)
@@ -142,11 +138,6 @@ namespace BizHawk.Client.EmuHawk
}
}
- public void FastUpdate()
- {
- // To do
- }
-
public void UpdateToolsLoadstate()
{
SyncCore();
diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IToolForm.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IToolForm.cs
index 772a444ce4..f1924fe8c4 100644
--- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IToolForm.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IToolForm.cs
@@ -22,13 +22,14 @@ namespace BizHawk.Client.EmuHawk
private bool _hackyDontUpdate;
private bool _initializing; // If true, will bypass restart logic, this is necessary since loading projects causes a movie to load which causes a rom to reload causing dialogs to restart
- public bool UpdateBefore => false;
-
- public void NewUpdate(ToolFormUpdateType type) { }
-
private int _lastRefresh;
- public void UpdateValues()
+ protected override void GeneralUpdate()
+ {
+ RefreshDialog();
+ }
+
+ protected override void UpdateAfter()
{
if (!IsHandleCreated || IsDisposed || CurrentTasMovie == null)
{
@@ -62,11 +63,6 @@ namespace BizHawk.Client.EmuHawk
RefreshDialog(refreshNeeded, refreshBranches: false);
}
- public void FastUpdate()
- {
- // Do nothing
- }
-
public void Restart()
{
if (!IsHandleCreated || IsDisposed)
diff --git a/src/BizHawk.Client.EmuHawk/tools/TI83/TI83KeyPad.cs b/src/BizHawk.Client.EmuHawk/tools/TI83/TI83KeyPad.cs
index 62c2f72df8..4460aa49dd 100644
--- a/src/BizHawk.Client.EmuHawk/tools/TI83/TI83KeyPad.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/TI83/TI83KeyPad.cs
@@ -33,29 +33,11 @@ namespace BizHawk.Client.EmuHawk
Global.InputManager.ClickyVirtualPadController.Click(name);
}
- #region Public API
-
- public bool UpdateBefore => false;
-
- public void NewUpdate(ToolFormUpdateType type) { }
-
- public void UpdateValues()
- {
- // Do nothing
- }
-
- public void FastUpdate()
- {
- // Do nothing
- }
-
public void Restart()
{
// Do nothing
}
- #endregion
-
private void SetToolTips()
{
// Set button hotkey mapping into tooltips
diff --git a/src/BizHawk.Client.EmuHawk/tools/ToolBox.cs b/src/BizHawk.Client.EmuHawk/tools/ToolBox.cs
index 1b120a724a..5a34f8a9da 100644
--- a/src/BizHawk.Client.EmuHawk/tools/ToolBox.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/ToolBox.cs
@@ -28,16 +28,6 @@ namespace BizHawk.Client.EmuHawk
);
}
- public void NewUpdate(ToolFormUpdateType type) { }
-
- public bool UpdateBefore => false;
- public void UpdateValues() { }
-
- public void FastUpdate()
- {
- // Do nothing
- }
-
public void Restart()
{
SetTools();
diff --git a/src/BizHawk.Client.EmuHawk/tools/ToolFormBase.cs b/src/BizHawk.Client.EmuHawk/tools/ToolFormBase.cs
index ae1033089e..389f729739 100644
--- a/src/BizHawk.Client.EmuHawk/tools/ToolFormBase.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/ToolFormBase.cs
@@ -18,6 +18,34 @@ namespace BizHawk.Client.EmuHawk
public virtual bool AskSaveChanges() => true;
+ public virtual void UpdateValues(ToolFormUpdateType type)
+ {
+ switch (type)
+ {
+ case ToolFormUpdateType.PreFrame:
+ UpdateBefore();
+ break;
+ case ToolFormUpdateType.PostFrame:
+ UpdateAfter();
+ break;
+ case ToolFormUpdateType.General:
+ GeneralUpdate();
+ break;
+ case ToolFormUpdateType.FastPreFrame:
+ FastUpdateBefore();
+ break;
+ case ToolFormUpdateType.FastPostFrame:
+ FastUpdateAfter();
+ break;
+ }
+ }
+
+ protected virtual void UpdateBefore() { }
+ protected virtual void UpdateAfter() { }
+ protected virtual void GeneralUpdate() { }
+ protected virtual void FastUpdateBefore() { }
+ protected virtual void FastUpdateAfter() { }
+
public static FileInfo OpenFileDialog(string currentFile, string path, string fileType, string fileExt)
{
if (!Directory.Exists(path))
diff --git a/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs b/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs
index 5083ab332b..4a44e93f65 100644
--- a/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs
@@ -464,42 +464,24 @@ namespace BizHawk.Client.EmuHawk
private void UpdateBefore()
{
- var beforeList = _tools.Where(t => t.UpdateBefore);
- foreach (var tool in beforeList)
+ foreach (var tool in _tools)
{
if (!tool.IsDisposed
|| (tool is RamWatch && _config.DisplayRamWatch)) // RAM Watch hack, on screen display should run even if RAM Watch is closed
{
- tool.UpdateValues();
- }
- }
-
- foreach (var tool in _tools)
- {
- if (!tool.IsDisposed)
- {
- tool.NewUpdate(ToolFormUpdateType.PreFrame);
+ tool.UpdateValues(ToolFormUpdateType.PreFrame);
}
}
}
private void UpdateAfter()
{
- var afterList = _tools.Where(t => !t.UpdateBefore);
- foreach (var tool in afterList)
+ foreach (var tool in _tools)
{
if (!tool.IsDisposed
|| (tool is RamWatch && _config.DisplayRamWatch)) // RAM Watch hack, on screen display should run even if RAM Watch is closed
{
- tool.UpdateValues();
- }
- }
-
- foreach (var tool in _tools)
- {
- if (!tool.IsDisposed)
- {
- tool.NewUpdate(ToolFormUpdateType.PostFrame);
+ tool.UpdateValues(ToolFormUpdateType.PostFrame);
}
}
}
@@ -516,7 +498,7 @@ namespace BizHawk.Client.EmuHawk
if (!tool.IsDisposed ||
(tool is RamWatch && _config.DisplayRamWatch)) // RAM Watch hack, on screen display should run even if RAM Watch is closed
{
- tool.UpdateValues();
+ tool.UpdateValues(ToolFormUpdateType.General);
}
}
}
@@ -585,22 +567,6 @@ namespace BizHawk.Client.EmuHawk
.All(result => result);
}
- ///
- /// Calls AskSave() on an instance of T, if it exists, else returns true
- /// The caller should interpret false as cancel and will back out of the action that invokes this call
- ///
- /// Type of tool
- public bool AskSave() where T : IToolForm
- {
- if (_config.SuppressAskSave) // User has elected to not be nagged
- {
- return true;
- }
-
- var tool = _tools.FirstOrDefault(t => t is T);
- return tool != null && tool.AskSaveChanges();
- }
-
///
/// If T exists, this call will close the tool, and remove it from memory
///
@@ -732,13 +698,12 @@ namespace BizHawk.Client.EmuHawk
public void FastUpdateBefore()
{
- var beforeList = _tools.Where(t => t.UpdateBefore);
- foreach (var tool in beforeList)
+ foreach (var tool in _tools)
{
if (!tool.IsDisposed
|| (tool is RamWatch && _config.DisplayRamWatch)) // RAM Watch hack, on screen display should run even if RAM Watch is closed
{
- tool.FastUpdate();
+ tool.UpdateValues(ToolFormUpdateType.FastPreFrame);
}
}
}
@@ -750,13 +715,12 @@ namespace BizHawk.Client.EmuHawk
LuaConsole.ResumeScripts(true);
}
- var afterList = _tools.Where(t => !t.UpdateBefore);
- foreach (var tool in afterList)
+ foreach (var tool in _tools)
{
if (!tool.IsDisposed
|| (tool is RamWatch && _config.DisplayRamWatch)) // RAM Watch hack, on screen display should run even if RAM Watch is closed
{
- tool.FastUpdate();
+ tool.UpdateValues(ToolFormUpdateType.FastPostFrame);
}
}
@@ -817,8 +781,6 @@ namespace BizHawk.Client.EmuHawk
public RamSearch RamSearch => GetTool();
- public Cheats Cheats => GetTool();
-
public HexEditor HexEditor => GetTool();
public VirtualpadTool VirtualPad => GetTool();
@@ -889,11 +851,7 @@ namespace BizHawk.Client.EmuHawk
UpdateValues();
UpdateValues();
UpdateValues();
-
- if (Has())
- {
- Cheats.UpdateDialog();
- }
+ UpdateValues();
_owner.UpdateCheatStatus();
}
diff --git a/src/BizHawk.Client.EmuHawk/tools/TraceLogger.cs b/src/BizHawk.Client.EmuHawk/tools/TraceLogger.cs
index 1e98f4d898..955949be56 100644
--- a/src/BizHawk.Client.EmuHawk/tools/TraceLogger.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/TraceLogger.cs
@@ -93,8 +93,6 @@ namespace BizHawk.Client.EmuHawk
});
}
- public bool UpdateBefore => false;
-
private void SaveConfigSettings()
{
//Tracer.Enabled = LoggingEnabled.Checked;
@@ -133,9 +131,7 @@ namespace BizHawk.Client.EmuHawk
public Action Putter { get; set; }
}
- public void UpdateValues() { }
-
- public void NewUpdate(ToolFormUpdateType type)
+ public override void UpdateValues(ToolFormUpdateType type)
{
if (type == ToolFormUpdateType.PostFrame)
{
@@ -192,10 +188,6 @@ namespace BizHawk.Client.EmuHawk
}
}
- public void FastUpdate()
- {
- }
-
public void Restart()
{
CloseFile();
diff --git a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs
index 26ac7b42b7..15b9036455 100644
--- a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs
@@ -127,10 +127,6 @@ namespace BizHawk.Client.EmuHawk
}
}
- #region IToolForm Implementation
-
- public bool UpdateBefore => false;
-
public void Restart()
{
if (!IsHandleCreated || IsDisposed)
@@ -141,9 +137,7 @@ namespace BizHawk.Client.EmuHawk
CreatePads();
}
- public void NewUpdate(ToolFormUpdateType type) { }
-
- public void UpdateValues()
+ protected override void UpdateAfter()
{
if (!IsHandleCreated || IsDisposed)
{
@@ -178,7 +172,7 @@ namespace BizHawk.Client.EmuHawk
Pads.ForEach(pad => pad.UpdateValues());
}
- public void FastUpdate()
+ protected override void FastUpdateAfter()
{
// TODO: SetPrevious logic should go here too or that will get out of whack
@@ -188,8 +182,6 @@ namespace BizHawk.Client.EmuHawk
}
}
- #endregion
-
#region Menu
private void PadsSubMenu_DropDownOpened(object sender, EventArgs e)
diff --git a/src/BizHawk.Client.EmuHawk/tools/Watch/RamPoke.cs b/src/BizHawk.Client.EmuHawk/tools/Watch/RamPoke.cs
index 6bddc22761..aae9479c16 100644
--- a/src/BizHawk.Client.EmuHawk/tools/Watch/RamPoke.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/Watch/RamPoke.cs
@@ -93,7 +93,7 @@ namespace BizHawk.Client.EmuHawk
{
var success = _watchList.All(watch => watch.Poke(ValueBox.Text));
- ParentTool?.UpdateValues();
+ ParentTool?.UpdateValues(ToolFormUpdateType.General);
if (success)
{
diff --git a/src/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs b/src/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs
index b6e1ee8076..e89253000b 100644
--- a/src/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs
@@ -71,8 +71,6 @@ namespace BizHawk.Client.EmuHawk
[ConfigPersist]
public RamSearchSettings Settings { get; set; }
- public bool UpdateBefore => false;
-
private void HardSetDisplayTypeDropDown(Common.DisplayType type)
{
foreach (var item in DisplayTypeDropdown.Items)
@@ -248,14 +246,21 @@ namespace BizHawk.Client.EmuHawk
SetTotal();
}
- public void NewUpdate(ToolFormUpdateType type)
+ public override void UpdateValues(ToolFormUpdateType type)
{
+ switch (type)
+ {
+ case ToolFormUpdateType.PostFrame:
+ case ToolFormUpdateType.General:
+ FrameUpdate();
+ break;
+ case ToolFormUpdateType.FastPostFrame:
+ MinimalUpdate();
+ break;
+ }
}
- ///
- /// This should only be called when the values of the list need an update such as after a poke or emulation occurred
- ///
- public void UpdateValues()
+ private void FrameUpdate()
{
if (_searches.Count > 0)
{
@@ -278,7 +283,7 @@ namespace BizHawk.Client.EmuHawk
}
}
- public void FastUpdate()
+ private void MinimalUpdate()
{
if (_searches.Count > 0)
{
diff --git a/src/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs b/src/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs
index c3b4e65847..b9b92114e2 100644
--- a/src/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs
@@ -99,15 +99,13 @@ namespace BizHawk.Client.EmuHawk
public IEnumerable Watches => _watches.Where(x => !x.IsSeparator);
- public bool UpdateBefore => false;
-
#region API
public void AddWatch(Watch watch)
{
_watches.Add(watch);
WatchListView.RowCount = _watches.Count;
- UpdateValues();
+ GeneralUpdate();
UpdateWatchCount();
Changes();
}
@@ -165,7 +163,7 @@ namespace BizHawk.Client.EmuHawk
Config.RecentWatches.Add(path);
WatchListView.RowCount = _watches.Count;
UpdateWatchCount();
- UpdateValues();
+ GeneralUpdate();
UpdateStatusBar();
_watches.Changes = false;
}
@@ -189,7 +187,7 @@ namespace BizHawk.Client.EmuHawk
UpdateWatchCount();
Config.RecentWatches.Add(_watches.CurrentFileName);
UpdateStatusBar();
- UpdateValues();
+ GeneralUpdate();
PokeAddressToolBarItem.Enabled =
FreezeAddressToolBarItem.Enabled =
SelectedIndices.Any()
@@ -212,7 +210,7 @@ namespace BizHawk.Client.EmuHawk
{
_watches.RefreshDomains(MemoryDomains);
_watches.Reload();
- UpdateValues();
+ GeneralUpdate();
UpdateStatusBar();
}
else
@@ -222,8 +220,58 @@ namespace BizHawk.Client.EmuHawk
}
}
- public void NewUpdate(ToolFormUpdateType type)
+ public override void UpdateValues(ToolFormUpdateType type)
{
+ switch (type)
+ {
+ case ToolFormUpdateType.PostFrame:
+ case ToolFormUpdateType.General:
+ FrameUpdate();
+ break;
+ case ToolFormUpdateType.FastPostFrame:
+ MinimalUpdate();
+ break;
+ }
+ }
+
+ #endregion
+
+ #region Private Methods
+
+ private void MinimalUpdate()
+ {
+ if ((!IsHandleCreated || IsDisposed) && !Config.DisplayRamWatch)
+ {
+ return;
+ }
+
+ if (_watches.Any())
+ {
+ _watches.UpdateValues();
+ DisplayOnScreenWatches();
+ }
+ }
+
+ private void FrameUpdate()
+ {
+ if ((!IsHandleCreated || IsDisposed) && !Config.DisplayRamWatch)
+ {
+ return;
+ }
+
+ GlobalWin.OSD.ClearRamWatches();
+ if (_watches.Any())
+ {
+ _watches.UpdateValues();
+ DisplayOnScreenWatches();
+
+ if (!IsHandleCreated || IsDisposed)
+ {
+ return;
+ }
+
+ WatchListView.RowCount = _watches.Count;
+ }
}
private void DisplayOnScreenWatches()
@@ -247,46 +295,6 @@ namespace BizHawk.Client.EmuHawk
}
}
- public void UpdateValues()
- {
- if ((!IsHandleCreated || IsDisposed) && !Config.DisplayRamWatch)
- {
- return;
- }
-
- GlobalWin.OSD.ClearRamWatches();
- if (_watches.Any())
- {
- _watches.UpdateValues();
- DisplayOnScreenWatches();
-
- if (!IsHandleCreated || IsDisposed)
- {
- return;
- }
-
- WatchListView.RowCount = _watches.Count;
- }
- }
-
- public void FastUpdate()
- {
- if ((!IsHandleCreated || IsDisposed) && !Config.DisplayRamWatch)
- {
- return;
- }
-
- if (_watches.Any())
- {
- _watches.UpdateValues();
- DisplayOnScreenWatches();
- }
- }
-
- #endregion
-
- #region Private Methods
-
private void Changes()
{
_watches.Changes = true;
@@ -336,7 +344,7 @@ namespace BizHawk.Client.EmuHawk
WatchListView.RowCount = _watches.Count;
UpdateWatchCount();
UpdateStatusBar();
- UpdateValues();
+ GeneralUpdate();
}
private void EditWatch(bool duplicate = false)
@@ -380,7 +388,7 @@ namespace BizHawk.Client.EmuHawk
}
}
- UpdateValues();
+ GeneralUpdate();
}
else if (SelectedSeparators.Any() && !duplicate)
{
@@ -406,7 +414,7 @@ namespace BizHawk.Client.EmuHawk
}
}
- UpdateValues();
+ GeneralUpdate();
}
}
@@ -476,7 +484,7 @@ namespace BizHawk.Client.EmuHawk
{
_watches.Clear();
WatchListView.RowCount = _watches.Count;
- UpdateValues();
+ GeneralUpdate();
UpdateWatchCount();
UpdateStatusBar();
_sortReverse = false;
@@ -735,7 +743,7 @@ namespace BizHawk.Client.EmuHawk
Changes();
UpdateWatchCount();
WatchListView.RowCount = _watches.Count;
- UpdateValues();
+ GeneralUpdate();
}
}
@@ -755,7 +763,7 @@ namespace BizHawk.Client.EmuHawk
}
WatchListView.RowCount = _watches.Count;
- UpdateValues();
+ GeneralUpdate();
UpdateWatchCount();
}
}
@@ -778,7 +786,7 @@ namespace BizHawk.Client.EmuHawk
if (poke.ShowHawkDialog(this) == DialogResult.OK)
{
- UpdateValues();
+ GeneralUpdate();
}
}
}
@@ -816,7 +824,7 @@ namespace BizHawk.Client.EmuHawk
private void ClearChangeCountsMenuItem_Click(object sender, EventArgs e)
{
_watches.ClearChangeCounts();
- UpdateValues();
+ GeneralUpdate();
}
private void MoveUpMenuItem_Click(object sender, EventArgs e)
@@ -981,7 +989,7 @@ namespace BizHawk.Client.EmuHawk
}
else
{
- UpdateValues();
+ GeneralUpdate();
}
}
@@ -1057,7 +1065,7 @@ namespace BizHawk.Client.EmuHawk
_watches.Load(filePaths[0], append: false);
Config.RecentWatches.Add(_watches.CurrentFileName);
WatchListView.RowCount = _watches.Count;
- UpdateValues();
+ GeneralUpdate();
}
}
@@ -1217,7 +1225,7 @@ namespace BizHawk.Client.EmuHawk
}
WatchListView.RowCount = _watches.Count;
- UpdateValues();
+ GeneralUpdate();
UpdateWatchCount();
UpdateStatusBar();
}