mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-23 11:45:27 +00:00
Add another RARCH_INPUT_CTL_* command
This commit is contained in:
parent
92c0907e80
commit
73ce9c0d23
2
driver.c
2
driver.c
@ -222,7 +222,7 @@ void init_drivers_pre(void)
|
||||
{
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_FIND_DRIVER, NULL);
|
||||
video_driver_ctl(RARCH_DISPLAY_CTL_FIND_DRIVER, NULL);
|
||||
find_input_driver();
|
||||
input_driver_ctl(RARCH_INPUT_CTL_FIND_DRIVER, NULL);
|
||||
find_camera_driver();
|
||||
find_location_driver();
|
||||
#ifdef HAVE_MENU
|
||||
|
@ -425,7 +425,7 @@ static void init_video_input(const input_driver_t *tmp)
|
||||
if (tmp)
|
||||
driver->input = tmp;
|
||||
else
|
||||
find_input_driver();
|
||||
input_driver_ctl(RARCH_INPUT_CTL_FIND_DRIVER, NULL);
|
||||
|
||||
/* This should never really happen as tmp (driver.input) is always
|
||||
* found before this in find_driver_input(), or we have aborted
|
||||
|
@ -112,30 +112,6 @@ const char* config_get_input_driver_options(void)
|
||||
return char_list_new_special(STRING_LIST_INPUT_DRIVERS, NULL);
|
||||
}
|
||||
|
||||
void find_input_driver(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
int i = find_driver_index("input_driver", settings->input.driver);
|
||||
|
||||
if (i >= 0)
|
||||
driver->input = (const input_driver_t*)input_driver_find_handle(i);
|
||||
else
|
||||
{
|
||||
unsigned d;
|
||||
RARCH_ERR("Couldn't find any input driver named \"%s\"\n",
|
||||
settings->input.driver);
|
||||
RARCH_LOG_OUTPUT("Available input drivers are:\n");
|
||||
for (d = 0; input_driver_find_handle(d); d++)
|
||||
RARCH_LOG_OUTPUT("\t%s\n", input_driver_find_ident(d));
|
||||
RARCH_WARN("Going to default to first input driver...\n");
|
||||
|
||||
driver->input = (const input_driver_t*)input_driver_find_handle(0);
|
||||
|
||||
if (!driver->input)
|
||||
retro_fail(1, "find_input_driver()");
|
||||
}
|
||||
}
|
||||
|
||||
const input_driver_t *input_get_ptr(void *data)
|
||||
{
|
||||
@ -310,6 +286,31 @@ bool input_driver_ctl(enum rarch_input_ctl_state state, void *data)
|
||||
return driver->input->keyboard_mapping_is_blocked(
|
||||
driver->input_data);
|
||||
return false;
|
||||
case RARCH_INPUT_CTL_FIND_DRIVER:
|
||||
{
|
||||
int i = find_driver_index("input_driver", settings->input.driver);
|
||||
if (i >= 0)
|
||||
driver->input = (const input_driver_t*)input_driver_find_handle(i);
|
||||
else
|
||||
{
|
||||
unsigned d;
|
||||
RARCH_ERR("Couldn't find any input driver named \"%s\"\n",
|
||||
settings->input.driver);
|
||||
RARCH_LOG_OUTPUT("Available input drivers are:\n");
|
||||
for (d = 0; input_driver_find_handle(d); d++)
|
||||
RARCH_LOG_OUTPUT("\t%s\n", input_driver_find_ident(d));
|
||||
RARCH_WARN("Going to default to first input driver...\n");
|
||||
|
||||
driver->input = (const input_driver_t*)input_driver_find_handle(0);
|
||||
|
||||
if (!driver->input)
|
||||
return false;
|
||||
retro_fail(1, "find_input_driver()");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
case RARCH_INPUT_CTL_NONE:
|
||||
default:
|
||||
break;
|
||||
|
@ -51,6 +51,7 @@ enum rarch_input_ctl_state
|
||||
RARCH_INPUT_CTL_NONE = 0,
|
||||
RARCH_INPUT_CTL_INIT,
|
||||
RARCH_INPUT_CTL_DEINIT,
|
||||
RARCH_INPUT_CTL_FIND_DRIVER,
|
||||
RARCH_INPUT_CTL_GRAB_STDIN,
|
||||
RARCH_INPUT_CTL_KB_MAPPING_IS_BLOCKED
|
||||
};
|
||||
@ -147,8 +148,6 @@ const char *input_driver_find_ident(int index);
|
||||
**/
|
||||
const char* config_get_input_driver_options(void);
|
||||
|
||||
void find_input_driver(void);
|
||||
|
||||
/**
|
||||
* input_driver_set_rumble_state:
|
||||
* @port : User number.
|
||||
|
Loading…
x
Reference in New Issue
Block a user