N64 sync settings - clean up some stuff and fix the plugin type being a read-only proprty in the new config dialog

This commit is contained in:
adelikat 2014-07-20 16:59:03 +00:00
parent 1342dae39d
commit 6819459292
11 changed files with 70 additions and 81 deletions

View File

@ -96,10 +96,10 @@ namespace BizHawk.Client.EmuHawk
s.VideoSizeY = Int32.Parse(strArr[1].Trim()); s.VideoSizeY = Int32.Parse(strArr[1].Trim());
switch (PluginComboBox.Text) switch (PluginComboBox.Text)
{ {
case "Rice": ss.VidPlugin = PluginType.RICE; break; case "Rice": ss.VidPlugin = PluginType.Rice; break;
case "Glide64": ss.VidPlugin = PluginType.GLIDE; break; case "Glide64": ss.VidPlugin = PluginType.Glide; break;
case "Glide64mk2": ss.VidPlugin = PluginType.GLIDE64MK2; break; case "Glide64mk2": ss.VidPlugin = PluginType.GlideMk2; break;
case "Jabo 1.6.1": ss.VidPlugin = PluginType.JABO; break; case "Jabo 1.6.1": ss.VidPlugin = PluginType.Jabo; break;
} }
//Rice //Rice
@ -321,13 +321,13 @@ namespace BizHawk.Client.EmuHawk
ss.Glide64mk2Plugin.fast_crc = Glide64mk2_fast_crc.Checked; ss.Glide64mk2Plugin.fast_crc = Glide64mk2_fast_crc.Checked;
ss.CoreType = CoreTypeDropdown.SelectedItem ss.Core = CoreTypeDropdown.SelectedItem
.ToString() .ToString()
.GetEnumFromDescription<N64SyncSettings.CORETYPE>(); .GetEnumFromDescription<N64SyncSettings.CoreType>();
ss.RspType = RspTypeDropdown.SelectedItem ss.Rsp = RspTypeDropdown.SelectedItem
.ToString() .ToString()
.GetEnumFromDescription<N64SyncSettings.RSPTYPE>(); .GetEnumFromDescription<N64SyncSettings.RspType>();
PutSettings(s); PutSettings(s);
PutSyncSettings(ss); PutSyncSettings(ss);
@ -338,8 +338,8 @@ namespace BizHawk.Client.EmuHawk
var s = GetSettings(); var s = GetSettings();
var ss = GetSyncSettings(); var ss = GetSyncSettings();
CoreTypeDropdown.PopulateFromEnum<N64SyncSettings.CORETYPE>(ss.CoreType); CoreTypeDropdown.PopulateFromEnum<N64SyncSettings.CoreType>(ss.Core);
RspTypeDropdown.PopulateFromEnum<N64SyncSettings.RSPTYPE>(ss.RspType); RspTypeDropdown.PopulateFromEnum<N64SyncSettings.RspType>(ss.Rsp);
//Load Variables //Load Variables
//Global //Global
@ -354,10 +354,10 @@ namespace BizHawk.Client.EmuHawk
} }
switch (ss.VidPlugin) switch (ss.VidPlugin)
{ {
case PluginType.GLIDE64MK2: PluginComboBox.Text = "Glide64mk2"; break; case PluginType.GlideMk2: PluginComboBox.Text = "Glide64mk2"; break;
case PluginType.GLIDE: PluginComboBox.Text = "Glide64"; break; case PluginType.Glide: PluginComboBox.Text = "Glide64"; break;
case PluginType.RICE: PluginComboBox.Text = "Rice"; break; case PluginType.Rice: PluginComboBox.Text = "Rice"; break;
case PluginType.JABO: PluginComboBox.Text = "Jabo 1.6.1"; break; case PluginType.Jabo: PluginComboBox.Text = "Jabo 1.6.1"; break;
} }
//Rice //Rice

View File

