mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
(Input) Add new function to input driver - get_capabilities
This commit is contained in:
parent
14ae3ca316
commit
3e8166bfa5
@ -1965,6 +1965,17 @@ static void android_input_free_input(void *data)
|
||||
(void)data;
|
||||
}
|
||||
|
||||
static uint64_t android_get_capabilities(void *data)
|
||||
{
|
||||
uint64_t caps = 0;
|
||||
|
||||
caps |= (1 << RETRO_DEVICE_JOYPAD);
|
||||
caps |= (1 << RETRO_DEVICE_POINTER);
|
||||
caps |= (1 << RETRO_DEVICE_ANALOG);
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
const input_driver_t input_android = {
|
||||
android_input_init,
|
||||
android_input_poll,
|
||||
@ -1972,5 +1983,6 @@ const input_driver_t input_android = {
|
||||
android_input_key_pressed,
|
||||
android_input_free_input,
|
||||
android_input_set_keybinds,
|
||||
android_input_get_capabilities,
|
||||
"android_input",
|
||||
};
|
||||
|
@ -309,6 +309,18 @@ static bool apple_input_set_rumble(void *data, unsigned port, enum retro_rumble_
|
||||
return input_joypad_set_rumble(g_joydriver, port, effect, strength);
|
||||
}
|
||||
|
||||
static uint64_t apple_get_capabilities(void *data)
|
||||
{
|
||||
uint64_t caps = 0;
|
||||
|
||||
caps |= (1 << RETRO_DEVICE_JOYPAD);
|
||||
caps |= (1 << RETRO_DEVICE_MOUSE);
|
||||
caps |= (1 << RETRO_DEVICE_KEYBOARD);
|
||||
caps |= (1 << RETRO_DEVICE_POINTER);
|
||||
caps |= (1 << RETRO_DEVICE_ANALOG);
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
const input_driver_t input_apple = {
|
||||
apple_input_init,
|
||||
@ -317,6 +329,7 @@ const input_driver_t input_apple = {
|
||||
apple_bind_button_pressed,
|
||||
apple_input_free_input,
|
||||
apple_input_set_keybinds,
|
||||
apple_input_get_capabilities,
|
||||
"apple_input",
|
||||
NULL,
|
||||
apple_input_set_rumble,
|
||||
|
@ -839,6 +839,19 @@ static void qnx_input_set_keybinds(void *data, unsigned device, unsigned port,
|
||||
#endif
|
||||
}
|
||||
|
||||
static uint64_t qnx_input_get_capabilities(void *data)
|
||||
{
|
||||
uint64_t caps = 0;
|
||||
|
||||
caps |= (1 << RETRO_DEVICE_JOYPAD);
|
||||
caps |= (1 << RETRO_DEVICE_POINTER);
|
||||
#ifdef HAVE_BB10
|
||||
caps |= (1 << RETRO_DEVICE_ANALOG);
|
||||
#endif
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
const input_driver_t input_qnx = {
|
||||
qnx_input_init,
|
||||
qnx_input_poll,
|
||||
@ -846,6 +859,6 @@ const input_driver_t input_qnx = {
|
||||
qnx_input_key_pressed,
|
||||
qnx_input_free_input,
|
||||
qnx_input_set_keybinds,
|
||||
qnx_input_get_capabilities,
|
||||
"qnx_input",
|
||||
};
|
||||
|
||||
|
1
driver.h
1
driver.h
@ -322,6 +322,7 @@ typedef struct input_driver
|
||||
bool (*key_pressed)(void *data, int key);
|
||||
void (*free)(void *data);
|
||||
void (*set_keybinds)(void *data, unsigned device, unsigned port, unsigned id, unsigned keybind_action);
|
||||
uint64_t (*get_capabilities)(void *data);
|
||||
const char *ident;
|
||||
|
||||
void (*grab_mouse)(void *data, bool state);
|
||||
|
@ -501,13 +501,24 @@ static bool gx_input_key_pressed(void *data, int key)
|
||||
return (g_extern.lifecycle_state & (1ULL << key));
|
||||
}
|
||||
|
||||
static uint64_t gx_input_get_capabilities(void *data)
|
||||
{
|
||||
uint64_t caps = 0;
|
||||
|
||||
caps |= (1 << RETRO_DEVICE_JOYPAD);
|
||||
caps |= (1 << RETRO_DEVICE_ANALOG);
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
|
||||
const input_driver_t input_gx = {
|
||||
.init = gx_input_init,
|
||||
.poll = gx_input_poll,
|
||||
.input_state = gx_input_state,
|
||||
.key_pressed = gx_input_key_pressed,
|
||||
.free = gx_input_free_input,
|
||||
.set_keybinds = gx_input_set_keybinds,
|
||||
.ident = "gx",
|
||||
gx_input_init,
|
||||
gx_input_poll,
|
||||
gx_input_state,
|
||||
gx_input_key_pressed,
|
||||
gx_input_free_input,
|
||||
gx_input_set_keybinds,
|
||||
gx_input_get_capabilities,
|
||||
"gx",
|
||||
};
|
||||
|
@ -663,6 +663,20 @@ static const char *dinput_joypad_name(unsigned pad)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static uint64_t dinput_get_capabilities(void *data)
|
||||
{
|
||||
uint64_t caps = 0;
|
||||
|
||||
caps |= (1 << RETRO_DEVICE_JOYPAD);
|
||||
caps |= (1 << RETRO_DEVICE_MOUSE);
|
||||
caps |= (1 << RETRO_DEVICE_KEYBOARD);
|
||||
caps |= (1 << RETRO_DEVICE_LIGHTGUN);
|
||||
caps |= (1 << RETRO_DEVICE_POINTER);
|
||||
caps |= (1 << RETRO_DEVICE_ANALOG);
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
const rarch_joypad_driver_t dinput_joypad = {
|
||||
dinput_joypad_init,
|
||||
dinput_joypad_query_pad,
|
||||
@ -672,6 +686,7 @@ const rarch_joypad_driver_t dinput_joypad = {
|
||||
dinput_joypad_poll,
|
||||
NULL,
|
||||
dinput_joypad_name,
|
||||
dinput_get_capabilities,
|
||||
"dinput",
|
||||
};
|
||||
|
||||
|
@ -322,6 +322,16 @@ static void linuxraw_input_poll(void *data)
|
||||
input_joypad_poll(linuxraw->joypad);
|
||||
}
|
||||
|
||||
static uint64_t linuxraw_get_capabilities(void *data)
|
||||
{
|
||||
uint64_t caps = 0;
|
||||
|
||||
caps |= (1 << RETRO_DEVICE_JOYPAD);
|
||||
caps |= (1 << RETRO_DEVICE_ANALOG);
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
const input_driver_t input_linuxraw = {
|
||||
linuxraw_input_init,
|
||||
linuxraw_input_poll,
|
||||
@ -329,6 +339,7 @@ const input_driver_t input_linuxraw = {
|
||||
linuxraw_bind_button_pressed,
|
||||
linuxraw_input_free,
|
||||
NULL,
|
||||
linuxraw_get_capabilities,
|
||||
"linuxraw",
|
||||
NULL,
|
||||
linuxraw_set_rumble,
|
||||
|
10
input/null.c
10
input/null.c
@ -61,6 +61,15 @@ static void nullinput_set_keybinds(void *data, unsigned device,
|
||||
(void)keybind_action;
|
||||
}
|
||||
|
||||
static uint64_t nullinput_get_capabilities(void *data)
|
||||
{
|
||||
uint64_t caps = 0;
|
||||
|
||||
caps |= (1 << RETRO_DEVICE_JOYPAD);
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
const input_driver_t input_null = {
|
||||
nullinput_input_init,
|
||||
nullinput_input_poll,
|
||||
@ -68,6 +77,7 @@ const input_driver_t input_null = {
|
||||
nullinput_input_key_pressed,
|
||||
nullinput_input_free_input,
|
||||
nullinput_set_keybinds,
|
||||
nullinput_get_capabilities,
|
||||
"null",
|
||||
};
|
||||
|
||||
|
@ -136,6 +136,17 @@ static void rwebinput_grab_mouse(void *data, bool state)
|
||||
(void)state;
|
||||
}
|
||||
|
||||
static uint64_t rwebinput_get_capabilities(void *data)
|
||||
{
|
||||
uint64_t caps = 0;
|
||||
|
||||
caps |= (1 << RETRO_DEVICE_JOYPAD);
|
||||
caps |= (1 << RETRO_DEVICE_KEYBOARD);
|
||||
caps |= (1 << RETRO_DEVICE_MOUSE);
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
const input_driver_t input_rwebinput = {
|
||||
rwebinput_input_init,
|
||||
rwebinput_input_poll,
|
||||
@ -143,6 +154,7 @@ const input_driver_t input_rwebinput = {
|
||||
rwebinput_bind_button_pressed,
|
||||
rwebinput_input_free,
|
||||
NULL,
|
||||
rwebinput_get_capabilities,
|
||||
"rwebinput",
|
||||
rwebinput_grab_mouse,
|
||||
};
|
||||
|
@ -244,6 +244,20 @@ static void sdl_input_poll(void *data)
|
||||
sdl_poll_mouse(sdl);
|
||||
}
|
||||
|
||||
static uint64_t sdl_get_capabilities(void *data)
|
||||
{
|
||||
uint64_t caps = 0;
|
||||
|
||||
caps |= (1 << RETRO_DEVICE_JOYPAD);
|
||||
caps |= (1 << RETRO_DEVICE_MOUSE);
|
||||
caps |= (1 << RETRO_DEVICE_KEYBOARD);
|
||||
caps |= (1 << RETRO_DEVICE_LIGHTGUN);
|
||||
caps |= (1 << RETRO_DEVICE_POINTER);
|
||||
caps |= (1 << RETRO_DEVICE_ANALOG);
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
const input_driver_t input_sdl = {
|
||||
sdl_input_init,
|
||||
sdl_input_poll,
|
||||
@ -251,6 +265,7 @@ const input_driver_t input_sdl = {
|
||||
sdl_bind_button_pressed,
|
||||
sdl_input_free,
|
||||
NULL,
|
||||
sdl_get_capabilities,
|
||||
"sdl",
|
||||
NULL,
|
||||
sdl_set_rumble,
|
||||
|
@ -281,6 +281,20 @@ static const rarch_joypad_driver_t *x_get_joypad_driver(void *data)
|
||||
return x11->joypad;
|
||||
}
|
||||
|
||||
static uint64_t x_input_get_capabilities(void *data)
|
||||
{
|
||||
uint64_t caps = 0;
|
||||
|
||||
caps |= (1 << RETRO_DEVICE_JOYPAD);
|
||||
caps |= (1 << RETRO_DEVICE_MOUSE);
|
||||
caps |= (1 << RETRO_DEVICE_KEYBOARD);
|
||||
caps |= (1 << RETRO_DEVICE_LIGHTGUN);
|
||||
caps |= (1 << RETRO_DEVICE_POINTER);
|
||||
caps |= (1 << RETRO_DEVICE_ANALOG);
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
const input_driver_t input_x = {
|
||||
x_input_init,
|
||||
x_input_poll,
|
||||
@ -288,6 +302,7 @@ const input_driver_t input_x = {
|
||||
x_bind_button_pressed,
|
||||
x_input_free,
|
||||
NULL,
|
||||
x_input_get_capabilities,
|
||||
"x",
|
||||
x_grab_mouse,
|
||||
x_set_rumble,
|
||||
|
@ -374,13 +374,26 @@ static bool ps3_input_key_pressed(void *data, int key)
|
||||
return (g_extern.lifecycle_state & (1ULL << key));
|
||||
}
|
||||
|
||||
static uint64_t ps3_input_get_capabilities(void *data)
|
||||
{
|
||||
uint64_t caps = 0;
|
||||
|
||||
caps |= (1 << RETRO_DEVICE_JOYPAD);
|
||||
#ifdef HAVE_MOUSE
|
||||
caps |= (1 << RETRO_DEVICE_MOUSE);
|
||||
#endif
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
const input_driver_t input_ps3 = {
|
||||
.init = ps3_input_init,
|
||||
.poll = ps3_input_poll,
|
||||
.input_state = ps3_input_state,
|
||||
.key_pressed = ps3_input_key_pressed,
|
||||
.free = ps3_input_free_input,
|
||||
.set_keybinds = ps3_input_set_keybinds,
|
||||
.ident = "ps3",
|
||||
ps3_input_init,
|
||||
ps3_input_poll,
|
||||
ps3_input_state,
|
||||
ps3_input_key_pressed,
|
||||
ps3_input_free_input,
|
||||
ps3_input_set_keybinds,
|
||||
ps3_input_get_capabilities,
|
||||
"ps3",
|
||||
};
|
||||
|
||||
|
@ -267,6 +267,15 @@ static bool xdk_input_key_pressed(void *data, int key)
|
||||
return (g_extern.lifecycle_state & (1ULL << key));
|
||||
}
|
||||
|
||||
static uint64_t xdk_input_get_capabilities(void *data)
|
||||
{
|
||||
uint64_t caps = 0;
|
||||
|
||||
caps |= (1 << RETRO_DEVICE_JOYPAD);
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
const input_driver_t input_xinput =
|
||||
{
|
||||
xdk_input_init,
|
||||
@ -275,5 +284,6 @@ const input_driver_t input_xinput =
|
||||
xdk_input_key_pressed,
|
||||
xdk_input_free_input,
|
||||
xdk_input_set_keybinds,
|
||||
xdk_input_get_capabilities,
|
||||
"xinput"
|
||||
};
|
||||
|
@ -109,13 +109,22 @@ static bool xenon360_input_key_pressed(void *data, int key)
|
||||
return (g_extern.lifecycle_state & (1ULL << key));
|
||||
}
|
||||
|
||||
static uint64_t xenon360_get_capabilities(void *data)
|
||||
{
|
||||
uint64_t caps = 0;
|
||||
|
||||
caps |= (1 << RETRO_DEVICE_JOYPAD);
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
const input_driver_t input_xenon360 = {
|
||||
.init = xenon360_input_init,
|
||||
.poll = xenon360_input_poll,
|
||||
.input_state = xenon360_input_state,
|
||||
.key_pressed = xenon360_input_key_pressed,
|
||||
.free = xenon360_input_free_input,
|
||||
.set_keybinds = xenon360_input_set_keybinds,
|
||||
.ident = "xenon360",
|
||||
xenon360_input_init,
|
||||
xenon360_input_poll,
|
||||
xenon360_input_state,
|
||||
xenon360_input_key_pressed,
|
||||
xenon360_input_free_input,
|
||||
xenon360_input_set_keybinds,
|
||||
xenon360_input_get_capabilities,
|
||||
"xenon360",
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user