From af73f87e8f8394ca51f181230bd3fef3a1725415 Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Wed, 8 Jun 2022 00:38:19 +1000 Subject: [PATCH] More settings anywhere cleanup --- .../movie/MovieConversionExtensions.cs | 4 +- src/BizHawk.Client.EmuHawk/MainForm.Events.cs | 223 +++++++----------- .../config/GB/GBLPrefs.Designer.cs | 4 +- .../config/GB/GBLPrefs.cs | 4 +- .../config/GB/GBPrefControl.Designer.cs | 210 ++++++++--------- .../config/GB/GBPrefs.Designer.cs | 104 ++++---- .../config/GB/GBPrefs.cs | 4 +- .../config/GenericCoreConfig.cs | 167 ++++++------- .../config/PSX/PSXOptions.cs | 11 +- .../config/SNES/BSNESOptions.cs | 4 +- .../config/SNES/SNESOptions.cs | 4 +- .../Consoles/NEC/PCE/HyperNyma.cs | 5 +- .../Consoles/NEC/PCE/TurboNyma.cs | 5 +- .../Consoles/NEC/PCFX/Tst.cs | 5 +- .../Consoles/Nintendo/Faust/Faust.cs | 5 +- .../Consoles/Nintendo/VB/VirtualBoyee.cs | 5 +- .../Consoles/SNK/NeoGeoPort.cs | 5 +- .../Consoles/Sega/Saturn/Saturnus.cs | 5 +- .../Consoles/Sony/PSX/Nymashock.cs | 5 +- 19 files changed, 341 insertions(+), 438 deletions(-) diff --git a/src/BizHawk.Client.Common/movie/MovieConversionExtensions.cs b/src/BizHawk.Client.Common/movie/MovieConversionExtensions.cs index fa1e7bea18..16ae2d0228 100644 --- a/src/BizHawk.Client.Common/movie/MovieConversionExtensions.cs +++ b/src/BizHawk.Client.Common/movie/MovieConversionExtensions.cs @@ -288,9 +288,7 @@ namespace BizHawk.Client.Common movie.HeaderEntries.Add(HeaderKeys.ClockRate, "0"); } - movie.Core = ((CoreAttribute)Attribute - .GetCustomAttribute(emulator.GetType(), typeof(CoreAttribute))) - .CoreName; + movie.Core = emulator.Attributes().CoreName; } internal static string ConvertFileNameToTasMovie(string oldFileName) diff --git a/src/BizHawk.Client.EmuHawk/MainForm.Events.cs b/src/BizHawk.Client.EmuHawk/MainForm.Events.cs index 12e26fcb26..1f817eb0fd 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -454,7 +454,7 @@ namespace BizHawk.Client.EmuHawk Config.PathEntries, Config.FirmwareUserSpecifications, FirmwareDatabase.FirmwareRecords.First(fr => fr.ID == id), - // exactFile: hash, //TODO re-scan FW dir for this file, then try autopatching +// exactFile: hash, //TODO re-scan FW dir for this file, then try autopatching forbidScan: true)?.Hash; private void PlayMovieMenuItem_Click(object sender, EventArgs e) @@ -1476,14 +1476,13 @@ namespace BizHawk.Client.EmuHawk return this.ShowDialogWithTempMute(form); } - private DialogResult OpenQuickNesGamepadSettingsDialog() + private DialogResult OpenQuickNesGamepadSettingsDialog(ISettingsAdapter settable) => GenericCoreConfig.DoDialogFor( this, - GetSettingsAdapterFor(), + settable, "QuickNES Controller Settings", - MovieSession.Movie.IsActive(), - hideSettings: true, - hideSyncSettings: false); + isMovieActive: MovieSession.Movie.IsActive(), + ignoreSettings: true); private void NesControllerSettingsMenuItem_Click(object sender, EventArgs e) { @@ -1491,7 +1490,7 @@ namespace BizHawk.Client.EmuHawk { NES => OpenNesHawkGamepadSettingsDialog(GetSettingsAdapterForLoadedCore()), SubNESHawk => OpenNesHawkGamepadSettingsDialog(GetSettingsAdapterForLoadedCore()), - QuickNES => OpenQuickNesGamepadSettingsDialog(), + QuickNES => OpenQuickNesGamepadSettingsDialog(GetSettingsAdapterForLoadedCore()), _ => DialogResult.None }; } @@ -1607,20 +1606,20 @@ namespace BizHawk.Client.EmuHawk }; } - private DialogResult OpenGambatteSettingsDialog() - => GBPrefs.DoGBPrefsDialog(Config, this, Game, MovieSession, GetSettingsAdapterFor()); + private DialogResult OpenGambatteSettingsDialog(ISettingsAdapter settable) + => GBPrefs.DoGBPrefsDialog(Config, this, Game, MovieSession, settable); private DialogResult OpenGBHawkSettingsDialog() - => OpenGenericCoreConfigFor("Gameboy Settings"); + => OpenGenericCoreConfigFor(CoreNames.GbHawk + " Settings"); private DialogResult OpenSameBoySettingsDialog() - => OpenGenericCoreConfigFor("Gameboy Settings"); + => OpenGenericCoreConfigFor(CoreNames.Sameboy + " Settings"); private void GbCoreSettingsMenuItem_Click(object sender, EventArgs e) { _ = Emulator switch { - Gameboy => OpenGambatteSettingsDialog(), + Gameboy => OpenGambatteSettingsDialog(GetSettingsAdapterForLoadedCore()), GBHawk => OpenGBHawkSettingsDialog(), Sameboy => OpenSameBoySettingsDialog(), _ => DialogResult.None @@ -1672,14 +1671,14 @@ namespace BizHawk.Client.EmuHawk }; } - private DialogResult OpenOctoshockSettingsDialog(OctoshockDll.eVidStandard vidStandard, Size vidSize) - => PSXOptions.DoSettingsDialog(Config, this, GetSettingsAdapterFor(), vidStandard, vidSize); + private DialogResult OpenOctoshockSettingsDialog(ISettingsAdapter settable, OctoshockDll.eVidStandard vidStandard, Size vidSize) + => PSXOptions.DoSettingsDialog(Config, this, settable, vidStandard, vidSize); private void PsxOptionsMenuItem_Click(object sender, EventArgs e) { var result = Emulator switch { - Octoshock octoshock => OpenOctoshockSettingsDialog(octoshock.SystemVidStandard, octoshock.CurrentVideoSize), + Octoshock octoshock => OpenOctoshockSettingsDialog(GetSettingsAdapterForLoadedCore(), octoshock.SystemVidStandard, octoshock.CurrentVideoSize), _ => DialogResult.None }; if (result.IsOk()) FrameBufferResized(); @@ -1732,18 +1731,18 @@ namespace BizHawk.Client.EmuHawk Tools.Load(); } - private DialogResult OpenOldBSNESSettingsDialog() - => SNESOptions.DoSettingsDialog(this, GetSettingsAdapterFor()); + private DialogResult OpenOldBSNESSettingsDialog(ISettingsAdapter settable) + => SNESOptions.DoSettingsDialog(this, settable); - private DialogResult OpenBSNESSettingsDialog() - => BSNESOptions.DoSettingsDialog(this, GetSettingsAdapterFor()); + private DialogResult OpenBSNESSettingsDialog(ISettingsAdapter settable) + => BSNESOptions.DoSettingsDialog(this, settable); private void SnesOptionsMenuItem_Click(object sender, EventArgs e) { _ = Emulator switch { - LibsnesCore => OpenOldBSNESSettingsDialog(), - BsnesCore => OpenBSNESSettingsDialog(), + LibsnesCore => OpenOldBSNESSettingsDialog(GetSettingsAdapterForLoadedCore()), + BsnesCore => OpenBSNESSettingsDialog(GetSettingsAdapterForLoadedCore()), _ => DialogResult.None }; } @@ -1875,14 +1874,14 @@ namespace BizHawk.Client.EmuHawk } } - private DialogResult OpenGambatteLinkSettingsDialog() - => GBLPrefs.DoGBLPrefsDialog(Config, this, Game, MovieSession, GetSettingsAdapterFor()); + private DialogResult OpenGambatteLinkSettingsDialog(ISettingsAdapter settable) + => GBLPrefs.DoGBLPrefsDialog(Config, this, Game, MovieSession, settable); private void GblSettingsMenuItem_Click(object sender, EventArgs e) { _ = Emulator switch { - GambatteLink => OpenGambatteLinkSettingsDialog(), + GambatteLink => OpenGambatteLinkSettingsDialog(GetSettingsAdapterForLoadedCore()), _ => DialogResult.None }; } @@ -1891,21 +1890,14 @@ namespace BizHawk.Client.EmuHawk where T : IEmulator => GenericCoreConfig.DoDialogFor(this, GetSettingsAdapterFor(), title, isMovieActive: MovieSession.Movie.IsActive()); - private DialogResult OpenGenericCoreConfig(string title) - => GenericCoreConfig.DoDialog(Emulator, this, title, isMovieActive: MovieSession.Movie.IsActive()); + private void OpenGenericCoreConfig() + => GenericCoreConfig.DoDialog(Emulator, this, isMovieActive: MovieSession.Movie.IsActive()); private void GenericCoreSettingsMenuItem_Click(object sender, EventArgs e) - { - var coreName = ((CoreAttribute) Attribute.GetCustomAttribute(Emulator.GetType(), typeof(CoreAttribute))).CoreName; - OpenGenericCoreConfig($"{coreName} Settings"); - } - - private DialogResult OpenNymaConfigFor(NymaCore.NymaSettingsInfo settingsInfo) - where T : IEmulator - => GenericCoreConfig.DoNymaDialogFor(this, GetSettingsAdapterFor(), settingsInfo, isMovieActive: MovieSession.Movie.IsActive()); + => OpenGenericCoreConfig(); private DialogResult OpenVirtuSettingsDialog() - => OpenGenericCoreConfigFor("Apple II Settings"); + => OpenGenericCoreConfigFor(CoreNames.Virtu + " Settings"); private void AppleIISettingsMenuItem_Click(object sender, EventArgs e) { @@ -1985,7 +1977,7 @@ namespace BizHawk.Client.EmuHawk } private DialogResult OpenC64HawkSettingsDialog() - => OpenGenericCoreConfigFor("C64 Settings"); + => OpenGenericCoreConfigFor(CoreNames.C64Hawk + " Settings"); private void C64SettingsMenuItem_Click(object sender, EventArgs e) { @@ -2735,6 +2727,16 @@ namespace BizHawk.Client.EmuHawk ToolStripMenuItemEx CreateGenericCoreConfigItem(string coreName) where T : IEmulator => CreateSettingsItem("Settings...", (_, _) => OpenGenericCoreConfigFor($"{coreName} Settings")); + ToolStripMenuItemEx CreateGenericNymaCoreConfigItem(string coreName, Func getCachedSettingsInfo) + where T : NymaCore + => CreateSettingsItem( + "Settings...", + (_, _) => GenericCoreConfig.DoNymaDialogFor( + this, + GetSettingsAdapterFor(), + $"{coreName} Settings", + getCachedSettingsInfo(CreateCoreComm()), + isMovieActive: MovieSession.Movie.IsActive())); ToolStripMenuItemEx CreateCoreSubmenu(VSystemCategory cat, string coreName, params ToolStripItem[] items) { ToolStripMenuItemEx submenu = new() { Tag = cat, Text = coreName }; @@ -2748,13 +2750,7 @@ namespace BizHawk.Client.EmuHawk var a7800HawkGamepadSettingsItem = CreateSettingsItem("Controller Settings...", (_, _) => OpenA7800HawkGamepadSettingsDialog(GetSettingsAdapterFor())); var a7800HawkFilterSettingsItem = CreateSettingsItem("Filter Settings...", (_, _) => OpenA7800HawkFilterSettingsDialog(GetSettingsAdapterFor())); var a7800HawkSubmenu = CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.A7800Hawk, a7800HawkGamepadSettingsItem, a7800HawkFilterSettingsItem); - a7800HawkSubmenu.DropDownOpened += (_, _) => - { - var isMovieActive = MovieSession.Movie.IsActive(); - var loadedCoreIsA7800Hawk = Emulator is A7800Hawk; - a7800HawkGamepadSettingsItem.Enabled = !isMovieActive || !loadedCoreIsA7800Hawk; - a7800HawkFilterSettingsItem.Enabled = !isMovieActive || !loadedCoreIsA7800Hawk; - }; + a7800HawkSubmenu.DropDownOpened += (_, _) => a7800HawkGamepadSettingsItem.Enabled = a7800HawkFilterSettingsItem.Enabled = MovieSession.Movie.NotActive() || Emulator is not A7800Hawk; items.Add(a7800HawkSubmenu); // Ares64 @@ -2765,42 +2761,32 @@ namespace BizHawk.Client.EmuHawk // BSNES var oldBSNESGamepadSettingsItem = CreateSettingsItem("Controller Configuration...", (_, _) => OpenOldBSNESGamepadSettingsDialog(GetSettingsAdapterFor())); - var oldBSNESSettingsItem = CreateSettingsItem("Options...", (_, _) => OpenOldBSNESSettingsDialog()); + var oldBSNESSettingsItem = CreateSettingsItem("Options...", (_, _) => OpenOldBSNESSettingsDialog(GetSettingsAdapterFor())); var oldBSNESSubmenu = CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.Bsnes, oldBSNESGamepadSettingsItem, oldBSNESSettingsItem); - oldBSNESSubmenu.DropDownOpened += (_, _) => - { - var loadedCoreIsOldBSNES = Emulator is LibsnesCore; - oldBSNESGamepadSettingsItem.Enabled = !loadedCoreIsOldBSNES || MovieSession.Movie.NotActive(); - }; + oldBSNESSubmenu.DropDownOpened += (_, _) => oldBSNESGamepadSettingsItem.Enabled = MovieSession.Movie.NotActive() || Emulator is not LibsnesCore; items.Add(oldBSNESSubmenu); // BSNESv115+ var bsnesGamepadSettingsItem = CreateSettingsItem("Controller Configuration...", (_, _) => OpenBSNESGamepadSettingsDialog(GetSettingsAdapterFor())); - var bsnesSettingsItem = CreateSettingsItem("Options...", (_, _) => OpenBSNESSettingsDialog()); + var bsnesSettingsItem = CreateSettingsItem("Options...", (_, _) => OpenBSNESSettingsDialog(GetSettingsAdapterFor())); var bsnesSubmenu = CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.Bsnes115, bsnesGamepadSettingsItem, bsnesSettingsItem); - bsnesSubmenu.DropDownOpened += (_, _) => - { - var loadedCoreIsBSNES = Emulator is BsnesCore; - bsnesGamepadSettingsItem.Enabled = !loadedCoreIsBSNES || MovieSession.Movie.NotActive(); - }; + bsnesSubmenu.DropDownOpened += (_, _) => bsnesGamepadSettingsItem.Enabled = MovieSession.Movie.NotActive() || Emulator is not BsnesCore; items.Add(bsnesSubmenu); // C64Hawk - var c64HawkSettingsItem = CreateSettingsItem("Settings...", (_, _) => OpenC64HawkSettingsDialog()); - var c64HawkSubmenu = CreateCoreSubmenu(VSystemCategory.PCs, CoreNames.C64Hawk, c64HawkSettingsItem); - items.Add(c64HawkSubmenu); + items.Add(CreateCoreSubmenu(VSystemCategory.PCs, CoreNames.C64Hawk, CreateSettingsItem("Settings...", (_, _) => OpenC64HawkSettingsDialog()))); // ChannelFHawk items.Add(CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.ChannelFHawk, CreateGenericCoreConfigItem(CoreNames.ChannelFHawk))); // ColecoHawk var colecoHawkGamepadSettingsItem = CreateSettingsItem("Controller Settings...", (_, _) => OpenColecoHawkGamepadSettingsDialog(GetSettingsAdapterFor())); - var colecoHawkSkipBIOSItem = CreateSettingsItem("Skip BIOS intro (When Applicable)", (sender, _) => ColecoHawkSetSkipBIOSIntro(!((ToolStripMenuItem)sender).Checked, GetSettingsAdapterFor())); - var colecoHawkUseSGMItem = CreateSettingsItem("Use the Super Game Module", (sender, _) => ColecoHawkSetSuperGameModule(!((ToolStripMenuItem)sender).Checked, GetSettingsAdapterFor())); + var colecoHawkSkipBIOSItem = CreateSettingsItem("Skip BIOS intro (When Applicable)", (sender, _) => ColecoHawkSetSkipBIOSIntro(!((ToolStripMenuItem) sender).Checked, GetSettingsAdapterFor())); + var colecoHawkUseSGMItem = CreateSettingsItem("Use the Super Game Module", (sender, _) => ColecoHawkSetSuperGameModule(!((ToolStripMenuItem) sender).Checked, GetSettingsAdapterFor())); var colecoHawkSubmenu = CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.ColecoHawk, colecoHawkGamepadSettingsItem, colecoHawkSkipBIOSItem, colecoHawkUseSGMItem); colecoHawkSubmenu.DropDownOpened += (_, _) => { - var ss = (ColecoVision.ColecoSyncSettings)GetSettingsAdapterFor().GetSyncSettings(); + var ss = (ColecoVision.ColecoSyncSettings) GetSettingsAdapterFor().GetSyncSettings(); colecoHawkGamepadSettingsItem.Enabled = MovieSession.Movie.NotActive() || Emulator is not ColecoVision; colecoHawkSkipBIOSItem.Checked = ss.SkipBiosIntro; colecoHawkUseSGMItem.Checked = ss.UseSGM; @@ -2825,30 +2811,17 @@ namespace BizHawk.Client.EmuHawk items.Add(CreateCoreSubmenu(VSystemCategory.Other, CoreNames.Emu83, CreateSettingsItem("Palette...", (_, _) => OpenTI83PaletteSettingsDialog(GetSettingsAdapterFor())))); // Faust - var faustSettingsItem = CreateSettingsItem("Settings...", (_, _) => OpenNymaConfigFor(Faust.CachedSettingsInfo(CreateCoreComm()))); - var faustSubmenu = CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.Faust, faustSettingsItem); - items.Add(faustSubmenu); + items.Add(CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.Faust, CreateGenericNymaCoreConfigItem(CoreNames.Faust, Faust.CachedSettingsInfo))); // Gambatte - var gambatteSettingsItem = CreateSettingsItem("Settings...", (_, _) => OpenGambatteSettingsDialog()); - var gambatteSubmenu = CreateCoreSubmenu(VSystemCategory.Handhelds, CoreNames.Gambatte, gambatteSettingsItem); - items.Add(gambatteSubmenu); - if (includeDupes) - { - var gambatteSettingsItem1 = CreateSettingsItem("Settings...", (_, _) => OpenGambatteSettingsDialog()); - var gambatteSubmenu1 = CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.Gambatte, gambatteSettingsItem1); - items.Add(gambatteSubmenu1); - } + items.Add(CreateCoreSubmenu(VSystemCategory.Handhelds, CoreNames.Gambatte, CreateSettingsItem("Settings...", (_, _) => OpenGambatteSettingsDialog(GetSettingsAdapterFor())))); + if (includeDupes) items.Add(CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.Gambatte, CreateSettingsItem("Settings...", (_, _) => OpenGambatteSettingsDialog(GetSettingsAdapterFor())))); // GambatteLink - var gambatteLinkSettingsItem = CreateSettingsItem("Settings...", (_, _) => OpenGambatteLinkSettingsDialog()); - var gambatteLinkSubmenu = CreateCoreSubmenu(VSystemCategory.Handhelds, CoreNames.GambatteLink, gambatteLinkSettingsItem); - items.Add(gambatteLinkSubmenu); + items.Add(CreateCoreSubmenu(VSystemCategory.Handhelds, CoreNames.GambatteLink, CreateSettingsItem("Settings...", (_, _) => OpenGambatteLinkSettingsDialog(GetSettingsAdapterFor())))); // GBHawk - var gbHawkSettingsItem = CreateSettingsItem("Settings...", (_, _) => OpenGBHawkSettingsDialog()); - var gbHawkSubmenu = CreateCoreSubmenu(VSystemCategory.Handhelds, CoreNames.GbHawk, gbHawkSettingsItem); - items.Add(gbHawkSubmenu); + items.Add(CreateCoreSubmenu(VSystemCategory.Handhelds, CoreNames.GbHawk, CreateSettingsItem("Settings...", (_, _) => OpenGBHawkSettingsDialog()))); // GBHawkLink items.Add(CreateCoreSubmenu(VSystemCategory.Handhelds, CoreNames.GBHawkLink, CreateGenericCoreConfigItem(CoreNames.GBHawkLink))); @@ -2869,9 +2842,7 @@ namespace BizHawk.Client.EmuHawk items.Add(CreateCoreSubmenu(VSystemCategory.Handhelds, CoreNames.Handy, CreateGenericCoreConfigItem(CoreNames.Handy))); // as Handy doesn't implement `IStatable<,>`, this opens an empty `GenericCoreConfig`, which is dumb, but matches the existing behaviour // HyperNyma - var hyperNymaSettingsItem = CreateSettingsItem("Settings...", (_, _) => OpenNymaConfigFor(HyperNyma.CachedSettingsInfo(CreateCoreComm()))); - var hyperNymaSubmenu = CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.HyperNyma, hyperNymaSettingsItem); - items.Add(hyperNymaSubmenu); + items.Add(CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.HyperNyma, CreateGenericNymaCoreConfigItem(CoreNames.HyperNyma, HyperNyma.CachedSettingsInfo))); // IntelliHawk var intelliHawkGamepadSettingsItem = CreateSettingsItem("Controller Settings...", (_, _) => OpenIntelliHawkGamepadSettingsDialog(GetSettingsAdapterFor())); @@ -2886,8 +2857,7 @@ namespace BizHawk.Client.EmuHawk CreateGenericCoreConfigItem(CoreNames.Libretro))); // as Libretro doesn't implement `IStatable<,>`, this opens an empty `GenericCoreConfig`, which is dumb, but matches the existing behaviour // MAME - // just guessing here --yoshi - var mameSettingsItem = CreateSettingsItem("Settings...", (_, _) => OpenGenericCoreConfig($"{CoreNames.MAME} Settings")); + var mameSettingsItem = CreateSettingsItem("Settings...", (_, _) => OpenGenericCoreConfig()); var mameSubmenu = CreateCoreSubmenu(VSystemCategory.Other, CoreNames.MAME, mameSettingsItem); mameSubmenu.DropDownOpened += (_, _) => mameSettingsItem.Enabled = Emulator is MAME; items.Add(mameSubmenu); @@ -2905,13 +2875,13 @@ namespace BizHawk.Client.EmuHawk var mupen64PlusGraphicsSettingsItem = CreateSettingsItem("Video Plugins...", N64PluginSettingsMenuItem_Click); var mupen64PlusGamepadSettingsItem = CreateSettingsItem("Controller Settings...", (_, _) => OpenMupen64PlusGamepadSettingsDialog(GetSettingsAdapterFor())); var mupen64PlusAnalogConstraintItem = CreateSettingsItem("Circular Analog Range", N64CircularAnalogRangeMenuItem_Click); - var mupen64PlusNonVILagFramesItem = CreateSettingsItem("Non-VI Lag Frames", (sender, _) => Mupen64PlusSetNonVILagFrames(!((ToolStripMenuItem)sender).Checked, GetSettingsAdapterFor())); - var mupen64PlusUseExpansionSlotItem = CreateSettingsItem("Use Expansion Slot", (sender, _) => Mupen64PlusSetUseExpansionSlot(!((ToolStripMenuItem)sender).Checked, GetSettingsAdapterFor())); + var mupen64PlusNonVILagFramesItem = CreateSettingsItem("Non-VI Lag Frames", (sender, _) => Mupen64PlusSetNonVILagFrames(!((ToolStripMenuItem) sender).Checked, GetSettingsAdapterFor())); + var mupen64PlusUseExpansionSlotItem = CreateSettingsItem("Use Expansion Slot", (sender, _) => Mupen64PlusSetUseExpansionSlot(!((ToolStripMenuItem) sender).Checked, GetSettingsAdapterFor())); var mupen64PlusSubmenu = CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.Mupen64Plus, mupen64PlusGraphicsSettingsItem, mupen64PlusGamepadSettingsItem, mupen64PlusAnalogConstraintItem, mupen64PlusNonVILagFramesItem, mupen64PlusUseExpansionSlotItem); mupen64PlusSubmenu.DropDownOpened += (_, _) => { var settable = GetSettingsAdapterFor(); - var s = (N64Settings)settable.GetSettings(); + var s = (N64Settings) settable.GetSettings(); var isMovieActive = MovieSession.Movie.IsActive(); var mupen64Plus = Emulator as N64; var loadedCoreIsMupen64Plus = mupen64Plus is not null; @@ -2926,16 +2896,14 @@ namespace BizHawk.Client.EmuHawk } else { - mupen64PlusUseExpansionSlotItem.Checked = !((N64SyncSettings)settable.GetSyncSettings()).DisableExpansionSlot; + mupen64PlusUseExpansionSlotItem.Checked = !((N64SyncSettings) settable.GetSyncSettings()).DisableExpansionSlot; mupen64PlusUseExpansionSlotItem.Enabled = true; } }; items.Add(mupen64PlusSubmenu); // NeoPop - var neoPopSettingsItem = CreateSettingsItem("Settings...", (_, _) => OpenNymaConfigFor(NeoGeoPort.CachedSettingsInfo(CreateCoreComm()))); - var neoPopSubmenu = CreateCoreSubmenu(VSystemCategory.Handhelds, CoreNames.NeoPop, neoPopSettingsItem); - items.Add(neoPopSubmenu); + items.Add(CreateCoreSubmenu(VSystemCategory.Handhelds, CoreNames.NeoPop, CreateGenericNymaCoreConfigItem(CoreNames.NeoPop, NeoGeoPort.CachedSettingsInfo))); // NesHawk var nesHawkGamepadSettingsItem = CreateSettingsItem("Controller Settings...", (_, _) => OpenNesHawkGamepadSettingsDialog(GetSettingsAdapterFor())); @@ -2950,19 +2918,16 @@ namespace BizHawk.Client.EmuHawk nesHawkAdvancedSettingsItem); nesHawkSubmenu.DropDownOpened += (_, _) => { - var isMovieActive = MovieSession.Movie.IsActive(); var nesHawk = Emulator as NES; - var loadedCoreIsNesHawk = nesHawk is not null; - nesHawkGamepadSettingsItem.Enabled = (!loadedCoreIsNesHawk || !isMovieActive) && Tools.IsAvailable(); - nesHawkVSSettingsItem.Enabled = !loadedCoreIsNesHawk || nesHawk.IsVS is true; - nesHawkAdvancedSettingsItem.Enabled = !loadedCoreIsNesHawk || !isMovieActive; + var canEditSyncSettings = nesHawk is null || MovieSession.Movie.NotActive(); + nesHawkGamepadSettingsItem.Enabled = canEditSyncSettings && Tools.IsAvailable(); + nesHawkVSSettingsItem.Enabled = nesHawk?.IsVS is null or true; + nesHawkAdvancedSettingsItem.Enabled = canEditSyncSettings; }; items.Add(nesHawkSubmenu); // Nymashock - var nymashockSettingsItem = CreateSettingsItem("Settings...", (_, _) => OpenNymaConfigFor(Nymashock.CachedSettingsInfo(CreateCoreComm()))); - var nymashockSubmenu = CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.Nymashock, nymashockSettingsItem); - items.Add(nymashockSubmenu); + items.Add(CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.Nymashock, CreateGenericNymaCoreConfigItem(CoreNames.Nymashock, Nymashock.CachedSettingsInfo))); // O2Hawk items.Add(CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.O2Hawk, CreateGenericCoreConfigItem(CoreNames.O2Hawk))); @@ -2971,21 +2936,15 @@ namespace BizHawk.Client.EmuHawk var octoshockGamepadSettingsItem = CreateSettingsItem("Controller / Memcard Settings...", (_, _) => OpenOctoshockGamepadSettingsDialog(GetSettingsAdapterFor())); var octoshockSettingsItem = CreateSettingsItem("Options...", PsxOptionsMenuItem_Click); // using init buffer sizes here (in practice, they don't matter here, but might as well) - var octoshockNtscSettingsItem = CreateSettingsItem("Options (as NTSC)...", (_, _) => OpenOctoshockSettingsDialog(OctoshockDll.eVidStandard.NTSC, new(280, 240))); - var octoshockPalSettingsItem = CreateSettingsItem("Options (as PAL)...", (_, _) => OpenOctoshockSettingsDialog(OctoshockDll.eVidStandard.PAL, new(280, 288))); - var octoshockSubmenu = CreateCoreSubmenu( - VSystemCategory.Consoles, - CoreNames.Octoshock, - octoshockGamepadSettingsItem, - octoshockSettingsItem, - octoshockNtscSettingsItem, - octoshockPalSettingsItem); + var octoshockNTSCSettingsItem = CreateSettingsItem("Options (as NTSC)...", (_, _) => OpenOctoshockSettingsDialog(GetSettingsAdapterFor(), OctoshockDll.eVidStandard.NTSC, new(280, 240))); + var octoshockPALSettingsItem = CreateSettingsItem("Options (as PAL)...", (_, _) => OpenOctoshockSettingsDialog(GetSettingsAdapterFor(), OctoshockDll.eVidStandard.PAL, new(280, 288))); + var octoshockSubmenu = CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.Octoshock, octoshockGamepadSettingsItem, octoshockSettingsItem, octoshockNTSCSettingsItem, octoshockPALSettingsItem); octoshockSubmenu.DropDownOpened += (_, _) => { var loadedCoreIsOctoshock = Emulator is Octoshock; octoshockGamepadSettingsItem.Enabled = !loadedCoreIsOctoshock || MovieSession.Movie.NotActive(); octoshockSettingsItem.Visible = loadedCoreIsOctoshock; - octoshockNtscSettingsItem.Visible = octoshockPalSettingsItem.Visible = !loadedCoreIsOctoshock; + octoshockNTSCSettingsItem.Visible = octoshockPALSettingsItem.Visible = !loadedCoreIsOctoshock; }; items.Add(octoshockSubmenu); @@ -2996,33 +2955,24 @@ namespace BizHawk.Client.EmuHawk items.Add(CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.PicoDrive, CreateGenericCoreConfigItem(CoreNames.PicoDrive))); // QuickNes - var quickNesGamepadSettingsItem = CreateSettingsItem("Controller Settings...", (_, _) => OpenQuickNesGamepadSettingsDialog()); + var quickNesGamepadSettingsItem = CreateSettingsItem("Controller Settings...", (_, _) => OpenQuickNesGamepadSettingsDialog(GetSettingsAdapterFor())); var quickNesSubmenu = CreateCoreSubmenu( VSystemCategory.Consoles, CoreNames.QuickNes, quickNesGamepadSettingsItem, CreateSettingsItem("Graphics Settings...", (_, _) => OpenQuickNesGraphicsSettingsDialog(GetSettingsAdapterFor()))); - quickNesSubmenu.DropDownOpened += (_, _) => - { - var isMovieActive = MovieSession.Movie.IsActive(); - var loadedCoreIsQuickNes = Emulator is QuickNES; - quickNesGamepadSettingsItem.Enabled = (!loadedCoreIsQuickNes || !isMovieActive) && Tools.IsAvailable(); - }; + quickNesSubmenu.DropDownOpened += (_, _) => quickNesGamepadSettingsItem.Enabled = (MovieSession.Movie.NotActive() || Emulator is not QuickNES) && Tools.IsAvailable(); items.Add(quickNesSubmenu); // SameBoy - var sameBoySettingsItem = CreateSettingsItem("Settings...", (_, _) => OpenSameBoySettingsDialog()); - var sameBoySubmenu = CreateCoreSubmenu( + items.Add(CreateCoreSubmenu( VSystemCategory.Handhelds, CoreNames.Sameboy, - sameBoySettingsItem, - CreateSettingsItem("Choose Custom Palette...", (_, _) => OpenSameBoyPaletteSettingsDialog(GetSettingsAdapterFor()))); - items.Add(sameBoySubmenu); + CreateSettingsItem("Settings...", (_, _) => OpenSameBoySettingsDialog()), + CreateSettingsItem("Choose Custom Palette...", (_, _) => OpenSameBoyPaletteSettingsDialog(GetSettingsAdapterFor())))); // Saturnus - var saturnusSettingsItem = CreateSettingsItem("Settings...", (_, _) => OpenNymaConfigFor(Saturnus.CachedSettingsInfo(CreateCoreComm()))); - var saturnusSubmenu = CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.Saturnus, saturnusSettingsItem); - items.Add(saturnusSubmenu); + items.Add(CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.Saturnus, CreateGenericNymaCoreConfigItem(CoreNames.Saturnus, Saturnus.CachedSettingsInfo))); // SMSHawk items.Add(CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.SMSHawk, CreateGenericCoreConfigItem(CoreNames.SMSHawk))); @@ -3047,12 +2997,11 @@ namespace BizHawk.Client.EmuHawk subNESHawkAdvancedSettingsItem); subNESHawkSubmenu.DropDownOpened += (_, _) => { - var isMovieActive = MovieSession.Movie.IsActive(); var subNESHawk = Emulator as SubNESHawk; - var loadedCoreIsSubNESHawk = subNESHawk is not null; - subNESHawkGamepadSettingsItem.Enabled = !isMovieActive && Tools.IsAvailable(); - subNESHawkVSSettingsItem.Enabled = !loadedCoreIsSubNESHawk || subNESHawk.IsVs is true; - subNESHawkAdvancedSettingsItem.Enabled = !loadedCoreIsSubNESHawk || !isMovieActive; + var canEditSyncSettings = subNESHawk is null || MovieSession.Movie.NotActive(); + subNESHawkGamepadSettingsItem.Enabled = canEditSyncSettings && Tools.IsAvailable(); + subNESHawkVSSettingsItem.Enabled = subNESHawk?.IsVs is null or true; + subNESHawkAdvancedSettingsItem.Enabled = canEditSyncSettings; }; items.Add(subNESHawkSubmenu); @@ -3060,14 +3009,10 @@ namespace BizHawk.Client.EmuHawk items.Add(CreateCoreSubmenu(VSystemCategory.Other, CoreNames.TI83Hawk, CreateSettingsItem("Palette...", (_, _) => OpenTI83PaletteSettingsDialog(GetSettingsAdapterFor())))); // T. S. T. - var tstSettingsItem = CreateSettingsItem("Settings...", (_, _) => OpenNymaConfigFor(Tst.CachedSettingsInfo(CreateCoreComm()))); - var tstSubmenu = CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.TST, tstSettingsItem); - items.Add(tstSubmenu); + items.Add(CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.TST, CreateGenericNymaCoreConfigItem(CoreNames.TST, Tst.CachedSettingsInfo))); // TurboNyma - var turboNymaSettingsItem = CreateSettingsItem("Settings...", (_, _) => OpenNymaConfigFor(TurboNyma.CachedSettingsInfo(CreateCoreComm()))); - var turboNymaSubmenu = CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.TurboNyma, turboNymaSettingsItem); - items.Add(turboNymaSubmenu); + items.Add(CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.TurboNyma, CreateGenericNymaCoreConfigItem(CoreNames.TurboNyma, TurboNyma.CachedSettingsInfo))); // uzem items.Add(CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.Uzem, CreateGenericCoreConfigItem(CoreNames.Uzem))); // as uzem doesn't implement `IStatable<,>`, this opens an empty `GenericCoreConfig`, which is dumb, but matches the existing behaviour @@ -3076,14 +3021,10 @@ namespace BizHawk.Client.EmuHawk items.Add(CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.VectrexHawk, CreateGenericCoreConfigItem(CoreNames.VectrexHawk))); // Virtu - var virtuSettingsItem = CreateSettingsItem("Settings...", (_, _) => OpenVirtuSettingsDialog()); - var virtuSubmenu = CreateCoreSubmenu(VSystemCategory.PCs, CoreNames.Virtu, virtuSettingsItem); - items.Add(virtuSubmenu); + items.Add(CreateCoreSubmenu(VSystemCategory.PCs, CoreNames.Virtu, CreateSettingsItem("Settings...", (_, _) => OpenVirtuSettingsDialog()))); // Virtual Boyee - var virtualBoyeeSettingsItem = CreateSettingsItem("Settings...", (_, _) => OpenNymaConfigFor(VirtualBoyee.CachedSettingsInfo(CreateCoreComm()))); - var virtualBoyeeSubmenu = CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.VirtualBoyee, virtualBoyeeSettingsItem); - items.Add(virtualBoyeeSubmenu); + items.Add(CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.VirtualBoyee, CreateGenericNymaCoreConfigItem(CoreNames.VirtualBoyee, VirtualBoyee.CachedSettingsInfo))); // ZXHawk items.Add(CreateCoreSubmenu( diff --git a/src/BizHawk.Client.EmuHawk/config/GB/GBLPrefs.Designer.cs b/src/BizHawk.Client.EmuHawk/config/GB/GBLPrefs.Designer.cs index c963387ae7..4f245c353d 100644 --- a/src/BizHawk.Client.EmuHawk/config/GB/GBLPrefs.Designer.cs +++ b/src/BizHawk.Client.EmuHawk/config/GB/GBLPrefs.Designer.cs @@ -49,8 +49,8 @@ // tabControl1 // this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.tabControl1.Controls.Add(this.tabPage1); this.tabControl1.Controls.Add(this.tabPage2); this.tabControl1.Controls.Add(this.tabPage3); diff --git a/src/BizHawk.Client.EmuHawk/config/GB/GBLPrefs.cs b/src/BizHawk.Client.EmuHawk/config/GB/GBLPrefs.cs index cace2624d3..cee335c88e 100644 --- a/src/BizHawk.Client.EmuHawk/config/GB/GBLPrefs.cs +++ b/src/BizHawk.Client.EmuHawk/config/GB/GBLPrefs.cs @@ -55,8 +55,8 @@ namespace BizHawk.Client.EmuHawk IMovieSession movieSession, ISettingsAdapter settable) { - var s = settable.GetSettings() as GambatteLink.GambatteLinkSettings; - var ss = settable.GetSyncSettings() as GambatteLink.GambatteLinkSyncSettings; + var s = (GambatteLink.GambatteLinkSettings) settable.GetSettings(); + var ss = (GambatteLink.GambatteLinkSyncSettings) settable.GetSyncSettings(); using var dlg = new GBLPrefs(dialogParent.DialogController, config, game, movieSession); dlg.PutSettings(s, ss); diff --git a/src/BizHawk.Client.EmuHawk/config/GB/GBPrefControl.Designer.cs b/src/BizHawk.Client.EmuHawk/config/GB/GBPrefControl.Designer.cs index d6075fbae2..bf3bc1bfc8 100644 --- a/src/BizHawk.Client.EmuHawk/config/GB/GBPrefControl.Designer.cs +++ b/src/BizHawk.Client.EmuHawk/config/GB/GBPrefControl.Designer.cs @@ -28,111 +28,111 @@ /// private void InitializeComponent() { - this.propertyGrid1 = new System.Windows.Forms.PropertyGrid(); - this.buttonDefaults = new System.Windows.Forms.Button(); - this.buttonGbPalette = new System.Windows.Forms.Button(); - this.cbRgbdsSyntax = new System.Windows.Forms.CheckBox(); - this.checkBoxMuted = new System.Windows.Forms.CheckBox(); - this.cbShowBorder = new System.Windows.Forms.CheckBox(); - this.buttonGbcPalette = new System.Windows.Forms.Button(); - this.SuspendLayout(); - // - // propertyGrid1 - // - this.propertyGrid1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.propertyGrid1.Location = new System.Drawing.Point(3, 3); - this.propertyGrid1.Name = "propertyGrid1"; - this.propertyGrid1.PropertySort = System.Windows.Forms.PropertySort.NoSort; - this.propertyGrid1.Size = new System.Drawing.Size(516, 408); - this.propertyGrid1.TabIndex = 0; - this.propertyGrid1.ToolbarVisible = false; - this.propertyGrid1.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.PropertyGrid1_PropertyValueChanged); - // - // buttonDefaults - // - this.buttonDefaults.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonDefaults.Location = new System.Drawing.Point(444, 417); - this.buttonDefaults.Name = "buttonDefaults"; - this.buttonDefaults.Size = new System.Drawing.Size(75, 23); - this.buttonDefaults.TabIndex = 1; - this.buttonDefaults.Text = "Defaults"; - this.buttonDefaults.UseVisualStyleBackColor = true; - this.buttonDefaults.Click += new System.EventHandler(this.ButtonDefaults_Click); - // - // buttonGbPalette - // - this.buttonGbPalette.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.buttonGbPalette.Location = new System.Drawing.Point(3, 417); - this.buttonGbPalette.Name = "buttonGbPalette"; - this.buttonGbPalette.Size = new System.Drawing.Size(87, 23); - this.buttonGbPalette.TabIndex = 2; - this.buttonGbPalette.Text = "GB Palette..."; - this.buttonGbPalette.UseVisualStyleBackColor = true; - this.buttonGbPalette.Click += new System.EventHandler(this.ButtonGbPalette_Click); - // - // buttonGbcPalette - // - this.buttonGbcPalette.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.buttonGbcPalette.Location = new System.Drawing.Point(96, 417); - this.buttonGbcPalette.Name = "buttonGbcPalette"; - this.buttonGbcPalette.Size = new System.Drawing.Size(87, 23); - this.buttonGbcPalette.TabIndex = 6; - this.buttonGbcPalette.Text = "GBC Palette..."; - this.buttonGbcPalette.UseVisualStyleBackColor = true; - this.buttonGbcPalette.Click += new System.EventHandler(this.ButtonGbcPalette_Click); - // - // cbRgbdsSyntax - // - this.cbRgbdsSyntax.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.cbRgbdsSyntax.AutoSize = true; - this.cbRgbdsSyntax.Location = new System.Drawing.Point(245, 421); - this.cbRgbdsSyntax.Name = "cbRgbdsSyntax"; - this.cbRgbdsSyntax.Size = new System.Drawing.Size(99, 17); - this.cbRgbdsSyntax.TabIndex = 3; - this.cbRgbdsSyntax.Text = "RGBDS Syntax"; - this.cbRgbdsSyntax.UseVisualStyleBackColor = true; - this.cbRgbdsSyntax.CheckedChanged += new System.EventHandler(this.CbRgbdsSyntax_CheckedChanged); - // - // checkBoxMuted - // - this.checkBoxMuted.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.checkBoxMuted.AutoSize = true; - this.checkBoxMuted.Location = new System.Drawing.Point(189, 421); - this.checkBoxMuted.Name = "checkBoxMuted"; - this.checkBoxMuted.Size = new System.Drawing.Size(50, 17); - this.checkBoxMuted.TabIndex = 4; - this.checkBoxMuted.Text = "Mute"; - this.checkBoxMuted.UseVisualStyleBackColor = true; - this.checkBoxMuted.CheckedChanged += new System.EventHandler(this.CheckBoxMuted_CheckedChanged); - // - // cbShowBorder - // - this.cbShowBorder.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.cbShowBorder.AutoSize = true; - this.cbShowBorder.Location = new System.Drawing.Point(350, 421); - this.cbShowBorder.Name = "cbShowBorder"; - this.cbShowBorder.Size = new System.Drawing.Size(87, 17); - this.cbShowBorder.TabIndex = 5; - this.cbShowBorder.Text = "Show Border"; - this.cbShowBorder.UseVisualStyleBackColor = true; - this.cbShowBorder.CheckedChanged += new System.EventHandler(this.CbShowBorder_CheckedChanged); - // - // GBPrefControl - // - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; - this.Controls.Add(this.buttonGbcPalette); - this.Controls.Add(this.cbRgbdsSyntax); - this.Controls.Add(this.checkBoxMuted); - this.Controls.Add(this.cbShowBorder); - this.Controls.Add(this.buttonGbPalette); - this.Controls.Add(this.buttonDefaults); - this.Controls.Add(this.propertyGrid1); - this.Name = "GBPrefControl"; - this.Size = new System.Drawing.Size(522, 443); - this.ResumeLayout(false); - this.PerformLayout(); + this.propertyGrid1 = new System.Windows.Forms.PropertyGrid(); + this.buttonDefaults = new System.Windows.Forms.Button(); + this.buttonGbPalette = new System.Windows.Forms.Button(); + this.cbRgbdsSyntax = new System.Windows.Forms.CheckBox(); + this.checkBoxMuted = new System.Windows.Forms.CheckBox(); + this.cbShowBorder = new System.Windows.Forms.CheckBox(); + this.buttonGbcPalette = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // propertyGrid1 + // + this.propertyGrid1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.propertyGrid1.Location = new System.Drawing.Point(3, 3); + this.propertyGrid1.Name = "propertyGrid1"; + this.propertyGrid1.PropertySort = System.Windows.Forms.PropertySort.NoSort; + this.propertyGrid1.Size = new System.Drawing.Size(516, 408); + this.propertyGrid1.TabIndex = 0; + this.propertyGrid1.ToolbarVisible = false; + this.propertyGrid1.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.PropertyGrid1_PropertyValueChanged); + // + // buttonDefaults + // + this.buttonDefaults.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonDefaults.Location = new System.Drawing.Point(444, 417); + this.buttonDefaults.Name = "buttonDefaults"; + this.buttonDefaults.Size = new System.Drawing.Size(75, 23); + this.buttonDefaults.TabIndex = 1; + this.buttonDefaults.Text = "Defaults"; + this.buttonDefaults.UseVisualStyleBackColor = true; + this.buttonDefaults.Click += new System.EventHandler(this.ButtonDefaults_Click); + // + // buttonGbPalette + // + this.buttonGbPalette.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.buttonGbPalette.Location = new System.Drawing.Point(3, 417); + this.buttonGbPalette.Name = "buttonGbPalette"; + this.buttonGbPalette.Size = new System.Drawing.Size(87, 23); + this.buttonGbPalette.TabIndex = 2; + this.buttonGbPalette.Text = "GB Palette..."; + this.buttonGbPalette.UseVisualStyleBackColor = true; + this.buttonGbPalette.Click += new System.EventHandler(this.ButtonGbPalette_Click); + // + // buttonGbcPalette + // + this.buttonGbcPalette.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.buttonGbcPalette.Location = new System.Drawing.Point(96, 417); + this.buttonGbcPalette.Name = "buttonGbcPalette"; + this.buttonGbcPalette.Size = new System.Drawing.Size(87, 23); + this.buttonGbcPalette.TabIndex = 6; + this.buttonGbcPalette.Text = "GBC Palette..."; + this.buttonGbcPalette.UseVisualStyleBackColor = true; + this.buttonGbcPalette.Click += new System.EventHandler(this.ButtonGbcPalette_Click); + // + // cbRgbdsSyntax + // + this.cbRgbdsSyntax.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.cbRgbdsSyntax.AutoSize = true; + this.cbRgbdsSyntax.Location = new System.Drawing.Point(245, 421); + this.cbRgbdsSyntax.Name = "cbRgbdsSyntax"; + this.cbRgbdsSyntax.Size = new System.Drawing.Size(99, 17); + this.cbRgbdsSyntax.TabIndex = 3; + this.cbRgbdsSyntax.Text = "RGBDS Syntax"; + this.cbRgbdsSyntax.UseVisualStyleBackColor = true; + this.cbRgbdsSyntax.CheckedChanged += new System.EventHandler(this.CbRgbdsSyntax_CheckedChanged); + // + // checkBoxMuted + // + this.checkBoxMuted.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.checkBoxMuted.AutoSize = true; + this.checkBoxMuted.Location = new System.Drawing.Point(189, 421); + this.checkBoxMuted.Name = "checkBoxMuted"; + this.checkBoxMuted.Size = new System.Drawing.Size(50, 17); + this.checkBoxMuted.TabIndex = 4; + this.checkBoxMuted.Text = "Mute"; + this.checkBoxMuted.UseVisualStyleBackColor = true; + this.checkBoxMuted.CheckedChanged += new System.EventHandler(this.CheckBoxMuted_CheckedChanged); + // + // cbShowBorder + // + this.cbShowBorder.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.cbShowBorder.AutoSize = true; + this.cbShowBorder.Location = new System.Drawing.Point(350, 421); + this.cbShowBorder.Name = "cbShowBorder"; + this.cbShowBorder.Size = new System.Drawing.Size(87, 17); + this.cbShowBorder.TabIndex = 5; + this.cbShowBorder.Text = "Show Border"; + this.cbShowBorder.UseVisualStyleBackColor = true; + this.cbShowBorder.CheckedChanged += new System.EventHandler(this.CbShowBorder_CheckedChanged); + // + // GBPrefControl + // + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; + this.Controls.Add(this.buttonGbcPalette); + this.Controls.Add(this.cbRgbdsSyntax); + this.Controls.Add(this.checkBoxMuted); + this.Controls.Add(this.cbShowBorder); + this.Controls.Add(this.buttonGbPalette); + this.Controls.Add(this.buttonDefaults); + this.Controls.Add(this.propertyGrid1); + this.Name = "GBPrefControl"; + this.Size = new System.Drawing.Size(522, 443); + this.ResumeLayout(false); + this.PerformLayout(); } diff --git a/src/BizHawk.Client.EmuHawk/config/GB/GBPrefs.Designer.cs b/src/BizHawk.Client.EmuHawk/config/GB/GBPrefs.Designer.cs index 2aac7c8af8..d308d38715 100644 --- a/src/BizHawk.Client.EmuHawk/config/GB/GBPrefs.Designer.cs +++ b/src/BizHawk.Client.EmuHawk/config/GB/GBPrefs.Designer.cs @@ -28,58 +28,58 @@ /// private void InitializeComponent() { - this.buttonOK = new System.Windows.Forms.Button(); - this.buttonCancel = new System.Windows.Forms.Button(); - this.gbPrefControl1 = new BizHawk.Client.EmuHawk.GBPrefControl(); - this.SuspendLayout(); - // - // buttonOK - // - this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK; - this.buttonOK.Location = new System.Drawing.Point(378, 386); - this.buttonOK.Name = "buttonOK"; - this.buttonOK.Size = new System.Drawing.Size(75, 23); - this.buttonOK.TabIndex = 1; - this.buttonOK.Text = "OK"; - this.buttonOK.UseVisualStyleBackColor = true; - // - // buttonCancel - // - this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.buttonCancel.Location = new System.Drawing.Point(459, 386); - this.buttonCancel.Name = "buttonCancel"; - this.buttonCancel.Size = new System.Drawing.Size(75, 23); - this.buttonCancel.TabIndex = 2; - this.buttonCancel.Text = "Cancel"; - this.buttonCancel.UseVisualStyleBackColor = true; - // - // gbPrefControl1 - // - this.gbPrefControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.gbPrefControl1.DialogParent = null; - this.gbPrefControl1.Location = new System.Drawing.Point(12, 12); - this.gbPrefControl1.Name = "gbPrefControl1"; - this.gbPrefControl1.Size = new System.Drawing.Size(522, 368); - this.gbPrefControl1.TabIndex = 0; - // - // GBPrefs - // - this.AcceptButton = this.buttonOK; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.buttonCancel; - this.ClientSize = new System.Drawing.Size(546, 421); - this.Controls.Add(this.buttonCancel); - this.Controls.Add(this.buttonOK); - this.Controls.Add(this.gbPrefControl1); - this.Name = "GBPrefs"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Game Boy Settings"; - this.ResumeLayout(false); + this.buttonOK = new System.Windows.Forms.Button(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.gbPrefControl1 = new BizHawk.Client.EmuHawk.GBPrefControl(); + this.SuspendLayout(); + // + // buttonOK + // + this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK; + this.buttonOK.Location = new System.Drawing.Point(378, 386); + this.buttonOK.Name = "buttonOK"; + this.buttonOK.Size = new System.Drawing.Size(75, 23); + this.buttonOK.TabIndex = 1; + this.buttonOK.Text = "OK"; + this.buttonOK.UseVisualStyleBackColor = true; + // + // buttonCancel + // + this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.buttonCancel.Location = new System.Drawing.Point(459, 386); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(75, 23); + this.buttonCancel.TabIndex = 2; + this.buttonCancel.Text = "Cancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + // + // gbPrefControl1 + // + this.gbPrefControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.gbPrefControl1.DialogParent = null; + this.gbPrefControl1.Location = new System.Drawing.Point(12, 12); + this.gbPrefControl1.Name = "gbPrefControl1"; + this.gbPrefControl1.Size = new System.Drawing.Size(522, 368); + this.gbPrefControl1.TabIndex = 0; + // + // GBPrefs + // + this.AcceptButton = this.buttonOK; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.buttonCancel; + this.ClientSize = new System.Drawing.Size(546, 421); + this.Controls.Add(this.buttonCancel); + this.Controls.Add(this.buttonOK); + this.Controls.Add(this.gbPrefControl1); + this.Name = "GBPrefs"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Game Boy Settings"; + this.ResumeLayout(false); } diff --git a/src/BizHawk.Client.EmuHawk/config/GB/GBPrefs.cs b/src/BizHawk.Client.EmuHawk/config/GB/GBPrefs.cs index 25c7516d45..d29ffd71b8 100644 --- a/src/BizHawk.Client.EmuHawk/config/GB/GBPrefs.cs +++ b/src/BizHawk.Client.EmuHawk/config/GB/GBPrefs.cs @@ -24,8 +24,8 @@ namespace BizHawk.Client.EmuHawk IMovieSession movieSession, ISettingsAdapter settable) { - var s = settable.GetSettings() as Gameboy.GambatteSettings; - var ss = settable.GetSyncSettings() as Gameboy.GambatteSyncSettings; + var s = (Gameboy.GambatteSettings) settable.GetSettings(); + var ss = (Gameboy.GambatteSyncSettings) settable.GetSyncSettings(); using var dlg = new GBPrefs(dialogParent.DialogController); dlg.gbPrefControl1.PutSettings(config, game, movieSession, s, ss); diff --git a/src/BizHawk.Client.EmuHawk/config/GenericCoreConfig.cs b/src/BizHawk.Client.EmuHawk/config/GenericCoreConfig.cs index 8a80dd9158..e86eb9f7f8 100644 --- a/src/BizHawk.Client.EmuHawk/config/GenericCoreConfig.cs +++ b/src/BizHawk.Client.EmuHawk/config/GenericCoreConfig.cs @@ -1,14 +1,89 @@ using System; +using System.Collections.Generic; using System.ComponentModel; using System.Windows.Forms; using BizHawk.Client.Common; using BizHawk.Emulation.Common; +using BizHawk.Emulation.Cores.Arcades.MAME; +using BizHawk.Emulation.Cores.Waterbox; namespace BizHawk.Client.EmuHawk { public partial class GenericCoreConfig : Form { + private readonly struct TempTypeDescProviderScope : IDisposable + { + private readonly TypeDescriptionProvider _desc; + + private readonly Type _type; + + public TempTypeDescProviderScope(TypeDescriptionProvider desc, Type type) + => TypeDescriptor.AddProvider(_desc = desc, _type = type); + + public void Dispose() + => TypeDescriptor.RemoveProvider(_desc, _type); + } + + public static DialogResult DoDialogFor( + IDialogParent owner, + ISettingsAdapter settable, + string title, + bool isMovieActive, + bool ignoreSettings = false, + bool ignoreSyncSettings = false) + { + using GenericCoreConfig dlg = new( + settable, + isMovieActive: isMovieActive, + ignoreSettings: ignoreSettings, + ignoreSyncSettings: ignoreSyncSettings) + { + Text = title, + }; + return owner.ShowDialogAsChild(dlg); + } + + private static DialogResult DoMAMEDialog( + IDialogParent owner, + ISettingsAdapter settable, + List settings, + bool isMovieActive) + { + using TempTypeDescProviderScope scope = new(new MAMETypeDescriptorProvider(settings), typeof(MAME.MAMESyncSettings)); + return DoDialogFor(owner, settable, "MAME Settings", isMovieActive: isMovieActive, ignoreSettings: true); + } + + public static DialogResult DoNymaDialogFor( + IDialogParent owner, + ISettingsAdapter settable, + string title, + NymaCore.NymaSettingsInfo settingsInfo, + bool isMovieActive) + { + NymaTypeDescriptorProvider desc = new(settingsInfo); + using TempTypeDescProviderScope scope = new(desc, typeof(NymaCore.NymaSettings)), scope1 = new(desc, typeof(NymaCore.NymaSyncSettings)); + return DoDialogFor( + owner, + settable, + title, + isMovieActive: isMovieActive, + ignoreSettings: !settingsInfo.HasSettings, + ignoreSyncSettings: !settingsInfo.HasSyncSettings); + } + + public static void DoDialog(IEmulator emulator, IDialogParent owner, bool isMovieActive) + { + var settable = ((MainForm) owner).GetSettingsAdapterForLoadedCoreUntyped(); //HACK + var title = $"{emulator.Attributes().CoreName} Settings"; + _ = emulator switch + { + MAME mame => DoMAMEDialog(owner, settable, mame.CurrentDriverSettings, isMovieActive: isMovieActive), + NymaCore core => DoNymaDialogFor(owner, settable, title, core.SettingsInfo, isMovieActive: isMovieActive), + _ => DoDialogFor(owner, settable, title, isMovieActive: isMovieActive) + }; + } + private readonly ISettingsAdapter _settable; private object _s; @@ -72,98 +147,6 @@ namespace BizHawk.Client.EmuHawk Close(); } - public static DialogResult DoDialog(IEmulator emulator, IDialogParent owner, string title, bool isMovieActive) - { - if (emulator is Emulation.Cores.Waterbox.NymaCore core) - { - var desc = new Emulation.Cores.Waterbox.NymaTypeDescriptorProvider(core.SettingsInfo); - try - { - // OH GOD THE HACKS WHY - TypeDescriptor.AddProvider(desc, typeof(Emulation.Cores.Waterbox.NymaCore.NymaSettings)); - TypeDescriptor.AddProvider(desc, typeof(Emulation.Cores.Waterbox.NymaCore.NymaSyncSettings)); - return DoDialog(owner, "Nyma Core", isMovieActive, !core.SettingsInfo.HasSettings, !core.SettingsInfo.HasSyncSettings); - } - finally - { - TypeDescriptor.RemoveProvider(desc, typeof(Emulation.Cores.Waterbox.NymaCore.NymaSettings)); - TypeDescriptor.RemoveProvider(desc, typeof(Emulation.Cores.Waterbox.NymaCore.NymaSyncSettings)); - } - } - else if (emulator is Emulation.Cores.Arcades.MAME.MAME mame) - { - var desc = new Emulation.Cores.Arcades.MAME.MAMETypeDescriptorProvider(mame.CurrentDriverSettings); - try - { - TypeDescriptor.AddProvider(desc, typeof(Emulation.Cores.Arcades.MAME.MAME.MAMESyncSettings)); - return DoDialog(owner, "MAME", isMovieActive, true, false); - } - finally - { - TypeDescriptor.RemoveProvider(desc, typeof(Emulation.Cores.Arcades.MAME.MAME.MAMESyncSettings)); - } - } - else - { - return DoDialog(owner, title, isMovieActive, false, false); - } - } - - public static DialogResult DoDialog( - IDialogParent owner, - string title, - bool isMovieActive, - bool hideSettings, - bool hideSyncSettings) - { - using var dlg = new GenericCoreConfig( - ((MainForm) owner).GetSettingsAdapterForLoadedCoreUntyped(), //HACK - isMovieActive: isMovieActive, - ignoreSettings: hideSettings, - ignoreSyncSettings: hideSyncSettings) - { - Text = title, - }; - return owner.ShowDialogAsChild(dlg); - } - - public static DialogResult DoDialogFor( - IDialogParent owner, - ISettingsAdapter settable, - string title, - bool isMovieActive, - bool hideSettings = false, - bool hideSyncSettings = false) - { - using GenericCoreConfig dlg = new(settable, isMovieActive, hideSettings, hideSyncSettings) { Text = title }; - return owner.ShowDialogAsChild(dlg); - } - - public static DialogResult DoNymaDialogFor( - IDialogParent owner, - ISettingsAdapter settable, - Emulation.Cores.Waterbox.NymaCore.NymaSettingsInfo settingsInfo, - bool isMovieActive) - { - var desc = new Emulation.Cores.Waterbox.NymaTypeDescriptorProvider(settingsInfo); - try - { - // OH GOD THE HACKS WHY - TypeDescriptor.AddProvider(desc, typeof(Emulation.Cores.Waterbox.NymaCore.NymaSettings)); - TypeDescriptor.AddProvider(desc, typeof(Emulation.Cores.Waterbox.NymaCore.NymaSyncSettings)); - using GenericCoreConfig dlg = new(settable, isMovieActive, !settingsInfo.HasSettings, !settingsInfo.HasSyncSettings) - { - Text = "Nyma Core" - }; - return owner.ShowDialogAsChild(dlg); - } - finally - { - TypeDescriptor.RemoveProvider(desc, typeof(Emulation.Cores.Waterbox.NymaCore.NymaSettings)); - TypeDescriptor.RemoveProvider(desc, typeof(Emulation.Cores.Waterbox.NymaCore.NymaSyncSettings)); - } - } - private void PropertyGrid2_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) { _syncSettingsChanged = true; diff --git a/src/BizHawk.Client.EmuHawk/config/PSX/PSXOptions.cs b/src/BizHawk.Client.EmuHawk/config/PSX/PSXOptions.cs index db1802d5e4..0d14187246 100644 --- a/src/BizHawk.Client.EmuHawk/config/PSX/PSXOptions.cs +++ b/src/BizHawk.Client.EmuHawk/config/PSX/PSXOptions.cs @@ -89,9 +89,14 @@ namespace BizHawk.Client.EmuHawk OctoshockDll.eVidStandard vidStandard, Size vidSize) { - var s = settable.GetSettings() as Octoshock.Settings; - var ss = settable.GetSyncSettings() as Octoshock.SyncSettings; - using var dlg = new PSXOptions(config, dialogParent.DialogController, settable, s, ss, vidStandard, vidSize); + using PSXOptions dlg = new( + config, + dialogParent.DialogController, + settable, + (Octoshock.Settings) settable.GetSettings(), + (Octoshock.SyncSettings) settable.GetSyncSettings(), + vidStandard, + vidSize); return dialogParent.ShowDialogAsChild(dlg); } diff --git a/src/BizHawk.Client.EmuHawk/config/SNES/BSNESOptions.cs b/src/BizHawk.Client.EmuHawk/config/SNES/BSNESOptions.cs index 83a1b24926..400fdd1b76 100644 --- a/src/BizHawk.Client.EmuHawk/config/SNES/BSNESOptions.cs +++ b/src/BizHawk.Client.EmuHawk/config/SNES/BSNESOptions.cs @@ -16,8 +16,8 @@ namespace BizHawk.Client.EmuHawk public static DialogResult DoSettingsDialog(IDialogParent dialogParent, ISettingsAdapter settable) { - var s = settable.GetSettings() as BsnesCore.SnesSettings; - var ss = settable.GetSyncSettings() as BsnesCore.SnesSyncSettings; + var s = (BsnesCore.SnesSettings) settable.GetSettings(); + var ss = (BsnesCore.SnesSyncSettings) settable.GetSyncSettings(); using var dlg = new BSNESOptions { AlwaysDoubleSize = s.AlwaysDoubleSize, diff --git a/src/BizHawk.Client.EmuHawk/config/SNES/SNESOptions.cs b/src/BizHawk.Client.EmuHawk/config/SNES/SNESOptions.cs index cdf64d3afc..24edf596a2 100644 --- a/src/BizHawk.Client.EmuHawk/config/SNES/SNESOptions.cs +++ b/src/BizHawk.Client.EmuHawk/config/SNES/SNESOptions.cs @@ -19,8 +19,8 @@ namespace BizHawk.Client.EmuHawk public static DialogResult DoSettingsDialog(IDialogParent dialogParent, ISettingsAdapter settable) { - var s = settable.GetSettings() as LibsnesCore.SnesSettings; - var ss = settable.GetSyncSettings() as LibsnesCore.SnesSyncSettings; + var s = (LibsnesCore.SnesSettings) settable.GetSettings(); + var ss = (LibsnesCore.SnesSyncSettings) settable.GetSyncSettings(); using var dlg = new SNESOptions { RandomizedInitialState = ss.RandomizedInitialState, diff --git a/src/BizHawk.Emulation.Cores/Consoles/NEC/PCE/HyperNyma.cs b/src/BizHawk.Emulation.Cores/Consoles/NEC/PCE/HyperNyma.cs index c227188251..315c26ac1f 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/NEC/PCE/HyperNyma.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/NEC/PCE/HyperNyma.cs @@ -50,10 +50,7 @@ namespace BizHawk.Emulation.Cores.Consoles.NEC.PCE _hyperNyma = DoInit(lp, "hyper.wbx", firmwares); - if (_cachedSettingsInfo is null) - { - _cachedSettingsInfo = SettingsInfo.Clone(); - } + _cachedSettingsInfo ??= SettingsInfo.Clone(); } public override string SystemId => IsSgx diff --git a/src/BizHawk.Emulation.Cores/Consoles/NEC/PCE/TurboNyma.cs b/src/BizHawk.Emulation.Cores/Consoles/NEC/PCE/TurboNyma.cs index 99ee750262..21d7239c94 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/NEC/PCE/TurboNyma.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/NEC/PCE/TurboNyma.cs @@ -61,10 +61,7 @@ namespace BizHawk.Emulation.Cores.Consoles.NEC.PCE _turboNyma = DoInit(lp, "turbo.wbx", firmwares); - if (_cachedSettingsInfo is null) - { - _cachedSettingsInfo = SettingsInfo.Clone(); - } + _cachedSettingsInfo ??= SettingsInfo.Clone(); } public override string SystemId => IsSgx diff --git a/src/BizHawk.Emulation.Cores/Consoles/NEC/PCFX/Tst.cs b/src/BizHawk.Emulation.Cores/Consoles/NEC/PCFX/Tst.cs index 5266685ae6..d133ab417e 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/NEC/PCFX/Tst.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/NEC/PCFX/Tst.cs @@ -41,10 +41,7 @@ namespace BizHawk.Emulation.Cores.Consoles.NEC.PCFX DoInit(lp, "pcfx.wbx", firmwares); - if (_cachedSettingsInfo is null) - { - _cachedSettingsInfo = SettingsInfo.Clone(); - } + _cachedSettingsInfo ??= SettingsInfo.Clone(); } protected override IDictionary SettingOverrides { get; } = new Dictionary diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Faust/Faust.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Faust/Faust.cs index ff8750961a..57b583338a 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Faust/Faust.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Faust/Faust.cs @@ -37,10 +37,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.Faust DoInit(game, rom, null, "faust.wbx", extension, deterministic); - if (_cachedSettingsInfo is null) - { - _cachedSettingsInfo = SettingsInfo.Clone(); - } + _cachedSettingsInfo ??= SettingsInfo.Clone(); } protected override HashSet ComputeHiddenPorts() diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/VB/VirtualBoyee.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/VB/VirtualBoyee.cs index 26296235c3..3dbed050f1 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/VB/VirtualBoyee.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/VB/VirtualBoyee.cs @@ -33,10 +33,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.VB { DoInit(lp, "vb.wbx"); - if (_cachedSettingsInfo is null) - { - _cachedSettingsInfo = SettingsInfo.Clone(); - } + _cachedSettingsInfo ??= SettingsInfo.Clone(); } protected override IDictionary SettingOverrides { get; } = new Dictionary diff --git a/src/BizHawk.Emulation.Cores/Consoles/SNK/NeoGeoPort.cs b/src/BizHawk.Emulation.Cores/Consoles/SNK/NeoGeoPort.cs index dd8e568572..1e1bbdc5e4 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/SNK/NeoGeoPort.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/SNK/NeoGeoPort.cs @@ -38,10 +38,7 @@ namespace BizHawk.Emulation.Cores.Consoles.SNK { _neopop = DoInit(game, rom, null, "ngp.wbx", extension, deterministic); - if (_cachedSettingsInfo is null) - { - _cachedSettingsInfo = SettingsInfo.Clone(); - } + _cachedSettingsInfo ??= SettingsInfo.Clone(); } public new bool SaveRamModified diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Saturnus.cs b/src/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Saturnus.cs index 2b71ee10f2..4f2e52e406 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Saturnus.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Saturnus.cs @@ -44,10 +44,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn }; DoInit(lp, "ss.wbx", firmwares); - if (_cachedSettingsInfo is null) - { - _cachedSettingsInfo = SettingsInfo.Clone(); - } + _cachedSettingsInfo ??= SettingsInfo.Clone(); } protected override IDictionary SettingOverrides { get; } = new Dictionary diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Nymashock.cs b/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Nymashock.cs index 6b61f06f12..983a8b2875 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Nymashock.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Nymashock.cs @@ -42,10 +42,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX }; DoInit(lp, "shock.wbx", firmwares); - if (_cachedSettingsInfo is null) - { - _cachedSettingsInfo = SettingsInfo.Clone(); - } + _cachedSettingsInfo ??= SettingsInfo.Clone(); } protected override IDictionary SettingOverrides { get; } = new Dictionary