RetroArch
Classes | Macros | Typedefs | Functions | Variables
xinput_joypad.c File Reference
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <boolean.h>
#include <retro_inline.h>
#include <compat/strl.h>
#include <dynamic/dylib.h>
#include "../../tasks/tasks_internal.h"
#include "../input_driver.h"
#include "../../verbosity.h"
Include dependency graph for xinput_joypad.c:

Classes

struct  XINPUT_GAMEPAD
 
struct  XINPUT_STATE
 
struct  XINPUT_VIBRATION
 
struct  xinput_joypad_state
 

Macros

#define XINPUT_GAMEPAD_DPAD_UP   0x0001
 
#define XINPUT_GAMEPAD_DPAD_DOWN   0x0002
 
#define XINPUT_GAMEPAD_DPAD_LEFT   0x0004
 
#define XINPUT_GAMEPAD_DPAD_RIGHT   0x0008
 
#define XINPUT_GAMEPAD_START   0x0010
 
#define XINPUT_GAMEPAD_BACK   0x0020
 
#define XINPUT_GAMEPAD_LEFT_THUMB   0x0040
 
#define XINPUT_GAMEPAD_RIGHT_THUMB   0x0080
 
#define XINPUT_GAMEPAD_LEFT_SHOULDER   0x0100
 
#define XINPUT_GAMEPAD_RIGHT_SHOULDER   0x0200
 
#define XINPUT_GAMEPAD_A   0x1000
 
#define XINPUT_GAMEPAD_B   0x2000
 
#define XINPUT_GAMEPAD_X   0x4000
 
#define XINPUT_GAMEPAD_Y   0x8000
 
#define XINPUT_GAMEPAD_GUIDE   0x0400
 
#define ERROR_DEVICE_NOT_CONNECTED   1167
 

Typedefs

typedef uint32_t(__stdcall * XInputGetStateEx_t) (uint32_t, XINPUT_STATE *)
 
typedef uint32_t(__stdcall * XInputSetState_t) (uint32_t, XINPUT_VIBRATION *)
 

Functions

static INLINE int pad_index_to_xuser_index (unsigned pad)
 
const char * xinput_joypad_name (unsigned pad)
 
static bool xinput_joypad_init (void *data)
 
static bool xinput_joypad_query_pad (unsigned pad)
 
static void xinput_joypad_destroy (void)
 
static bool xinput_joypad_button (unsigned port_num, uint16_t joykey)
 
static int16_t xinput_joypad_axis (unsigned port_num, uint32_t joyaxis)
 
static void xinput_joypad_poll (void)
 
static bool xinput_joypad_rumble (unsigned pad, enum retro_rumble_effect effect, uint16_t strength)
 

Variables

int g_xinput_pad_indexes [MAX_USERS]
 
bool g_xinput_block_pads
 
static XInputGetStateEx_t g_XInputGetStateEx
 
static XInputSetState_t g_XInputSetState
 
static bool g_xinput_guide_button_supported
 
static XINPUT_VIBRATION g_xinput_rumble_states [4]
 
static xinput_joypad_state g_xinput_states [4]
 
static const char *const XBOX_CONTROLLER_NAMES [4]
 
static const char *const XBOX_ONE_CONTROLLER_NAMES [4]
 
static const uint16_t button_index_to_bitmap_code []
 
input_device_driver_t xinput_joypad
 

Macro Definition Documentation

◆ ERROR_DEVICE_NOT_CONNECTED

#define ERROR_DEVICE_NOT_CONNECTED   1167

◆ XINPUT_GAMEPAD_A

#define XINPUT_GAMEPAD_A   0x1000

◆ XINPUT_GAMEPAD_B

#define XINPUT_GAMEPAD_B   0x2000

◆ XINPUT_GAMEPAD_BACK

#define XINPUT_GAMEPAD_BACK   0x0020

◆ XINPUT_GAMEPAD_DPAD_DOWN

#define XINPUT_GAMEPAD_DPAD_DOWN   0x0002

◆ XINPUT_GAMEPAD_DPAD_LEFT

#define XINPUT_GAMEPAD_DPAD_LEFT   0x0004

◆ XINPUT_GAMEPAD_DPAD_RIGHT

#define XINPUT_GAMEPAD_DPAD_RIGHT   0x0008

◆ XINPUT_GAMEPAD_DPAD_UP

#define XINPUT_GAMEPAD_DPAD_UP   0x0001

◆ XINPUT_GAMEPAD_GUIDE

#define XINPUT_GAMEPAD_GUIDE   0x0400

◆ XINPUT_GAMEPAD_LEFT_SHOULDER

#define XINPUT_GAMEPAD_LEFT_SHOULDER   0x0100

◆ XINPUT_GAMEPAD_LEFT_THUMB

#define XINPUT_GAMEPAD_LEFT_THUMB   0x0040

◆ XINPUT_GAMEPAD_RIGHT_SHOULDER

#define XINPUT_GAMEPAD_RIGHT_SHOULDER   0x0200

◆ XINPUT_GAMEPAD_RIGHT_THUMB

#define XINPUT_GAMEPAD_RIGHT_THUMB   0x0080

◆ XINPUT_GAMEPAD_START

#define XINPUT_GAMEPAD_START   0x0010

