From f0211599312ce111478faf8d825671ded9b12325 Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Fri, 17 Mar 2023 06:35:42 +1000 Subject: [PATCH] Split `FirmwaresMenuItem_Click` --- src/BizHawk.Client.EmuHawk/MainForm.Events.cs | 31 +++++++++---------- src/BizHawk.Client.EmuHawk/MainForm.cs | 2 +- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/BizHawk.Client.EmuHawk/MainForm.Events.cs b/src/BizHawk.Client.EmuHawk/MainForm.Events.cs index 3eaacb2d28..79bce0e942 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -880,25 +880,22 @@ namespace BizHawk.Client.EmuHawk InputManager.SyncControls(Emulator, MovieSession, Config); } + private void OpenFWConfigRomLoadFailed(RomLoader.RomErrorArgs args) + { + using FirmwaresConfig configForm = new( + this, + FirmwareManager, + Config.FirmwareUserSpecifications, + Config.PathEntries, + retryLoadRom: true, + reloadRomPath: args.RomPath); + args.Retry = this.ShowDialogWithTempMute(configForm) is DialogResult.Retry; + } + private void FirmwaresMenuItem_Click(object sender, EventArgs e) { - if (e is RomLoader.RomErrorArgs args) - { - using var configForm = new FirmwaresConfig( - this, - FirmwareManager, - Config.FirmwareUserSpecifications, - Config.PathEntries, - retryLoadRom: true, - reloadRomPath: args.RomPath); - var result = this.ShowDialogWithTempMute(configForm); - args.Retry = result == DialogResult.Retry; - } - else - { - using var configForm = new FirmwaresConfig(this, FirmwareManager, Config.FirmwareUserSpecifications, Config.PathEntries); - this.ShowDialogWithTempMute(configForm); - } + using var configForm = new FirmwaresConfig(this, FirmwareManager, Config.FirmwareUserSpecifications, Config.PathEntries); + this.ShowDialogWithTempMute(configForm); } private void MessagesMenuItem_Click(object sender, EventArgs e) diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index a6b99c0eb8..b78395232d 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -3694,7 +3694,7 @@ namespace BizHawk.Client.EmuHawk text: "The core needs certain firmware to load this rom.\n\nOpen the firmware manager now?", useOKCancel: true)) { - FirmwaresMenuItem_Click(null, e); + OpenFWConfigRomLoadFailed(e); if (e.Retry) { // Retry loading the ROM here. This leads to recursion, as the original call to LoadRom has not exited yet,