From e4f142c0d18b05984cf53a21c70ccd22c68f6215 Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Sat, 20 Nov 2021 04:33:34 +1000 Subject: [PATCH] Don't inform the user they've hit cancel, they already know --- src/BizHawk.Client.EmuHawk/MainForm.Events.cs | 95 +++++-------------- .../config/A7800/A7800ControllerSettings.cs | 1 - .../config/A7800/A7800FilterSettings.cs | 1 - .../AmstradCPC/AmstradCPCAudioSettings.cs | 1 - .../AmstradCPCCoreEmulationSettings.cs | 1 - .../AmstradCPC/AmstradCPCNonSyncSettings.cs | 1 - .../config/AmstradCPC/AmstradCPCPokeMemory.cs | 1 - .../ColecoVision/ColecoControllerSettings.cs | 1 - .../config/EmuHawkOptions.cs | 1 - .../config/INTV/IntvControllerSettings.cs | 1 - .../config/NES/NesControllerSettings.cs | 1 - .../config/PathConfig.cs | 1 - .../config/SNES/BSNESControllerConfig.cs | 1 - .../config/SNES/SNESControllerConfig.cs | 1 - .../ZXSpectrum/ZXSpectrumAudioSettings.cs | 1 - .../ZXSpectrumCoreEmulationSettings.cs | 1 - .../ZXSpectrum/ZXSpectrumJoystickSettings.cs | 1 - .../ZXSpectrum/ZXSpectrumNonSyncSettings.cs | 1 - .../config/ZXSpectrum/ZXSpectrumPokeMemory.cs | 1 - 19 files changed, 26 insertions(+), 87 deletions(-) diff --git a/src/BizHawk.Client.EmuHawk/MainForm.Events.cs b/src/BizHawk.Client.EmuHawk/MainForm.Events.cs index 79f50c8305..fccbef899d 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -842,31 +842,21 @@ namespace BizHawk.Client.EmuHawk private void ControllersMenuItem_Click(object sender, EventArgs e) { using var controller = new ControllerConfig(this, Emulator, Config); - if (controller.ShowDialog().IsOk()) - { - AddOnScreenMessage("Controller settings saved"); - InitControls(); - InputManager.SyncControls(Emulator, MovieSession, Config); - } - else - { - AddOnScreenMessage("Controller config aborted"); - } + if (!controller.ShowDialog().IsOk()) return; + AddOnScreenMessage("Controller settings saved"); + + InitControls(); + InputManager.SyncControls(Emulator, MovieSession, Config); } private void HotkeysMenuItem_Click(object sender, EventArgs e) { using var hotkeyConfig = new HotkeyConfig(Config); - if (hotkeyConfig.ShowDialog().IsOk()) - { - AddOnScreenMessage("Hotkey settings saved"); - InitControls(); - InputManager.SyncControls(Emulator, MovieSession, Config); - } - else - { - AddOnScreenMessage("Hotkey config aborted"); - } + if (!hotkeyConfig.ShowDialog().IsOk()) return; + AddOnScreenMessage("Hotkey settings saved"); + + InitControls(); + InputManager.SyncControls(Emulator, MovieSession, Config); } private void FirmwaresMenuItem_Click(object sender, EventArgs e) @@ -887,10 +877,7 @@ namespace BizHawk.Client.EmuHawk private void MessagesMenuItem_Click(object sender, EventArgs e) { using var form = new MessageConfig(Config); - var result = form.ShowDialog(); - AddOnScreenMessage(result.IsOk() - ? "Message settings saved" - : "Message config aborted"); + if (form.ShowDialog().IsOk()) AddOnScreenMessage("Message settings saved"); } private void PathsMenuItem_Click(object sender, EventArgs e) @@ -909,13 +896,9 @@ namespace BizHawk.Client.EmuHawk _ => Enumerable.Empty() }; using var form = new SoundConfig(this, Config, GetDeviceNamesCallback); - if (!form.ShowDialog().IsOk()) - { - AddOnScreenMessage("Sound config aborted"); - return; - } - + if (!form.ShowDialog().IsOk()) return; AddOnScreenMessage("Sound settings saved"); + if (form.ApplyNewSoundDevice) { Sound.Dispose(); @@ -933,10 +916,7 @@ namespace BizHawk.Client.EmuHawk private void AutofireMenuItem_Click(object sender, EventArgs e) { using var form = new AutofireConfig(Config, InputManager.AutoFireController, InputManager.AutofireStickyXorAdapter); - var result = form.ShowDialog(); - AddOnScreenMessage(result.IsOk() - ? "Autofire settings saved" - : "Autofire config aborted"); + if (form.ShowDialog().IsOk()) AddOnScreenMessage("Autofire settings saved"); } private void RewindOptionsMenuItem_Click(object sender, EventArgs e) @@ -944,19 +924,14 @@ namespace BizHawk.Client.EmuHawk if (Emulator.HasSavestates()) { using var form = new RewindConfig(Config, CreateRewinder, () => this.Rewinder, Emulator.AsStatable()); - AddOnScreenMessage(form.ShowDialog().IsOk() - ? "Rewind and State settings saved" - : "Rewind config aborted"); + if (form.ShowDialog().IsOk()) AddOnScreenMessage("Rewind and State settings saved"); } } private void FileExtensionsMenuItem_Click(object sender, EventArgs e) { using var form = new FileExtensionPreferences(Config.PreferredPlatformsForExtensions); - var result = form.ShowDialog(); - AddOnScreenMessage(result.IsOk() - ? "Rom Extension Preferences changed" - : "Rom Extension Preferences cancelled"); + if (form.ShowDialog().IsOk()) AddOnScreenMessage("Rom Extension Preferences changed"); } private void BumpAutoFlushSaveRamTimer() @@ -976,19 +951,13 @@ namespace BizHawk.Client.EmuHawk private void ProfilesMenuItem_Click(object sender, EventArgs e) { using var form = new ProfileConfig(this, Emulator, Config); - if (form.ShowDialog().IsOk()) - { - AddOnScreenMessage("Profile settings saved"); + if (!form.ShowDialog().IsOk()) return; + AddOnScreenMessage("Profile settings saved"); - // We hide the FirstBoot items since the user setup a Profile - // Is it a bad thing to do this constantly? - Config.FirstBoot = false; - ProfileFirstBootLabel.Visible = false; - } - else - { - AddOnScreenMessage("Profile config aborted"); - } + // We hide the FirstBoot items since the user setup a Profile + // Is it a bad thing to do this constantly? + Config.FirstBoot = false; + ProfileFirstBootLabel.Visible = false; } private void ClockThrottleMenuItem_Click(object sender, EventArgs e) @@ -1536,9 +1505,7 @@ namespace BizHawk.Client.EmuHawk if (Emulator is TI83 ti83) { using var form = new TI83PaletteConfig(this, ti83.GetSettings().Clone()); - AddOnScreenMessage(form.ShowDialog().IsOk() - ? "Palette settings saved" - : "Palette config aborted"); + if (form.ShowDialog().IsOk()) AddOnScreenMessage("Palette settings saved"); } } @@ -1724,20 +1691,10 @@ namespace BizHawk.Client.EmuHawk private void N64PluginSettingsMenuItem_Click(object sender, EventArgs e) { using var form = new N64VideoPluginConfig(this, Config, Emulator); - if (form.ShowDialog().IsOk()) + if (form.ShowDialog().IsOk() + && Emulator is not N64) // If it's loaded, the reboot required message will appear { - if (Emulator.IsNull()) - { - AddOnScreenMessage("Plugin settings saved"); - } - else - { - // Do nothing, Reboot is being flagged already if they changed anything - } - } - else - { - AddOnScreenMessage("Plugin settings aborted"); + AddOnScreenMessage("Plugin settings saved"); } } diff --git a/src/BizHawk.Client.EmuHawk/config/A7800/A7800ControllerSettings.cs b/src/BizHawk.Client.EmuHawk/config/A7800/A7800ControllerSettings.cs index af367753c7..84a6a75bf5 100644 --- a/src/BizHawk.Client.EmuHawk/config/A7800/A7800ControllerSettings.cs +++ b/src/BizHawk.Client.EmuHawk/config/A7800/A7800ControllerSettings.cs @@ -51,7 +51,6 @@ namespace BizHawk.Client.EmuHawk private void CancelBtn_Click(object sender, EventArgs e) { - _mainForm.AddOnScreenMessage("Controller settings aborted"); DialogResult = DialogResult.Cancel; Close(); } diff --git a/src/BizHawk.Client.EmuHawk/config/A7800/A7800FilterSettings.cs b/src/BizHawk.Client.EmuHawk/config/A7800/A7800FilterSettings.cs index 5828839cdd..73e344322c 100644 --- a/src/BizHawk.Client.EmuHawk/config/A7800/A7800FilterSettings.cs +++ b/src/BizHawk.Client.EmuHawk/config/A7800/A7800FilterSettings.cs @@ -48,7 +48,6 @@ namespace BizHawk.Client.EmuHawk private void CancelBtn_Click(object sender, EventArgs e) { - _mainForm.AddOnScreenMessage("Filter settings aborted"); DialogResult = DialogResult.Cancel; Close(); } diff --git a/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCAudioSettings.cs b/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCAudioSettings.cs index 59aa021814..910cc66da6 100644 --- a/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCAudioSettings.cs +++ b/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCAudioSettings.cs @@ -59,7 +59,6 @@ namespace BizHawk.Client.EmuHawk private void CancelBtn_Click(object sender, EventArgs e) { - _mainForm.AddOnScreenMessage("Misc settings aborted"); DialogResult = DialogResult.Cancel; Close(); } diff --git a/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCCoreEmulationSettings.cs b/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCCoreEmulationSettings.cs index 72b79ac102..ab9db646e2 100644 --- a/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCCoreEmulationSettings.cs +++ b/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCCoreEmulationSettings.cs @@ -73,7 +73,6 @@ namespace BizHawk.Client.EmuHawk private void CancelBtn_Click(object sender, EventArgs e) { - _mainForm.AddOnScreenMessage("Core emulator settings aborted"); DialogResult = DialogResult.Cancel; Close(); } diff --git a/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCNonSyncSettings.cs b/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCNonSyncSettings.cs index dfbefefe84..c948c9e4ff 100644 --- a/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCNonSyncSettings.cs +++ b/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCNonSyncSettings.cs @@ -54,7 +54,6 @@ namespace BizHawk.Client.EmuHawk private void CancelBtn_Click(object sender, EventArgs e) { - _mainForm.AddOnScreenMessage("Misc settings aborted"); DialogResult = DialogResult.Cancel; Close(); } diff --git a/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCPokeMemory.cs b/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCPokeMemory.cs index 76120e7849..be58ab315a 100644 --- a/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCPokeMemory.cs +++ b/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCPokeMemory.cs @@ -31,7 +31,6 @@ namespace BizHawk.Client.EmuHawk private void CancelBtn_Click(object sender, EventArgs e) { - _mainForm.AddOnScreenMessage("POKE memory aborted"); DialogResult = DialogResult.Cancel; Close(); } diff --git a/src/BizHawk.Client.EmuHawk/config/ColecoVision/ColecoControllerSettings.cs b/src/BizHawk.Client.EmuHawk/config/ColecoVision/ColecoControllerSettings.cs index 2b70ec677e..3e6824f872 100644 --- a/src/BizHawk.Client.EmuHawk/config/ColecoVision/ColecoControllerSettings.cs +++ b/src/BizHawk.Client.EmuHawk/config/ColecoVision/ColecoControllerSettings.cs @@ -51,7 +51,6 @@ namespace BizHawk.Client.EmuHawk private void CancelBtn_Click(object sender, EventArgs e) { - _mainForm.AddOnScreenMessage("Controller settings aborted"); DialogResult = DialogResult.Cancel; Close(); } diff --git a/src/BizHawk.Client.EmuHawk/config/EmuHawkOptions.cs b/src/BizHawk.Client.EmuHawk/config/EmuHawkOptions.cs index a6c70e3a46..61da2376b5 100644 --- a/src/BizHawk.Client.EmuHawk/config/EmuHawkOptions.cs +++ b/src/BizHawk.Client.EmuHawk/config/EmuHawkOptions.cs @@ -162,7 +162,6 @@ namespace BizHawk.Client.EmuHawk { Close(); DialogResult = DialogResult.Cancel; - _osdMessageCallback("Customizing aborted."); } private void AcceptBackgroundInputCheckbox_CheckedChanged(object sender, EventArgs e) diff --git a/src/BizHawk.Client.EmuHawk/config/INTV/IntvControllerSettings.cs b/src/BizHawk.Client.EmuHawk/config/INTV/IntvControllerSettings.cs index 10f2ff5f53..f1099ff0fe 100644 --- a/src/BizHawk.Client.EmuHawk/config/INTV/IntvControllerSettings.cs +++ b/src/BizHawk.Client.EmuHawk/config/INTV/IntvControllerSettings.cs @@ -51,7 +51,6 @@ namespace BizHawk.Client.EmuHawk private void CancelBtn_Click(object sender, EventArgs e) { - _mainForm.AddOnScreenMessage("Controller settings aborted"); DialogResult = DialogResult.Cancel; Close(); } diff --git a/src/BizHawk.Client.EmuHawk/config/NES/NesControllerSettings.cs b/src/BizHawk.Client.EmuHawk/config/NES/NesControllerSettings.cs index 88d1c24d9e..bfc5a2bcc6 100644 --- a/src/BizHawk.Client.EmuHawk/config/NES/NesControllerSettings.cs +++ b/src/BizHawk.Client.EmuHawk/config/NES/NesControllerSettings.cs @@ -62,7 +62,6 @@ namespace BizHawk.Client.EmuHawk private void CancelBtn_Click(object sender, EventArgs e) { - _mainForm.AddOnScreenMessage("Controller settings aborted"); DialogResult = DialogResult.Cancel; Close(); } diff --git a/src/BizHawk.Client.EmuHawk/config/PathConfig.cs b/src/BizHawk.Client.EmuHawk/config/PathConfig.cs index 58aa18a5e1..addb0795c8 100644 --- a/src/BizHawk.Client.EmuHawk/config/PathConfig.cs +++ b/src/BizHawk.Client.EmuHawk/config/PathConfig.cs @@ -267,7 +267,6 @@ namespace BizHawk.Client.EmuHawk private void Cancel_Click(object sender, EventArgs e) { - _mainForm.AddOnScreenMessage("Path config aborted"); Close(); } diff --git a/src/BizHawk.Client.EmuHawk/config/SNES/BSNESControllerConfig.cs b/src/BizHawk.Client.EmuHawk/config/SNES/BSNESControllerConfig.cs index 22a400f54a..8175ff19f0 100644 --- a/src/BizHawk.Client.EmuHawk/config/SNES/BSNESControllerConfig.cs +++ b/src/BizHawk.Client.EmuHawk/config/SNES/BSNESControllerConfig.cs @@ -50,7 +50,6 @@ namespace BizHawk.Client.EmuHawk private void CancelBtn_Click(object sender, EventArgs e) { - _mainForm.AddOnScreenMessage("Controller settings aborted"); DialogResult = DialogResult.Cancel; Close(); } diff --git a/src/BizHawk.Client.EmuHawk/config/SNES/SNESControllerConfig.cs b/src/BizHawk.Client.EmuHawk/config/SNES/SNESControllerConfig.cs index a9b4e247c3..f0ca2c16a2 100644 --- a/src/BizHawk.Client.EmuHawk/config/SNES/SNESControllerConfig.cs +++ b/src/BizHawk.Client.EmuHawk/config/SNES/SNESControllerConfig.cs @@ -53,7 +53,6 @@ namespace BizHawk.Client.EmuHawk private void CancelBtn_Click(object sender, EventArgs e) { - _mainForm.AddOnScreenMessage("Controller settings aborted"); DialogResult = DialogResult.Cancel; Close(); } diff --git a/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumAudioSettings.cs b/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumAudioSettings.cs index 85d5248e9b..e628fe907b 100644 --- a/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumAudioSettings.cs +++ b/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumAudioSettings.cs @@ -63,7 +63,6 @@ namespace BizHawk.Client.EmuHawk private void CancelBtn_Click(object sender, EventArgs e) { - _mainForm.AddOnScreenMessage("Misc settings aborted"); DialogResult = DialogResult.Cancel; Close(); } diff --git a/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumCoreEmulationSettings.cs b/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumCoreEmulationSettings.cs index 6f32c7ed4b..c4dd5e284f 100644 --- a/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumCoreEmulationSettings.cs +++ b/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumCoreEmulationSettings.cs @@ -69,7 +69,6 @@ namespace BizHawk.Client.EmuHawk private void CancelBtn_Click(object sender, EventArgs e) { - _mainForm.AddOnScreenMessage("Core emulator settings aborted"); DialogResult = DialogResult.Cancel; Close(); } diff --git a/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumJoystickSettings.cs b/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumJoystickSettings.cs index 36109a368a..69fb1df88b 100644 --- a/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumJoystickSettings.cs +++ b/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumJoystickSettings.cs @@ -122,7 +122,6 @@ namespace BizHawk.Client.EmuHawk private void CancelBtn_Click(object sender, EventArgs e) { - _mainForm.AddOnScreenMessage("Joystick settings aborted"); DialogResult = DialogResult.Cancel; Close(); } diff --git a/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumNonSyncSettings.cs b/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumNonSyncSettings.cs index 865b91fd49..709d960db0 100644 --- a/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumNonSyncSettings.cs +++ b/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumNonSyncSettings.cs @@ -72,7 +72,6 @@ namespace BizHawk.Client.EmuHawk private void CancelBtn_Click(object sender, EventArgs e) { - _mainForm.AddOnScreenMessage("Misc settings aborted"); DialogResult = DialogResult.Cancel; Close(); } diff --git a/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumPokeMemory.cs b/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumPokeMemory.cs index f8b8eb7654..18eb71b7fb 100644 --- a/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumPokeMemory.cs +++ b/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumPokeMemory.cs @@ -32,7 +32,6 @@ namespace BizHawk.Client.EmuHawk private void CancelBtn_Click(object sender, EventArgs e) { - _mainForm.AddOnScreenMessage("POKE memory aborted"); DialogResult = DialogResult.Cancel; Close(); }