From 681945929221d222683cc051fe0b112477eb4bd1 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 20 Jul 2014 16:59:03 +0000 Subject: [PATCH] N64 sync settings - clean up some stuff and fix the plugin type being a read-only proprty in the new config dialog --- .../config/N64/N64VideoPluginconfig.cs | 28 ++++++++-------- .../config/N64/NewN64PluginSettings.cs | 12 +++---- .../config/ProfileConfig.cs | 12 +++---- .../Consoles/Nintendo/N64/N64.cs | 4 +-- .../Nintendo/N64/N64SyncSettings.Glide.cs | 15 ++++----- .../Nintendo/N64/N64SyncSettings.GlideMk2.cs | 13 +++----- .../Nintendo/N64/N64SyncSettings.Jabo.cs | 5 ++- .../Nintendo/N64/N64SyncSettings.Rice.cs | 13 +++----- .../Consoles/Nintendo/N64/N64SyncSettings.cs | 33 +++++++++---------- .../N64/NativeAPI/mupen64plusCoreApi.cs | 8 ++--- .../N64/NativeAPI/mupen64plusVideoApi.cs | 8 ++--- 11 files changed, 70 insertions(+), 81 deletions(-) diff --git a/BizHawk.Client.EmuHawk/config/N64/N64VideoPluginconfig.cs b/BizHawk.Client.EmuHawk/config/N64/N64VideoPluginconfig.cs index f42d879563..b7e8430635 100644 --- a/BizHawk.Client.EmuHawk/config/N64/N64VideoPluginconfig.cs +++ b/BizHawk.Client.EmuHawk/config/N64/N64VideoPluginconfig.cs @@ -96,10 +96,10 @@ namespace BizHawk.Client.EmuHawk s.VideoSizeY = Int32.Parse(strArr[1].Trim()); switch (PluginComboBox.Text) { - case "Rice": ss.VidPlugin = PluginType.RICE; break; - case "Glide64": ss.VidPlugin = PluginType.GLIDE; break; - case "Glide64mk2": ss.VidPlugin = PluginType.GLIDE64MK2; break; - case "Jabo 1.6.1": ss.VidPlugin = PluginType.JABO; break; + case "Rice": ss.VidPlugin = PluginType.Rice; break; + case "Glide64": ss.VidPlugin = PluginType.Glide; break; + case "Glide64mk2": ss.VidPlugin = PluginType.GlideMk2; break; + case "Jabo 1.6.1": ss.VidPlugin = PluginType.Jabo; break; } //Rice @@ -321,13 +321,13 @@ namespace BizHawk.Client.EmuHawk ss.Glide64mk2Plugin.fast_crc = Glide64mk2_fast_crc.Checked; - ss.CoreType = CoreTypeDropdown.SelectedItem + ss.Core = CoreTypeDropdown.SelectedItem .ToString() - .GetEnumFromDescription(); + .GetEnumFromDescription(); - ss.RspType = RspTypeDropdown.SelectedItem + ss.Rsp = RspTypeDropdown.SelectedItem .ToString() - .GetEnumFromDescription(); + .GetEnumFromDescription(); PutSettings(s); PutSyncSettings(ss); @@ -338,8 +338,8 @@ namespace BizHawk.Client.EmuHawk var s = GetSettings(); var ss = GetSyncSettings(); - CoreTypeDropdown.PopulateFromEnum(ss.CoreType); - RspTypeDropdown.PopulateFromEnum(ss.RspType); + CoreTypeDropdown.PopulateFromEnum(ss.Core); + RspTypeDropdown.PopulateFromEnum(ss.Rsp); //Load Variables //Global @@ -354,10 +354,10 @@ namespace BizHawk.Client.EmuHawk } switch (ss.VidPlugin) { - case PluginType.GLIDE64MK2: PluginComboBox.Text = "Glide64mk2"; break; - case PluginType.GLIDE: PluginComboBox.Text = "Glide64"; break; - case PluginType.RICE: PluginComboBox.Text = "Rice"; break; - case PluginType.JABO: PluginComboBox.Text = "Jabo 1.6.1"; break; + case PluginType.GlideMk2: PluginComboBox.Text = "Glide64mk2"; break; + case PluginType.Glide: PluginComboBox.Text = "Glide64"; break; + case PluginType.Rice: PluginComboBox.Text = "Rice"; break; + case PluginType.Jabo: PluginComboBox.Text = "Jabo 1.6.1"; break; } //Rice diff --git a/BizHawk.Client.EmuHawk/config/N64/NewN64PluginSettings.cs b/BizHawk.Client.EmuHawk/config/N64/NewN64PluginSettings.cs index fdad226ddc..d417375e3e 100644 --- a/BizHawk.Client.EmuHawk/config/N64/NewN64PluginSettings.cs +++ b/BizHawk.Client.EmuHawk/config/N64/NewN64PluginSettings.cs @@ -35,13 +35,13 @@ namespace BizHawk.Client.EmuHawk s.VideoSizeX = int.Parse(strArr[0].Trim()); s.VideoSizeY = int.Parse(strArr[1].Trim()); - ss.CoreType = CoreTypeDropdown.SelectedItem + ss.Core = CoreTypeDropdown.SelectedItem .ToString() - .GetEnumFromDescription(); + .GetEnumFromDescription(); - ss.RspType = RspTypeDropdown.SelectedItem + ss.Rsp = RspTypeDropdown.SelectedItem .ToString() - .GetEnumFromDescription(); + .GetEnumFromDescription(); ss.VidPlugin = PluginComboBox.SelectedItem .ToString() @@ -59,8 +59,8 @@ namespace BizHawk.Client.EmuHawk s = GetSettings(); ss = GetSyncSettings(); - CoreTypeDropdown.PopulateFromEnum(ss.CoreType); - RspTypeDropdown.PopulateFromEnum(ss.RspType); + CoreTypeDropdown.PopulateFromEnum(ss.Core); + RspTypeDropdown.PopulateFromEnum(ss.Rsp); PluginComboBox.PopulateFromEnum(ss.VidPlugin); var video_setting = s.VideoSizeX diff --git a/BizHawk.Client.EmuHawk/config/ProfileConfig.cs b/BizHawk.Client.EmuHawk/config/ProfileConfig.cs index 212ff520f9..37fead5817 100644 --- a/BizHawk.Client.EmuHawk/config/ProfileConfig.cs +++ b/BizHawk.Client.EmuHawk/config/ProfileConfig.cs @@ -61,8 +61,8 @@ namespace BizHawk.Client.EmuHawk // N64 var n64Settings = GetSyncSettings(); - n64Settings.RspType = N64SyncSettings.RSPTYPE.Rsp_Hle; - n64Settings.CoreType = N64SyncSettings.CORETYPE.Dynarec; + n64Settings.Rsp = N64SyncSettings.RspType.Rsp_Hle; + n64Settings.Core = N64SyncSettings.CoreType.Dynarec; Global.Config.N64UseCircularAnalogConstraint = true; PutSyncSettings(n64Settings); @@ -115,8 +115,8 @@ namespace BizHawk.Client.EmuHawk // N64 var n64Settings = GetSyncSettings(); - n64Settings.RspType = N64SyncSettings.RSPTYPE.Rsp_Z64_hlevideo; - n64Settings.CoreType = N64SyncSettings.CORETYPE.Pure_Interpret; + n64Settings.Rsp = N64SyncSettings.RspType.Rsp_Z64_hlevideo; + n64Settings.Core = N64SyncSettings.CoreType.Pure_Interpret; Global.Config.N64UseCircularAnalogConstraint = true; PutSyncSettings(n64Settings); @@ -172,8 +172,8 @@ namespace BizHawk.Client.EmuHawk // N64 var n64Settings = GetSyncSettings(); - n64Settings.RspType = N64SyncSettings.RSPTYPE.Rsp_Z64_hlevideo; - n64Settings.CoreType = N64SyncSettings.CORETYPE.Pure_Interpret; + n64Settings.Rsp = N64SyncSettings.RspType.Rsp_Z64_hlevideo; + n64Settings.Core = N64SyncSettings.CoreType.Pure_Interpret; Global.Config.N64UseCircularAnalogConstraint = false; PutSyncSettings(n64Settings); diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.cs index 9bcafeb0c9..a65c97526f 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.cs @@ -99,7 +99,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 StartThreadLoop(); var videosettings = _syncSettings.GetVPS(game, _settings.VideoSizeX, _settings.VideoSizeY); - var coreType = _syncSettings.CoreType; + var coreType = _syncSettings.Core; //zero 19-apr-2014 - added this to solve problem with SDL initialization corrupting the main thread (I think) and breaking subsequent emulators (for example, NES) //not sure why this works... if we put the plugin initializations in here, we get deadlocks in some SDL initialization. doesnt make sense to me... @@ -114,7 +114,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 _inputProvider = new N64Input(api, comm, this._syncSettings.Controllers); - string rsp = _syncSettings.RspType == N64SyncSettings.RSPTYPE.Rsp_Hle ? + string rsp = _syncSettings.Rsp == N64SyncSettings.RspType.Rsp_Hle ? "mupen64plus-rsp-hle.dll" : "mupen64plus-rsp-z64-hlevideo.dll"; diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64SyncSettings.Glide.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64SyncSettings.Glide.cs index b5f77033bb..728da19031 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64SyncSettings.Glide.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64SyncSettings.Glide.cs @@ -1,9 +1,8 @@ using System.Collections.Generic; using System.ComponentModel; -using Newtonsoft.Json; +using System.Reflection; using BizHawk.Emulation.Common; -using System.Reflection; namespace BizHawk.Emulation.Cores.Nintendo.N64 { @@ -69,13 +68,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 depth_bias = 20; } - [JsonIgnore] - [Description("Plugin Type")] - public PluginType PluginType - { - get { return PluginType.GLIDE; } - } - [DefaultValue(1)] [DisplayName("Wire Frame Mode")] [Description("0=Normal colors, 1=Vertex colors, 2=Red only")] @@ -342,6 +334,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 } } + public PluginType GetPluginType() + { + return PluginType.Glide; + } + public Dictionary GetPluginSettings() { //TODO: deal witn the game depedent settings diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64SyncSettings.GlideMk2.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64SyncSettings.GlideMk2.cs index cada5051d2..545664e22b 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64SyncSettings.GlideMk2.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64SyncSettings.GlideMk2.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.ComponentModel; -using Newtonsoft.Json; using BizHawk.Emulation.Common; using System.Reflection; @@ -58,13 +57,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 read_back_to_screen = 0; } - [JsonIgnore] - [DisplayName("Plugin Type")] - public PluginType PluginType - { - get { return PluginType.GLIDE64MK2; } - } - [DefaultValue(true)] [DisplayName("Wrapper FBO")] public bool wrpFBO { get; set; } @@ -286,6 +278,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 } } + public PluginType GetPluginType() + { + return PluginType.GlideMk2; + } + public Dictionary GetPluginSettings() { //TODO: deal witn the game depedent settings diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64SyncSettings.Jabo.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64SyncSettings.Jabo.cs index ad251f54e3..4f6b5b30e6 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64SyncSettings.Jabo.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64SyncSettings.Jabo.cs @@ -29,10 +29,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 clear_mode = DIRECT3D_CLEAR_MODE.def; } - [JsonIgnore] - public PluginType PluginType + public PluginType GetPluginType() { - get { return PluginType.JABO; } + return PluginType.Jabo; } public void FillPerGameHacks(GameInfo game) diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64SyncSettings.Rice.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64SyncSettings.Rice.cs index c2e3c43ee9..190377d121 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64SyncSettings.Rice.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64SyncSettings.Rice.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.ComponentModel; -using Newtonsoft.Json; using BizHawk.Emulation.Common; using System.Reflection; @@ -79,13 +78,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 EnableHacksForGame = 0; } - [JsonIgnore] - [Description("Plugin Type")] - public PluginType PluginType - { - get { return PluginType.RICE; } - } - [DefaultValue(0)] [DisplayName("Frame Buffer Emulation")] [Description("0=ROM default, 1=disable")] @@ -403,6 +395,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 } } + public PluginType GetPluginType() + { + return PluginType.Rice; + } + public Dictionary GetPluginSettings() { //TODO: deal witn the game depedent settings diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64SyncSettings.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64SyncSettings.cs index 611ffd4655..1625b8bcf5 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64SyncSettings.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64SyncSettings.cs @@ -8,9 +8,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 { public partial class N64SyncSettings { - public CORETYPE CoreType = CORETYPE.Dynarec; + public CoreType Core = CoreType.Dynarec; - public enum CORETYPE + public enum CoreType { [Description("Pure Interpreter")] Pure_Interpret = 0, @@ -22,9 +22,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 Dynarec = 2, } - public RSPTYPE RspType = RSPTYPE.Rsp_Hle; - - public enum RSPTYPE + public enum RspType { [Description("Hle")] Rsp_Hle = 0, @@ -33,7 +31,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 Rsp_Z64_hlevideo = 1 } - public PluginType VidPlugin = PluginType.RICE; + public PluginType VidPlugin = PluginType.Rice; + public RspType Rsp = RspType.Rsp_Hle; public N64ControllerSettings[] Controllers = { @@ -52,8 +51,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 { return new N64SyncSettings { - CoreType = CoreType, - RspType = RspType, + Core = Core, + Rsp = Rsp, VidPlugin = VidPlugin, RicePlugin = RicePlugin.Clone(), GlidePlugin = GlidePlugin.Clone(), @@ -71,10 +70,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 switch (VidPlugin) { // clone so per game hacks don't overwrite our settings object - case PluginType.GLIDE: ips = GlidePlugin.Clone(); break; - case PluginType.GLIDE64MK2: ips = Glide64mk2Plugin.Clone(); break; - case PluginType.RICE: ips = RicePlugin.Clone(); break; - case PluginType.JABO: ips = JaboPlugin.Clone(); break; + case PluginType.Glide: ips = GlidePlugin.Clone(); break; + case PluginType.GlideMk2: ips = Glide64mk2Plugin.Clone(); break; + case PluginType.Rice: ips = RicePlugin.Clone(); break; + case PluginType.Jabo: ips = JaboPlugin.Clone(); break; } ips.FillPerGameHacks(game); ret.Parameters = ips.GetPluginSettings(); @@ -85,21 +84,21 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 public enum PluginType { [Description("Rice")] - RICE, + Rice, [Description("Glide64")] - GLIDE, + Glide, [Description("Glide64 mk2")] - GLIDE64MK2, + GlideMk2, [Description("Jabo")] - JABO + Jabo } public interface IPluginSettings { - PluginType PluginType { get; } + PluginType GetPluginType(); Dictionary GetPluginSettings(); void FillPerGameHacks(GameInfo game); } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeAPI/mupen64plusCoreApi.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeAPI/mupen64plusCoreApi.cs index 977a4baeaf..b582acc955 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeAPI/mupen64plusCoreApi.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeAPI/mupen64plusCoreApi.cs @@ -475,19 +475,19 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64.NativeApi public void set_video_parameters(VideoPluginSettings video_settings) { IntPtr video_plugin_section = IntPtr.Zero; - if (video_settings.Plugin == PluginType.RICE) + if (video_settings.Plugin == PluginType.Rice) { m64pConfigOpenSection("Video-Rice", ref video_plugin_section); } - else if (video_settings.Plugin == PluginType.GLIDE) + else if (video_settings.Plugin == PluginType.Glide) { m64pConfigOpenSection("Video-Glide64", ref video_plugin_section); } - else if (video_settings.Plugin == PluginType.GLIDE64MK2) + else if (video_settings.Plugin == PluginType.GlideMk2) { m64pConfigOpenSection("Video-Glide64mk2", ref video_plugin_section); } - else if (video_settings.Plugin == PluginType.JABO) + else if (video_settings.Plugin == PluginType.Jabo) { m64pConfigOpenSection("Video-Jabo", ref video_plugin_section); } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeAPI/mupen64plusVideoApi.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeAPI/mupen64plusVideoApi.cs index 14bcbcf9ce..dfe26e5030 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeAPI/mupen64plusVideoApi.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeAPI/mupen64plusVideoApi.cs @@ -47,16 +47,16 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64.NativeApi switch (settings.Plugin) { default: - case PluginType.RICE: + case PluginType.Rice: videoplugin = "mupen64plus-video-rice.dll"; break; - case PluginType.GLIDE: + case PluginType.Glide: videoplugin = "mupen64plus-video-glide64.dll"; break; - case PluginType.GLIDE64MK2: + case PluginType.GlideMk2: videoplugin = "mupen64plus-video-glide64mk2.dll"; break; - case PluginType.JABO: + case PluginType.Jabo: videoplugin = "mupen64plus-video-jabo.dll"; break; }