port gamepad API

Still haven't tested it. Preliminary thoughts?
Needs added to config.h.in