@ -35,13 +35,13 @@ namespace BizHawk.Client.EmuHawk
s.VideoSizeX = int.Parse(strArr[0].Trim()); s.VideoSizeX = int.Parse(strArr[0].Trim());
s.VideoSizeY = int.Parse(strArr[1].Trim()); s.VideoSizeY = int.Parse(strArr[1].Trim());
ss.CoreType = CoreTypeDropdown.SelectedItem ss.Core = CoreTypeDropdown.SelectedItem
.ToString() .ToString()
.GetEnumFromDescription<N64SyncSettings.CORETYPE>(); .GetEnumFromDescription<N64SyncSettings.CoreType>();
ss.RspType = RspTypeDropdown.SelectedItem ss.Rsp = RspTypeDropdown.SelectedItem
.ToString() .ToString()
.GetEnumFromDescription<N64SyncSettings.RSPTYPE>(); .GetEnumFromDescription<N64SyncSettings.RspType>();
ss.VidPlugin = PluginComboBox.SelectedItem ss.VidPlugin = PluginComboBox.SelectedItem
.ToString() .ToString()
@ -59,8 +59,8 @@ namespace BizHawk.Client.EmuHawk
s = GetSettings(); s = GetSettings();
ss = GetSyncSettings(); ss = GetSyncSettings();
CoreTypeDropdown.PopulateFromEnum<N64SyncSettings.CORETYPE>(ss.CoreType); CoreTypeDropdown.PopulateFromEnum<N64SyncSettings.CoreType>(ss.Core);
RspTypeDropdown.PopulateFromEnum<N64SyncSettings.RSPTYPE>(ss.RspType); RspTypeDropdown.PopulateFromEnum<N64SyncSettings.RspType>(ss.Rsp);
PluginComboBox.PopulateFromEnum<PluginType>(ss.VidPlugin); PluginComboBox.PopulateFromEnum<PluginType>(ss.VidPlugin);
var video_setting = s.VideoSizeX var video_setting = s.VideoSizeX

View File

@ -61,8 +61,8 @@ namespace BizHawk.Client.EmuHawk
// N64 // N64
var n64Settings = GetSyncSettings<N64, N64SyncSettings>(); var n64Settings = GetSyncSettings<N64, N64SyncSettings>();
n64Settings.RspType = N64SyncSettings.RSPTYPE.Rsp_Hle; n64Settings.Rsp = N64SyncSettings.RspType.Rsp_Hle;
n64Settings.CoreType = N64SyncSettings.CORETYPE.Dynarec; n64Settings.Core = N64SyncSettings.CoreType.Dynarec;
Global.Config.N64UseCircularAnalogConstraint = true; Global.Config.N64UseCircularAnalogConstraint = true;
PutSyncSettings<N64>(n64Settings); PutSyncSettings<N64>(n64Settings);
@ -115,8 +115,8 @@ namespace BizHawk.Client.EmuHawk
// N64 // N64
var n64Settings = GetSyncSettings<N64, N64SyncSettings>(); var n64Settings = GetSyncSettings<N64, N64SyncSettings>();
n64Settings.RspType = N64SyncSettings.RSPTYPE.Rsp_Z64_hlevideo; n64Settings.Rsp = N64SyncSettings.RspType.Rsp_Z64_hlevideo;
n64Settings.CoreType = N64SyncSettings.CORETYPE.Pure_Interpret; n64Settings.Core = N64SyncSettings.CoreType.Pure_Interpret;
Global.Config.N64UseCircularAnalogConstraint = true; Global.Config.N64UseCircularAnalogConstraint = true;
PutSyncSettings<N64>(n64Settings); PutSyncSettings<N64>(n64Settings);
@ -172,8 +172,8 @@ namespace BizHawk.Client.EmuHawk
// N64 // N64
var n64Settings = GetSyncSettings<N64, N64SyncSettings>(); var n64Settings = GetSyncSettings<N64, N64SyncSettings>();
n64Settings.RspType = N64SyncSettings.RSPTYPE.Rsp_Z64_hlevideo; n64Settings.Rsp = N64SyncSettings.RspType.Rsp_Z64_hlevideo;
n64Settings.CoreType = N64SyncSettings.CORETYPE.Pure_Interpret; n64Settings.Core = N64SyncSettings.CoreType.Pure_Interpret;
Global.Config.N64UseCircularAnalogConstraint = false; Global.Config.N64UseCircularAnalogConstraint = false;
PutSyncSettings<N64>(n64Settings); PutSyncSettings<N64>(n64Settings);

View File

