From e332096731711fba1b966b5f61bc07bf30ea35af Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 24 May 2020 15:19:14 -0500 Subject: [PATCH] wire up more pce core picker --- src/BizHawk.Client.Common/RomLoader.cs | 10 +++++- src/BizHawk.Client.Common/config/Config.cs | 3 +- .../MainForm.Designer.cs | 31 ++++++++++++++++ src/BizHawk.Client.EmuHawk/MainForm.Events.cs | 35 +++++++++++++++++-- .../Consoles/NEC/PCE/TerboGrafix.cs | 2 +- .../Consoles/PC Engine/PCEngine.cs | 2 +- src/BizHawk.Emulation.Cores/CoreNames.cs | 2 +- 7 files changed, 78 insertions(+), 7 deletions(-) diff --git a/src/BizHawk.Client.Common/RomLoader.cs b/src/BizHawk.Client.Common/RomLoader.cs index 237c90f829..1d484ad472 100644 --- a/src/BizHawk.Client.Common/RomLoader.cs +++ b/src/BizHawk.Client.Common/RomLoader.cs @@ -837,7 +837,15 @@ namespace BizHawk.Client.Common switch (game.System) { default: - core = CoreInventory.Instance[game.System]; + if (Global.Config.PreferredCores.TryGetValue(game.System, out string coreName)) + { + core = CoreInventory.Instance[game.System, coreName]; + } + else + { + core = CoreInventory.Instance[game.System]; + } + break; case null: diff --git a/src/BizHawk.Client.Common/config/Config.cs b/src/BizHawk.Client.Common/config/Config.cs index ccd9d7ea88..573ead9388 100644 --- a/src/BizHawk.Client.Common/config/Config.cs +++ b/src/BizHawk.Client.Common/config/Config.cs @@ -324,7 +324,8 @@ namespace BizHawk.Client.Common ["SNES"] = CoreNames.Snes9X, ["GB"] = CoreNames.Gambatte, ["PCE"] = CoreNames.PceHawk, - ["PCECD"] = CoreNames.PceHawk + ["PCECD"] = CoreNames.PceHawk, + ["SGX"] = CoreNames.PceHawk }; // ReSharper disable once UnusedMember.Global diff --git a/src/BizHawk.Client.EmuHawk/MainForm.Designer.cs b/src/BizHawk.Client.EmuHawk/MainForm.Designer.cs index 6f657e515d..027221c46a 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.Designer.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.Designer.cs @@ -193,8 +193,11 @@ this.CorebsnesMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.SGBCoreSubmenu = new System.Windows.Forms.ToolStripMenuItem(); this.SgbBsnesMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.PceHawkMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.TurboNymaMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.SgbSameBoyMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.GBCoreSubmenu = new System.Windows.Forms.ToolStripMenuItem(); + this.PceCoreSubmenu = new System.Windows.Forms.ToolStripMenuItem(); this.GBGambatteMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.GBGBHawkMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.GBInSGBMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -1789,6 +1792,7 @@ this.CoreSNESSubMenu, this.SGBCoreSubmenu, this.GBCoreSubmenu, + this.PceCoreSubmenu, this.GBInSGBMenuItem, this.toolStripMenuItem16, this.AllowGameDbCoreOverridesMenuItem, @@ -1879,6 +1883,16 @@ this.SGBCoreSubmenu.Text = "SGB"; this.SGBCoreSubmenu.DropDownOpened += new System.EventHandler(this.SGBCoreSubmenu_DropDownOpened); // + // PceCoreSubmenu + // + this.PceCoreSubmenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.PceHawkMenuItem, + this.TurboNymaMenuItem}); + this.PceCoreSubmenu.Name = "PceCoreSubmenu"; + this.PceCoreSubmenu.Size = new System.Drawing.Size(223, 22); + this.PceCoreSubmenu.Text = "PCE"; + this.PceCoreSubmenu.DropDownOpened += new System.EventHandler(this.PceCoreSubmenu_DropDownOpened); + // // SgbBsnesMenuItem // this.SgbBsnesMenuItem.Name = "SgbBsnesMenuItem"; @@ -1893,6 +1907,20 @@ this.SgbSameBoyMenuItem.Text = "SameBoy"; this.SgbSameBoyMenuItem.Click += new System.EventHandler(this.SgbCorePick_Click); // + // PceHawkMenuItem + // + this.PceHawkMenuItem.Name = "PceHawkMenuItem"; + this.PceHawkMenuItem.Size = new System.Drawing.Size(118, 22); + this.PceHawkMenuItem.Text = "PCEHawk"; + this.PceHawkMenuItem.Click += new System.EventHandler(this.PceHawkCorePick_Click); + // + // TurboNymaMenuItem + // + this.TurboNymaMenuItem.Name = "TurboNymaMenuItem"; + this.TurboNymaMenuItem.Size = new System.Drawing.Size(118, 22); + this.TurboNymaMenuItem.Text = "TurboNyma"; + this.TurboNymaMenuItem.Click += new System.EventHandler(this.TurboNymaCorePick_Click); + // // GBCoreSubmenu // this.GBCoreSubmenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -4311,7 +4339,10 @@ private System.Windows.Forms.ToolStripMenuItem SGBCoreSubmenu; private System.Windows.Forms.ToolStripMenuItem SgbBsnesMenuItem; private System.Windows.Forms.ToolStripMenuItem SgbSameBoyMenuItem; + private System.Windows.Forms.ToolStripMenuItem PceHawkMenuItem; + private System.Windows.Forms.ToolStripMenuItem TurboNymaMenuItem; private System.Windows.Forms.ToolStripMenuItem GBCoreSubmenu; + private System.Windows.Forms.ToolStripMenuItem PceCoreSubmenu; private System.Windows.Forms.ToolStripMenuItem GBGambatteMenuItem; private System.Windows.Forms.ToolStripMenuItem GBGBHawkMenuItem; private System.Windows.Forms.ToolStripMenuItem pCFXToolStripMenuItem; diff --git a/src/BizHawk.Client.EmuHawk/MainForm.Events.cs b/src/BizHawk.Client.EmuHawk/MainForm.Events.cs index 39aa5a7ccb..242f4c48d4 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -1257,6 +1257,12 @@ namespace BizHawk.Client.EmuHawk SubGBHawkMenuItem.Checked = Config.PreferredCores["GB"] == CoreNames.SubGbHawk; } + private void PceCoreSubmenu_DropDownOpened(object sender, EventArgs e) + { + PceHawkMenuItem.Checked = Config.PreferredCores["PCE"] == CoreNames.PceHawk; + TurboNymaMenuItem.Checked = Config.PreferredCores["PCE"] == CoreNames.TurboNyma; + } + private void SubGBCorePick_Click(object sender, EventArgs e) { Config.PreferredCores["GB"] = CoreNames.SubGbHawk; @@ -1285,11 +1291,36 @@ namespace BizHawk.Client.EmuHawk } } + private void PceHawkCorePick_Click(object sender, EventArgs e) + { + // TODO: do we want to be able to pick different cores for each system? + Config.PreferredCores["PCE"] = CoreNames.PceHawk; + Config.PreferredCores["PCECD"] = CoreNames.PceHawk; + Config.PreferredCores["SGX"] = CoreNames.PceHawk; + + if (Emulator.SystemId == "PCE" || Emulator.SystemId == "PCECD" || Emulator.SystemId == "SGX") + { + FlagNeedsReboot(); + } + } + + private void TurboNymaCorePick_Click(object sender, EventArgs e) + { + Config.PreferredCores["PCE"] = CoreNames.TurboNyma; + Config.PreferredCores["PCECD"] = CoreNames.TurboNyma; + Config.PreferredCores["SGX"] = CoreNames.TurboNyma; + + if (Emulator.SystemId == "PCE" || Emulator.SystemId == "PCECD" || Emulator.SystemId == "SGX") + { + FlagNeedsReboot(); + } + } + private void GBCorePick_Click(object sender, EventArgs e) { - Config.PreferredCores["GB"] = CoreNames.GbHawk; + Config.PreferredCores["PCE"] = CoreNames.TurboNyma; - if (Emulator.SystemId == "GB" || Emulator.SystemId == "GBC") + if (Emulator.SystemId == "PCE" || Emulator.SystemId == "PCECD") { FlagNeedsReboot(); } diff --git a/src/BizHawk.Emulation.Cores/Consoles/NEC/PCE/TerboGrafix.cs b/src/BizHawk.Emulation.Cores/Consoles/NEC/PCE/TerboGrafix.cs index e06082bf0d..8282a0a768 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/NEC/PCE/TerboGrafix.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/NEC/PCE/TerboGrafix.cs @@ -3,7 +3,7 @@ using BizHawk.Emulation.Cores.Waterbox; namespace BizHawk.Emulation.Cores.Consoles.NEC.PCE { - [Core(CoreNames.TerboGrafix, "Mednafen Team", true, false, "", "", false)] + [Core(CoreNames.TurboNyma, "Mednafen Team", true, false, "", "", false)] public class TerboGrafix : NymaCore, IRegionable { [CoreConstructor("PCE")] diff --git a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs index cf7634674a..dbaec13a69 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs @@ -19,7 +19,7 @@ namespace BizHawk.Emulation.Cores.PCEngine public sealed partial class PCEngine : IEmulator, ISaveRam, IInputPollable, IVideoLogicalOffsets, IRomInfo, IDebuggable, ISettable, IDriveLight, ICodeDataLogger { - // [CoreConstructor(new[] { "PCE", "SGX" })] + [CoreConstructor(new[] { "PCE", "SGX" })] public PCEngine(GameInfo game, byte[] rom, object settings, object syncSettings) { switch (game.System) diff --git a/src/BizHawk.Emulation.Cores/CoreNames.cs b/src/BizHawk.Emulation.Cores/CoreNames.cs index e30905e00e..959982d8a5 100644 --- a/src/BizHawk.Emulation.Cores/CoreNames.cs +++ b/src/BizHawk.Emulation.Cores/CoreNames.cs @@ -22,6 +22,6 @@ namespace BizHawk.Emulation.Cores public const string PicoDrive = "PicoDrive"; public const string Gpgx = "Genplus-gx"; public const string PceHawk = "PCEHawk"; - public const string TerboGrafix = "Terbo Grafix"; + public const string TurboNyma = "Terbo Grafix"; } }