foxygit / fake-08-xbox360 Log in
main xbox360 commits tags

/platform/xex/runtime/xex_input.h · 918 B

raw
/* Controllers through XamInputGetState. */
#ifndef XEX_INPUT_H
#define XEX_INPUT_H

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

/* XINPUT_GAMEPAD_* button bits */
#define XEX_PAD_UP     0x0001
#define XEX_PAD_DOWN   0x0002
#define XEX_PAD_LEFT   0x0004
#define XEX_PAD_RIGHT  0x0008
#define XEX_PAD_START  0x0010
#define XEX_PAD_BACK   0x0020
#define XEX_PAD_LTHUMB 0x0040
#define XEX_PAD_RTHUMB 0x0080
#define XEX_PAD_LB     0x0100
#define XEX_PAD_RB     0x0200
#define XEX_PAD_A      0x1000
#define XEX_PAD_B      0x2000
#define XEX_PAD_X      0x4000
#define XEX_PAD_Y      0x8000

typedef struct {
    uint16_t buttons;
    uint8_t left_trigger, right_trigger;
    int16_t lx, ly, rx, ry;
} xex_pad;

/* Reads controller `port` (0-3). Returns 0 when connected; otherwise the
 * state is zeroed and -1 is returned. */
int xex_input_get(int port, xex_pad *pad);

#ifdef __cplusplus
}
#endif

#endif