static Int32 XInputGetState_Hooked(Int32 dwUserIndex, out RawState state) { Int32 ret = 0; try { XInputHook This = (XInputHook)HookRuntimeInfo.Callback; ret = XInputGetState(dwUserIndex, out state); //This.Interface.Notify(String.Format("Called XInputGetState index {0} return {1} state {2}", dwUserIndex, ret, state)); This.stateMtx.WaitOne(); state.dwPacketNumber = This.state.dwPacketNumber; state.Gamepad.wButtons = This.state.Gamepad.wButtons; state.Gamepad.bLeftTrigger = This.state.Gamepad.bLeftTrigger; state.Gamepad.bRightTrigger = This.state.Gamepad.bRightTrigger; state.Gamepad.sThumbLX = This.state.Gamepad.sThumbLX; state.Gamepad.sThumbLY = This.state.Gamepad.sThumbLY; state.Gamepad.sThumbRX = This.state.Gamepad.sThumbRX; state.Gamepad.sThumbRY = This.state.Gamepad.sThumbRY; This.stateMtx.ReleaseMutex(); } catch { state = new RawState(); } return(ret); }
public RawState(RawState state) { dwPacketNumber = state.dwPacketNumber; Gamepad.wButtons = state.Gamepad.wButtons; Gamepad.bLeftTrigger = state.Gamepad.bLeftTrigger; Gamepad.bRightTrigger = state.Gamepad.bRightTrigger; Gamepad.sThumbLX = state.Gamepad.sThumbLX; Gamepad.sThumbLY = state.Gamepad.sThumbLY; Gamepad.sThumbRX = state.Gamepad.sThumbRX; Gamepad.sThumbRY = state.Gamepad.sThumbRY; }
public void OnGetInputState(Int32 InUserIndex, Int32 ret, RawState state) { Console.WriteLine("XInputGetState called on index {0} ret {3} y axis {1} packet {2}", InUserIndex, state.Gamepad.sThumbLY, state.dwPacketNumber, ret); }
static extern Int32 XInputGetState(Int32 dwUserIndex, out RawState state);