N64 Sync Settings - remove GetPluginSettings from IPluginSettings and make an extension method, rather than having every plugin implement the same method in the same way
This commit is contained in:
parent
15c7dfe269
commit
f5ff868c50
|
@ -338,23 +338,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
|
|||
{
|
||||
return PluginType.Glide;
|
||||
}
|
||||
|
||||
public Dictionary<string, object> GetPluginSettings()
|
||||
{
|
||||
//TODO: deal witn the game depedent settings
|
||||
var dictionary = new Dictionary<string, object>();
|
||||
var members = this.GetType().GetMembers();
|
||||
foreach (var member in members)
|
||||
{
|
||||
if (member.MemberType == MemberTypes.Property)
|
||||
{
|
||||
var field = this.GetType().GetProperty(member.Name).GetValue(this, null);
|
||||
dictionary.Add(member.Name, field);
|
||||
}
|
||||
}
|
||||
|
||||
return dictionary;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -282,23 +282,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
|
|||
{
|
||||
return PluginType.GlideMk2;
|
||||
}
|
||||
|
||||
public Dictionary<string, object> GetPluginSettings()
|
||||
{
|
||||
//TODO: deal witn the game depedent settings
|
||||
var dictionary = new Dictionary<string, object>();
|
||||
var members = this.GetType().GetMembers();
|
||||
foreach (var member in members)
|
||||
{
|
||||
if (member.MemberType == MemberTypes.Property)
|
||||
{
|
||||
var field = this.GetType().GetProperty(member.Name).GetValue(this, null);
|
||||
dictionary.Add(member.Name, field);
|
||||
}
|
||||
}
|
||||
|
||||
return dictionary;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,23 +39,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
|
|||
|
||||
}
|
||||
|
||||
public Dictionary<string, object> GetPluginSettings()
|
||||
{
|
||||
//TODO: deal witn the game depedent settings
|
||||
var dictionary = new Dictionary<string, object>();
|
||||
var members = this.GetType().GetMembers();
|
||||
foreach (var member in members)
|
||||
{
|
||||
if (member.MemberType == MemberTypes.Property)
|
||||
{
|
||||
var field = this.GetType().GetProperty(member.Name).GetValue(this, null);
|
||||
dictionary.Add(member.Name, field);
|
||||
}
|
||||
}
|
||||
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
[DefaultValue(ANISOTROPIC_FILTERING_LEVEL.FourTimes)]
|
||||
[DisplayName("Anisotropic filtering")]
|
||||
[Description("Anisotropic filtering level")]
|
||||
|
|
|
@ -399,23 +399,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
|
|||
{
|
||||
return PluginType.Rice;
|
||||
}
|
||||
|
||||
public Dictionary<string, object> GetPluginSettings()
|
||||
{
|
||||
//TODO: deal witn the game depedent settings
|
||||
var dictionary = new Dictionary<string, object>();
|
||||
var members = this.GetType().GetMembers();
|
||||
foreach (var member in members)
|
||||
{
|
||||
if (member.MemberType == MemberTypes.Property)
|
||||
{
|
||||
var field = this.GetType().GetProperty(member.Name).GetValue(this, null);
|
||||
dictionary.Add(member.Name, field);
|
||||
}
|
||||
}
|
||||
|
||||
return dictionary;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ using BizHawk.Emulation.Common;
|
|||
using BizHawk.Emulation.Cores.Nintendo.N64.NativeApi;
|
||||
using Newtonsoft.Json;
|
||||
using System.ComponentModel;
|
||||
using System.Reflection;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Nintendo.N64
|
||||
{
|
||||
|
@ -113,7 +114,26 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
|
|||
public interface IPluginSettings
|
||||
{
|
||||
PluginType GetPluginType();
|
||||
Dictionary<string, object> GetPluginSettings();
|
||||
void FillPerGameHacks(GameInfo game);
|
||||
}
|
||||
|
||||
public static class PluginExtensions
|
||||
{
|
||||
public static Dictionary<string, object> GetPluginSettings(this IPluginSettings plugin)
|
||||
{
|
||||
// TODO: deal witn the game depedent settings
|
||||
var dictionary = new Dictionary<string, object>();
|
||||
var members = plugin.GetType().GetMembers();
|
||||
foreach (var member in members)
|
||||
{
|
||||
if (member.MemberType == MemberTypes.Property)
|
||||
{
|
||||
var field = plugin.GetType().GetProperty(member.Name).GetValue(plugin, null);
|
||||
dictionary.Add(member.Name, field);
|
||||
}
|
||||
}
|
||||
|
||||
return dictionary;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue