diff --git a/BizHawk.Client.Common/RomLoader.cs b/BizHawk.Client.Common/RomLoader.cs index ca46ad5c13..7f02da9f0b 100644 --- a/BizHawk.Client.Common/RomLoader.cs +++ b/BizHawk.Client.Common/RomLoader.cs @@ -610,7 +610,7 @@ namespace BizHawk.Client.Common var left = Database.GetGameInfo(leftBytes, "left.gb"); var right = Database.GetGameInfo(rightBytes, "right.gb"); - if (Global.Config.GbUseGbHawk) + if (Global.Config.PreferredCores["GB"] == CoreNames.GbHawk) { nextEmulator = new GBHawkLink( nextComm, @@ -960,7 +960,7 @@ namespace BizHawk.Client.Common break; case "SNES": - bool useSnes9x = Global.Config.SnesInSnes9x; + bool useSnes9x = Global.Config.PreferredCores["SNES"] == CoreNames.Snes9X; if (Global.Config.CoreForcingViaGameDb && !string.IsNullOrEmpty(game.ForcedCore)) { if (game.ForcedCore.ToLower() == "snes9x") @@ -991,80 +991,33 @@ namespace BizHawk.Client.Common case "NES": { // apply main spur-of-the-moment switcheroo as lowest priority - string preference = "neshawk"; - if (Global.Config.NesInQuickNes) - { - preference = "quicknes"; - } + string preference = Global.Config.PreferredCores["NES"]; // if user has saw fit to override in gamedb, apply that if (Global.Config.CoreForcingViaGameDb && !string.IsNullOrEmpty(game.ForcedCore)) { - preference = game.ForcedCore; + preference = game.ForcedCore.ToLower() switch + { + "quicknes" => CoreNames.QuickNes, + _ => CoreNames.NesHawk + }; } // but only neshawk is accurate if (forceAccurateCore) { - preference = "neshawk"; + preference = CoreNames.NesHawk; } - if (preference == "neshawk") - { - core = Global.Config.UseSubNESHawk - ? CoreInventory.Instance["NES", "SubNESHawk"] - : CoreInventory.Instance["NES", "NesHawk"]; - } - else - { - core = CoreInventory.Instance["NES", "QuickNes"]; - } + core = CoreInventory.Instance["NES", preference]; } - break; case "GB": - if (!Global.Config.GbAsSgb) - { - if (Global.Config.UseSubGBHawk) - { - core = CoreInventory.Instance["GB", "SubGBHawk"]; - } - else - { - core = Global.Config.GbUseGbHawk - ? CoreInventory.Instance["GB", "GBHawk"] - : CoreInventory.Instance["GB", "Gambatte"]; - } - } - else - { - if (Global.Config.SgbUseBsnes) - { - game.System = "SNES"; - game.AddOption("SGB"); - var snes = new LibsnesCore(game, rom.FileData, null, null, nextComm, GetCoreSettings(), GetCoreSyncSettings()); - nextEmulator = snes; - } - else - { - core = CoreInventory.Instance["SGB", "SameBoy"]; - } - } - break; case "GBC": if (!Global.Config.GbAsSgb) { - if (Global.Config.UseSubGBHawk) - { - core = CoreInventory.Instance["GB", "SubGBHawk"]; - } - else - { - core = Global.Config.GbUseGbHawk - ? CoreInventory.Instance["GBC", "GBHawk"] - : CoreInventory.Instance["GBC", "Gambatte"]; - } + core = CoreInventory.Instance["GB", Global.Config.PreferredCores["GB"]]; } else { @@ -1106,9 +1059,7 @@ namespace BizHawk.Client.Common nextEmulator = cpc; break; case "GBA": - core = Global.Config.GbaUsemGba - ? CoreInventory.Instance["GBA", "mGBA"] - : CoreInventory.Instance["GBA", "VBA-Next"]; + core = CoreInventory.Instance["GBA", Global.Config.PreferredCores["GBA"]]; break; case "PSX": nextEmulator = new Octoshock(nextComm, null, null, rom.FileData, GetCoreSettings(), GetCoreSyncSettings(), "PSX etc."); diff --git a/BizHawk.Client.Common/config/Config.cs b/BizHawk.Client.Common/config/Config.cs index ea80bac519..17013e7743 100644 --- a/BizHawk.Client.Common/config/Config.cs +++ b/BizHawk.Client.Common/config/Config.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using BizHawk.Common; using BizHawk.Common.PathExtensions; +using BizHawk.Emulation.Cores; namespace BizHawk.Client.Common { @@ -311,16 +312,18 @@ namespace BizHawk.Client.Common // as this setting spans multiple cores and doesn't actually affect the behavior of any core, // it hasn't been absorbed into the new system public bool GbAsSgb { get; set; } - public bool UseSubNESHawk { get; set; } - public bool UseSubGBHawk { get; set; } - public bool NesInQuickNes { get; set; } = true; - public bool SnesInSnes9x { get; set; } = true; - public bool GbaUsemGba { get; set; } = true; public bool SgbUseBsnes { get; set; } - public bool GbUseGbHawk { get; set; } public bool CoreForcingViaGameDb { get; set; } = true; public string LibretroCore { get; set; } + public Dictionary PreferredCores = new Dictionary + { + ["NES"] = CoreNames.QuickNes, + ["SNES"] = CoreNames.Snes9X, + ["GBA"] = CoreNames.Mgba, + ["GB"] = CoreNames.Gambatte + }; + // ReSharper disable once UnusedMember.Global public string LastWrittenFrom { get; set; } = VersionInfo.MainVersion; diff --git a/BizHawk.Client.Common/movie/MovieSession.cs b/BizHawk.Client.Common/movie/MovieSession.cs index 1b8782b9b0..dbc25c9550 100644 --- a/BizHawk.Client.Common/movie/MovieSession.cs +++ b/BizHawk.Client.Common/movie/MovieSession.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using BizHawk.Emulation.Common; @@ -74,12 +75,7 @@ namespace BizHawk.Client.Common } } - // The behavior here is to only temporarily override these settings when playing a movie and then restore the user's preferred settings - // A more elegant approach would be appreciated - public bool? PreviousNesInQuickNES { get; set; } - public bool? PreviousSnesInSnes9x { get; set; } - public bool? PreviousGbaUsemGba { get; set; } - public bool? PreviousGbUseGbHawk { get; set; } + public IDictionary PreferredCores { get; } = new Dictionary(); public void RecreateMovieController(ControllerDefinition definition) { @@ -258,53 +254,21 @@ namespace BizHawk.Client.Common switch (emulator.SystemId) { case "NES": - if (movie.Core == CoreNames.QuickNes) - { - PreviousNesInQuickNES = Global.Config.NesInQuickNes; - Global.Config.NesInQuickNes = true; - } - else if (movie.Core == CoreNames.NesHawk) - { - PreviousNesInQuickNES = Global.Config.NesInQuickNes; - Global.Config.NesInQuickNes = false; - } + PreferredCores["NES"] = Global.Config.PreferredCores["NES"]; + Global.Config.PreferredCores["NES"] = movie.Core; break; case "SNES": - if (movie.Core == CoreNames.Snes9X) - { - PreviousSnesInSnes9x = Global.Config.SnesInSnes9x; - Global.Config.SnesInSnes9x = true; - } - else if (movie.Core == CoreNames.Bsnes) - { - PreviousSnesInSnes9x = Global.Config.SnesInSnes9x; - Global.Config.SnesInSnes9x = false; - } + PreferredCores["SNES"] = Global.Config.PreferredCores["SNES"]; + Global.Config.PreferredCores["SNES"] = movie.Core; break; case "GBA": - if (movie.Core == CoreNames.Mgba) - { - PreviousGbaUsemGba = Global.Config.GbaUsemGba; - Global.Config.GbaUsemGba = true; - } - else if (movie.Core == CoreNames.VbaNext) - { - PreviousGbaUsemGba = Global.Config.GbaUsemGba; - Global.Config.GbaUsemGba = false; - } + PreferredCores["GBA"] = Global.Config.PreferredCores["GBA"]; + Global.Config.PreferredCores["GBA"] = movie.Core; break; case "GB": case "GBC": - if (movie.Core == CoreNames.GbHawk) - { - PreviousGbUseGbHawk = Global.Config.GbUseGbHawk; - Global.Config.GbUseGbHawk = true; - } - else if (movie.Core == CoreNames.Gambatte) - { - PreviousGbUseGbHawk = Global.Config.GbUseGbHawk; - Global.Config.GbUseGbHawk = false; - } + PreferredCores["GB"] = Global.Config.PreferredCores["GB"]; + Global.Config.PreferredCores["GB"] = movie.Core; break; } } diff --git a/BizHawk.Client.Common/movie/import/LsmvImport.cs b/BizHawk.Client.Common/movie/import/LsmvImport.cs index 52a3c31eb7..f4d3e1dc37 100644 --- a/BizHawk.Client.Common/movie/import/LsmvImport.cs +++ b/BizHawk.Client.Common/movie/import/LsmvImport.cs @@ -5,6 +5,7 @@ using System.Text; using BizHawk.Common; using BizHawk.Common.IOExtensions; using BizHawk.Emulation.Common; +using BizHawk.Emulation.Cores; using BizHawk.Emulation.Cores.Nintendo.SNES; namespace BizHawk.Client.Common.movie.import @@ -283,7 +284,7 @@ namespace BizHawk.Client.Common.movie.import Result.Movie.HeaderEntries[HeaderKeys.Platform] = platform; Result.Movie.SyncSettingsJson = ConfigService.SaveWithType(ss); - Config.SnesInSnes9x = false; // TODO: convert to snes9x if user has set this to true + Config.PreferredCores["SNES"] = CoreNames.Bsnes; // TODO: convert to snes9x if it is the user's preference } private IController EmptyLmsvFrame() diff --git a/BizHawk.Client.Common/movie/import/SmvImport.cs b/BizHawk.Client.Common/movie/import/SmvImport.cs index 935d001e9c..adc2c2a532 100644 --- a/BizHawk.Client.Common/movie/import/SmvImport.cs +++ b/BizHawk.Client.Common/movie/import/SmvImport.cs @@ -3,6 +3,7 @@ using System.IO; using System.Linq; using System.Text; using BizHawk.Emulation.Common; +using BizHawk.Emulation.Cores; using BizHawk.Emulation.Cores.Nintendo.SNES; namespace BizHawk.Client.Common.movie.import @@ -313,7 +314,7 @@ namespace BizHawk.Client.Common.movie.import Result.Movie.AppendFrame(controllers); Result.Movie.SyncSettingsJson = ConfigService.SaveWithType(ss); - Config.SnesInSnes9x = false; // TODO: convert to snes9x if user has set this to true + Config.PreferredCores["SNES"] = CoreNames.Bsnes; // TODO: convert to snes9x if it is the user's preference } } } diff --git a/BizHawk.Client.Common/movie/import/VbmImport.cs b/BizHawk.Client.Common/movie/import/VbmImport.cs index 405dd208da..278e17b771 100644 --- a/BizHawk.Client.Common/movie/import/VbmImport.cs +++ b/BizHawk.Client.Common/movie/import/VbmImport.cs @@ -1,6 +1,7 @@ using System; using System.IO; using BizHawk.Emulation.Common; +using BizHawk.Emulation.Cores; using BizHawk.Emulation.Cores.Nintendo.GBA; using BizHawk.Emulation.Cores.Nintendo.GBHawk; using BizHawk.Emulation.Cores.Nintendo.Gameboy; @@ -274,13 +275,13 @@ namespace BizHawk.Client.Common.movie.import if (isGBA) { - Config.GbaUsemGba = true; + Config.PreferredCores["GBA"] = CoreNames.Mgba; var ss = new MGBAHawk.SyncSettings { SkipBios = true }; Result.Movie.SyncSettingsJson = ConfigService.SaveWithType(ss); } else { - if (Config.GbUseGbHawk || Config.UseSubGBHawk) + if (Config.PreferredCores["GB"] == CoreNames.GbHawk || Config.PreferredCores["GB"] == CoreNames.SubGbHawk) { var tempSync = new GBHawk.GBSyncSettings(); if (is_GBC) { tempSync.ConsoleMode = GBHawk.GBSyncSettings.ConsoleModeType.GBC; } diff --git a/BizHawk.Client.Common/movie/interfaces/IMovieSession.cs b/BizHawk.Client.Common/movie/interfaces/IMovieSession.cs index 6c1b12094a..2157b2b55c 100644 --- a/BizHawk.Client.Common/movie/interfaces/IMovieSession.cs +++ b/BizHawk.Client.Common/movie/interfaces/IMovieSession.cs @@ -1,4 +1,5 @@ -using System.IO; +using System.Collections.Generic; +using System.IO; using BizHawk.Emulation.Common; namespace BizHawk.Client.Common @@ -28,11 +29,10 @@ namespace BizHawk.Client.Common IController PreviousFrame { get; } - // TODO: this isn't sustainable - bool? PreviousNesInQuickNES { get; set; } - bool? PreviousSnesInSnes9x { get; set; } - bool? PreviousGbaUsemGba { get; set; } - bool? PreviousGbUseGbHawk { get; set; } + /// + /// Previous saved core preferences. Stored so that they can be stored after a movie overrides the value + /// + IDictionary PreferredCores { get; } /// /// Recreates MovieController with the given controller definition diff --git a/BizHawk.Client.EmuHawk/EmuHawkUtil.cs b/BizHawk.Client.EmuHawk/EmuHawkUtil.cs index a291266b2d..60d2e01b51 100644 --- a/BizHawk.Client.EmuHawk/EmuHawkUtil.cs +++ b/BizHawk.Client.EmuHawk/EmuHawkUtil.cs @@ -45,8 +45,8 @@ namespace BizHawk.Client.EmuHawk return emulator switch { - Snes9x _ => PromptToSwitchCore("Snes9x", "bsnes", () => Global.Config.SnesInSnes9x = false), - QuickNES _ => PromptToSwitchCore("QuickNes", "NesHawk", () => Global.Config.NesInQuickNes = false), + Snes9x _ => PromptToSwitchCore("Snes9x", "bsnes", () => Global.Config.PreferredCores["SNES"] = Cores.CoreNames.Bsnes), + QuickNES _ => PromptToSwitchCore("QuickNes", "NesHawk", () => Global.Config.PreferredCores["NES"] = Cores.CoreNames.QuickNes), _ => true }; } diff --git a/BizHawk.Client.EmuHawk/MainForm.Designer.cs b/BizHawk.Client.EmuHawk/MainForm.Designer.cs index 952244bf6e..b28218c7c0 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Designer.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Designer.cs @@ -1949,7 +1949,7 @@ this.GBGambatteMenuItem.Name = "GBGambatteMenuItem"; this.GBGambatteMenuItem.Size = new System.Drawing.Size(121, 22); this.GBGambatteMenuItem.Text = "Gambatte"; - this.GBGambatteMenuItem.Click += new System.EventHandler(this.GBCorePick_Click); + this.GBGambatteMenuItem.Click += new System.EventHandler(this.GambatteCorePick_Click); // // GBGBHawkMenuItem // diff --git a/BizHawk.Client.EmuHawk/MainForm.Events.cs b/BizHawk.Client.EmuHawk/MainForm.Events.cs index cbe876fb0b..ddce19eb76 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -19,6 +19,7 @@ using BizHawk.Client.EmuHawk.ToolExtensions; using BizHawk.Emulation.Cores.Computers.AppleII; using BizHawk.Common; using BizHawk.Common.PathExtensions; +using BizHawk.Emulation.Cores; using BizHawk.Emulation.Cores.Atari.A7800Hawk; using BizHawk.Emulation.Cores.Computers.Commodore64; using BizHawk.Emulation.Cores.Nintendo.Gameboy; @@ -936,8 +937,8 @@ namespace BizHawk.Client.EmuHawk private void CoreMenuItem_DropDownOpened(object sender, EventArgs e) { - quickNESMenuItem.Checked = Config.NesInQuickNes; - nesHawkMenuItem.Checked = !Config.NesInQuickNes; + quickNESMenuItem.Checked = Config.PreferredCores["NES"] == CoreNames.QuickNes; + nesHawkMenuItem.Checked = Config.PreferredCores["NES"] == CoreNames.NesHawk; } private void ControllersMenuItem_Click(object sender, EventArgs e) @@ -1199,15 +1200,14 @@ namespace BizHawk.Client.EmuHawk private void NesCoreSubMenu_DropDownOpened(object sender, EventArgs e) { - QuicknesCoreMenuItem.Checked = Config.NesInQuickNes; - NesCoreMenuItem.Checked = !Config.NesInQuickNes && !Config.UseSubNESHawk; - SubNesHawkMenuItem.Checked = Config.UseSubNESHawk; + QuicknesCoreMenuItem.Checked = Config.PreferredCores["NES"] == CoreNames.QuickNes; + NesCoreMenuItem.Checked = Config.PreferredCores["NES"] == CoreNames.NesHawk; + SubNesHawkMenuItem.Checked = Config.PreferredCores["NES"] == CoreNames.SubNesHawk; } private void QuickNesCorePick_Click(object sender, EventArgs e) { - Config.NesInQuickNes = true; - Config.UseSubNESHawk = false; + Config.PreferredCores["NES"] = CoreNames.QuickNes; if (Emulator.SystemId == "NES") { @@ -1217,8 +1217,7 @@ namespace BizHawk.Client.EmuHawk private void NesCorePick_Click(object sender, EventArgs e) { - Config.NesInQuickNes = false; - Config.UseSubNESHawk = false; + Config.PreferredCores["NES"] = CoreNames.NesHawk; if (Emulator.SystemId == "NES") { @@ -1228,20 +1227,9 @@ namespace BizHawk.Client.EmuHawk private void SubNesCorePick_Click(object sender, EventArgs e) { - Config.UseSubNESHawk = true; - Config.NesInQuickNes = false; + Config.PreferredCores["NES"] = CoreNames.SubNesHawk; - if (!Emulator.IsNull()) - { - FlagNeedsReboot(); - } - } - - private void SubGBCorePick_Click(object sender, EventArgs e) - { - Config.UseSubGBHawk ^= true; - - if (!Emulator.IsNull()) + if (Emulator.SystemId == "NES") { FlagNeedsReboot(); } @@ -1249,13 +1237,15 @@ namespace BizHawk.Client.EmuHawk private void CoreSNESSubMenu_DropDownOpened(object sender, EventArgs e) { - Coresnes9xMenuItem.Checked = Config.SnesInSnes9x; - CorebsnesMenuItem.Checked = !Config.SnesInSnes9x; + Coresnes9xMenuItem.Checked = Config.PreferredCores["SNES"] == CoreNames.Snes9X; + CorebsnesMenuItem.Checked = Config.PreferredCores["SNES"] == CoreNames.Bsnes; } private void CoreSnesToggle_Click(object sender, EventArgs e) { - Config.SnesInSnes9x ^= true; + Config.PreferredCores["SNES"] = Config.PreferredCores["SNES"] == CoreNames.Snes9X + ? CoreNames.Bsnes + : CoreNames.Snes9X; if (Emulator.SystemId == "SNES") { @@ -1265,13 +1255,15 @@ namespace BizHawk.Client.EmuHawk private void GbaCoreSubMenu_DropDownOpened(object sender, EventArgs e) { - VbaNextCoreMenuItem.Checked = !Config.GbaUsemGba; - MgbaCoreMenuItem.Checked = Config.GbaUsemGba; + VbaNextCoreMenuItem.Checked = Config.PreferredCores["GBA"] == CoreNames.VbaNext; + MgbaCoreMenuItem.Checked = Config.PreferredCores["GBA"] == CoreNames.Mgba; } private void GbaCorePick_Click(object sender, EventArgs e) { - Config.GbaUsemGba ^= true; + Config.PreferredCores["GBA"] = Config.PreferredCores["GBA"] == CoreNames.VbaNext + ? CoreNames.Mgba + : CoreNames.VbaNext; if (Emulator.SystemId == "GBA") { FlagNeedsReboot(); @@ -1286,16 +1278,34 @@ namespace BizHawk.Client.EmuHawk private void GBCoreSubmenu_DropDownOpened(object sender, EventArgs e) { - GBGambatteMenuItem.Checked = !Config.GbUseGbHawk; - GBGBHawkMenuItem.Checked = Config.GbUseGbHawk; - SubGBHawkMenuItem.Checked = Config.UseSubGBHawk; + GBGambatteMenuItem.Checked = Config.PreferredCores["GB"] == CoreNames.Gambatte; + GBGBHawkMenuItem.Checked = Config.PreferredCores["GB"] == CoreNames.GbHawk; + SubGBHawkMenuItem.Checked = Config.PreferredCores["GB"] == CoreNames.SubGbHawk; + } + + private void SubGBCorePick_Click(object sender, EventArgs e) + { + Config.PreferredCores["GB"] = CoreNames.SubGbHawk; + if (Emulator.SystemId == "GB" || Emulator.SystemId == "GBC") + { + FlagNeedsReboot(); + } } private void SgbCorePick_Click(object sender, EventArgs e) { Config.SgbUseBsnes ^= true; - // TODO: only flag if one of these cores - if (!Emulator.IsNull()) + if (Emulator.SystemId == "GB" || Emulator.SystemId == "GBC") + { + FlagNeedsReboot(); + } + } + + private void GambatteCorePick_Click(object sender, EventArgs e) + { + Config.PreferredCores["GB"] = CoreNames.Gambatte; + + if (Emulator.SystemId == "GB" || Emulator.SystemId == "GBC") { FlagNeedsReboot(); } @@ -1303,10 +1313,9 @@ namespace BizHawk.Client.EmuHawk private void GBCorePick_Click(object sender, EventArgs e) { - Config.GbUseGbHawk ^= true; - Config.UseSubGBHawk = false; - // TODO: only flag if one of these cores - if (!Emulator.IsNull()) + Config.PreferredCores["GB"] = CoreNames.GbHawk; + + if (Emulator.SystemId == "GB" || Emulator.SystemId == "GBC") { FlagNeedsReboot(); } @@ -1550,13 +1559,13 @@ namespace BizHawk.Client.EmuHawk private void QuickNesMenuItem_Click(object sender, EventArgs e) { - Config.NesInQuickNes = true; + Config.PreferredCores["NES"] = CoreNames.QuickNes; FlagNeedsReboot(); } private void NesHawkMenuItem_Click(object sender, EventArgs e) { - Config.NesInQuickNes = false; + Config.PreferredCores["NES"] = CoreNames.NesHawk; FlagNeedsReboot(); } @@ -2006,13 +2015,13 @@ namespace BizHawk.Client.EmuHawk private void UsemGBAMenuItem_Click(object sender, EventArgs e) { - Config.GbaUsemGba = true; + Config.PreferredCores["GBA"] = CoreNames.Mgba; FlagNeedsReboot(); } private void UseVbaNextMenuItem_Click(object sender, EventArgs e) { - Config.GbaUsemGba = false; + Config.PreferredCores["GBA"] = CoreNames.VbaNext; FlagNeedsReboot(); } @@ -2023,8 +2032,8 @@ namespace BizHawk.Client.EmuHawk private void GBACoreSelectionSubMenu_DropDownOpened(object sender, EventArgs e) { - GBAmGBAMenuItem.Checked = Config.GbaUsemGba; - GBAVBANextMenuItem.Checked = !Config.GbaUsemGba; + GBAmGBAMenuItem.Checked = Config.PreferredCores["GBA"] == CoreNames.Mgba; + GBAVBANextMenuItem.Checked = Config.PreferredCores["GBA"] == CoreNames.VbaNext; } #endregion diff --git a/BizHawk.Client.EmuHawk/MainForm.Movie.cs b/BizHawk.Client.EmuHawk/MainForm.Movie.cs index 5e3fa3d985..7276311c43 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Movie.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Movie.cs @@ -31,28 +31,9 @@ namespace BizHawk.Client.EmuHawk RebootCore(); - if (MovieSession.PreviousNesInQuickNES.HasValue) + foreach (var previousPref in MovieSession.PreferredCores) { - Config.NesInQuickNes = MovieSession.PreviousNesInQuickNES.Value; - MovieSession.PreviousNesInQuickNES = null; - } - - if (MovieSession.PreviousSnesInSnes9x.HasValue) - { - Config.SnesInSnes9x = MovieSession.PreviousSnesInSnes9x.Value; - MovieSession.PreviousSnesInSnes9x = null; - } - - if (MovieSession.PreviousGbaUsemGba.HasValue) - { - Config.GbaUsemGba = MovieSession.PreviousGbaUsemGba.Value; - MovieSession.PreviousGbaUsemGba = null; - } - - if (MovieSession.PreviousGbUseGbHawk.HasValue) - { - Config.GbUseGbHawk = MovieSession.PreviousGbUseGbHawk.Value; - MovieSession.PreviousGbUseGbHawk = null; + Config.PreferredCores[previousPref.Key] = previousPref.Value; } Config.RecentMovies.Add(movie.Filename); diff --git a/BizHawk.Client.EmuHawk/config/ProfileConfig.cs b/BizHawk.Client.EmuHawk/config/ProfileConfig.cs index 30584a5800..e70fc9c0b0 100644 --- a/BizHawk.Client.EmuHawk/config/ProfileConfig.cs +++ b/BizHawk.Client.EmuHawk/config/ProfileConfig.cs @@ -3,7 +3,7 @@ using System.Windows.Forms; using BizHawk.Client.Common; using BizHawk.Emulation.Common; - +using BizHawk.Emulation.Cores; using BizHawk.Emulation.Cores.Nintendo.N64; using BizHawk.Emulation.Cores.Consoles.Sega.gpgx; using BizHawk.Emulation.Cores.Sega.MasterSystem; @@ -113,7 +113,7 @@ namespace BizHawk.Client.EmuHawk PutSyncSettings(n64Settings); // SNES - _config.SnesInSnes9x = true; + _config.PreferredCores["SNES"] = CoreNames.Snes9X; // Genesis var genesisSettings = GetSyncSettings(); @@ -138,7 +138,7 @@ namespace BizHawk.Client.EmuHawk PutSyncSettings(a2600Settings); // NES - _config.NesInQuickNes = true; + _config.PreferredCores["NES"] = CoreNames.QuickNes; } private void SetLongPlay() @@ -146,7 +146,7 @@ namespace BizHawk.Client.EmuHawk _config.SaveStateCompressionLevelNormal = 5; // SNES - _config.SnesInSnes9x = false; + _config.PreferredCores["SNES"] = CoreNames.Bsnes; // SMS var smsSettings = GetSyncSettings(); @@ -161,7 +161,7 @@ namespace BizHawk.Client.EmuHawk PutSyncSettings(a2600Settings); // NES - _config.NesInQuickNes = false; + _config.PreferredCores["NES"] = CoreNames.NesHawk; } private void SetTas() @@ -185,7 +185,7 @@ namespace BizHawk.Client.EmuHawk PutSyncSettings(n64Settings); // SNES - _config.SnesInSnes9x = false; + _config.PreferredCores["SNES"] = CoreNames.Snes9X; // Genesis var genesisSettings = GetSyncSettings(); @@ -205,7 +205,7 @@ namespace BizHawk.Client.EmuHawk PutSyncSettings(a2600Settings); // NES - _config.NesInQuickNes = false; + _config.PreferredCores["NES"] = CoreNames.NesHawk; } private void SetN64Tas() diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.cs index 65a96b83ec..26512fcab0 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.cs @@ -7,7 +7,7 @@ using BizHawk.Emulation.Cores.Components.ARM; namespace BizHawk.Emulation.Cores.Nintendo.GBA { - [Core("VBA-Next", "many authors", true, true, "cd508312a29ed8c29dacac1b11c2dce56c338a54", "https://github.com/libretro/vba-next", false)] + [Core(CoreNames.VbaNext, "many authors", true, true, "cd508312a29ed8c29dacac1b11c2dce56c338a54", "https://github.com/libretro/vba-next", false)] [ServiceNotApplicable(new[] { typeof(IDriveLight), typeof(IRegionable) })] public partial class VBANext : IEmulator, IVideoProvider, ISoundProvider, IInputPollable, IGBAGPUViewable, ISaveRam, IStatable, IDebuggable, ISettable diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/SubGBHawk/SubGBHawk.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/SubGBHawk/SubGBHawk.cs index d325f61c3d..94617ad8dd 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/SubGBHawk/SubGBHawk.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/SubGBHawk/SubGBHawk.cs @@ -1,10 +1,9 @@ using BizHawk.Emulation.Common; -using BizHawk.Emulation.Cores.Nintendo.GBHawk; namespace BizHawk.Emulation.Cores.Nintendo.SubGBHawk { [Core( - "SubGBHawk", + CoreNames.SubGbHawk, "", isPorted: false, isReleased: true)] diff --git a/BizHawk.Emulation.Cores/CoreNames.cs b/BizHawk.Emulation.Cores/CoreNames.cs index e873d71efe..fc2dfbbc86 100644 --- a/BizHawk.Emulation.Cores/CoreNames.cs +++ b/BizHawk.Emulation.Cores/CoreNames.cs @@ -18,5 +18,6 @@ namespace BizHawk.Emulation.Cores public const string VbaNext = "VBA-Next"; public const string GbHawk = "GBHawk"; public const string Gambatte = "Gambatte"; + public const string SubGbHawk = "SubGBHawk"; } }