public static uint XInputGetCapabilities(uint dwUserIndex, uint dwFlags, ref XINPUT_CAPABILITIES pCapabilities) { #if !EXPERIMENTAL return(OriginalXInputGetCapabilitiesFunction.Value(dwUserIndex, dwFlags, ref pCapabilities)); #else Log.DebugFormat("dwUserIndex = {0}", dwUserIndex); if (OriginalXInputGetCapabilitiesFunction.Value(dwUserIndex, dwFlags, ref pCapabilities) == ResultWin32.ERROR_SUCCESS) { return(ResultWin32.ERROR_SUCCESS); } try { ScpHidReport report = Proxy.GetReport(dwUserIndex); if (report == null || report.PadState != DsState.Connected) { return(ResultWin32.ERROR_DEVICE_NOT_CONNECTED); } pCapabilities.Type = XInputConstants.XINPUT_DEVTYPE_GAMEPAD; pCapabilities.SubType = XInputConstants.XINPUT_DEVSUBTYPE_GAMEPAD; pCapabilities.Flags = (ushort)(XInputConstants.CapabilityFlags.XINPUT_CAPS_FFB_SUPPORTED | XInputConstants.CapabilityFlags.XINPUT_CAPS_WIRELESS); pCapabilities.Gamepad = new XINPUT_GAMEPAD() { wButtons = 0xFFFF, bLeftTrigger = 0xFF, bRightTrigger = 0xFF }; } catch (Exception ex) { Log.ErrorFormat("Unexpected error: {0}", ex); return(ResultWin32.ERROR_DEVICE_NOT_CONNECTED); } return(ResultWin32.ERROR_SUCCESS); #endif }
public static uint XInputGetCapabilities(uint dwUserIndex, uint dwFlags, ref XINPUT_CAPABILITIES pCapabilities) { return(OriginalXInputGetCapabilitiesFunction.Value(dwUserIndex, dwFlags, ref pCapabilities)); }