mirror of
https://github.com/libretro/RetroArch
synced 2025-01-26 18:35:22 +00:00
Move set_keybinds autoconfiguration (that is done on every console
port) to driver.c - reducing lots of duplicate code
This commit is contained in:
parent
fb1355b975
commit
c26653fca8
32
driver.c
32
driver.c
@ -895,12 +895,44 @@ void init_video_input(void)
|
|||||||
RARCH_ERR("Cannot init input driver. Exiting ...\n");
|
RARCH_ERR("Cannot init input driver. Exiting ...\n");
|
||||||
rarch_fail(1, "init_video_input()");
|
rarch_fail(1, "init_video_input()");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RARCH_ERR("Cannot find input driver. Exiting ...\n");
|
RARCH_ERR("Cannot find input driver. Exiting ...\n");
|
||||||
rarch_fail(1, "init_video_input()");
|
rarch_fail(1, "init_video_input()");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (driver.input != NULL)
|
||||||
|
{
|
||||||
|
for(unsigned i = 0; i < MAX_PLAYERS; i++)
|
||||||
|
{
|
||||||
|
unsigned action = 0;
|
||||||
|
|
||||||
|
if (driver.input->set_keybinds)
|
||||||
|
action |= (1ULL << KEYBINDS_ACTION_SET_DEFAULT_BINDS);
|
||||||
|
|
||||||
|
switch (g_settings.input.dpad_emulation[i])
|
||||||
|
{
|
||||||
|
case ANALOG_DPAD_LSTICK:
|
||||||
|
action |= (1ULL << KEYBINDS_ACTION_SET_ANALOG_DPAD_LSTICK);
|
||||||
|
break;
|
||||||
|
case ANALOG_DPAD_RSTICK:
|
||||||
|
action |= (1ULL << KEYBINDS_ACTION_SET_ANALOG_DPAD_RSTICK);
|
||||||
|
break;
|
||||||
|
case ANALOG_DPAD_NONE:
|
||||||
|
action |= (1ULL << KEYBINDS_ACTION_SET_ANALOG_DPAD_NONE);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (action)
|
||||||
|
if (driver.input->set_keybinds)
|
||||||
|
driver.input->set_keybinds(driver.input_data, 0, i, 0,
|
||||||
|
action);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_OVERLAY
|
#ifdef HAVE_OVERLAY
|
||||||
|
@ -446,37 +446,6 @@ static void *gx_input_init(void)
|
|||||||
SYS_SetPowerCallback(power_callback);
|
SYS_SetPowerCallback(power_callback);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for(unsigned i = 0; i < MAX_PLAYERS; i++)
|
|
||||||
if (driver.input->set_keybinds)
|
|
||||||
driver.input->set_keybinds(driver.input_data, 0, i, 0,
|
|
||||||
(1ULL << KEYBINDS_ACTION_SET_DEFAULT_BINDS));
|
|
||||||
|
|
||||||
for(unsigned i = 0; i < MAX_PLAYERS; i++)
|
|
||||||
{
|
|
||||||
unsigned keybind_action = 0;
|
|
||||||
|
|
||||||
switch (g_settings.input.dpad_emulation[i])
|
|
||||||
{
|
|
||||||
case ANALOG_DPAD_LSTICK:
|
|
||||||
keybind_action = (1ULL << KEYBINDS_ACTION_SET_ANALOG_DPAD_LSTICK);
|
|
||||||
break;
|
|
||||||
case ANALOG_DPAD_RSTICK:
|
|
||||||
keybind_action = (1ULL << KEYBINDS_ACTION_SET_ANALOG_DPAD_RSTICK);
|
|
||||||
break;
|
|
||||||
case ANALOG_DPAD_NONE:
|
|
||||||
keybind_action = (1ULL << KEYBINDS_ACTION_SET_ANALOG_DPAD_NONE);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (keybind_action)
|
|
||||||
if (driver.input->set_keybinds)
|
|
||||||
driver.input->set_keybinds(driver.input_data, 0, i, 0,
|
|
||||||
keybind_action);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return (void*)-1;
|
return (void*)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,36 +513,6 @@ static void* ps3_input_init(void)
|
|||||||
cellMouseInit(MAX_MICE);
|
cellMouseInit(MAX_MICE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for(unsigned i = 0; i < MAX_PLAYERS; i++)
|
|
||||||
if (driver.input->set_keybinds)
|
|
||||||
driver.input->set_keybinds(driver.input_data, 0, i, 0,
|
|
||||||
(1ULL << KEYBINDS_ACTION_SET_DEFAULT_BINDS));
|
|
||||||
|
|
||||||
for(unsigned i = 0; i < MAX_PLAYERS; i++)
|
|
||||||
{
|
|
||||||
unsigned keybind_action = 0;
|
|
||||||
|
|
||||||
switch (g_settings.input.dpad_emulation[i])
|
|
||||||
{
|
|
||||||
case ANALOG_DPAD_LSTICK:
|
|
||||||
keybind_action = (1ULL << KEYBINDS_ACTION_SET_ANALOG_DPAD_LSTICK);
|
|
||||||
break;
|
|
||||||
case ANALOG_DPAD_RSTICK:
|
|
||||||
keybind_action = (1ULL << KEYBINDS_ACTION_SET_ANALOG_DPAD_RSTICK);
|
|
||||||
break;
|
|
||||||
case ANALOG_DPAD_NONE:
|
|
||||||
keybind_action = (1ULL << KEYBINDS_ACTION_SET_ANALOG_DPAD_NONE);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (keybind_action)
|
|
||||||
if (driver.input->set_keybinds)
|
|
||||||
driver.input->set_keybinds(driver.input_data, 0, i, 0,
|
|
||||||
keybind_action);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (void*)-1;
|
return (void*)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,36 +167,6 @@ static void* psp_input_initialize(void)
|
|||||||
#endif
|
#endif
|
||||||
sceCtrlSetSamplingMode(DEFAULT_SAMPLING_MODE);
|
sceCtrlSetSamplingMode(DEFAULT_SAMPLING_MODE);
|
||||||
|
|
||||||
for(unsigned i = 0; i < MAX_PLAYERS; i++)
|
|
||||||
if (driver.input->set_keybinds)
|
|
||||||
driver.input->set_keybinds(driver.input_data, 0, i, 0,
|
|
||||||
(1ULL << KEYBINDS_ACTION_SET_DEFAULT_BINDS));
|
|
||||||
|
|
||||||
for(unsigned i = 0; i < MAX_PLAYERS; i++)
|
|
||||||
{
|
|
||||||
unsigned keybind_action = 0;
|
|
||||||
|
|
||||||
switch (g_settings.input.dpad_emulation[i])
|
|
||||||
{
|
|
||||||
case ANALOG_DPAD_LSTICK:
|
|
||||||
keybind_action = (1ULL << KEYBINDS_ACTION_SET_ANALOG_DPAD_LSTICK);
|
|
||||||
break;
|
|
||||||
case ANALOG_DPAD_RSTICK:
|
|
||||||
keybind_action = (1ULL << KEYBINDS_ACTION_SET_ANALOG_DPAD_RSTICK);
|
|
||||||
break;
|
|
||||||
case ANALOG_DPAD_NONE:
|
|
||||||
keybind_action = (1ULL << KEYBINDS_ACTION_SET_ANALOG_DPAD_NONE);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (keybind_action)
|
|
||||||
if (driver.input->set_keybinds)
|
|
||||||
driver.input->set_keybinds(driver.input_data, 0, i, 0,
|
|
||||||
action);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (void*)-1;
|
return (void*)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,36 +399,6 @@ static void *xdk_input_init(void)
|
|||||||
while(XGetDeviceEnumerationStatus() == XDEVICE_ENUMERATION_BUSY) {}
|
while(XGetDeviceEnumerationStatus() == XDEVICE_ENUMERATION_BUSY) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for(unsigned i = 0; i < MAX_PLAYERS; i++)
|
|
||||||
if (driver.input->set_keybinds)
|
|
||||||
driver.input->set_keybinds(driver.input_data, 0, i, 0,
|
|
||||||
(1ULL << KEYBINDS_ACTION_SET_DEFAULT_BINDS));
|
|
||||||
|
|
||||||
for(unsigned i = 0; i < MAX_PLAYERS; i++)
|
|
||||||
{
|
|
||||||
unsigned keybind_action = 0;
|
|
||||||
|
|
||||||
switch (g_settings.input.dpad_emulation[i])
|
|
||||||
{
|
|
||||||
case ANALOG_DPAD_LSTICK:
|
|
||||||
keybind_action = (1ULL << KEYBINDS_ACTION_SET_ANALOG_DPAD_LSTICK);
|
|
||||||
break;
|
|
||||||
case ANALOG_DPAD_RSTICK:
|
|
||||||
keybind_action = (1ULL << KEYBINDS_ACTION_SET_ANALOG_DPAD_RSTICK);
|
|
||||||
break;
|
|
||||||
case ANALOG_DPAD_NONE:
|
|
||||||
keybind_action = (1ULL << KEYBINDS_ACTION_SET_ANALOG_DPAD_NONE);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (keybind_action)
|
|
||||||
if (driver.input->set_keybinds)
|
|
||||||
driver.input->set_keybinds(driver.input_data, 0, i, 0,
|
|
||||||
keybind_action);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (void*)-1;
|
return (void*)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user