Pass global Config to BatchRun/BatchRunner

This commit is contained in:
YoshiRulz 2020-11-30 19:24:17 +10:00
parent 32f571144e
commit f314aa3d61
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
3 changed files with 9 additions and 5 deletions

View File

@ -1297,7 +1297,7 @@ namespace BizHawk.Client.EmuHawk
private void BatchRunnerMenuItem_Click(object sender, EventArgs e)
{
using var form = new BatchRun(CreateCoreComm);
using var form = new BatchRun(Config, CreateCoreComm);
form.ShowDialog();
}

View File

@ -4,20 +4,24 @@ using System.Windows.Forms;
using System.Threading;
using System.IO;
using BizHawk.Client.Common;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
{
public partial class BatchRun : Form
{
private readonly Config _config;
private readonly Func<CoreComm> _createCoreComm;
private List<BatchRunner.Result> _mostRecentResults;
private Thread _thread;
public BatchRun(Func<CoreComm> createCoreComm)
public BatchRun(Config config, Func<CoreComm> createCoreComm)
{
_config = config;
_createCoreComm = createCoreComm;
InitializeComponent();
}
@ -87,7 +91,7 @@ namespace BizHawk.Client.EmuHawk
try
{
var pp = (Tuple<int, List<string>>)o;
BatchRunner br = new BatchRunner(_createCoreComm(), pp.Item2, pp.Item1);
BatchRunner br = new BatchRunner(_config, _createCoreComm(), pp.Item2, pp.Item1);
br.OnProgress += BrOnProgress;
var results = br.Run();
this.Invoke(() => { label3.Text = "Status: Finished!"; _mostRecentResults = results; });

View File

@ -64,12 +64,12 @@ namespace BizHawk.Client.EmuHawk
}
}
public BatchRunner(CoreComm comm, IEnumerable<string> files, int numFrames)
public BatchRunner(Config config, CoreComm comm, IEnumerable<string> files, int numFrames)
{
_files = new List<string>(files);
_numFrames = numFrames;
_ldr = new RomLoader(GlobalWin.Config);
_ldr = new RomLoader(config);
_ldr.OnLoadError += OnLoadError;
_ldr.ChooseArchive = ChooseArchive;
_comm = comm;