Adding gamepad support (using code from controlrecorder), not tested but builds and needs own thread