diff --git a/input/input_driver.h b/input/input_driver.h index 180dfffa69..339f850dd7 100644 --- a/input/input_driver.h +++ b/input/input_driver.h @@ -407,41 +407,6 @@ const input_device_driver_t *input_joypad_init_driver( void input_pad_connect(unsigned port, input_device_driver_t *driver); -/*****************************************************************************/ -#ifdef HAVE_HID -#include "include/hid_driver.h" - -/** - * Get an enumerated list of all HID driver names - * - * @return String listing of all HID driver names, separated by '|'. - **/ -const char* config_get_hid_driver_options(void); - -/** - * Finds first suitable HID driver and initializes. - * - * @return HID driver if found, otherwise NULL. - **/ -const hid_driver_t *input_hid_init_first(void); - -/** - * Get a pointer to the HID driver data structure - * - * @return Pointer to hid_data struct - **/ -const void *hid_driver_get_data(void); - -/** - * This should 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); - -#endif /* HAVE_HID */ -/*****************************************************************************/ - - /** * line_complete callback (when carriage return is pressed) * @@ -477,6 +442,42 @@ struct input_keyboard_ctx_wait void input_keyboard_event(bool down, unsigned code, uint32_t character, uint16_t mod, unsigned device); + +/*************************************/ +#ifdef HAVE_HID +#include "include/hid_driver.h" + +/** + * Get an enumerated list of all HID driver names + * + * @return String listing of all HID driver names, separated by '|'. + **/ +const char* config_get_hid_driver_options(void); + +/** + * Finds first suitable HID driver and initializes. + * + * @return HID driver if found, otherwise NULL. + **/ +const hid_driver_t *input_hid_init_first(void); + +/** + * Get a pointer to the HID driver data structure + * + * @return Pointer to hid_data struct + **/ +const void *hid_driver_get_data(void); + +/** + * This should 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); + +#endif /* HAVE_HID */ +/*************************************/ + + /** * Set the name of the device in the specified port * @@ -775,31 +776,6 @@ extern hid_driver_t libusb_hid; extern hid_driver_t wiiusb_hid; #endif /* HAVE_HID */ -typedef struct menu_input_ctx_line -{ - const char *label; - const char *label_setting; - unsigned type; - unsigned idx; - input_keyboard_line_complete_t cb; -} menu_input_ctx_line_t; - -const char *menu_input_dialog_get_label_setting_buffer(void); - -const char *menu_input_dialog_get_label_buffer(void); - -const char *menu_input_dialog_get_buffer(void); - -unsigned menu_input_dialog_get_kb_idx(void); - -bool menu_input_dialog_start_search(void); - -bool menu_input_dialog_get_display_kb(void); - -bool menu_input_dialog_start(menu_input_ctx_line_t *line); - -void menu_input_dialog_end(void); - RETRO_END_DECLS #endif /* __INPUT_DRIVER__H */ diff --git a/menu/menu_input.h b/menu/menu_input.h index 6c36189595..37eccaaaa7 100644 --- a/menu/menu_input.h +++ b/menu/menu_input.h @@ -182,22 +182,74 @@ typedef struct menu_input_ctx_hitbox int32_t y2; } menu_input_ctx_hitbox_t; -/* Provides access to all pointer device parameters */ -void menu_input_get_pointer_state(menu_input_pointer_t *pointer); +/** + * Copy parameters from the global menu_input_state to a menu_input_pointer_t + * in order to provide access to all pointer device parameters. + * + * @param copy_target menu_input_pointer_t struct where values will be copied + **/ +void menu_input_get_pointer_state(menu_input_pointer_t *copy_target); -/* Getters/setters for menu item (index) currently - * selected/highlighted (hovered over) by the pointer - * device - * Note: Each menu driver is responsible for setting this */ +/** + * Get the menu item index currently selected or hovered over by the pointer. + * + * @return the selected menu index + **/ unsigned menu_input_get_pointer_selection(void); +/** + * Set the menu item index that is currently selected or hovered over by the + * pointer. Note: Each menu driver is responsible for setting this. + * + * @param selection the selected menu index + **/ void menu_input_set_pointer_selection(unsigned selection); -/* Allows pointer y acceleration to be overridden - * (typically want to set acceleration to zero when - * calling populate entries) */ +/** + * Allows the pointer's y acceleration to be overridden. For example, menu + * drivers typically set acceleration to zero when populating entries. + * + * @param y_accel + **/ void menu_input_set_pointer_y_accel(float y_accel); +/** + * Line complete callback. Calls back after return is pressed with the + * completed line. Line can be NULL. (Meaning that it might return a NULL + * pointer instead of an empty string?) + * + * @param userdata + * @param line a string representation of the completed line + * (FIXME it might return a NULL pointer instead of an empty + * string?) + **/ +typedef void (*input_keyboard_line_complete_t)(void *userdata, const char *line); + +typedef struct menu_input_ctx_line +{ + const char *label; + const char *label_setting; + unsigned type; + unsigned idx; + input_keyboard_line_complete_t cb; +} menu_input_ctx_line_t; + +bool menu_input_dialog_start(menu_input_ctx_line_t *line); + +const char *menu_input_dialog_get_label_setting_buffer(void); + +const char *menu_input_dialog_get_label_buffer(void); + +const char *menu_input_dialog_get_buffer(void); + +unsigned menu_input_dialog_get_kb_idx(void); + +bool menu_input_dialog_start_search(void); + +bool menu_input_dialog_get_display_kb(void); + +void menu_input_dialog_end(void); + RETRO_END_DECLS #endif diff --git a/network/netplay/netplay_handshake.c b/network/netplay/netplay_handshake.c index 08bb128e98..312040c648 100644 --- a/network/netplay/netplay_handshake.c +++ b/network/netplay/netplay_handshake.c @@ -36,6 +36,7 @@ #include "../../content.h" #include "../../retroarch.h" #include "../../version.h" +#include "../../menu/menu_input.h" struct nick_buf_s { diff --git a/retroarch.c b/retroarch.c index 53fa87c2dc..f439b73e54 100644 --- a/retroarch.c +++ b/retroarch.c @@ -24541,18 +24541,18 @@ static unsigned menu_event( return ret; } -void menu_input_get_pointer_state(menu_input_pointer_t *pointer) +void menu_input_get_pointer_state(menu_input_pointer_t *copy_target) { struct rarch_state *p_rarch = &rarch_st; menu_input_t *menu_input = &p_rarch->menu_input_state; - if (!pointer) + if (!copy_target) return; /* Copy parameters from global menu_input_state * (i.e. don't pass by reference) * This is a fast operation */ - memcpy(pointer, &menu_input->pointer, sizeof(menu_input_pointer_t)); + memcpy(copy_target, &menu_input->pointer, sizeof(menu_input_pointer_t)); } unsigned menu_input_get_pointer_selection(void)