Implement FastUpdate() on IToolForm. The intent here is for tools to do the minimum amount necessary when updating. This allows them to avoid slow things like drawing, but do critical activities such as Ram tools incrementing change counters, and loggers can continue logging. When Turboing, instead of bypassing tool updates, the client will run the fast update instead. Note: a few tools still need to be thought out as to what they need to do in a fast update
This commit is contained in:
parent
c82db1384f
commit
570f77cc68
|
@ -2551,6 +2551,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
GlobalWin.Tools.UpdateToolsBefore();
|
||||
}
|
||||
else
|
||||
{
|
||||
GlobalWin.Tools.FastUpdateBefore();
|
||||
}
|
||||
|
||||
_runloopFps++;
|
||||
|
||||
|
@ -2636,6 +2640,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
UpdateToolsAfter();
|
||||
}
|
||||
else
|
||||
{
|
||||
GlobalWin.Tools.FastUpdateAfter();
|
||||
}
|
||||
}
|
||||
|
||||
if (Global.ClientControls["Rewind"] || PressRewind)
|
||||
|
|
|
@ -21,6 +21,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
public void Restart()
|
||||
{
|
||||
if (!(Global.Emulator is NES))
|
||||
|
|
|
@ -207,6 +207,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
_programmaticUpdateOfRegisterBoxes = false;
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
{
|
||||
/* TODO */
|
||||
}
|
||||
|
||||
private void UpdateTraceLog()
|
||||
{
|
||||
var instructions = Global.CoreComm.Tracer.TakeContents().Split('\n');
|
||||
|
|
|
@ -70,7 +70,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void UpdateValues()
|
||||
{
|
||||
// Do nothing;
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
public void Restart()
|
||||
|
|
|
@ -584,6 +584,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region mouseovers
|
||||
|
|
|
@ -35,6 +35,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
public GBGameGenie()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
|
|
@ -718,6 +718,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
private void GBAGPUView_Load(object sender, EventArgs e)
|
||||
{
|
||||
Restart();
|
||||
|
|
|
@ -80,6 +80,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
public GenGameGenie()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
|
|
@ -132,6 +132,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
public void Restart()
|
||||
{
|
||||
Emu = Global.Emulator as GPGX;
|
||||
|
|
|
@ -110,6 +110,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
AddressLabel.Text = GenerateAddressString();
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
public void Restart()
|
||||
{
|
||||
if (!IsHandleCreated || IsDisposed)
|
||||
|
|
|
@ -6,7 +6,14 @@
|
|||
/// 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
|
||||
/// </summary>
|
||||
void UpdateValues();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
void FastUpdate();
|
||||
|
||||
/// <summary>
|
||||
/// Will be called anytime the dialog needs to be restarted, such as when a new ROM is loaded
|
||||
/// The tool implementing this needs to account for a Game and Core change
|
||||
|
|
|
@ -76,7 +76,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
Owner = Global.Config.LuaSettings.FloatingWindow ? null : GlobalWin.MainForm;
|
||||
}
|
||||
|
||||
public void UpdateValues() { }
|
||||
public void UpdateValues()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
public LuaConsole Get() { return this; }
|
||||
|
||||
|
|
|
@ -65,6 +65,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
private void UpdateDebugView()
|
||||
{
|
||||
DebugView.BlazingFast = true;
|
||||
|
|
|
@ -55,6 +55,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
public NESGameGenie()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
|
|
@ -70,6 +70,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private unsafe void DrawTile(int* dst, int pitch, byte* pal, byte* tile, int* finalpal)
|
||||
|
|
|
@ -67,6 +67,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
public void Restart()
|
||||
{
|
||||
if (Global.Emulator is NES)
|
||||
|
|
|
@ -125,6 +125,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
|
|
@ -46,6 +46,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
UpdateDisplay();
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
public void Restart()
|
||||
{
|
||||
if (Global.Emulator is PCEngine)
|
||||
|
|
|
@ -146,6 +146,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
lvChannels.EndUpdate();
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
{
|
||||
// Todo
|
||||
}
|
||||
|
||||
class PSGEntry
|
||||
{
|
||||
public int index;
|
||||
|
|
|
@ -46,6 +46,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
bmpViewSPPal.Refresh();
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
unsafe static void Draw16x16(byte* src, int* dest, int pitch, int* pal)
|
||||
{
|
||||
|
|
|
@ -150,6 +150,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
public void Restart()
|
||||
{
|
||||
if (!(Global.Emulator is SMS))
|
||||
|
|
|
@ -77,6 +77,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void SnesGGDecode(string code, ref int val, ref int add)
|
||||
|
|
|
@ -145,6 +145,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
{
|
||||
// To do
|
||||
}
|
||||
|
||||
public void UpdateToolsLoadstate()
|
||||
{
|
||||
SyncCore();
|
||||
|
|
|
@ -31,6 +31,17 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
{
|
||||
// TODO: think more about this
|
||||
|
||||
if (StopFrame.HasValue && Global.Emulator.Frame == StopFrame.Value)
|
||||
{
|
||||
GlobalWin.MainForm.PauseEmulator();
|
||||
StopFrame = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Restart()
|
||||
{
|
||||
if (!IsHandleCreated || IsDisposed)
|
||||
|
|
|
@ -45,6 +45,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
public void Restart()
|
||||
{
|
||||
if (!(Global.Emulator is TI83))
|
||||
|
|
|
@ -39,6 +39,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
public bool UpdateBefore { get { return false; } }
|
||||
public void UpdateValues() { }
|
||||
|
||||
public void FastUpdate()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
public void Restart()
|
||||
{
|
||||
SetTools();
|
||||
|
|
|
@ -252,6 +252,32 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public void FastUpdateBefore()
|
||||
{
|
||||
var beforeList = _tools.Where(x => x.UpdateBefore);
|
||||
foreach (var tool in beforeList)
|
||||
{
|
||||
if (!tool.IsDisposed ||
|
||||
(tool is RamWatch && Global.Config.DisplayRamWatch)) // Ram Watch hack, on screen display should run even if Ram Watch is closed
|
||||
{
|
||||
tool.FastUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void FastUpdateAfter()
|
||||
{
|
||||
var afterList = _tools.Where(x => !x.UpdateBefore);
|
||||
foreach (var tool in afterList)
|
||||
{
|
||||
if (!tool.IsDisposed ||
|
||||
(tool is RamWatch && Global.Config.DisplayRamWatch)) // Ram Watch hack, on screen display should run even if Ram Watch is closed
|
||||
{
|
||||
tool.FastUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Note: Referencing these properties creates an instance of the tool and persists it. They should be referenced by type if this is not desired
|
||||
#region Tools
|
||||
|
||||
|
|
|
@ -90,6 +90,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
{
|
||||
// TODO: think more about this logic
|
||||
if (!ToWindowRadio.Checked)
|
||||
{
|
||||
LogToFile();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Restart()
|
||||
{
|
||||
if (!IsHandleCreated || IsDisposed)
|
||||
|
|
|
@ -198,6 +198,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
Pads.ForEach(pad => pad.Refresh());
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
{
|
||||
// TODO: SetPrevious logic should go here too or that will get out of whack
|
||||
|
||||
if (!Readonly && !Global.Config.VirtualPadSticky)
|
||||
{
|
||||
Pads.ForEach(pad => pad.Clear());
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
|
|
@ -243,6 +243,19 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
{
|
||||
if (_searches.Count > 0)
|
||||
{
|
||||
_searches.Update();
|
||||
|
||||
if (_autoSearch)
|
||||
{
|
||||
DoSearch();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Restart()
|
||||
{
|
||||
if (!IsHandleCreated || IsDisposed)
|
||||
|
|
|
@ -240,6 +240,40 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
{
|
||||
if (_paused)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((!IsHandleCreated || IsDisposed) && !Global.Config.DisplayRamWatch)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_watches.Any())
|
||||
{
|
||||
_watches.UpdateValues();
|
||||
|
||||
if (Global.Config.DisplayRamWatch)
|
||||
{
|
||||
for (var i = 0; i < _watches.Count; i++)
|
||||
{
|
||||
var frozen = !_watches[i].IsSeparator && Global.CheatList.IsActive(_watches[i].Domain, _watches[i].Address ?? 0);
|
||||
GlobalWin.OSD.AddGUIText(
|
||||
_watches[i].ToString(),
|
||||
Global.Config.DispRamWatchx,
|
||||
Global.Config.DispRamWatchy + (i * 14),
|
||||
Color.Black,
|
||||
frozen ? Color.Cyan : Color.White,
|
||||
0
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
|
Loading…
Reference in New Issue