Remove set_rumble function from input driver

This commit is contained in:
twinaphex 2020-09-02 00:38:11 +02:00
parent 17cf1ae58f
commit 2fde8c21a9
26 changed files with 40 additions and 300 deletions

View File

@ -1569,17 +1569,6 @@ static float android_input_get_sensor_input(void *data,
return 0;
}
static bool android_input_set_rumble(
const input_device_driver_t *joypad,
const input_device_driver_t *sec_joypad,
unsigned port,
enum retro_rumble_effect effect, uint16_t strength)
{
if (joypad)
return input_joypad_set_rumble(joypad, port, effect, strength);
return false;
}
input_driver_t input_android = {
android_input_init,
android_input_poll,
@ -1591,6 +1580,5 @@ input_driver_t input_android = {
"android",
NULL, /* grab_mouse */
NULL,
android_input_set_rumble
NULL
};

View File

@ -537,22 +537,6 @@ static void cocoa_input_free(void *data)
free(apple);
}
static bool cocoa_input_set_rumble(
const input_device_driver_t *joypad,
const input_device_driver_t *sec_joypad,
unsigned port, enum retro_rumble_effect effect, uint16_t strength)
{
if (joypad)
return input_joypad_set_rumble(joypad,
port, effect, strength);
#ifdef HAVE_MFI
if (sec_joypad)
return input_joypad_set_rumble(sec_joypad,
port, effect, strength);
#endif
return false;
}
static uint64_t cocoa_input_get_capabilities(void *data)
{
return
@ -573,6 +557,5 @@ input_driver_t input_cocoa = {
cocoa_input_get_capabilities,
"cocoa",
NULL, /* grab_mouse */
NULL,
cocoa_input_set_rumble
NULL
};

View File

@ -103,6 +103,5 @@ input_driver_t input_ctr = {
ctr_input_get_capabilities,
"ctr",
NULL, /* grab_mouse */
NULL,
NULL /* set_rumble */
NULL
};

View File

@ -967,17 +967,6 @@ static void dinput_grab_mouse(void *data, bool state)
IDirectInputDevice8_Acquire(di->mouse);
}
static bool dinput_set_rumble(
const input_device_driver_t *joypad,
const input_device_driver_t *sec_joypad,
unsigned port,
enum retro_rumble_effect effect, uint16_t strength)
{
if (joypad)
return input_joypad_set_rumble(joypad, port, effect, strength);
return false;
}
static uint64_t dinput_get_capabilities(void *data)
{
uint64_t caps = 0;
@ -1002,6 +991,5 @@ input_driver_t input_dinput = {
dinput_get_capabilities,
"dinput",
dinput_grab_mouse,
NULL,
dinput_set_rumble
NULL
};

View File

@ -156,6 +156,5 @@ input_driver_t input_dos = {
dos_input_get_capabilities,
"dos",
NULL, /* grab_mouse */
NULL,
NULL /* set_rumble */
NULL
};

View File

@ -307,6 +307,5 @@ input_driver_t input_gx = {
"gx",
NULL, /* grab_mouse */
NULL,
NULL /* set_rumble */
NULL
};

View File

@ -179,17 +179,6 @@ static void linuxraw_input_free(void *data)
free(data);
}
static bool linuxraw_set_rumble(
const input_device_driver_t *joypad,
const input_device_driver_t *sec_joypad,
unsigned port,
enum retro_rumble_effect effect, uint16_t strength)
{
if (joypad)
return input_joypad_set_rumble(joypad, port, effect, strength);
return false;
}
static void linuxraw_input_poll(void *data)
{
uint8_t c;
@ -233,6 +222,5 @@ input_driver_t input_linuxraw = {
linuxraw_get_capabilities,
"linuxraw",
NULL, /* grab_mouse */
linux_terminal_grab_stdin,
linuxraw_set_rumble
linux_terminal_grab_stdin
};

View File

@ -85,18 +85,6 @@ static uint64_t ps2_input_get_capabilities(void *data)
return (1 << RETRO_DEVICE_JOYPAD) | (1 << RETRO_DEVICE_ANALOG);
}
static bool ps2_input_set_rumble(
const input_device_driver_t *joypad,
const input_device_driver_t *sec_joypad,
unsigned port,
enum retro_rumble_effect effect, uint16_t strength)
{
if (joypad)
return input_joypad_set_rumble(joypad,
port, effect, strength);
return false;
}
input_driver_t input_ps2 = {
ps2_input_initialize,
NULL, /* poll */
@ -107,6 +95,5 @@ input_driver_t input_ps2 = {
ps2_input_get_capabilities,
"ps2",
NULL, /* grab_mouse */
NULL,
ps2_input_set_rumble
NULL
};

View File

@ -209,18 +209,6 @@ static bool ps3_input_set_sensor_state(void *data, unsigned port,
return false;
}
static bool ps3_input_set_rumble(
const input_device_driver_t *joypad,
const input_device_driver_t *sec_joypad,
unsigned port,
enum retro_rumble_effect effect, uint16_t strength)
{
if (joypad)
return input_joypad_set_rumble(joypad,
port, effect, strength);
return false;
}
input_driver_t input_ps3 = {
ps3_input_init,
#ifdef HAVE_MOUSE
@ -236,6 +224,5 @@ input_driver_t input_ps3 = {
"ps3",
NULL, /* grab_mouse */
NULL,
ps3_input_set_rumble
NULL
};

View File

@ -90,18 +90,6 @@ static uint64_t ps4_input_get_capabilities(void *data)
return (1 << RETRO_DEVICE_JOYPAD) | (1 << RETRO_DEVICE_ANALOG);
}
static bool ps4_input_set_rumble(
const input_device_driver_t *joypad,
const input_device_driver_t *sec_joypad,
unsigned port,
enum retro_rumble_effect effect, uint16_t strength)
{
if (joypad)
return input_joypad_set_rumble(joypad,
port, effect, strength);
return false;
}
input_driver_t input_ps4 = {
ps4_input_initialize,
NULL, /* poll */
@ -112,6 +100,5 @@ input_driver_t input_ps4 = {
ps4_input_get_capabilities,
"ps4",
NULL, /* grab_mouse */
NULL,
ps4_input_set_rumble
NULL
};

View File

@ -326,8 +326,7 @@ input_driver_t input_ps3 = {
"ps3",
NULL, /* grab_mouse */
NULL,
NULL /* set_rumble */
NULL
};
/* RetroArch - A frontend for libretro.

View File

@ -355,20 +355,6 @@ static uint64_t psp_input_get_capabilities(void *data)
return caps;
}
static bool psp_input_set_rumble(
const input_device_driver_t *joypad,
const input_device_driver_t *sec_joypad,
unsigned port,
enum retro_rumble_effect effect, uint16_t strength)
{
psp_input_t *psp = (psp_input_t*)data;
if (joypad)
return input_joypad_set_rumble(joypad,
port, effect, strength);
return false;
}
#ifdef VITA
static bool psp_input_set_sensor_state(void *data, unsigned port,
enum retro_sensor_action action, unsigned event_rate)
@ -469,6 +455,5 @@ input_driver_t input_psp = {
#endif
NULL, /* grab_mouse */
NULL,
psp_input_set_rumble
NULL
};

View File

@ -868,6 +868,5 @@ input_driver_t input_qnx = {
qnx_input_get_capabilities,
"qnx_input",
NULL,
NULL,
NULL
};

View File

@ -703,6 +703,5 @@ input_driver_t input_rwebinput = {
rwebinput_get_capabilities,
"rwebinput",
rwebinput_grab_mouse,
NULL,
NULL /* set_rumble */
NULL
};

View File

@ -300,17 +300,6 @@ static void sdl2_grab_mouse(void *data, bool state)
}
#endif
static bool sdl_set_rumble(
const input_device_driver_t *joypad,
const input_device_driver_t *sec_joypad,
unsigned port,
enum retro_rumble_effect effect, uint16_t strength)
{
if (joypad)
return input_joypad_set_rumble(joypad, port, effect, strength);
return false;
}
static void sdl_poll_mouse(sdl_input_t *sdl)
{
Uint8 btn = SDL_GetRelativeMouseState(&sdl->mouse_x, &sdl->mouse_y);
@ -411,6 +400,5 @@ input_driver_t input_sdl = {
"sdl",
NULL, /* grab_mouse */
#endif
NULL,
sdl_set_rumble
NULL
};

View File

@ -844,19 +844,6 @@ static uint64_t switch_input_get_capabilities(void *data)
return caps;
}
static bool switch_input_set_rumble(
const input_device_driver_t *joypad,
const input_device_driver_t *sec_joypad,
unsigned port,
enum retro_rumble_effect effect, uint16_t strength)
{
#ifdef HAVE_LIBNX
if (joypad)
return input_joypad_set_rumble(joypad, port, effect, strength);
#endif
return false;
}
static bool switch_input_set_sensor_state(void *data, unsigned port,
enum retro_sensor_action action, unsigned event_rate)
{
@ -963,6 +950,5 @@ input_driver_t input_switch = {
switch_input_get_capabilities,
"switch",
NULL, /* grab_mouse */
NULL,
switch_input_set_rumble
NULL
};

View File

@ -1407,18 +1407,6 @@ static void udev_input_grab_mouse(void *data, bool state)
#endif
}
static bool udev_input_set_rumble(
const input_device_driver_t *joypad,
const input_device_driver_t *sec_joypad,
unsigned port,
enum retro_rumble_effect effect, uint16_t strength)
{
if (joypad)
return input_joypad_set_rumble(joypad,
port, effect, strength);
return false;
}
input_driver_t input_udev = {
udev_input_init,
udev_input_poll,
@ -1430,9 +1418,8 @@ input_driver_t input_udev = {
"udev",
udev_input_grab_mouse,
#ifdef __linux__
linux_terminal_grab_stdin,
linux_terminal_grab_stdin
#else
NULL,
NULL
#endif
udev_input_set_rumble
};

View File

@ -73,17 +73,6 @@ static uint64_t uwp_input_get_capabilities(void *data)
return caps;
}
static bool uwp_input_set_rumble(
const input_device_driver_t *joypad,
const input_device_driver_t *sec_joypad,
unsigned port,
enum retro_rumble_effect effect, uint16_t strength)
{
if (joypad)
return input_joypad_set_rumble(joypad, port, effect, strength);
return false;
}
static int16_t uwp_input_state(
void *data,
const input_device_driver_t *joypad,
@ -213,6 +202,5 @@ input_driver_t input_uwp = {
uwp_input_get_capabilities,
"uwp",
NULL, /* grab_mouse */
NULL,
uwp_input_set_rumble
NULL
};

View File

@ -360,17 +360,6 @@ static uint64_t input_wl_get_capabilities(void *data)
(1 << RETRO_DEVICE_LIGHTGUN);
}
static bool input_wl_set_rumble(
const input_device_driver_t *joypad,
const input_device_driver_t *sec_joypad,
unsigned port,
enum retro_rumble_effect effect, uint16_t strength)
{
if (joypad)
return input_joypad_set_rumble(joypad, port, effect, strength);
return false;
}
input_driver_t input_wayland = {
NULL,
input_wl_poll,
@ -381,6 +370,5 @@ input_driver_t input_wayland = {
input_wl_get_capabilities,
"wayland",
NULL, /* grab_mouse */
NULL,
input_wl_set_rumble
NULL
};

View File

@ -192,6 +192,5 @@ input_driver_t input_wiiu = {
wiiu_input_get_capabilities,
"wiiu",
NULL, /* grab_mouse */
NULL,
NULL /* set_rumble */
NULL
};

View File

@ -819,17 +819,6 @@ static void winraw_grab_mouse(void *d, bool grab)
wr->mouse_grab = grab;
}
static bool winraw_set_rumble(
const input_device_driver_t *joypad,
const input_device_driver_t *sec_joypad,
unsigned port,
enum retro_rumble_effect effect, uint16_t strength)
{
if (joypad)
return input_joypad_set_rumble(joypad, port, effect, strength);
return false;
}
input_driver_t input_winraw = {
winraw_init,
winraw_poll,
@ -840,6 +829,5 @@ input_driver_t input_winraw = {
winraw_get_capabilities,
"raw",
winraw_grab_mouse,
NULL,
winraw_set_rumble
NULL
};

View File

@ -710,17 +710,6 @@ static void x_grab_mouse(void *data, bool state)
x11->grab_mouse = state;
}
static bool x_set_rumble(
const input_device_driver_t *joypad,
const input_device_driver_t *sec_joypad,
unsigned port,
enum retro_rumble_effect effect, uint16_t strength)
{
if (joypad)
return input_joypad_set_rumble(joypad, port, effect, strength);
return false;
}
static uint64_t x_input_get_capabilities(void *data)
{
uint64_t caps = 0;
@ -745,6 +734,5 @@ input_driver_t input_x = {
x_input_get_capabilities,
"x",
x_grab_mouse,
NULL,
x_set_rumble
NULL
};

View File

@ -101,20 +101,6 @@ static uint64_t xdk_input_get_capabilities(void *data)
return (1 << RETRO_DEVICE_JOYPAD) | (1 << RETRO_DEVICE_ANALOG);
}
/* FIXME - are we sure about treating low frequency motor as the
* "strong" motor? Does it apply for Xbox too? */
static bool xdk_input_set_rumble(
const input_device_driver_t *joypad,
const input_device_driver_t *sec_joypad,
unsigned port,
enum retro_rumble_effect effect, uint16_t strength)
{
if (joypad)
return input_joypad_set_rumble(joypad, port, effect, strength);
return false;
}
input_driver_t input_xinput = {
xdk_input_init,
NULL, /* poll */
@ -125,6 +111,5 @@ input_driver_t input_xinput = {
xdk_input_get_capabilities,
"xinput",
NULL, /* grab_mouse */
NULL,
xdk_input_set_rumble
NULL
};

View File

@ -140,6 +140,5 @@ input_driver_t input_xenon360 = {
xenon360_input_get_capabilities,
"xenon360",
NULL, /* grab_mouse */
NULL,
NULL /* set_rumble */
NULL
};

View File

@ -199,11 +199,6 @@ struct input_driver
void (*grab_mouse)(void *data, bool state);
bool (*grab_stdin)(void *data);
bool (*set_rumble)(
const input_device_driver_t *joypad_data,
const input_device_driver_t *sec_joypad_data,
unsigned port,
enum retro_rumble_effect effect, uint16_t state);
};
struct rarch_joypad_driver
@ -372,20 +367,6 @@ const input_device_driver_t *input_joypad_init_driver(
break; \
}
/**
* input_joypad_set_rumble:
* @drv : Input device driver handle.
* @port : User number.
* @effect : Rumble effect to set.
* @strength : Strength of rumble effect.
*
* Sets rumble effect @effect with strength @strength.
*
* Returns: true (1) if successful, otherwise false (0).
**/
bool input_joypad_set_rumble(const input_device_driver_t *driver,
unsigned port, enum retro_rumble_effect effect, uint16_t strength);
/**
* input_pad_connect:
* @port : Joystick number.

View File

@ -691,11 +691,6 @@ static float input_null_get_sensor_input(void *data, unsigned port, unsigned id)
static uint64_t input_null_get_capabilities(void *data) { return 0; }
static void input_null_grab_mouse(void *data, bool state) { }
static bool input_null_grab_stdin(void *data) { return false; }
static bool input_null_set_rumble(
const input_device_driver_t *joypad,
const input_device_driver_t *sec_joypad,
unsigned port,
enum retro_rumble_effect effect, uint16_t state) { return false; }
static input_driver_t input_null = {
input_null_init,
@ -707,8 +702,7 @@ static input_driver_t input_null = {
input_null_get_capabilities,
"null",
input_null_grab_mouse,
input_null_grab_stdin,
input_null_set_rumble
input_null_grab_stdin
};
static input_driver_t *input_drivers[] = {
@ -23589,18 +23583,24 @@ bool input_driver_set_rumble_state(unsigned port,
enum retro_rumble_effect effect, uint16_t strength)
{
struct rarch_state *p_rarch = &rarch_st;
if (p_rarch->current_input && p_rarch->current_input->set_rumble)
{
settings_t *settings = p_rarch->configuration_settings;
#ifdef HAVE_MFI
const input_device_driver_t *sec_joypad = p_rarch->sec_joypad;
const input_device_driver_t *sec_joypad = p_rarch->sec_joypad;
#else
const input_device_driver_t *sec_joypad = NULL;
const input_device_driver_t *sec_joypad = NULL;
#endif
return p_rarch->current_input->set_rumble(p_rarch->joypad,
sec_joypad,
port, effect, strength);
}
return false;
bool rumble_state = false;
unsigned joy_idx = settings->uints.input_joypad_map[port];
if (joy_idx >= MAX_USERS)
return false;
if (p_rarch->joypad && p_rarch->joypad->set_rumble)
rumble_state = p_rarch->joypad->set_rumble(
joy_idx, effect, strength);
if (sec_joypad && sec_joypad->set_rumble)
rumble_state = sec_joypad->set_rumble(
joy_idx, effect, strength);
return rumble_state;
}
const char *joypad_driver_name(unsigned i)
@ -26626,30 +26626,6 @@ const input_device_driver_t *input_joypad_init_driver(
return input_joypad_init_first(data);
}
/**
* input_joypad_set_rumble:
* @drv : Input device driver handle.
* @port : User number.
* @effect : Rumble effect to set.
* @strength : Strength of rumble effect.
*
* Sets rumble effect @effect with strength @strength.
*
* Returns: true (1) if successful, otherwise false (0).
**/
bool input_joypad_set_rumble(const input_device_driver_t *drv,
unsigned port, enum retro_rumble_effect effect, uint16_t strength)
{
struct rarch_state *p_rarch = &rarch_st;
settings_t *settings = p_rarch->configuration_settings;
unsigned joy_idx = settings->uints.input_joypad_map[port];
if (!drv || !drv->set_rumble || joy_idx >= MAX_USERS)
return false;
return drv->set_rumble(joy_idx, effect, strength);
}
bool input_key_pressed(int key, bool keyboard_pressed)
{
rarch_joypad_info_t joypad_info;