diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeAPI/mupen64plusCoreApi.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeAPI/mupen64plusCoreApi.cs index f69c927db7..ac96aa6710 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeAPI/mupen64plusCoreApi.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeAPI/mupen64plusCoreApi.cs @@ -19,6 +19,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64.NativeApi AutoResetEvent m64pFrameComplete = new AutoResetEvent(false); ManualResetEvent m64pStartupComplete = new ManualResetEvent(false); + [DllImport("kernel32.dll")] + public static extern UInt32 GetLastError(); + [DllImport("kernel32.dll")] public static extern IntPtr LoadLibrary(string dllToLoad); @@ -698,7 +701,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64.NativeApi AttachedPlugin plugin; plugin.dllHandle = LoadLibrary(PluginName); if (plugin.dllHandle == IntPtr.Zero) - throw new InvalidOperationException(string.Format("Failed to load plugin {0}", PluginName)); + throw new InvalidOperationException(string.Format("Failed to load plugin {0}, error code: 0x{1:X}", PluginName, GetLastError())); plugin.dllStartup = (PluginStartup)Marshal.GetDelegateForFunctionPointer(GetProcAddress(plugin.dllHandle, "PluginStartup"), typeof(PluginStartup)); plugin.dllShutdown = (PluginShutdown)Marshal.GetDelegateForFunctionPointer(GetProcAddress(plugin.dllHandle, "PluginShutdown"), typeof(PluginShutdown));