![]() Parsing a decimal number to retrieve each (if several) of its hexadecimal components in short How can I translate this number into a list of pressed button human readable names (such as the constants XINPUT_GAMEPAD_A, XINPUT_GAMEPAD_A, XINPUT_GAMEPAD_LEFT_SHOULDER, or anything else ? I have a number that represent the button pressed or the sum of the buttons pressed. Return DllCall(_XInput_SetState ,"uint",UserIndex ,"uint*",LeftMotorSpeed|RightMotorSpeed ![]() XInput_SetState(UserIndex, LeftMotorSpeed, RightMotorSpeed) The two motors are not the same, and they create The left motor is the low-frequency rumble motor. If the controller is not connected, the return value is 1167 (ERROR_DEVICE_NOT_CONNECTED). If the function succeeds, the return value is 0 (ERROR_SUCCESS). RightMotorSpeed - Speed of the right motor, between 5. LeftMotorSpeed - Speed of the left motor, between 5. This function is used to activate the vibration # wButton show Guide button down by returning 1024 (0x0400) #ĭllCall(_XInput_GuideState, "uint", UserIndex, "uint", &xiState)ĭwPacketNumber: NumGet(xiState, 0, "UInt")īLeftTrigger: NumGet(xiState, 6, "UChar")īRightTrigger: NumGet(xiState, 7, "UChar") If ErrorLevel := DllCall(_XInput_GetState ,"uint",UserIndex ,"uint",&xiState) Global _XInput_GetState, _XInput_GuideState XInput.ahk converts this structure to an AutoHotkey_L object. XInput.dll returns controller state as a binary structure: If the function fails, the return value is an error code defined in Winerror.h. If the controller is not connected, the return value is ERROR_DEVICE_NOT_CONNECTED (1167). If the function succeeds, the return value is ERROR_SUCCESS (zero). State - Receives the current state of the controller. UserIndex - Index of the user's controller. Retrieves the current state of the specified controller. MsgBox, Failed to initialize XInput: function not found. If !(_XInput_GetState & _XInput_SetState & _XInput_GetCapabilities) _XInput_GuideState := DllCall("GetProcAddress", "Uint", _XInput_hm, "Uint", 100) # This dllcall add guide state for some reason. _XInput_GetCapabilities := DllCall("GetProcAddress" ,"ptr",_XInput_hm ,"astr","XInputGetCapabilities") _XInput_SetState := DllCall("GetProcAddress" ,"ptr",_XInput_hm ,"astr","XInputSetState") _XInput_GetState := DllCall("GetProcAddress" ,"ptr",_XInput_hm ,"astr","XInputGetState") MsgBox, Failed to initialize XInput: %dll%.dll not found. _XInput_hm := DllCall("LoadLibrary" ,"str",dll) XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE := 8689 XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE := 7849 Device subtypes available in XINPUT_CAPABILITIES Device types available in XINPUT_CAPABILITIES Newer versions of XInput may require additional constants. NOTE: These are based on my outdated copy of the DirectX SDK. Initializes XInput.ahk with the given XInput DLL.ĭll - The path or name of the XInput DLL to load. * This version of the script uses objects, so requires AutoHotkey_L. Here is the final code, witsh is your raw xinput + those 2 lines : Just by adding 2 dllcalls, and of course with no idea what they do because I have no knowledge on this dll, hexa, deep stuff. I got this Guide button on xbox Pad to be returned as any other buttons with the wButtons property (returning 1024 aka 0x0400 the undocumented value) I played a bit with your Xinput lib and this other thread.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |