From 77bbc41286257391c49236f8aa9040f554fbd519 Mon Sep 17 00:00:00 2001 From: "J.D. Purcell" Date: Sat, 12 Oct 2019 17:56:20 -0400 Subject: [PATCH] Fix prerequisites dialog (broken by 42764f00 and 436b6452). --- BizHawk.Client.EmuHawk/Program.cs | 2 +- BizHawk.Common/OSTailoredCode.cs | 7 +------ .../Consoles/Nintendo/N64/NativeApi/mupen64plusCoreApi.cs | 2 ++ 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/BizHawk.Client.EmuHawk/Program.cs b/BizHawk.Client.EmuHawk/Program.cs index 8da6077bbf..a954845ac9 100644 --- a/BizHawk.Client.EmuHawk/Program.cs +++ b/BizHawk.Client.EmuHawk/Program.cs @@ -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(); diff --git a/BizHawk.Common/OSTailoredCode.cs b/BizHawk.Common/OSTailoredCode.cs index 9109daeeda..65b46ff569 100644 --- a/BizHawk.Common/OSTailoredCode.cs +++ b/BizHawk.Common/OSTailoredCode.cs @@ -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; } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeApi/mupen64plusCoreApi.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeApi/mupen64plusCoreApi.cs index 3cc7b24ec8..c0dfaba506 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeApi/mupen64plusCoreApi.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeApi/mupen64plusCoreApi.cs @@ -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));