Iām creating an accessibility app that enables customers to navigate Home windows utilizing a recreation controller. The app works by utilizing the left joystick to maneuver the mouse and the precise joystick to carry out actions (e.g., up = click on, down = alt-click, and many others.). It runs within the background and makes use of a gamepad hook to detect inputs and Home windows APIs to set off the corresponding actions.
The problem Iām encountering is that whereas the app efficiently performs the meant actions, it doesnāt block the precise joystick inputs, which ends up in each the app’s actions and the native gamepad conduct occurring concurrently. Primarily, the precise joystick enter is being detected by each my app and Home windows, inflicting conflicts.
I am utilizing SharpDX.XInput to get the gamepad state, as proven on this snippet:
if (controller.IsConnected) {
var state = controller.GetState();
// Get the joystick positions
var leftThumbX = state.Gamepad.LeftThumbX / 32767.0f; // Normalize to -1.0 to 1.0
var leftThumbY = state.Gamepad.LeftThumbY / 32767.0f;
}
Nevertheless, SharpDX.XInput does not appear to supply a option to intercept or block the enter occasion propagation. The purpose is for my app to solely obtain the enter from the precise joystick, stopping Home windows or different processes from reacting to it.
After researching, I seemed into a number of potential options like HidHide and ViGEmBus, however these libraries require exterior installs, which I wish to keep away from for ease of use and to maintain the app self-contained for accessibility customers. I additionally explored intercepting enter at a decrease degree utilizing Home windows API, nevertheless it solely appears to be doable for keyboard and mouse with preexisting drivers.
Is there a option to block or intercept the precise joystick inputs in order that solely my app receives them, whereas retaining the answer self-contained (with out requiring exterior libraries or installs)?