◆ XINPUT_GAMEPAD_X

#define XINPUT_GAMEPAD_X   0x4000

◆ XINPUT_GAMEPAD_Y

#define XINPUT_GAMEPAD_Y   0x8000

Typedef Documentation

◆ XInputGetStateEx_t

typedef uint32_t(__stdcall * XInputGetStateEx_t) (uint32_t, XINPUT_STATE *)

◆ XInputSetState_t

typedef uint32_t(__stdcall * XInputSetState_t) (uint32_t, XINPUT_VIBRATION *)

Function Documentation

◆ pad_index_to_xuser_index()

static INLINE int pad_index_to_xuser_index ( unsigned  pad)
static
Here is the caller graph for this function:

◆ xinput_joypad_axis()

static int16_t xinput_joypad_axis ( unsigned  port_num,
uint32_t  joyaxis 
)
static
Here is the call graph for this function:

◆ xinput_joypad_button()

static bool xinput_joypad_button ( unsigned  port_num,
uint16_t  joykey 
)
static
Here is the call graph for this function:

◆ xinput_joypad_destroy()

static void xinput_joypad_destroy ( void  )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xinput_joypad_init()

static bool xinput_joypad_init ( void data)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xinput_joypad_name()

const char* xinput_joypad_name ( unsigned  pad)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xinput_joypad_poll()

static void xinput_joypad_poll ( void  )
static
Here is the call graph for this function:

◆ xinput_joypad_query_pad()

static bool xinput_joypad_query_pad ( unsigned  pad)
static
Here is the call graph for this function:

◆ xinput_joypad_rumble()

static bool xinput_joypad_rumble ( unsigned  pad,
enum retro_rumble_effect  effect,
uint16_t  strength 
)
static
Here is the call graph for this function:

Variable Documentation

◆ button_index_to_bitmap_code

const uint16_t button_index_to_bitmap_code[]
static
Initial value:
= {
}
#define XINPUT_GAMEPAD_B
Definition: xinput_joypad.c:71
#define XINPUT_GAMEPAD_START
Definition: xinput_joypad.c:64
#define XINPUT_GAMEPAD_A
Definition: xinput_joypad.c:70
#define XINPUT_GAMEPAD_LEFT_THUMB
Definition: xinput_joypad.c:66
#define XINPUT_GAMEPAD_Y
Definition: xinput_joypad.c:73
#define XINPUT_GAMEPAD_RIGHT_SHOULDER
Definition: xinput_joypad.c:69
#define XINPUT_GAMEPAD_RIGHT_THUMB
Definition: xinput_joypad.c:67
#define XINPUT_GAMEPAD_LEFT_SHOULDER
Definition: xinput_joypad.c:68
#define XINPUT_GAMEPAD_X
Definition: xinput_joypad.c:72
#define XINPUT_GAMEPAD_GUIDE
Definition: xinput_joypad.c:101
#define XINPUT_GAMEPAD_BACK
Definition: xinput_joypad.c:65

◆ g_xinput_block_pads

bool g_xinput_block_pads

◆ g_xinput_guide_button_supported

bool g_xinput_guide_button_supported
static

◆ g_xinput_pad_indexes

int g_xinput_pad_indexes[MAX_USERS]

◆ g_xinput_rumble_states

XINPUT_VIBRATION g_xinput_rumble_states[4]
static

◆ g_xinput_states

xinput_joypad_state g_xinput_states[4]
static

◆ g_XInputGetStateEx

XInputGetStateEx_t g_XInputGetStateEx
static

◆ g_XInputSetState

XInputSetState_t g_XInputSetState
static

◆ XBOX_CONTROLLER_NAMES

const char* const XBOX_CONTROLLER_NAMES[4]
static
Initial value:
=
{
"XInput Controller (User 1)",
"XInput Controller (User 2)",
"XInput Controller (User 3)",
"XInput Controller (User 4)"
}

◆ XBOX_ONE_CONTROLLER_NAMES

const char* const XBOX_ONE_CONTROLLER_NAMES[4]
static
Initial value:
=
{
"XBOX One Controller (User 1)",
"XBOX One Controller (User 2)",
"XBOX One Controller (User 3)",
"XBOX One Controller (User 4)"
}

◆ xinput_joypad

input_device_driver_t xinput_joypad
Initial value:
= {
"xinput",
}
static void xinput_joypad_destroy(void)
Definition: xinput_joypad.c:358
const char * xinput_joypad_name(unsigned pad)
Definition: xinput_joypad.c:167
static int16_t xinput_joypad_axis(unsigned port_num, uint32_t joyaxis)
Definition: xinput_joypad.c:441
#define NULL
Pointer to 0.
Definition: gctypes.h:65
static void xinput_joypad_poll(void)
Definition: xinput_joypad.c:511
static bool xinput_joypad_button(unsigned port_num, uint16_t joykey)
Definition: xinput_joypad.c:397
static bool xinput_joypad_query_pad(unsigned pad)
Definition: xinput_joypad.c:346
static bool xinput_joypad_rumble(unsigned pad, enum retro_rumble_effect effect, uint16_t strength)
Definition: xinput_joypad.c:554
static bool xinput_joypad_init(void *data)
Definition: xinput_joypad.c:216