@ -99,7 +99,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
StartThreadLoop(); StartThreadLoop();
var videosettings = _syncSettings.GetVPS(game, _settings.VideoSizeX, _settings.VideoSizeY); 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) //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... //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); _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-hle.dll" :
"mupen64plus-rsp-z64-hlevideo.dll"; "mupen64plus-rsp-z64-hlevideo.dll";

View File

@ -1,9 +1,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using Newtonsoft.Json; using System.Reflection;
using BizHawk.Emulation.Common; using BizHawk.Emulation.Common;
using System.Reflection;
namespace BizHawk.Emulation.Cores.Nintendo.N64 namespace BizHawk.Emulation.Cores.Nintendo.N64
{ {
@ -69,13 +68,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
depth_bias = 20; depth_bias = 20;
} }
[JsonIgnore]
[Description("Plugin Type")]
public PluginType PluginType
{
get { return PluginType.GLIDE; }
}
[DefaultValue(1)] [DefaultValue(1)]
[DisplayName("Wire Frame Mode")] [DisplayName("Wire Frame Mode")]
[Description("0=Normal colors, 1=Vertex colors, 2=Red only")] [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<string, object> GetPluginSettings() public Dictionary<string, object> GetPluginSettings()
{ {
//TODO: deal witn the game depedent settings //TODO: deal witn the game depedent settings

View File

@ -1,6 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using Newtonsoft.Json;
using BizHawk.Emulation.Common; using BizHawk.Emulation.Common;
using System.Reflection; using System.Reflection;
@ -58,13 +57,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
read_back_to_screen = 0; read_back_to_screen = 0;
} }
[JsonIgnore]
[DisplayName("Plugin Type")]
public PluginType PluginType
{
get { return PluginType.GLIDE64MK2; }
}
[DefaultValue(true)] [DefaultValue(true)]
[DisplayName("Wrapper FBO")] [DisplayName("Wrapper FBO")]
public bool wrpFBO { get; set; } public bool wrpFBO { get; set; }
@ -286,6 +278,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
} }
} }
public PluginType GetPluginType()
{
return PluginType.GlideMk2;
}
public Dictionary<string, object> GetPluginSettings() public Dictionary<string, object> GetPluginSettings()
{ {
//TODO: deal witn the game depedent settings //TODO: deal witn the game depedent settings

View File

@ -29,10 +29,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
clear_mode = DIRECT3D_CLEAR_MODE.def; clear_mode = DIRECT3D_CLEAR_MODE.def;
} }
[JsonIgnore] public PluginType GetPluginType()
public PluginType PluginType
{ {
get { return PluginType.JABO; } return PluginType.Jabo;
} }
public void FillPerGameHacks(GameInfo game) public void FillPerGameHacks(GameInfo game)

View File

