KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
controller.h File Reference

Definitions for using the controller device. More...

#include <kos/cdefs.h>
#include <stdint.h>
#include <kos/regfield.h>

Go to the source code of this file.

Data Structures

struct  cont_state_t
 Controller state structure. More...
 

Macros

#define CONT_C   BIT(0)
 C button Mask.
 
#define CONT_B   BIT(1)
 B button Mask.
 
#define CONT_A   BIT(2)
 A button Mask.
 
#define CONT_START   BIT(3)
 Start button Mask.
 
#define CONT_DPAD_UP   BIT(4)
 Main Dpad Up button Mask.
 
#define CONT_DPAD_DOWN   BIT(5)
 Main Dpad Down button Mask.
 
#define CONT_DPAD_LEFT   BIT(6)
 Main Dpad Left button Mask.
 
#define CONT_DPAD_RIGHT   BIT(7)
 Main Dpad right button Mask.
 
#define CONT_Z   BIT(8)
 Z button Mask.
 
#define CONT_Y   BIT(9)
 Y button Mask.
 
#define CONT_X   BIT(10)
 X button Mask.
 
#define CONT_D   BIT(11)
 D button Mask.
 
#define CONT_DPAD2_UP   BIT(12)
 Secondary Dpad Up button Mask.
 
#define CONT_DPAD2_DOWN   BIT(13)
 Secondary Dpad Down button Mask.
 
#define CONT_DPAD2_LEFT   BIT(14)
 Secondary Dpad Left button Mask.
 
#define CONT_DPAD2_RIGHT   BIT(15)
 Secondary Dpad Right button Mask.
 
#define CONT_RESET_BUTTONS   (CONT_A | CONT_B | CONT_X | CONT_Y | CONT_START)
 Controller buttons for standard reset action.
 
#define CONT_CAPABILITY_C   BIT(24)
 C button capability mask.
 
#define CONT_CAPABILITY_B   BIT(25)
 B button capability mask.
 
#define CONT_CAPABILITY_A   BIT(26)
 A button capability mask.
 
#define CONT_CAPABILITY_START   BIT(27)
 Start button capability mask.
 
#define CONT_CAPABILITY_DPAD_UP   BIT(28)
 First Dpad up capability mask.
 
#define CONT_CAPABILITY_DPAD_DOWN   BIT(29)
 First Dpad down capability mask.
 
#define CONT_CAPABILITY_DPAD_LEFT   BIT(30)
 First Dpad left capability mask.
 
#define CONT_CAPABILITY_DPAD_RIGHT   BIT(31)
 First Dpad right capability mask.
 
#define CONT_CAPABILITY_Z   BIT(16)
 Z button capability mask.
 
#define CONT_CAPABILITY_Y   BIT(17)
 Y button capability mask.
 
#define CONT_CAPABILITY_X   BIT(18)
 X button capability mask.
 
#define CONT_CAPABILITY_D   BIT(19)
 D button capability mask.
 
#define CONT_CAPABILITY_DPAD2_UP   BIT(20)
 Second Dpad up capability mask.
 
#define CONT_CAPABILITY_DPAD2_DOWN   BIT(21)
 Second Dpad down capability mask.
 
#define CONT_CAPABILITY_DPAD2_LEFT   BIT(22)
 Second Dpad left capability mask.
 
#define CONT_CAPABILITY_DPAD2_RIGHT   BIT(23)
 Second Dpad right capability mask.
 
#define CONT_CAPABILITY_RTRIG   BIT(8)
 Right trigger capability mask.
 
#define CONT_CAPABILITY_LTRIG   BIT(9)
 Left trigger capability mask.
 
#define CONT_CAPABILITY_ANALOG_X   BIT(10)
 First analog X axis capability mask.
 
#define CONT_CAPABILITY_ANALOG_Y   BIT(11)
 First analog Y axis capability mask.
 
#define CONT_CAPABILITY_ANALOG2_X   BIT(12)
 Second analog X axis capability mask.
 
#define CONT_CAPABILITY_ANALOG2_Y   BIT(13)
 Second analog Y axis capability mask.
 
#define CONT_CAPABILITIES_STANDARD_BUTTONS
 Standard button (A, B, X, Y, Start) controller capabilities.
 
#define CONT_CAPABILITIES_DPAD
 Directional pad (up, down, left right) controller capabilities.
 
#define CONT_CAPABILITIES_ANALOG
 Analog stick (X, Y axes) controller capabilities.
 
#define CONT_CAPABILITIES_TRIGGERS
 Trigger (L, R lever) controller capabilities.
 
#define CONT_CAPABILITIES_EXTENDED_BUTTONS
 Extended button (C, Z) controller capabilities.
 
#define CONT_CAPABILITIES_SECONDARY_DPAD
 Secondary directional pad (up, down, left, right) controller capabilities.
 
#define CONT_CAPABILITIES_SECONDARY_ANALOG
 Secondary analog stick (X, Y axes) controller capabilities.
 
#define CONT_CAPABILITIES_DUAL_DPAD
 Both directional pads (up, down, left right) controller capabilities.
 
#define CONT_CAPABILITIES_DUAL_ANALOG
 Both analog sticks (X, Y axes) controller capabilities.
 
#define CONT_TYPE_STANDARD_CONTROLLER
 Standard controller type.
 
#define CONT_TYPE_DUAL_ANALOG_CONTROLLER
 Dual analog controller type.
 
#define CONT_TYPE_ASCII_PAD
 ASCII fighting pad controller type.
 
#define CONT_TYPE_ARCADE_STICK
 Arcade stick controller type.
 
#define CONT_TYPE_TWIN_STICK
 Twin stick joystick controller type.
 
#define CONT_TYPE_ASCII_MISSION_STICK
 ASCII Mission Stick controller type.
 
#define CONT_TYPE_RACING_CONTROLLER
 Racing wheel/controller type.
 
#define CONT_TYPE_MARACAS
 Samba De Amigo maraca controller type.
 
#define CONT_TYPE_DANCE_MAT
 Dance Dance Revolution mat controller type.
 
#define CONT_TYPE_FISHING_ROD
 Fishing rod controller type.
 
#define CONT_TYPE_POP_N_MUSIC
 Pop'n'Music controller type.
 
#define CONT_TYPE_DENSHA_DE_GO
 Densha de Go! controller type.
 
#define CONT_TYPE_PANTHERDC
 Madcatz PantherDC "Flight Stick + Trackball" controller type.
 

Typedefs

typedef void(* cont_btn_callback_t) (uint8_t addr, uint32_t btns)
 Controller automatic callback type.
 

Functions

int cont_btn_callback (uint8_t addr, uint32_t btns, cont_btn_callback_t cb)
 Set an automatic button press callback.
 
int __pure cont_has_capabilities (const struct maple_device *cont, uint32_t capabilities)
 Check for controller capabilities.
 
int __pure cont_is_type (const struct maple_device *cont, uint32_t type)
 Check for controller type.
 

Detailed Description

Definitions for using the controller device.

This file contains the definitions needed to access the Maple controller device. Obviously, this corresponds to the MAPLE_FUNC_CONTROLLER function code.

Author
Jordan DeLong
Megan Potter
Falco Girgis