TAStudio - don't draw unless Tastudio is "engaged", fixes a lot of NREs through various core reboot scenarios

This commit is contained in:
adelikat 2020-06-21 10:57:23 -05:00
parent b0258ef3db
commit 4d0d9e04aa
2 changed files with 25 additions and 1 deletions

View File

@ -155,6 +155,11 @@ namespace BizHawk.Client.EmuHawk
private void TasView_QueryItemIcon(int index, RollColumn column, ref Bitmap bitmap, ref int offsetX, ref int offsetY)
{
if (!_engaged)
{
return;
}
var overrideIcon = QueryItemIconCallback?.Invoke(index, column.Name);
if (overrideIcon != null)
@ -218,6 +223,11 @@ namespace BizHawk.Client.EmuHawk
private void TasView_QueryItemBkColor(int index, RollColumn column, ref Color color)
{
if (!_engaged)
{
return;
}
Color? overrideColor = QueryItemBgColorCallback?.Invoke(index, column.Name);
if (overrideColor.HasValue)
@ -260,6 +270,11 @@ namespace BizHawk.Client.EmuHawk
private void TasView_QueryRowBkColor(int index, ref Color color)
{
if (!_engaged)
{
return;
}
var record = CurrentTasMovie[index];
if (MainForm.IsSeeking && MainForm.PauseOnFrame == index)
@ -299,6 +314,12 @@ namespace BizHawk.Client.EmuHawk
private void TasView_QueryItemText(int index, RollColumn column, out string text, ref int offsetX, ref int offsetY)
{
if (!_engaged)
{
text = "";
return;
}
var overrideText = QueryItemTextCallback?.Invoke(index, column.Name);
if (overrideText != null)
{

View File

@ -33,6 +33,7 @@ namespace BizHawk.Client.EmuHawk
private bool _initialized;
private bool _exiting;
private bool _engaged;
private bool CanAutoload => Settings.RecentTas.AutoLoad && !string.IsNullOrEmpty(Settings.RecentTas.MostRecent);
@ -109,7 +110,6 @@ namespace BizHawk.Client.EmuHawk
recentMacrosToolStripMenuItem.Image = Properties.Resources.Recent;
TASEditorManualOnlineMenuItem.Image = Properties.Resources.Help;
ForumThreadMenuItem.Image = Properties.Resources.TAStudio;
Icon = Properties.Resources.TAStudio_MultiSize;
}
@ -210,6 +210,7 @@ namespace BizHawk.Client.EmuHawk
private bool Engage()
{
_engaged = false;
MainForm.PauseOnFrame = null;
MainForm.PauseEmulator();
@ -283,6 +284,7 @@ namespace BizHawk.Client.EmuHawk
SetSplicer();
SetupBoolPatterns();
_engaged = true;
return true;
}
@ -790,6 +792,7 @@ namespace BizHawk.Client.EmuHawk
private void Disengage()
{
_engaged = false;
MainForm.PauseOnFrame = null;
MainForm.AddOnScreenMessage("TAStudio disengaged");
MainForm.TakeBackControl();