view controller_info.h @ 1597:75aa418d0227

Use better names for "Guide" button on PS and Xbox controllers, handle d-pad directions in get_button_label
author Michael Pavone <pavone@retrodev.com>
date Wed, 25 Jul 2018 09:35:46 -0700
parents 437e80a700aa
children 1fc61c844ec5
line wrap: on
line source

#ifndef CONTROLLER_INFO_H_
#define CONTROLLER_INFO_H_
#include <stdint.h>

enum {
	TYPE_UNKNOWN,
	TYPE_GENERIC_MAPPING,
	TYPE_XBOX,
	TYPE_PSX,
	TYPE_NINTENDO,
	TYPE_SEGA
};

enum {
	SUBTYPE_UNKNOWN,
	SUBTYPE_XBOX,
	SUBTYPE_X360,
	SUBTYPE_XBONE,
	SUBTYPE_PS2,
	SUBTYPE_PS3,
	SUBTYPE_PS4,
	SUBTYPE_WIIU,
	SUBTYPE_SWITCH,
	SUBTYPE_GENESIS,
	SUBTYPE_SATURN
};

enum {
	VARIANT_NORMAL,
	VARIANT_6B_BUMPERS, //C and Z positions are RB and LB respectively
	VARIANT_6B_RIGHT //C and Z positions are RT and RB respectively
};

typedef struct {
	char const *name;
	uint8_t    type;
	uint8_t    subtype;
	uint8_t    variant;
} controller_info;

controller_info get_controller_info(int index);
const char *get_button_label(controller_info *info, int button);
const char *get_axis_label(controller_info *info, int axis);

#endif //CONTROLLER_INFO_H_