Fix prerequisites dialog (broken by 42764f00 and 436b6452).

This commit is contained in:
J.D. Purcell 2019-10-12 17:56:20 -04:00
parent d7ee6ba579
commit 77bbc41286
3 changed files with 4 additions and 7 deletions

View File

@ -49,7 +49,7 @@ namespace BizHawk.Client.EmuHawk
};
var box = new BizHawk.Client.EmuHawk.CustomControls.PrereqsAlert(!fail)
{
textBox1 = { Text = string.Concat("\n", alertLines) }
textBox1 = { Text = string.Join(Environment.NewLine, alertLines) }
};
box.ShowDialog();
if (fail) System.Diagnostics.Process.GetCurrentProcess().Kill();

View File

@ -75,12 +75,7 @@ namespace BizHawk.Common
[DllImport("kernel32.dll")]
private static extern bool FreeLibrary(IntPtr hModule); // return type was annotated MarshalAs(UnmanagedType.Bool)
public IntPtr LoadPlatformSpecific(string dllToLoad)
{
var p = LoadLibrary(dllToLoad);
if (p == IntPtr.Zero) throw new InvalidOperationException($"got null pointer, error code {GetLastError()}");
return p;
}
public IntPtr LoadPlatformSpecific(string dllToLoad) => LoadLibrary(dllToLoad);
public IntPtr GetProcAddr(IntPtr hModule, string procName) => GetProcAddress(hModule, procName);
public int FreePlatformSpecific(IntPtr hModule) => FreeLibrary(hModule) ? 1 : 0;
}

View File

@ -935,6 +935,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64.NativeApi
AttachedPlugin plugin;
plugin.dllHandle = libLoader.LoadPlatformSpecific(PluginName);
if (plugin.dllHandle == IntPtr.Zero)
throw new InvalidOperationException($"Failed to load plugin {PluginName}");
plugin.dllStartup = (PluginStartup)Marshal.GetDelegateForFunctionPointer(libLoader.GetProcAddr(plugin.dllHandle, "PluginStartup"), typeof(PluginStartup));
plugin.dllShutdown = (PluginShutdown)Marshal.GetDelegateForFunctionPointer(libLoader.GetProcAddr(plugin.dllHandle, "PluginShutdown"), typeof(PluginShutdown));