Essgee.Unity/Assets/Plugins/Essgee/Utilities/XInput/NativeMethods.cs
2025-01-02 17:55:16 +08:00

26 lines
764 B
C#

using System.Runtime.InteropServices;
namespace Essgee.Utilities.XInput
{
static class NativeMethods
{
const string dllName = "xinput9_1_0.dll";
public const int FlagGamepad = 0x00000001;
[DllImport(dllName, EntryPoint = "XInputGetState")]
public static extern int GetState(int dwUserIndex, ref XInputState pState);
[DllImport(dllName, EntryPoint = "XInputSetState")]
public static extern int SetState(int dwUserIndex, ref XInputVibration pVibration);
[DllImport(dllName, EntryPoint = "XInputGetCapabilities")]
public static extern int GetCapabilities(int dwUserIndex, int dwFlags, ref XInputCapabilities pCapabilities);
}
public enum Errors
{
Success = 0x00000000,
BadArguments = 0x000000A0,
DeviceNotConnected = 0x0000048F
}
}