Basic bot - if bot is unable to run and a message box is shown, show a specific error as to why it can't, instead of a generic error

This commit is contained in:
adelikat 2020-01-29 17:10:03 -06:00
parent 285c251135
commit 1836ad86b6
1 changed files with 8 additions and 7 deletions

View File

@ -933,9 +933,10 @@ namespace BizHawk.Client.EmuHawk
private void StartBot()
{
if (!CanStart())
var message = CanStart();
if (!string.IsNullOrWhiteSpace(message))
{
MessageBox.Show("Unable to run with current settings");
MessageBox.Show(message);
return;
}
@ -972,24 +973,24 @@ namespace BizHawk.Client.EmuHawk
_logGenerator.SetSource(Global.ClickyVirtualPadController);
}
private bool CanStart()
private string CanStart()
{
if (!ControlProbabilities.Any(cp => cp.Value > 0))
{
return false;
return "At least one control must have a probability greater than 0.";
}
if (!MaximizeAddressBox.ToRawInt().HasValue)
{
return false;
return "A main value address is required.";
}
if (FrameLengthNumeric.Value == 0)
{
return false;
return "A frame count greater than 0 is required";
}
return true;
return null;
}
private void StopBot()