N64 sync settings - clean up object convert public fields to properties
This commit is contained in:
parent
6819459292
commit
4382dc0c9a
|
@ -62,7 +62,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public N64ControllerSettings.N64ControllerPakType PakType
|
||||
public N64SyncSettings.N64ControllerSettings.N64ControllerPakType PakType
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -70,10 +70,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
return PakTypeDropdown.SelectedItem
|
||||
.ToString()
|
||||
.GetEnumFromDescription<N64ControllerSettings.N64ControllerPakType>();
|
||||
.GetEnumFromDescription<N64SyncSettings.N64ControllerSettings.N64ControllerPakType>();
|
||||
}
|
||||
|
||||
return N64ControllerSettings.N64ControllerPakType.NO_PAK;
|
||||
return N64SyncSettings.N64ControllerSettings.N64ControllerPakType.NO_PAK;
|
||||
}
|
||||
|
||||
set
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
this.ControllerSetting4.IsConnected = false;
|
||||
this.ControllerSetting4.Location = new System.Drawing.Point(12, 114);
|
||||
this.ControllerSetting4.Name = "ControllerSetting4";
|
||||
this.ControllerSetting4.PakType = BizHawk.Emulation.Cores.Nintendo.N64.N64ControllerSettings.N64ControllerPakType.NO_PAK;
|
||||
this.ControllerSetting4.PakType = BizHawk.Emulation.Cores.Nintendo.N64.N64SyncSettings.N64ControllerSettings.N64ControllerPakType.NO_PAK;
|
||||
this.ControllerSetting4.Size = new System.Drawing.Size(291, 28);
|
||||
this.ControllerSetting4.TabIndex = 5;
|
||||
//
|
||||
|
@ -76,7 +76,7 @@
|
|||
this.ControllerSetting3.IsConnected = false;
|
||||
this.ControllerSetting3.Location = new System.Drawing.Point(12, 80);
|
||||
this.ControllerSetting3.Name = "ControllerSetting3";
|
||||
this.ControllerSetting3.PakType = BizHawk.Emulation.Cores.Nintendo.N64.N64ControllerSettings.N64ControllerPakType.NO_PAK;
|
||||
this.ControllerSetting3.PakType = BizHawk.Emulation.Cores.Nintendo.N64.N64SyncSettings.N64ControllerSettings.N64ControllerPakType.NO_PAK;
|
||||
this.ControllerSetting3.Size = new System.Drawing.Size(291, 28);
|
||||
this.ControllerSetting3.TabIndex = 4;
|
||||
//
|
||||
|
@ -86,7 +86,7 @@
|
|||
this.ControllerSetting2.IsConnected = false;
|
||||
this.ControllerSetting2.Location = new System.Drawing.Point(12, 46);
|
||||
this.ControllerSetting2.Name = "ControllerSetting2";
|
||||
this.ControllerSetting2.PakType = BizHawk.Emulation.Cores.Nintendo.N64.N64ControllerSettings.N64ControllerPakType.NO_PAK;
|
||||
this.ControllerSetting2.PakType = BizHawk.Emulation.Cores.Nintendo.N64.N64SyncSettings.N64ControllerSettings.N64ControllerPakType.NO_PAK;
|
||||
this.ControllerSetting2.Size = new System.Drawing.Size(291, 28);
|
||||
this.ControllerSetting2.TabIndex = 3;
|
||||
//
|
||||
|
@ -96,7 +96,7 @@
|
|||
this.ControllerSetting1.IsConnected = false;
|
||||
this.ControllerSetting1.Location = new System.Drawing.Point(12, 12);
|
||||
this.ControllerSetting1.Name = "ControllerSetting1";
|
||||
this.ControllerSetting1.PakType = BizHawk.Emulation.Cores.Nintendo.N64.N64ControllerSettings.N64ControllerPakType.NO_PAK;
|
||||
this.ControllerSetting1.PakType = BizHawk.Emulation.Cores.Nintendo.N64.N64SyncSettings.N64ControllerSettings.N64ControllerPakType.NO_PAK;
|
||||
this.ControllerSetting1.Size = new System.Drawing.Size(291, 28);
|
||||
this.ControllerSetting1.TabIndex = 2;
|
||||
//
|
||||
|
|
|
@ -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.GlideMk2; break;
|
||||
case "Jabo 1.6.1": ss.VidPlugin = PluginType.Jabo; break;
|
||||
case "Rice": ss.VideoPlugin = PluginType.Rice; break;
|
||||
case "Glide64": ss.VideoPlugin = PluginType.Glide; break;
|
||||
case "Glide64mk2": ss.VideoPlugin = PluginType.GlideMk2; break;
|
||||
case "Jabo 1.6.1": ss.VideoPlugin = PluginType.Jabo; break;
|
||||
}
|
||||
|
||||
//Rice
|
||||
|
@ -352,7 +352,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
VideoResolutionComboBox.SelectedIndex = index;
|
||||
}
|
||||
switch (ss.VidPlugin)
|
||||
switch (ss.VideoPlugin)
|
||||
{
|
||||
case PluginType.GlideMk2: PluginComboBox.Text = "Glide64mk2"; break;
|
||||
case PluginType.Glide: PluginComboBox.Text = "Glide64"; break;
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
.ToString()
|
||||
.GetEnumFromDescription<N64SyncSettings.RspType>();
|
||||
|
||||
ss.VidPlugin = PluginComboBox.SelectedItem
|
||||
ss.VideoPlugin = PluginComboBox.SelectedItem
|
||||
.ToString()
|
||||
.GetEnumFromDescription<PluginType>();
|
||||
|
||||
|
@ -61,7 +61,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
CoreTypeDropdown.PopulateFromEnum<N64SyncSettings.CoreType>(ss.Core);
|
||||
RspTypeDropdown.PopulateFromEnum<N64SyncSettings.RspType>(ss.Rsp);
|
||||
PluginComboBox.PopulateFromEnum<PluginType>(ss.VidPlugin);
|
||||
PluginComboBox.PopulateFromEnum<PluginType>(ss.VideoPlugin);
|
||||
|
||||
var video_setting = s.VideoSizeX
|
||||
+ " x "
|
||||
|
|
|
@ -242,6 +242,7 @@
|
|||
<Compile Include="Consoles\Nintendo\GBA\Meteor.cs" />
|
||||
<Compile Include="Consoles\Nintendo\N64\N64Input.cs" />
|
||||
<Compile Include="Consoles\Nintendo\N64\N64Settings.cs" />
|
||||
<Compile Include="Consoles\Nintendo\N64\N64SyncSettings.Controller.cs" />
|
||||
<Compile Include="Consoles\Nintendo\N64\N64SyncSettings.Glide.cs" />
|
||||
<Compile Include="Consoles\Nintendo\N64\N64SyncSettings.GlideMk2.cs" />
|
||||
<Compile Include="Consoles\Nintendo\N64\N64SyncSettings.Jabo.cs" />
|
||||
|
|
|
@ -484,25 +484,25 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
|
|||
MakeMemoryDomain("EEPROM", mupen64plusApi.N64_MEMORY.EEPROM, MemoryDomain.Endian.Little);
|
||||
|
||||
if (_syncSettings.Controllers[0].IsConnected &&
|
||||
_syncSettings.Controllers[0].PakType == N64ControllerSettings.N64ControllerPakType.MEMORY_CARD)
|
||||
_syncSettings.Controllers[0].PakType == N64SyncSettings.N64ControllerSettings.N64ControllerPakType.MEMORY_CARD)
|
||||
{
|
||||
MakeMemoryDomain("Mempak 1", mupen64plusApi.N64_MEMORY.MEMPAK1, MemoryDomain.Endian.Little);
|
||||
}
|
||||
|
||||
if (_syncSettings.Controllers[1].IsConnected &&
|
||||
_syncSettings.Controllers[1].PakType == N64ControllerSettings.N64ControllerPakType.MEMORY_CARD)
|
||||
_syncSettings.Controllers[1].PakType == N64SyncSettings.N64ControllerSettings.N64ControllerPakType.MEMORY_CARD)
|
||||
{
|
||||
MakeMemoryDomain("Mempak 2", mupen64plusApi.N64_MEMORY.MEMPAK2, MemoryDomain.Endian.Little);
|
||||
}
|
||||
|
||||
if (_syncSettings.Controllers[2].IsConnected &&
|
||||
_syncSettings.Controllers[2].PakType == N64ControllerSettings.N64ControllerPakType.MEMORY_CARD)
|
||||
_syncSettings.Controllers[2].PakType == N64SyncSettings.N64ControllerSettings.N64ControllerPakType.MEMORY_CARD)
|
||||
{
|
||||
MakeMemoryDomain("Mempak 3", mupen64plusApi.N64_MEMORY.MEMPAK3, MemoryDomain.Endian.Little);
|
||||
}
|
||||
|
||||
if (_syncSettings.Controllers[3].IsConnected &&
|
||||
_syncSettings.Controllers[3].PakType == N64ControllerSettings.N64ControllerPakType.MEMORY_CARD)
|
||||
_syncSettings.Controllers[3].PakType == N64SyncSettings.N64ControllerSettings.N64ControllerPakType.MEMORY_CARD)
|
||||
{
|
||||
MakeMemoryDomain("Mempak 4", mupen64plusApi.N64_MEMORY.MEMPAK4, MemoryDomain.Endian.Little);
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
|
|||
}
|
||||
};
|
||||
|
||||
public N64Input(mupen64plusApi core, CoreComm comm, N64ControllerSettings[] controllerSettings)
|
||||
public N64Input(mupen64plusApi core, CoreComm comm, N64SyncSettings.N64ControllerSettings[] controllerSettings)
|
||||
{
|
||||
api = new mupen64plusInputApi(core);
|
||||
CoreComm = comm;
|
||||
|
@ -154,7 +154,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
|
|||
/// </summary>
|
||||
/// <param name="controller">Id of the controller</param>
|
||||
/// <param name="type">Type to which the controller pak is set. Currently only NO_PAK and MEMORY_CARD are supported</param>
|
||||
public void SetControllerPakType(int controller, N64ControllerSettings.N64ControllerPakType type)
|
||||
public void SetControllerPakType(int controller, N64SyncSettings.N64ControllerSettings.N64ControllerPakType type)
|
||||
{
|
||||
api.SetM64PControllerPakType(controller, type);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,70 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
|
|||
{
|
||||
public partial class N64SyncSettings
|
||||
{
|
||||
public CoreType Core = CoreType.Dynarec;
|
||||
public N64SyncSettings()
|
||||
{
|
||||
VideoPlugin = PluginType.Rice;
|
||||
Core = CoreType.Dynarec;
|
||||
Rsp = RspType.Rsp_Hle;
|
||||
|
||||
Controllers = new []
|
||||
{
|
||||
new N64ControllerSettings(),
|
||||
new N64ControllerSettings { IsConnected = false },
|
||||
new N64ControllerSettings { IsConnected = false },
|
||||
new N64ControllerSettings { IsConnected = false },
|
||||
};
|
||||
|
||||
RicePlugin = new N64RicePluginSettings();
|
||||
GlidePlugin = new N64GlidePluginSettings();
|
||||
Glide64mk2Plugin = new N64Glide64mk2PluginSettings();
|
||||
JaboPlugin = new N64JaboPluginSettings();
|
||||
}
|
||||
|
||||
public CoreType Core { get; set; }
|
||||
public RspType Rsp { get; set; }
|
||||
public PluginType VideoPlugin { get; set; }
|
||||
|
||||
public N64ControllerSettings[] Controllers { get; private set; }
|
||||
|
||||
public N64RicePluginSettings RicePlugin { get; private set; }
|
||||
public N64GlidePluginSettings GlidePlugin { get; private set; }
|
||||
public N64Glide64mk2PluginSettings Glide64mk2Plugin { get; private set; }
|
||||
public N64JaboPluginSettings JaboPlugin { get; private set; }
|
||||
|
||||
public N64SyncSettings Clone()
|
||||
{
|
||||
return new N64SyncSettings
|
||||
{
|
||||
Core = Core,
|
||||
Rsp = Rsp,
|
||||
VideoPlugin = VideoPlugin,
|
||||
RicePlugin = RicePlugin.Clone(),
|
||||
GlidePlugin = GlidePlugin.Clone(),
|
||||
Glide64mk2Plugin = Glide64mk2Plugin.Clone(),
|
||||
JaboPlugin = JaboPlugin.Clone(),
|
||||
Controllers = System.Array.ConvertAll(Controllers, a => a.Clone())
|
||||
};
|
||||
}
|
||||
|
||||
// get mupenapi internal object
|
||||
public VideoPluginSettings GetVPS(GameInfo game, int videoSizeX, int videoSizeY)
|
||||
{
|
||||
var ret = new VideoPluginSettings(VideoPlugin, videoSizeX, videoSizeY);
|
||||
IPluginSettings ips = null;
|
||||
switch (VideoPlugin)
|
||||
{
|
||||
// clone so per game hacks don't overwrite our settings object
|
||||
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();
|
||||
return ret;
|
||||
}
|
||||
|
||||
public enum CoreType
|
||||
{
|
||||
|
@ -30,55 +93,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
|
|||
[Description("Z64 Hle Video")]
|
||||
Rsp_Z64_hlevideo = 1
|
||||
}
|
||||
|
||||
public PluginType VidPlugin = PluginType.Rice;
|
||||
public RspType Rsp = RspType.Rsp_Hle;
|
||||
|
||||
public N64ControllerSettings[] Controllers =
|
||||
{
|
||||
new N64ControllerSettings(),
|
||||
new N64ControllerSettings { IsConnected = false },
|
||||
new N64ControllerSettings { IsConnected = false },
|
||||
new N64ControllerSettings { IsConnected = false },
|
||||
};
|
||||
|
||||
public N64RicePluginSettings RicePlugin = new N64RicePluginSettings();
|
||||
public N64GlidePluginSettings GlidePlugin = new N64GlidePluginSettings();
|
||||
public N64Glide64mk2PluginSettings Glide64mk2Plugin = new N64Glide64mk2PluginSettings();
|
||||
public N64JaboPluginSettings JaboPlugin = new N64JaboPluginSettings();
|
||||
|
||||
public N64SyncSettings Clone()
|
||||
{
|
||||
return new N64SyncSettings
|
||||
{
|
||||
Core = Core,
|
||||
Rsp = Rsp,
|
||||
VidPlugin = VidPlugin,
|
||||
RicePlugin = RicePlugin.Clone(),
|
||||
GlidePlugin = GlidePlugin.Clone(),
|
||||
Glide64mk2Plugin = Glide64mk2Plugin.Clone(),
|
||||
JaboPlugin = JaboPlugin.Clone(),
|
||||
Controllers = System.Array.ConvertAll(Controllers, a => a.Clone())
|
||||
};
|
||||
}
|
||||
|
||||
// get mupenapi internal object
|
||||
public VideoPluginSettings GetVPS(GameInfo game, int videoSizeX, int videoSizeY)
|
||||
{
|
||||
var ret = new VideoPluginSettings(VidPlugin, videoSizeX, videoSizeY);
|
||||
IPluginSettings ips = null;
|
||||
switch (VidPlugin)
|
||||
{
|
||||
// clone so per game hacks don't overwrite our settings object
|
||||
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();
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
public enum PluginType
|
||||
|
@ -102,71 +116,4 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
|
|||
Dictionary<string, object> GetPluginSettings();
|
||||
void FillPerGameHacks(GameInfo game);
|
||||
}
|
||||
|
||||
public class N64ControllerSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// Enumeration defining the different controller pak types
|
||||
/// for N64
|
||||
/// </summary>
|
||||
public enum N64ControllerPakType
|
||||
{
|
||||
[Description("None")]
|
||||
NO_PAK = 1,
|
||||
|
||||
[Description("Memory Card")]
|
||||
MEMORY_CARD = 2,
|
||||
|
||||
[Description("Rumble Pak")]
|
||||
RUMBLE_PAK = 3,
|
||||
|
||||
[Description("Transfer Pak")]
|
||||
TRANSFER_PAK = 4
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
private N64ControllerPakType _type = N64ControllerPakType.NO_PAK;
|
||||
|
||||
/// <summary>
|
||||
/// Type of the pak inserted in the controller
|
||||
/// Currently only NO_PAK and MEMORY_CARD are
|
||||
/// supported. Other values may be set and
|
||||
/// are recognized but they have no function
|
||||
/// yet. e.g. TRANSFER_PAK makes the N64
|
||||
/// recognize a transfer pak inserted in
|
||||
/// the controller but there is no
|
||||
/// communication to the transfer pak.
|
||||
/// </summary>
|
||||
public N64ControllerPakType PakType
|
||||
{
|
||||
get { return _type; }
|
||||
set { _type = value; }
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
private bool _isConnected = true;
|
||||
|
||||
/// <summary>
|
||||
/// Connection status of the controller i.e.:
|
||||
/// Is the controller plugged into the N64?
|
||||
/// </summary>
|
||||
public bool IsConnected
|
||||
{
|
||||
get { return _isConnected; }
|
||||
set { _isConnected = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clones this object
|
||||
/// </summary>
|
||||
/// <returns>New object with the same values</returns>
|
||||
public N64ControllerSettings Clone()
|
||||
{
|
||||
return new N64ControllerSettings
|
||||
{
|
||||
PakType = PakType,
|
||||
IsConnected = IsConnected
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64.NativeApi
|
|||
OnRumbleChange(Control, on);
|
||||
}
|
||||
|
||||
public void SetM64PControllerPakType(int controller, N64ControllerSettings.N64ControllerPakType type)
|
||||
public void SetM64PControllerPakType(int controller, N64SyncSettings.N64ControllerSettings.N64ControllerPakType type)
|
||||
{
|
||||
InpSetControllerPakType(controller, (int)type);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue