mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 19:20:35 +00:00
Move hid_data to input_st
This commit is contained in:
parent
b200ced199
commit
9184d0e114
@ -5048,3 +5048,58 @@ int16_t input_driver_state_wrapper(unsigned port, unsigned device,
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef HAVE_HID
|
||||
void *hid_driver_get_data(void)
|
||||
{
|
||||
return (void *)input_driver_st.hid_data;
|
||||
}
|
||||
|
||||
/* This is only to be called after we've invoked free() on the
|
||||
* HID driver; the memory will have already been freed, so we need to
|
||||
* reset the pointer.
|
||||
*/
|
||||
void hid_driver_reset_data(void)
|
||||
{
|
||||
input_driver_st.hid_data = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* config_get_hid_driver_options:
|
||||
*
|
||||
* Get an enumerated list of all HID driver names, separated by '|'.
|
||||
*
|
||||
* Returns: string listing of all HID driver names, separated by '|'.
|
||||
**/
|
||||
const char* config_get_hid_driver_options(void)
|
||||
{
|
||||
return char_list_new_special(STRING_LIST_INPUT_HID_DRIVERS, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* input_hid_init_first:
|
||||
*
|
||||
* Finds first suitable HID driver and initializes.
|
||||
*
|
||||
* Returns: HID driver if found, otherwise NULL.
|
||||
**/
|
||||
const hid_driver_t *input_hid_init_first(void)
|
||||
{
|
||||
unsigned i;
|
||||
input_driver_state_t *input_st = &input_driver_st;
|
||||
|
||||
for (i = 0; hid_drivers[i]; i++)
|
||||
{
|
||||
input_st->hid_data = hid_drivers[i]->init();
|
||||
|
||||
if (input_st->hid_data)
|
||||
{
|
||||
RARCH_LOG("[Input]: Found HID driver: \"%s\".\n",
|
||||
hid_drivers[i]->ident);
|
||||
return hid_drivers[i];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
@ -377,6 +377,9 @@ typedef struct
|
||||
#endif
|
||||
|
||||
/* pointers */
|
||||
#ifdef HAVE_HID
|
||||
const void *hid_data;
|
||||
#endif
|
||||
void *keyboard_press_data;
|
||||
input_keyboard_line_t keyboard_line; /* ptr alignment */
|
||||
input_keyboard_press_t keyboard_press_cb; /* ptr alignment */
|
||||
|
59
retroarch.c
59
retroarch.c
@ -13972,63 +13972,6 @@ const char* config_get_joypad_driver_options(void)
|
||||
return char_list_new_special(STRING_LIST_INPUT_JOYPAD_DRIVERS, NULL);
|
||||
}
|
||||
|
||||
#ifdef HAVE_HID
|
||||
void *hid_driver_get_data(void)
|
||||
{
|
||||
struct rarch_state *p_rarch = &rarch_st;
|
||||
return (void *)p_rarch->hid_data;
|
||||
}
|
||||
|
||||
/* This is only to be called after we've invoked free() on the
|
||||
* HID driver; the memory will have already been freed, so we need to
|
||||
* reset the pointer.
|
||||
*/
|
||||
void hid_driver_reset_data(void)
|
||||
{
|
||||
struct rarch_state *p_rarch = &rarch_st;
|
||||
p_rarch->hid_data = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* config_get_hid_driver_options:
|
||||
*
|
||||
* Get an enumerated list of all HID driver names, separated by '|'.
|
||||
*
|
||||
* Returns: string listing of all HID driver names, separated by '|'.
|
||||
**/
|
||||
const char* config_get_hid_driver_options(void)
|
||||
{
|
||||
return char_list_new_special(STRING_LIST_INPUT_HID_DRIVERS, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* input_hid_init_first:
|
||||
*
|
||||
* Finds first suitable HID driver and initializes.
|
||||
*
|
||||
* Returns: HID driver if found, otherwise NULL.
|
||||
**/
|
||||
const hid_driver_t *input_hid_init_first(void)
|
||||
{
|
||||
unsigned i;
|
||||
struct rarch_state *p_rarch = &rarch_st;
|
||||
|
||||
for (i = 0; hid_drivers[i]; i++)
|
||||
{
|
||||
p_rarch->hid_data = hid_drivers[i]->init();
|
||||
|
||||
if (p_rarch->hid_data)
|
||||
{
|
||||
RARCH_LOG("[Input]: Found HID driver: \"%s\".\n",
|
||||
hid_drivers[i]->ident);
|
||||
return hid_drivers[i];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_MENU) && defined(HAVE_ACCESSIBILITY)
|
||||
static const char *accessibility_lut_name(char key)
|
||||
{
|
||||
@ -14128,7 +14071,7 @@ void input_keyboard_event(bool down, unsigned code,
|
||||
static bool deferred_wait_keys;
|
||||
runloop_state_t *runloop_st = &runloop_state;
|
||||
retro_keyboard_event_t
|
||||
*key_event = &runloop_st->key_event;
|
||||
*key_event = &runloop_st->key_event;
|
||||
input_driver_state_t
|
||||
*input_st = input_state_get_ptr();
|
||||
#ifdef HAVE_ACCESSIBILITY
|
||||
|
@ -574,9 +574,6 @@ struct rarch_state
|
||||
const wifi_driver_t *wifi_driver;
|
||||
void *wifi_data;
|
||||
|
||||
#ifdef HAVE_HID
|
||||
const void *hid_data;
|
||||
#endif
|
||||
settings_t *configuration_settings;
|
||||
#ifdef HAVE_NETWORKING
|
||||
/* Used while Netplay is running */
|
||||
|
Loading…
x
Reference in New Issue
Block a user