check for existence of xinput1_3.dll before calling on the slimdx code to attempt using it
This commit is contained in:
parent
fd0a31721e
commit
0d674308b9
|
@ -19,6 +19,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
[Out] out bool wow64Process
|
||||
);
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
public static extern IntPtr LoadLibrary(string dllToLoad);
|
||||
[DllImport("kernel32.dll")]
|
||||
public static extern IntPtr GetProcAddress(IntPtr hModule, string procedureName);
|
||||
[DllImport("kernel32.dll")]
|
||||
public static extern bool FreeLibrary(IntPtr hModule);
|
||||
|
||||
|
||||
static bool InternalCheckIsWow64()
|
||||
{
|
||||
if ((Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor >= 1) ||
|
||||
|
|
|
@ -17,9 +17,17 @@ namespace BizHawk.Client.EmuHawk
|
|||
IsAvailable = false;
|
||||
try
|
||||
{
|
||||
//don't remove this code. it's important to catch errors on systems with broken xinput installs.
|
||||
var test = new SlimDX.XInput.Controller(UserIndex.One).IsConnected;
|
||||
IsAvailable = true;
|
||||
//some users wont even have xinput installed. in order to avoid spurious exceptions and possible instability, check for the library first
|
||||
IntPtr lib = Win32.LoadLibrary("xinput1_3.dll");
|
||||
if (lib != IntPtr.Zero)
|
||||
{
|
||||
Win32.FreeLibrary(lib);
|
||||
|
||||
//don't remove this code. it's important to catch errors on systems with broken xinput installs.
|
||||
//(probably, checking for the library was adequate, but lets not get rid of this anyway)
|
||||
var test = new SlimDX.XInput.Controller(UserIndex.One).IsConnected;
|
||||
IsAvailable = true;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
|
|
Loading…
Reference in New Issue