@ -1,6 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using Newtonsoft.Json;
using BizHawk.Emulation.Common; using BizHawk.Emulation.Common;
using System.Reflection; using System.Reflection;
@ -79,13 +78,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
EnableHacksForGame = 0; EnableHacksForGame = 0;
} }
[JsonIgnore]
[Description("Plugin Type")]
public PluginType PluginType
{
get { return PluginType.RICE; }
}
[DefaultValue(0)] [DefaultValue(0)]
[DisplayName("Frame Buffer Emulation")] [DisplayName("Frame Buffer Emulation")]
[Description("0=ROM default, 1=disable")] [Description("0=ROM default, 1=disable")]
@ -403,6 +395,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
} }
} }
public PluginType GetPluginType()
{
return PluginType.Rice;
}
public Dictionary<string, object> GetPluginSettings() public Dictionary<string, object> GetPluginSettings()
{ {
//TODO: deal witn the game depedent settings //TODO: deal witn the game depedent settings

View File

@ -8,9 +8,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
{ {
public partial class N64SyncSettings public partial class N64SyncSettings
{ {
public CORETYPE CoreType = CORETYPE.Dynarec; public CoreType Core = CoreType.Dynarec;
public enum CORETYPE public enum CoreType
{ {
[Description("Pure Interpreter")] [Description("Pure Interpreter")]
Pure_Interpret = 0, Pure_Interpret = 0,
@ -22,9 +22,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
Dynarec = 2, Dynarec = 2,
} }
public RSPTYPE RspType = RSPTYPE.Rsp_Hle; public enum RspType
public enum RSPTYPE
{ {
[Description("Hle")] [Description("Hle")]
Rsp_Hle = 0, Rsp_Hle = 0,
@ -33,7 +31,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
Rsp_Z64_hlevideo = 1 Rsp_Z64_hlevideo = 1
} }
public PluginType VidPlugin = PluginType.RICE; public PluginType VidPlugin = PluginType.Rice;
public RspType Rsp = RspType.Rsp_Hle;
public N64ControllerSettings[] Controllers = public N64ControllerSettings[] Controllers =
{ {
@ -52,8 +51,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
{ {
return new N64SyncSettings return new N64SyncSettings
{ {
CoreType = CoreType, Core = Core,
RspType = RspType, Rsp = Rsp,
VidPlugin = VidPlugin, VidPlugin = VidPlugin,
RicePlugin = RicePlugin.Clone(), RicePlugin = RicePlugin.Clone(),
GlidePlugin = GlidePlugin.Clone(), GlidePlugin = GlidePlugin.Clone(),
@ -71,10 +70,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
switch (VidPlugin) switch (VidPlugin)
{ {
// clone so per game hacks don't overwrite our settings object // clone so per game hacks don't overwrite our settings object
case PluginType.GLIDE: ips = GlidePlugin.Clone(); break; case PluginType.Glide: ips = GlidePlugin.Clone(); break;
case PluginType.GLIDE64MK2: ips = Glide64mk2Plugin.Clone(); break; case PluginType.GlideMk2: ips = Glide64mk2Plugin.Clone(); break;
case PluginType.RICE: ips = RicePlugin.Clone(); break; case PluginType.Rice: ips = RicePlugin.Clone(); break;
case PluginType.JABO: ips = JaboPlugin.Clone(); break; case PluginType.Jabo: ips = JaboPlugin.Clone(); break;
} }
ips.FillPerGameHacks(game); ips.FillPerGameHacks(game);
ret.Parameters = ips.GetPluginSettings(); ret.Parameters = ips.GetPluginSettings();
@ -85,21 +84,21 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
public enum PluginType public enum PluginType
{ {
[Description("Rice")] [Description("Rice")]
RICE, Rice,
[Description("Glide64")] [Description("Glide64")]
GLIDE, Glide,
[Description("Glide64 mk2")] [Description("Glide64 mk2")]
GLIDE64MK2, GlideMk2,
[Description("Jabo")] [Description("Jabo")]
JABO Jabo
} }
public interface IPluginSettings public interface IPluginSettings
{ {
PluginType PluginType { get; } PluginType GetPluginType();
Dictionary<string, object> GetPluginSettings(); Dictionary<string, object> GetPluginSettings();
void FillPerGameHacks(GameInfo game); void FillPerGameHacks(GameInfo game);
} }

View File

@ -475,19 +475,19 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64.NativeApi
public void set_video_parameters(VideoPluginSettings video_settings) public void set_video_parameters(VideoPluginSettings video_settings)
{ {
IntPtr video_plugin_section = IntPtr.Zero; 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); 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); 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); 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); m64pConfigOpenSection("Video-Jabo", ref video_plugin_section);
} }

View File

@ -47,16 +47,16 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64.NativeApi
switch (settings.Plugin) switch (settings.Plugin)
{ {
default: default:
case PluginType.RICE: case PluginType.Rice:
videoplugin = "mupen64plus-video-rice.dll"; videoplugin = "mupen64plus-video-rice.dll";
break; break;
case PluginType.GLIDE: case PluginType.Glide:
videoplugin = "mupen64plus-video-glide64.dll"; videoplugin = "mupen64plus-video-glide64.dll";
break; break;
case PluginType.GLIDE64MK2: case PluginType.GlideMk2:
videoplugin = "mupen64plus-video-glide64mk2.dll"; videoplugin = "mupen64plus-video-glide64mk2.dll";
break; break;
case PluginType.JABO: case PluginType.Jabo:
videoplugin = "mupen64plus-video-jabo.dll"; videoplugin = "mupen64plus-video-jabo.dll";
break; break;
} }