Melee Modding Library  2.0.0
A C library for modding Super Smash Bros Melee
controller.h
Go to the documentation of this file.
1 
6 #ifndef MML_CONTROLLER_H
7 #define MML_CONTROLLER_H
8 
9 #include "gctypes.h"
10 
12 
13 #define BUTTON_BITS 0x000F
14 #define RADIUS_BITS 0x00F0
15 #define ANGLE_BITS 0xFF00
16 
17 
19 
20 #define NO_BUTTON 0x00
21 #define A_BUTTON 0x01
22 #define B_BUTTON 0x02
23 #define X_BUTTON 0x03
24 #define Z_BUTTON 0x04
25 #define L_BUTTON 0x05
26 #define START_BUTTON 0x06
27 #define DPAD_UP 0x07
28 #define DPAD_DOWN 0x08
29 #define DPAD_LEFT 0x09
30 #define DPAD_RIGHT 0x0a
31 #define CSTICK_UP 0x0b
32 #define CSTICK_DOWN 0x0c
33 #define CSTICK_LEFT 0x0d
34 #define CSTICK_RIGHT 0x0e
35 #define NO_STICK 0x00
36 #define TILT_STICK 0x10
37 #define FULL_STICK 0x20
38 
39 
41 #define TILT_RADIUS 0.3
42 
43 //TODO: match up with game struct
45 typedef struct
46 {
55 } Controller;
56 
58 #define DEFAULT_CONTROLLER ((Controller) {0, 0.f, 0.f, 0.f, 0.f})
59 
71 void setController(Controller* controller, u16 state);
72 
83 void writeController(Controller* controller, u32 port, bool pData);
84 
85 #endif
f32 CstickY
Definition: controller.h:53
Data types for the gamecube.
Represents the state of a controller.
Definition: controller.h:45
void setController(Controller *controller, u16 state)
Set the state of the controller.
Definition: controller.c:16
float f32
Definition: gctypes.h:30
uint16_t u16
Definition: gctypes.h:15
f32 stickY
Definition: controller.h:50
f32 stickX
Definition: controller.h:49
uint32_t u32
Definition: gctypes.h:16
f32 CstickX
Definition: controller.h:52
u32 buttons
Definition: controller.h:47
void writeController(Controller *controller, u32 port, bool pData)
Write the state of controller to the memory addresses read by the game.
Definition: controller.c:75