API for determining controller types
More...
|
| | Types |
| | Preconfigured capabilities for standard controllers
|
| |
|
| int | cont_is_type (const struct maple_device *cont, uint32_t type) |
| | Check for controller type.
|
| |
API for determining controller types
The following API is for detecting between different types of standard controllers. These controllers are not identified by specific model but are instead identified solely by capabilities, so that homebrew software can remain generic and future-proof to later homebrew controllers or exotic, untested 3rd party peripherals.
- Warning
- Usually you want to check if a controller supports the capabilities of another controller, not whether it is has the exact same capabilities of a controller. For example, a controller that happens to come along supporting a dual analog stick but is otherwise the same layout as a standard controller would not match the standard controller type; however, it would implement its capabilities. There exist 3rd party adapters for connecting dual-analog PS2 controllers to DC which operate like this today.
- Note
- If you really want to hard-code the detection of a certain exact model or brand of controller, instead of basing your detection upon capabilities, check for its product_name or license within the maple_devinfo structure.
- See also
- cont_has_capabilities, maple_devinfo
◆ cont_is_type()
| int cont_is_type |
( |
const struct maple_device * | cont, |
|
|
uint32_t | type ) |
Check for controller type.
Checks whether or not a controller has the exact capabilities associated with the given type.
- Warning
- Just because a controller has all of the same capabilities of a type does not mean that it's that exact type. For example, the ASCII Pad and Arcade Stick both implement the same capabilities, although they are not the same controllers. They would be indistinguishable here, by design, so that you are able to generalize to a collection of 1st or 3rd party controllers easily.
- Parameters
-
| cont | Pointer to a Maple device structure which implements the CONTROLLER function.
|
| type | Type identifier or capability mask the controller is expected to match |
- Return values
-
| 1 | The controller matches the given type. |
| 0 | The controller doesn't match the given type. |
| -1 | Invalid controller. |
- See also
- cont_has_capabilities