diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeAPI/mupen64plusCoreApi.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeAPI/mupen64plusCoreApi.cs
index 8565f7c8ea..ed078b9183 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeAPI/mupen64plusCoreApi.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeAPI/mupen64plusCoreApi.cs
@@ -4,6 +4,7 @@ using System.Runtime.InteropServices;
using System.Threading;
using BizHawk.Emulation.Common;
+using System.Text;
namespace BizHawk.Emulation.Cores.Nintendo.N64.NativeApi
{
@@ -192,6 +193,18 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64.NativeApi
delegate m64p_error ConfigSetParameter(IntPtr ConfigSectionHandle, string ParamName, m64p_type ParamType, ref int ParamValue);
ConfigSetParameter m64pConfigSetParameter;
+ ///
+ /// Sets a parameter in the global config system
+ ///
+ /// The handle of the section to access
+ /// The name of the parameter to set
+ /// The type of the parameter
+ /// A pointer to the value to use for the parameter (must be a string)
+ ///
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ delegate m64p_error ConfigSetParameterStr(IntPtr ConfigSectionHandle, string ParamName, m64p_type ParamType, StringBuilder ParamValue);
+ ConfigSetParameterStr m64pConfigSetParameterStr;
+
///
/// Saves the mupen64plus state to the provided buffer
///
@@ -513,6 +526,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64.NativeApi
m64pCoreDetachPlugin = (CoreDetachPlugin)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreDetachPlugin"), typeof(CoreDetachPlugin));
m64pConfigOpenSection = (ConfigOpenSection)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "ConfigOpenSection"), typeof(ConfigOpenSection));
m64pConfigSetParameter = (ConfigSetParameter)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "ConfigSetParameter"), typeof(ConfigSetParameter));
+ m64pConfigSetParameterStr = (ConfigSetParameterStr)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "ConfigSetParameter"), typeof(ConfigSetParameterStr));
m64pCoreSaveState = (savestates_save_bkm)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "savestates_save_bkm"), typeof(savestates_save_bkm));
m64pCoreLoadState = (savestates_load_bkm)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "savestates_load_bkm"), typeof(savestates_load_bkm));
m64pDebugMemGetPointer = (DebugMemGetPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "DebugMemGetPointer"), typeof(DebugMemGetPointer));
@@ -568,20 +582,30 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64.NativeApi
foreach (string Parameter in video_settings.Parameters.Keys)
{
- int value = 0;
- if (video_settings.Parameters[Parameter].GetType() == typeof(int))
+ if (video_settings.Parameters[Parameter].GetType() == typeof(string))
{
- value = (int)video_settings.Parameters[Parameter];
+ string value = ((string)video_settings.Parameters[Parameter]);
+ StringBuilder sb = new StringBuilder(value);
+ m64pConfigSetParameterStr(video_plugin_section, Parameter, m64p_type.M64TYPE_STRING, sb);
}
- else if (video_settings.Parameters[Parameter].GetType() == typeof(bool))
+ else
{
- value = (bool)video_settings.Parameters[Parameter] ? 1 : 0;
+ int value = 0;
+
+ if (video_settings.Parameters[Parameter].GetType() == typeof(int))
+ {
+ value = (int)video_settings.Parameters[Parameter];
+ }
+ else if (video_settings.Parameters[Parameter].GetType() == typeof(bool))
+ {
+ value = (bool)video_settings.Parameters[Parameter] ? 1 : 0;
+ }
+ else if (video_settings.Parameters[Parameter] is Enum)
+ {
+ value = (int)video_settings.Parameters[Parameter];
+ }
+ m64pConfigSetParameter(video_plugin_section, Parameter, m64p_type.M64TYPE_INT, ref value);
}
- else if (video_settings.Parameters[Parameter] is Enum)
- {
- value = (int)video_settings.Parameters[Parameter];
- }
- m64pConfigSetParameter(video_plugin_section, Parameter, m64p_type.M64TYPE_INT, ref value);
}
}