diff --git a/BizHawk.Client.Common/tools/Interfaces/IToolForm.cs b/BizHawk.Client.Common/tools/Interfaces/IToolForm.cs
index 9d1bedf96d..f064998381 100644
--- a/BizHawk.Client.Common/tools/Interfaces/IToolForm.cs
+++ b/BizHawk.Client.Common/tools/Interfaces/IToolForm.cs
@@ -1,11 +1,35 @@
namespace BizHawk.Client.EmuHawk
{
+ public enum ToolFormUpdateType
+ {
+ //reserved
+ Legacy, LegacyFast,
+
+ //reserved concept: we can run other events through here (should probably rename then)
+ Reset,
+
+ ///
+ /// Called before a frame emulates
+ ///
+ PreFrame,
+
+ ///
+ /// Called after a frame emulates
+ ///
+ PostFrame
+ }
+
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
///
- void UpdateValues();
+ void UpdateValues();
+
+ ///
+ /// A new extensible update method
+ ///
+ void NewUpdate(ToolFormUpdateType type);
///
/// Will be called by the client when performance is critical,
@@ -32,6 +56,7 @@
/// 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; }
diff --git a/BizHawk.Client.EmuHawk/CoreFeatureAnalysis.cs b/BizHawk.Client.EmuHawk/CoreFeatureAnalysis.cs
index f92d5e6417..1b09703a87 100644
--- a/BizHawk.Client.EmuHawk/CoreFeatureAnalysis.cs
+++ b/BizHawk.Client.EmuHawk/CoreFeatureAnalysis.cs
@@ -129,6 +129,8 @@ namespace BizHawk.Client.EmuHawk
Close();
}
+ public void NewUpdate(ToolFormUpdateType type) { }
+
private TreeNode CreateCoreTree(CoreInfo ci)
{
var ret = new TreeNode
diff --git a/BizHawk.Client.EmuHawk/config/NES/NESSoundConfig.cs b/BizHawk.Client.EmuHawk/config/NES/NESSoundConfig.cs
index b20866231b..54306e6c9b 100644
--- a/BizHawk.Client.EmuHawk/config/NES/NESSoundConfig.cs
+++ b/BizHawk.Client.EmuHawk/config/NES/NESSoundConfig.cs
@@ -21,6 +21,8 @@ namespace BizHawk.Client.EmuHawk
{
}
+ public void NewUpdate(ToolFormUpdateType type) { }
+
public void FastUpdate()
{
}
diff --git a/BizHawk.Client.EmuHawk/tools/AutoHawk.cs b/BizHawk.Client.EmuHawk/tools/AutoHawk.cs
index fa56b6a20e..cda238bcfb 100644
--- a/BizHawk.Client.EmuHawk/tools/AutoHawk.cs
+++ b/BizHawk.Client.EmuHawk/tools/AutoHawk.cs
@@ -40,6 +40,8 @@ namespace BizHawk.Client.EmuHawk
#region IToolForm Implementation
+ public void NewUpdate(ToolFormUpdateType type) { }
+
public void UpdateValues()
{
// TODO: per frame stuff goes here
diff --git a/BizHawk.Client.EmuHawk/tools/BasicBot/BasicBot.cs b/BizHawk.Client.EmuHawk/tools/BasicBot/BasicBot.cs
index 401516c80d..1ce96bb3cc 100644
--- a/BizHawk.Client.EmuHawk/tools/BasicBot/BasicBot.cs
+++ b/BizHawk.Client.EmuHawk/tools/BasicBot/BasicBot.cs
@@ -371,6 +371,8 @@ namespace BizHawk.Client.EmuHawk
public bool UpdateBefore { get { return true; } }
+ public void NewUpdate(ToolFormUpdateType type) { }
+
public void UpdateValues()
{
Update(fast: false);
diff --git a/BizHawk.Client.EmuHawk/tools/CDL.cs b/BizHawk.Client.EmuHawk/tools/CDL.cs
index 23c44ceb23..105292189f 100644
--- a/BizHawk.Client.EmuHawk/tools/CDL.cs
+++ b/BizHawk.Client.EmuHawk/tools/CDL.cs
@@ -63,7 +63,9 @@ namespace BizHawk.Client.EmuHawk
InitializeComponent();
tsbViewStyle.SelectedIndex = 0;
- }
+ }
+
+ public void NewUpdate(ToolFormUpdateType type) { }
public void UpdateValues()
{
diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs
index fe8f93e877..63c6a1d221 100644
--- a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs
+++ b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs
@@ -58,6 +58,8 @@ namespace BizHawk.Client.EmuHawk
public bool UpdateBefore { get { return false; } }
+ public void NewUpdate(ToolFormUpdateType type) { }
+
public void UpdateValues()
{
// Do nothing
diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs b/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs
index 60e246ffc2..d9a07b2904 100644
--- a/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs
+++ b/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs
@@ -86,6 +86,8 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger
ParentDebugger.DisableCancelSeekBtn();
}
+ public void NewUpdate(ToolFormUpdateType type) { }
+
public void UpdateValues()
{
if (Enabled)
diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.IToolForm.cs b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.IToolForm.cs
index 57007d5b57..2344f2f5b9 100644
--- a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.IToolForm.cs
+++ b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.IToolForm.cs
@@ -134,6 +134,8 @@ namespace BizHawk.Client.EmuHawk
#endregion
+ public void NewUpdate(ToolFormUpdateType type) { }
+
public void UpdateValues()
{
// Nothing to do
diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/RegisterBoxControl.cs b/BizHawk.Client.EmuHawk/tools/Debugger/RegisterBoxControl.cs
index 48b420e6e7..6d3b70f058 100644
--- a/BizHawk.Client.EmuHawk/tools/Debugger/RegisterBoxControl.cs
+++ b/BizHawk.Client.EmuHawk/tools/Debugger/RegisterBoxControl.cs
@@ -33,6 +33,8 @@ namespace BizHawk.Client.EmuHawk
}
+ public void NewUpdate(ToolFormUpdateType type) { }
+
public void UpdateValues()
{
if (this.Enabled)
diff --git a/BizHawk.Client.EmuHawk/tools/GB/GBGPUView.cs b/BizHawk.Client.EmuHawk/tools/GB/GBGPUView.cs
index 33fa588a42..6e4064214e 100644
--- a/BizHawk.Client.EmuHawk/tools/GB/GBGPUView.cs
+++ b/BizHawk.Client.EmuHawk/tools/GB/GBGPUView.cs
@@ -533,6 +533,8 @@ namespace BizHawk.Client.EmuHawk
///
int cbscanline_emu = -4; // force refresh
+ public void NewUpdate(ToolFormUpdateType type) { }
+
///
/// put me in ToolsBefore
///
diff --git a/BizHawk.Client.EmuHawk/tools/GB/GBGameGenie.cs b/BizHawk.Client.EmuHawk/tools/GB/GBGameGenie.cs
index b09573ba1e..f6faf6ae52 100644
--- a/BizHawk.Client.EmuHawk/tools/GB/GBGameGenie.cs
+++ b/BizHawk.Client.EmuHawk/tools/GB/GBGameGenie.cs
@@ -33,6 +33,8 @@ namespace BizHawk.Client.EmuHawk
Close();
}
}
+
+ public void NewUpdate(ToolFormUpdateType type) { }
public void UpdateValues()
{
diff --git a/BizHawk.Client.EmuHawk/tools/GBA/GBAGPUView.cs b/BizHawk.Client.EmuHawk/tools/GBA/GBAGPUView.cs
index 2f8fad4e99..7fade6caf0 100644
--- a/BizHawk.Client.EmuHawk/tools/GBA/GBAGPUView.cs
+++ b/BizHawk.Client.EmuHawk/tools/GBA/GBAGPUView.cs
@@ -693,6 +693,8 @@ namespace BizHawk.Client.EmuHawk
UpdateValues();
}
+ public void NewUpdate(ToolFormUpdateType type) { }
+
/// belongs in ToolsBefore
public void UpdateValues()
{
diff --git a/BizHawk.Client.EmuHawk/tools/GameShark.cs b/BizHawk.Client.EmuHawk/tools/GameShark.cs
index 6c8dfc8b5a..006062fe0f 100644
--- a/BizHawk.Client.EmuHawk/tools/GameShark.cs
+++ b/BizHawk.Client.EmuHawk/tools/GameShark.cs
@@ -154,7 +154,9 @@ namespace BizHawk.Client.EmuHawk
public void Restart()
{
- }
+ }
+
+ public void NewUpdate(ToolFormUpdateType type) { }
public void UpdateValues()
{
diff --git a/BizHawk.Client.EmuHawk/tools/Genesis/GenGameGenie.cs b/BizHawk.Client.EmuHawk/tools/Genesis/GenGameGenie.cs
index a00b0858f2..268dec7d4a 100644
--- a/BizHawk.Client.EmuHawk/tools/Genesis/GenGameGenie.cs
+++ b/BizHawk.Client.EmuHawk/tools/Genesis/GenGameGenie.cs
@@ -85,6 +85,8 @@ namespace BizHawk.Client.EmuHawk
}
}
+ public void NewUpdate(ToolFormUpdateType type) { }
+
public void UpdateValues()
{
if (Emulator.SystemId != "GEN")
diff --git a/BizHawk.Client.EmuHawk/tools/Genesis/VDPViewer.cs b/BizHawk.Client.EmuHawk/tools/Genesis/VDPViewer.cs
index e7e801cc78..1f7c619657 100644
--- a/BizHawk.Client.EmuHawk/tools/Genesis/VDPViewer.cs
+++ b/BizHawk.Client.EmuHawk/tools/Genesis/VDPViewer.cs
@@ -119,6 +119,7 @@ namespace BizHawk.Client.EmuHawk
bmpViewTiles.Refresh();
}
+ public void NewUpdate(ToolFormUpdateType type) { }
public void UpdateValues()
{
diff --git a/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs b/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs
index 415d25a8b5..b32b91b408 100644
--- a/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs
+++ b/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs
@@ -146,6 +146,8 @@ namespace BizHawk.Client.EmuHawk
return true;
}
+ public void NewUpdate(ToolFormUpdateType type) { }
+
public void UpdateValues()
{
AddressesLabel.Text = GenerateMemoryViewString(true);
diff --git a/BizHawk.Client.EmuHawk/tools/HexEditor/NewHexEditor.cs b/BizHawk.Client.EmuHawk/tools/HexEditor/NewHexEditor.cs
index dc34d45caa..761cff4e55 100644
--- a/BizHawk.Client.EmuHawk/tools/HexEditor/NewHexEditor.cs
+++ b/BizHawk.Client.EmuHawk/tools/HexEditor/NewHexEditor.cs
@@ -41,7 +41,9 @@ namespace BizHawk.Client.EmuHawk
#endregion
- #region IToolForm implementation
+ #region IToolForm implementation
+
+ public void NewUpdate(ToolFormUpdateType type) { }
public void UpdateValues()
{
diff --git a/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs b/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs
index 02aa10a940..ac8482ffff 100644
--- a/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs
+++ b/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs
@@ -94,6 +94,8 @@ namespace BizHawk.Client.EmuHawk
get { return SelectedItems.Where(x => !x.IsSeparator); }
}
+ public void NewUpdate(ToolFormUpdateType type) { }
+
public void UpdateValues()
{
// Do nothing
diff --git a/BizHawk.Client.EmuHawk/tools/Lua/LuaRegisteredFunctionsList.cs b/BizHawk.Client.EmuHawk/tools/Lua/LuaRegisteredFunctionsList.cs
index 24731ce95a..d65745fe8b 100644
--- a/BizHawk.Client.EmuHawk/tools/Lua/LuaRegisteredFunctionsList.cs
+++ b/BizHawk.Client.EmuHawk/tools/Lua/LuaRegisteredFunctionsList.cs
@@ -13,6 +13,8 @@ namespace BizHawk.Client.EmuHawk
InitializeComponent();
}
+ public void NewUpdate(ToolFormUpdateType type) { }
+
public void UpdateValues()
{
if (GlobalWin.Tools.LuaConsole.LuaImp.RegisteredFunctions.Any())
diff --git a/BizHawk.Client.EmuHawk/tools/Macros/MacroInput.cs b/BizHawk.Client.EmuHawk/tools/Macros/MacroInput.cs
index 5f6f40a1c4..3916ff290f 100644
--- a/BizHawk.Client.EmuHawk/tools/Macros/MacroInput.cs
+++ b/BizHawk.Client.EmuHawk/tools/Macros/MacroInput.cs
@@ -80,6 +80,8 @@ namespace BizHawk.Client.EmuHawk
MacroInputTool_Load(null, null);
}
+ public void NewUpdate(ToolFormUpdateType type) { }
+
// These do absolutely nothing.
public void UpdateValues()
{
diff --git a/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs b/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs
index edd5eab6a0..1cf3b86494 100644
--- a/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs
+++ b/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs
@@ -57,6 +57,8 @@ namespace BizHawk.Client.EmuHawk
#region IToolForm
+ public void NewUpdate(ToolFormUpdateType type) { }
+
public void UpdateValues()
{
diff --git a/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskFileSelector.cs b/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskFileSelector.cs
index 26fa36ce65..c6d57470bf 100644
--- a/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskFileSelector.cs
+++ b/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskFileSelector.cs
@@ -100,6 +100,8 @@ namespace BizHawk.Client.EmuHawk
UpdateValues();
}
+ public void NewUpdate(ToolFormUpdateType type) { }
+
public void UpdateValues()
{
UseCurrentRomButton.Enabled = Global.Emulator != null // For the designer
diff --git a/BizHawk.Client.EmuHawk/tools/NES/BarcodeEntry.cs b/BizHawk.Client.EmuHawk/tools/NES/BarcodeEntry.cs
index aad9193f69..6b3e64fcc5 100644
--- a/BizHawk.Client.EmuHawk/tools/NES/BarcodeEntry.cs
+++ b/BizHawk.Client.EmuHawk/tools/NES/BarcodeEntry.cs
@@ -25,6 +25,8 @@ namespace BizHawk.Client.EmuHawk
#region IToolForm
+ public void NewUpdate(ToolFormUpdateType type) { }
+
public void UpdateValues()
{
}
diff --git a/BizHawk.Client.EmuHawk/tools/NES/NESGameGenie.cs b/BizHawk.Client.EmuHawk/tools/NES/NESGameGenie.cs
index 6cbfcfc980..207aa4a542 100644
--- a/BizHawk.Client.EmuHawk/tools/NES/NESGameGenie.cs
+++ b/BizHawk.Client.EmuHawk/tools/NES/NESGameGenie.cs
@@ -55,6 +55,8 @@ namespace BizHawk.Client.EmuHawk
}
}
+ public void NewUpdate(ToolFormUpdateType type) { }
+
public void UpdateValues()
{
if (Emulator.SystemId != "NES")
diff --git a/BizHawk.Client.EmuHawk/tools/NES/NESMusicRipper.cs b/BizHawk.Client.EmuHawk/tools/NES/NESMusicRipper.cs
index d3bbd8e0dd..edf5ab9a99 100644
--- a/BizHawk.Client.EmuHawk/tools/NES/NESMusicRipper.cs
+++ b/BizHawk.Client.EmuHawk/tools/NES/NESMusicRipper.cs
@@ -33,6 +33,8 @@ namespace BizHawk.Client.EmuHawk
{
}
+ public void NewUpdate(ToolFormUpdateType type) { }
+
public void UpdateValues()
{
}
diff --git a/BizHawk.Client.EmuHawk/tools/NES/NESNameTableViewer.cs b/BizHawk.Client.EmuHawk/tools/NES/NESNameTableViewer.cs
index 7e2ca61859..e705b63745 100644
--- a/BizHawk.Client.EmuHawk/tools/NES/NESNameTableViewer.cs
+++ b/BizHawk.Client.EmuHawk/tools/NES/NESNameTableViewer.cs
@@ -47,6 +47,8 @@ namespace BizHawk.Client.EmuHawk
Generate(true);
}
+ public void NewUpdate(ToolFormUpdateType type) { }
+
public void UpdateValues()
{
_ppu.InstallCallback1(() => Generate(), scanline);
diff --git a/BizHawk.Client.EmuHawk/tools/NES/NESPPU.cs b/BizHawk.Client.EmuHawk/tools/NES/NESPPU.cs
index af29c61754..d9afd6335f 100644
--- a/BizHawk.Client.EmuHawk/tools/NES/NESPPU.cs
+++ b/BizHawk.Client.EmuHawk/tools/NES/NESPPU.cs
@@ -63,6 +63,7 @@ namespace BizHawk.Client.EmuHawk
public bool AskSaveChanges() { return true; }
public bool UpdateBefore { get { return true; } }
+ public void NewUpdate(ToolFormUpdateType type) { }
public void UpdateValues()
{
_ppu.InstallCallback2(() => Generate(), scanline);
diff --git a/BizHawk.Client.EmuHawk/tools/PCE/PCEBGViewer.cs b/BizHawk.Client.EmuHawk/tools/PCE/PCEBGViewer.cs
index 61d6fde6bf..3c2eef6155 100644
--- a/BizHawk.Client.EmuHawk/tools/PCE/PCEBGViewer.cs
+++ b/BizHawk.Client.EmuHawk/tools/PCE/PCEBGViewer.cs
@@ -94,6 +94,8 @@ namespace BizHawk.Client.EmuHawk
// Nothing to do
}
+ public void NewUpdate(ToolFormUpdateType type) { }
+
public void UpdateValues()
{
Generate();
diff --git a/BizHawk.Client.EmuHawk/tools/PCE/PCESoundDebugger.cs b/BizHawk.Client.EmuHawk/tools/PCE/PCESoundDebugger.cs
index f3dfbc15e3..9ae289b835 100644
--- a/BizHawk.Client.EmuHawk/tools/PCE/PCESoundDebugger.cs
+++ b/BizHawk.Client.EmuHawk/tools/PCE/PCESoundDebugger.cs
@@ -42,6 +42,8 @@ namespace BizHawk.Client.EmuHawk
base.OnShown(e);
}
+ public void NewUpdate(ToolFormUpdateType type) { }
+
public void UpdateValues()
{
foreach (var entry in PSGEntries)
diff --git a/BizHawk.Client.EmuHawk/tools/PCE/PCETileViewer.cs b/BizHawk.Client.EmuHawk/tools/PCE/PCETileViewer.cs
index b2946fbefc..74dfed6a45 100644
--- a/BizHawk.Client.EmuHawk/tools/PCE/PCETileViewer.cs
+++ b/BizHawk.Client.EmuHawk/tools/PCE/PCETileViewer.cs
@@ -32,6 +32,8 @@ namespace BizHawk.Client.EmuHawk
#region IToolForm
+ public void NewUpdate(ToolFormUpdateType type) { }
+
public void UpdateValues()
{
DrawBacks();
diff --git a/BizHawk.Client.EmuHawk/tools/SMS/VDPViewer.cs b/BizHawk.Client.EmuHawk/tools/SMS/VDPViewer.cs
index 3596de17ab..c3f7b8aade 100644
--- a/BizHawk.Client.EmuHawk/tools/SMS/VDPViewer.cs
+++ b/BizHawk.Client.EmuHawk/tools/SMS/VDPViewer.cs
@@ -139,6 +139,8 @@ namespace BizHawk.Client.EmuHawk
bmpViewPalette.Refresh();
}
+ public void NewUpdate(ToolFormUpdateType type) { }
+
public void UpdateValues()
{
unsafe
diff --git a/BizHawk.Client.EmuHawk/tools/SNES/SNESGameGenie.cs b/BizHawk.Client.EmuHawk/tools/SNES/SNESGameGenie.cs
index e527112d68..6635ecac01 100644
--- a/BizHawk.Client.EmuHawk/tools/SNES/SNESGameGenie.cs
+++ b/BizHawk.Client.EmuHawk/tools/SNES/SNESGameGenie.cs
@@ -63,6 +63,8 @@ namespace BizHawk.Client.EmuHawk
// Do nothing
}
+ public void NewUpdate(ToolFormUpdateType type) { }
+
public void UpdateValues()
{
// Do nothing
diff --git a/BizHawk.Client.EmuHawk/tools/SNES/SNESGraphicsDebugger.cs b/BizHawk.Client.EmuHawk/tools/SNES/SNESGraphicsDebugger.cs
index 9754c7cb3d..aae602d2a3 100644
--- a/BizHawk.Client.EmuHawk/tools/SNES/SNESGraphicsDebugger.cs
+++ b/BizHawk.Client.EmuHawk/tools/SNES/SNESGraphicsDebugger.cs
@@ -133,6 +133,8 @@ namespace BizHawk.Client.EmuHawk
else return string.Format("@{0} ({1}K)", address.ToHexString(4), address / 1024);
}
+ public void NewUpdate(ToolFormUpdateType type) { }
+
public void UpdateValues()
{
SyncCore();
diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IToolForm.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IToolForm.cs
index 8a8dc39523..a9cc1f74eb 100644
--- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IToolForm.cs
+++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IToolForm.cs
@@ -22,6 +22,8 @@ namespace BizHawk.Client.EmuHawk
public bool UpdateBefore { get { return false; } }
+ public void NewUpdate(ToolFormUpdateType type) { }
+
private int lastRefresh = 0;
public void UpdateValues()
{
diff --git a/BizHawk.Client.EmuHawk/tools/TI83/TI83KeyPad.cs b/BizHawk.Client.EmuHawk/tools/TI83/TI83KeyPad.cs
index a75d6e68b8..3838f50491 100644
--- a/BizHawk.Client.EmuHawk/tools/TI83/TI83KeyPad.cs
+++ b/BizHawk.Client.EmuHawk/tools/TI83/TI83KeyPad.cs
@@ -41,6 +41,8 @@ namespace BizHawk.Client.EmuHawk
public bool AskSaveChanges() { return true; }
public bool UpdateBefore { get { return false; } }
+ public void NewUpdate(ToolFormUpdateType type) { }
+
public void UpdateValues()
{
// Do nothing
diff --git a/BizHawk.Client.EmuHawk/tools/ToolBox.cs b/BizHawk.Client.EmuHawk/tools/ToolBox.cs
index 1755fedef5..8cd866bcac 100644
--- a/BizHawk.Client.EmuHawk/tools/ToolBox.cs
+++ b/BizHawk.Client.EmuHawk/tools/ToolBox.cs
@@ -33,6 +33,8 @@ namespace BizHawk.Client.EmuHawk
);
}
+ public void NewUpdate(ToolFormUpdateType type) { }
+
public bool AskSaveChanges() { return true; }
public bool UpdateBefore { get { return false; } }
public void UpdateValues() { }
diff --git a/BizHawk.Client.EmuHawk/tools/ToolManager.cs b/BizHawk.Client.EmuHawk/tools/ToolManager.cs
index 114be5dc92..fc7de1142c 100644
--- a/BizHawk.Client.EmuHawk/tools/ToolManager.cs
+++ b/BizHawk.Client.EmuHawk/tools/ToolManager.cs
@@ -405,6 +405,8 @@ namespace BizHawk.Client.EmuHawk
tool.UpdateValues();
}
}
+ foreach (var tool in _tools)
+ tool.NewUpdate(ToolFormUpdateType.PreFrame);
}
public void UpdateAfter()
@@ -418,6 +420,9 @@ namespace BizHawk.Client.EmuHawk
tool.UpdateValues();
}
}
+
+ foreach (var tool in _tools)
+ tool.NewUpdate(ToolFormUpdateType.PostFrame);
}
///
diff --git a/BizHawk.Client.EmuHawk/tools/TraceLogger.cs b/BizHawk.Client.EmuHawk/tools/TraceLogger.cs
index e8b36cd897..ac003a2abb 100644
--- a/BizHawk.Client.EmuHawk/tools/TraceLogger.cs
+++ b/BizHawk.Client.EmuHawk/tools/TraceLogger.cs
@@ -33,9 +33,10 @@ namespace BizHawk.Client.EmuHawk
set { this.Registers.Width = value; }
}
- private readonly List _instructions = new List();
+ private List _instructions = new List();
private FileInfo _logFile;
+ private StreamWriter _streamWriter;
public TraceLogger()
{
@@ -61,7 +62,7 @@ namespace BizHawk.Client.EmuHawk
private void SaveConfigSettings()
{
- Tracer.Enabled = LoggingEnabled.Checked;
+ //Tracer.Enabled = LoggingEnabled.Checked;
}
private void TraceView_QueryItemText(int index, int column, out string text)
@@ -77,7 +78,6 @@ namespace BizHawk.Client.EmuHawk
case 1:
text = _instructions[index].RegisterInfo;
break;
-
}
}
}
@@ -86,35 +86,79 @@ namespace BizHawk.Client.EmuHawk
{
ClearList();
OpenLogFile.Enabled = false;
- Tracer.Enabled = LoggingEnabled.Checked = false;
+ //Tracer.Enabled = LoggingEnabled.Checked = false;
SetTracerBoxTitle();
}
- public void UpdateValues()
+ class CallbackSink : ITraceSink
{
- _instructions.AddRange(Tracer.TakeContents());
-
- if (ToWindowRadio.Checked)
+ public void Put(TraceInfo info)
{
- TraceView.BlazingFast = !GlobalWin.MainForm.EmulatorPaused;
- LogToWindow();
+ putter(info);
}
- else
+
+ public Action putter;
+ }
+
+ public void UpdateValues() { }
+
+ public void NewUpdate(ToolFormUpdateType type)
+ {
+ if (type == ToolFormUpdateType.PostFrame)
{
- DumpToDisk(_logFile);
- _instructions.Clear();
+ if (ToWindowRadio.Checked)
+ TraceView.VirtualListSize = _instructions.Count;
+ else
+ {
+ _streamWriter.Close();
+ _streamWriter = null;
+ }
+ }
+
+ if (type == ToolFormUpdateType.PreFrame)
+ {
+ if (LoggingEnabled.Checked)
+ {
+ //connect tracer to sink for next frame
+ if (ToWindowRadio.Checked)
+ {
+ //update listview with most recentr results
+ TraceView.BlazingFast = !GlobalWin.MainForm.EmulatorPaused;
+
+ Tracer.Sink = new CallbackSink()
+ {
+ putter = (info) =>
+ {
+ if (_instructions.Count >= MaxLines) { }
+ else _instructions.Add(info);
+ }
+ };
+ _instructions.Clear();
+ }
+ else
+ {
+ _streamWriter = new StreamWriter(_logFile.FullName, append: true);
+ Tracer.Sink = new CallbackSink {
+ putter = (info) =>
+ {
+ //no padding supported. core should be doing this anyway.
+ _streamWriter.WriteLine("{0} {1}", info.Disassembly, info.RegisterInfo);
+ }
+ };
+ }
+ }
+ else Tracer.Sink = null;
}
}
public void FastUpdate()
{
- _instructions.AddRange(Tracer.TakeContents());
}
public void Restart()
{
ClearList();
- Tracer.Enabled = LoggingEnabled.Checked = false;
+ //Tracer.Enabled = LoggingEnabled.Checked = false;
SetTracerBoxTitle();
}
@@ -290,7 +334,7 @@ namespace BizHawk.Client.EmuHawk
private void LoggingEnabled_CheckedChanged(object sender, EventArgs e)
{
- Tracer.Enabled = LoggingEnabled.Checked;
+ //Tracer.Enabled = LoggingEnabled.Checked;
SetTracerBoxTitle();
if (LoggingEnabled.Checked && _logFile != null)
diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs
index ad992ddee3..2e61ff4818 100644
--- a/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs
+++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs
@@ -168,6 +168,8 @@ namespace BizHawk.Client.EmuHawk
CreatePads();
}
+ public void NewUpdate(ToolFormUpdateType type) { }
+
public void UpdateValues()
{
if (!IsHandleCreated || IsDisposed)
diff --git a/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs b/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs
index d07b9b414b..e96cee76ea 100644
--- a/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs
+++ b/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs
@@ -261,6 +261,8 @@ namespace BizHawk.Client.EmuHawk
SetTotal();
}
+ public void NewUpdate(ToolFormUpdateType type) { }
+
///
/// This should only be called when the values of the list need an update such as after a poke or emulation occured
///
diff --git a/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs b/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs
index a5a6b770fe..f8ef58e4ac 100644
--- a/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs
+++ b/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs
@@ -229,6 +229,8 @@ namespace BizHawk.Client.EmuHawk
}
}
+ public void NewUpdate(ToolFormUpdateType type) { }
+
public void UpdateValues()
{
if (_paused)
diff --git a/BizHawk.Emulation.Common/Base Implementations/CallbackBasedTraceBuffer.cs b/BizHawk.Emulation.Common/Base Implementations/CallbackBasedTraceBuffer.cs
index 5d219cc356..157bfdd29b 100644
--- a/BizHawk.Emulation.Common/Base Implementations/CallbackBasedTraceBuffer.cs
+++ b/BizHawk.Emulation.Common/Base Implementations/CallbackBasedTraceBuffer.cs
@@ -36,51 +36,35 @@ namespace BizHawk.Emulation.Common
protected readonly List Buffer = new List();
- private bool _enabled;
-
- public abstract void TraceFromCallback();
-
- public bool Enabled
- {
- get
- {
- return _enabled;
- }
-
- set
- {
- _enabled = value;
- DebuggableCore.MemoryCallbacks.Remove(TraceFromCallback);
-
- if (_enabled)
- {
- DebuggableCore.MemoryCallbacks.Add(new TracingMemoryCallback(TraceFromCallback));
- }
- }
+ public abstract void TraceFromCallback();
+
+ public ITraceSink _sink;
+
+ public bool Enabled { get { return Sink != null; } }
+
+ public void Put(TraceInfo info) { Sink.Put(info); }
+
+ public ITraceSink Sink
+ {
+ get
+ {
+ return _sink;
+ }
+ set
+ {
+ _sink = value;
+ DebuggableCore.MemoryCallbacks.Remove(TraceFromCallback);
+
+ if (_sink != null)
+ {
+ DebuggableCore.MemoryCallbacks.Add(new TracingMemoryCallback(TraceFromCallback));
+ }
+ }
}
+
public string Header { get; set; }
- public IEnumerable Contents
- {
- get { return Buffer; }
- }
-
- public IEnumerable TakeContents()
- {
- var contents = Buffer.ToList();
- Buffer.Clear();
- return contents;
- }
-
- public void Put(TraceInfo content)
- {
- if (Enabled)
- {
- Buffer.Add(content);
- }
- }
-
public class TracingMemoryCallback : IMemoryCallback
{
public TracingMemoryCallback(Action callback)
diff --git a/BizHawk.Emulation.Common/Base Implementations/TraceBuffer.cs b/BizHawk.Emulation.Common/Base Implementations/TraceBuffer.cs
index 1dfbc4271c..9f6902abb4 100644
--- a/BizHawk.Emulation.Common/Base Implementations/TraceBuffer.cs
+++ b/BizHawk.Emulation.Common/Base Implementations/TraceBuffer.cs
@@ -1,39 +1,23 @@
using System.Collections.Generic;
using System.Linq;
+//garbage
+
namespace BizHawk.Emulation.Common
{
public class TraceBuffer : ITraceable
{
- private readonly List Buffer = new List();
-
public TraceBuffer()
{
Header = "Instructions";
}
- public IEnumerable TakeContents()
- {
- var contents = Buffer.ToList();
- Buffer.Clear();
- return contents;
- }
-
- public IEnumerable Contents
- {
- get { return Buffer; }
- }
-
- public void Put(TraceInfo content)
- {
- if (Enabled)
- {
- Buffer.Add(content);
- }
- }
-
- public bool Enabled { get; set; }
-
public string Header { get; set; }
+
+ public ITraceSink Sink { get; set; }
+
+ public bool Enabled { get { return Sink != null; } }
+
+ public void Put(TraceInfo info) { Sink.Put(info); }
}
}
diff --git a/BizHawk.Emulation.Common/Interfaces/Services/ITraceable.cs b/BizHawk.Emulation.Common/Interfaces/Services/ITraceable.cs
index 81bfa53472..371bc08668 100644
--- a/BizHawk.Emulation.Common/Interfaces/Services/ITraceable.cs
+++ b/BizHawk.Emulation.Common/Interfaces/Services/ITraceable.cs
@@ -2,13 +2,18 @@
namespace BizHawk.Emulation.Common
{
+ public interface ITraceSink
+ {
+ void Put(TraceInfo info);
+ }
+
///
/// This service allows the core to dump a cpu trace to the client
/// If available the Trace Logger tool will be available on the client
///
public interface ITraceable : IEmulatorService
{
- bool Enabled { get; set; }
+ //bool Enabled { get; set; }
///
/// The header that would be used by a trace logger
@@ -18,14 +23,30 @@ namespace BizHawk.Emulation.Common
///
/// The current log of cpu instructions
///
- IEnumerable Contents { get; }
+ //IEnumerable Contents { get; }
///
/// Takes the current log of cpu instructions, when doing so, it will clear the contents from the buffer
///
- IEnumerable TakeContents();
+ //IEnumerable TakeContents();
- void Put(TraceInfo content);
+ //void Put(TraceInfo content);
+
+ //that's right, we can only have one sink.
+ //a sink can route to two other sinks if it has to, though
+ ITraceSink Sink { get; set; }
+
+ ///
+ /// This is defined as equivalent to Sink != null
+ /// It's put here because it's such a common operation to check whether it's enabled, and it's not nice to write Sink != null all over
+ ///
+ bool Enabled { get; }
+
+ ///
+ /// This is defined as equivalent to Sink.Put
+ /// TBD: could it be defined as equivalent to if(Enabled) Sink.Put()? Probably not, that's just a small amount of wasted work
+ ///
+ void Put(TraceInfo info);
}
public class TraceInfo