From 0db397c2d202599290d271114e1084547746e405 Mon Sep 17 00:00:00 2001 From: Ash Date: Fri, 31 Mar 2017 16:41:50 +1100 Subject: [PATCH] Create special case for missing C++ redistributables Error first spotted at https://gbatemp.net/posts/7211285 - hopefully this error will lead people in the right direction. --- .../manager/ControllerManager.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/net/ash/HIDToVPADNetworkClient/manager/ControllerManager.java b/src/net/ash/HIDToVPADNetworkClient/manager/ControllerManager.java index a287081..0e565fc 100644 --- a/src/net/ash/HIDToVPADNetworkClient/manager/ControllerManager.java +++ b/src/net/ash/HIDToVPADNetworkClient/manager/ControllerManager.java @@ -35,6 +35,7 @@ import com.ivan.xinput.XInputDevice14; import com.ivan.xinput.exceptions.XInputNotLoadedException; import lombok.Synchronized; +import lombok.extern.java.Log; import net.ash.HIDToVPADNetworkClient.controller.Controller; import net.ash.HIDToVPADNetworkClient.controller.Controller.ControllerType; import net.ash.HIDToVPADNetworkClient.controller.LinuxDevInputController; @@ -47,6 +48,7 @@ import net.ash.HIDToVPADNetworkClient.util.PureJavaHidApiManager; import net.ash.HIDToVPADNetworkClient.util.Settings; import purejavahidapi.HidDeviceInfo; +@Log public class ControllerManager { private static Map attachedControllers = new HashMap(); @@ -145,9 +147,24 @@ public class ControllerManager { return connectedDevices; } + private static boolean threwUnsatisfiedLinkError = false; private static Map detectWindowsControllers() { Map result = new HashMap(); ControllerType type = ControllerType.XINPUT13; + + //Try and catch missing C++ redist + try { + XInputDevice.isAvailable(); + } catch (UnsatisfiedLinkError e) { + if (!threwUnsatisfiedLinkError) { + e.printStackTrace(); + log.info("This error can be fixed! Please install the Visual C++ Redistributables:"); + log.info("https://www.microsoft.com/en-us/download/details.aspx?id=48145"); + log.info("If that doesn't help, create an issue on GitHub."); + threwUnsatisfiedLinkError = true; + } + } + if (XInputDevice.isAvailable() || XInputDevice14.isAvailable()) { if (XInputDevice14.isAvailable()) { type = ControllerType.XINPUT14;