Make the Basic Bot fail more gracefully
This commit is contained in:
parent
bd90dc6aa6
commit
6d2d07428e
|
@ -146,6 +146,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
_previousInvisibleEmulation = InvisibleEmulationCheckBox.Checked = Settings.InvisibleEmulation;
|
_previousInvisibleEmulation = InvisibleEmulationCheckBox.Checked = Settings.InvisibleEmulation;
|
||||||
_previousDisplayMessage = Config.DisplayMessages;
|
_previousDisplayMessage = Config.DisplayMessages;
|
||||||
|
Closing += (_, _) => StopBot();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dictionary<string, double> ControlProbabilities =>
|
private Dictionary<string, double> ControlProbabilities =>
|
||||||
|
@ -1073,6 +1074,12 @@ namespace BizHawk.Client.EmuHawk
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (_isBotting) RestoreConfigFlags(); // disposed while running? least we can do is not clobber config
|
||||||
|
base.Dispose(disposing: disposing);
|
||||||
|
}
|
||||||
|
|
||||||
private void StopBot()
|
private void StopBot()
|
||||||
{
|
{
|
||||||
RunBtn.Visible = true;
|
RunBtn.Visible = true;
|
||||||
|
@ -1084,20 +1091,21 @@ namespace BizHawk.Client.EmuHawk
|
||||||
_targetFrame = 0;
|
_targetFrame = 0;
|
||||||
reset_curent(0);
|
reset_curent(0);
|
||||||
GoalGroupBox.Enabled = true;
|
GoalGroupBox.Enabled = true;
|
||||||
|
RestoreConfigFlags();
|
||||||
if (MovieSession.Movie.IsRecording())
|
|
||||||
{
|
|
||||||
MovieSession.Movie.IsCountingRerecords = _oldCountingSetting;
|
|
||||||
}
|
|
||||||
|
|
||||||
Config.DisplayMessages = _previousDisplayMessage;
|
|
||||||
MainForm.InvisibleEmulation = _previousInvisibleEmulation;
|
|
||||||
MainForm.PauseEmulator();
|
MainForm.PauseEmulator();
|
||||||
SetNormalSpeed();
|
SetNormalSpeed();
|
||||||
UpdateBotStatusIcon();
|
UpdateBotStatusIcon();
|
||||||
MessageLabel.Text = "Bot stopped";
|
MessageLabel.Text = "Bot stopped";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void RestoreConfigFlags()
|
||||||
|
{
|
||||||
|
Config.DisplayMessages = _previousDisplayMessage;
|
||||||
|
MainForm.InvisibleEmulation = _previousInvisibleEmulation;
|
||||||
|
var movie = MovieSession.Movie;
|
||||||
|
if (movie.IsRecording()) movie.IsCountingRerecords = _oldCountingSetting;
|
||||||
|
}
|
||||||
|
|
||||||
private void UpdateBotStatusIcon()
|
private void UpdateBotStatusIcon()
|
||||||
{
|
{
|
||||||
if (_replayMode)
|
if (_replayMode)
|
||||||
|
|
Loading…
Reference in New Issue