I used to play "Mechwarrior" a lot as well as indulging in Microsoft Flight Simulator back in the early/mid 2000's, and I had all kinds of gaming controllers hooked up via USB... a Cyborg 3D joystic that had 3 axis plus all kinds of buttons such as a main trigger on the front of the stick handle, a directional "hat" controller on the top and left & right side firing buttons as well as 10 programmable keys on the base, plus an external Nostromo gamepad that had a small programmable keyboard and a D-pad controller, along with a set of rudder pedals. In most cases, the device driver and user-mode configuration software would make all of the "keys" send various keystrokes, but the joystick fire buttons didn't work that way... they were handled via the same game controller interface that the various axis position readings were handled for yaw, pitch, roll, throttle, etc. Somewhere in Microsoft's documentation, possibly in whatever the descendent of or successor to DirectX is, there are functions for USB HID devices of the gaming controller type. Consuming that interface functionality is where I'd have expected program could would have to go in terms of detecting button presses for the joystick fire button as opposed to detecting a keystroke from a programmable key.