From f314aa3d617d94497d1cb9a4a5b2a25c301729c3 Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Mon, 30 Nov 2020 19:24:17 +1000 Subject: [PATCH] Pass global Config to BatchRun/BatchRunner --- src/BizHawk.Client.EmuHawk/MainForm.Events.cs | 2 +- src/BizHawk.Client.EmuHawk/tools/BatchRun.cs | 8 ++++++-- src/BizHawk.Client.EmuHawk/tools/BatchRunner.cs | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/BizHawk.Client.EmuHawk/MainForm.Events.cs b/src/BizHawk.Client.EmuHawk/MainForm.Events.cs index 0240fac6c3..03dc0b5d62 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -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(); } diff --git a/src/BizHawk.Client.EmuHawk/tools/BatchRun.cs b/src/BizHawk.Client.EmuHawk/tools/BatchRun.cs index 99b416a5e0..6766da4d04 100644 --- a/src/BizHawk.Client.EmuHawk/tools/BatchRun.cs +++ b/src/BizHawk.Client.EmuHawk/tools/BatchRun.cs @@ -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 _createCoreComm; private List _mostRecentResults; private Thread _thread; - public BatchRun(Func createCoreComm) + public BatchRun(Config config, Func createCoreComm) { + _config = config; _createCoreComm = createCoreComm; InitializeComponent(); } @@ -87,7 +91,7 @@ namespace BizHawk.Client.EmuHawk try { var pp = (Tuple>)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; }); diff --git a/src/BizHawk.Client.EmuHawk/tools/BatchRunner.cs b/src/BizHawk.Client.EmuHawk/tools/BatchRunner.cs index 25cba04bd5..5e5e8f89aa 100644 --- a/src/BizHawk.Client.EmuHawk/tools/BatchRunner.cs +++ b/src/BizHawk.Client.EmuHawk/tools/BatchRunner.cs @@ -64,12 +64,12 @@ namespace BizHawk.Client.EmuHawk } } - public BatchRunner(CoreComm comm, IEnumerable files, int numFrames) + public BatchRunner(Config config, CoreComm comm, IEnumerable files, int numFrames) { _files = new List(files); _numFrames = numFrames; - _ldr = new RomLoader(GlobalWin.Config); + _ldr = new RomLoader(config); _ldr.OnLoadError += OnLoadError; _ldr.ChooseArchive = ChooseArchive; _comm = comm;