83Plus:Software:usb8x/Asm Interface/Pad

From WikiTI
Jump to: navigation, search

The usb8x gamepad driver is compatible with some USB gamepad controllers. It will (probably) not work with most analog sticks, but will (probably) work with most D-Pads and buttons. The gamepad driver does not bind buttons to a particular function. In other words, it doesn't know that the "down" button means down. Unless you already know the appropriate button mappings for a particular gamepad (the mapping could be saved between program runs), you will have to prompt the user to map buttons with PadSetup.

The gamepad driver is initialized via PadInit. This entry point initializes both the driver and the gamepad hardware, so you may want to check to see if a device is connected via IsDeviceConnected first.

After initializing the gamepad, use PadSetup to help determine button mappings, unless you've already saved a previous mapping. Then use PadStart to start receiving gamepad data to your callback function. The callback will be passed raw data from the gamepad, and should use the masks it collected via PadSetup to determine which buttons have been pressed.

Entry Points

PadInit Initialize gamepad driver and hardware
PadSetup Get offset and bitmask to detect a specific button (map buttons)
PadStart Start sending gamepad data to the callback function
PadVersion Get driver version and RAM requirements