1 /*  RetroArch - A frontend for libretro.
2  *  Copyright (C) 2010-2014 - Hans-Kristian Arntzen
3  *  Copyright (C) 2011-2017 - Daniel De Matteis
4  *
5  *  RetroArch is free software: you can redistribute it and/or modify it under the terms
6  *  of the GNU General Public License as published by the Free Software Found-
7  *  ation, either version 3 of the License, or (at your option) any later version.
8  *
9  *  RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10  *  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  *  PURPOSE.  See the GNU General Public License for more details.
12  *
13  *  You should have received a copy of the GNU General Public License along with RetroArch.
14  *  If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef __INPUT_DRIVER__H
18 #define __INPUT_DRIVER__H
19 
20 #include <stdint.h>
21 #include <stdlib.h>
22 #include <stddef.h>
23 #include <sys/types.h>
24 
25 #include "input_types.h"
26 
27 #ifdef HAVE_CONFIG_H
28 #include "config.h"
29 #endif /* HAVE_CONFIG_H */
30 
31 #include <boolean.h>
32 #include <retro_common_api.h>
33 #include <retro_inline.h>
34 #include <libretro.h>
35 #include <retro_miscellaneous.h>
36 
37 #include "input_defines.h"
38 
39 #include "../msg_hash.h"
40 #include "include/hid_types.h"
41 #include "include/hid_driver.h"
42 #include "include/gamepad.h"
43 
44 RETRO_BEGIN_DECLS
45 
46 struct retro_keybind
47 {
48    /**
49     * Human-readable label for the control.
50     */
51    char     *joykey_label;
52 
53    /**
54     * Human-readable label for an analog axis.
55     */
56    char     *joyaxis_label;
57 
58    /**
59     * Joypad axis. Negative and positive axes are both represented by this variable.
60     */
61    uint32_t joyaxis;
62 
63    /**
64     * Default joy axis binding value for resetting bind to default.
65     */
66    uint32_t def_joyaxis;
67 
68    /**
69     * Used by input_{push,pop}_analog_dpad().
70     */
71    uint32_t orig_joyaxis;
72 
73    enum msg_hash_enums enum_idx;
74 
75    enum retro_key key;
76 
77    uint16_t id;
78 
79    /**
80     * What mouse button ID has been mapped to this control.
81     */
82    uint16_t mbutton;
83 
84    /**
85     * Joypad key. Joypad POV (hats) are embedded into this key as well.
86     **/
87    uint16_t joykey;
88 
89    /**
90     * Default key binding value (for resetting bind).
91     */
92    uint16_t def_joykey;
93 
94    /**
95     * Determines whether or not the binding is valid.
96     */
97    bool valid;
98 };
99 
100 extern struct retro_keybind input_config_binds[MAX_USERS][RARCH_BIND_LIST_END];
101 extern struct retro_keybind input_autoconf_binds[MAX_USERS][RARCH_BIND_LIST_END];
102 
103 struct rarch_joypad_info
104 {
105    const struct retro_keybind *auto_binds;
106    float axis_threshold;
107    uint16_t joy_idx;
108 };
109 
110 typedef struct
111 {
112    unsigned name_index;
113    uint16_t vid;
114    uint16_t pid;
115    char joypad_driver[32];
116    char name[256];
117    char display_name[256];
118    char config_path[PATH_MAX_LENGTH]; /* Path to the RetroArch config file */
119    char config_name[PATH_MAX_LENGTH]; /* Base name of the RetroArch config file */
120    bool autoconfigured;
121 } input_device_info_t;
122 
123 /**
124  * Organizes the functions and data structures of each driver that are accessed
125  * by other parts of the input code. The input_driver structs are the "interface"
126  * between RetroArch and the input driver.
127  *
128  * Every driver must establish an input_driver struct with pointers to its own
129  * implementations of these functions, and each of those input_driver structs is
130  * declared below.
131  */
132 struct input_driver
133 {
134    /**
135     * Initializes input driver.
136     *
137     * @param joypad_driver  Name of the joypad driver associated with the
138     *                       input driver
139     */
140    void *(*init)(const char *joypad_driver);
141 
142   /**
143     * Called once every frame to poll input. This function pointer can be set
144     * to NULL if not supported by the input driver, for example if a joypad
145     * driver is responsible for polling on a particular driver/platform.
146     *
147     * @param data  the input state struct
148     */
149    void (*poll)(void *data);
150 
151    /**
152     * Queries state for a specified control on a specified input port. This
153     * function pointer can be set to NULL if not supported by the input driver,
154     * for example if a joypad driver is responsible for quering state for a
155     * particular driver/platform.
156     *
157     * @param joypad_data      Input state struct, defined by the input driver
158     * @param sec_joypad_data  Input state struct for secondary input devices (eg
159     *                         MFi controllers), defined by a secondary driver.
160     *                         Queried state to be returned is the logical OR of
161     *                         joypad_data and sec_joypad_data. May be NULL.
162     * @param joypad_info      Info struct for the controller to be queried,
163     *                         with hardware device ID and autoconfig mapping.
164     * @param retro_keybinds   Structure for control mappings for all libretro
165     *                         input device abstractions
166     * @param keyboard_mapping_blocked
167     *                         If true, disregard custom keyboard mapping
168     * @param port             Which RetroArch port is being polled
169     * @param device           Which libretro abstraction is being polled
170     *                         (RETRO_DEVICE_ID_RETROPAD, RETRO_DEVICE_ID_MOUSE)
171     * @param index            For controls with more than one axis or multiple
172     *                         simultaneous inputs, such as an analog joystick
173     *                         or touchpad.
174     * @param id               Which control is being polled
175     *                         (eg RETRO_DEVICE_ID_JOYPAD_START)
176     *
177     * @return 1 for pressed digital control, 0 for non-pressed digital control.
178     *          Values in the range of a signed 16-bit integer,[-0x8000, 0x7fff]
179     */
180    int16_t (*input_state)(void *data,
181          const input_device_driver_t *joypad_data,
182          const input_device_driver_t *sec_joypad_data,
183          rarch_joypad_info_t *joypad_info,
184          const struct retro_keybind **retro_keybinds,
185          bool keyboard_mapping_blocked,
186          unsigned port, unsigned device, unsigned index, unsigned id);
187 
188    /**
189     * Frees the input struct.
190     *
191     * @param data The input state struct.
192     */
193    void (*free)(void *data);
194 
195    /**
196     * Sets the state related for sensors, such as polling rate or to deactivate
197     * the sensor entirely, etc. This function pointer may be set to NULL if
198     * setting sensor values is not supported.
199     *
200     * @param data    The input state struct
201     * @param port
202     * @param effect  Sensor action
203     * @param rate    Sensor rate update
204     *
205     * @return true if the operation is successful.
206    **/
207    bool (*set_sensor_state)(void *data, unsigned port,
208          enum retro_sensor_action action, unsigned rate);
209 
210    /**
211     * Retrieves the sensor state associated with the provided port and ID. This
212     * function pointer may be set to NULL if retreiving sensor state is not
213     * supported.
214     *
215     * @param data  The input state struct
216     * @param port
217     * @param id    Sensor ID
218     *
219     * @return The current state associated with the port and ID as a float
220     **/
221    float (*get_sensor_input)(void *data, unsigned port, unsigned id);
222 
223    /**
224     * The means for an input driver to indicate to RetroArch which libretro
225     * input abstractions the driver supports.
226     *
227     * @param data  The input state struct.
228     *
229     * @return A unit64_t composed via bitwise operators.
230     */
231    uint64_t (*get_capabilities)(void *data);
232 
233    /**
234     * The human-readable name of the input driver.
235     */
236    const char *ident;
237 
238    /**
239     * Grab or ungrab the mouse according to the value of `state`. This function
240     * pointer can be set to NULL if the driver does not support grabbing the
241     * mouse.
242     *
243     * @param data   The input state struct
244     * @param state  True to grab the mouse, false to ungrab
245     */
246    void (*grab_mouse)(void *data, bool state);
247 
248    /**
249     * Check to see if the input driver has claimed stdin, and therefore it is
250     * not available for other input. This function pointercan be set to NULL if
251     * the driver does not support claiming stdin.
252     *
253     * @param data  The input state struct
254     *
255     * @return True if the input driver has claimed stdin.
256     */
257    bool (*grab_stdin)(void *data);
258 };
259 
260 struct rarch_joypad_driver
261 {
262    void *(*init)(void *data);
263    bool (*query_pad)(unsigned);
264    void (*destroy)(void);
265    int16_t (*button)(unsigned, uint16_t);
266    int16_t (*state)(rarch_joypad_info_t *joypad_info,
267          const struct retro_keybind *binds, unsigned port);
268    void (*get_buttons)(unsigned, input_bits_t *);
269    int16_t (*axis)(unsigned, uint32_t);
270    void (*poll)(void);
271    bool (*set_rumble)(unsigned, enum retro_rumble_effect, uint16_t);
272    const char *(*name)(unsigned);
273 
274    const char *ident;
275 };
276 
277 /**
278  * Get an enumerated list of all input driver names
279  *
280  * @return string listing of all input driver names, separated by '|'.
281  **/
282 const char* config_get_input_driver_options(void);
283 
284 /**
285  * Sets the rumble state. Used by RETRO_ENVIRONMENT_GET_RUMBLE_INTERFACE.
286  *
287  * @param port      User number.
288  * @param effect    Rumble effect.
289  * @param strength  Strength of rumble effect.
290  *
291  * @return true if the rumble state has been successfully set
292  **/
293 bool input_driver_set_rumble_state(unsigned port,
294       enum retro_rumble_effect effect, uint16_t strength);
295 
296 /**
297  * Sets the sensor state. Used by RETRO_ENVIRONMENT_GET_SENSOR_INTERFACE.
298  *
299  * @param port
300  * @param effect  Sensor action
301  * @param rate    Sensor rate update
302  *
303  * @return true if the sensor state has been successfully set
304  **/
305 bool input_sensor_set_state(unsigned port,
306       enum retro_sensor_action action, unsigned rate);
307 
308 /**
309  * Retrieves the sensor state associated with the provided port and ID.
310  *
311  * @param port
312  * @param id    Sensor ID
313  *
314  * @return The current state associated with the port and ID as a float
315  **/
316 float input_sensor_get_input(unsigned port, unsigned id);
317 
318 /**
319  * Retrieves the input driver state struct
320  *
321  * @return The input state struct
322  **/
323 void *input_driver_get_data(void);
324 
325 /**
326  * Sets the input_driver_nonblock_state flag to true
327  **/
328 void input_driver_set_nonblock_state(void);
329 
330 /**
331  * Sets the input_driver_nonblock_state flag to false
332  **/
333 void input_driver_unset_nonblock_state(void);
334 
335 /**
336  * If the action is INPUT_ACTION_AXIS_THRESHOLD, return the current
337  * input_driver_axis_threshold.
338  *
339  * @return value of input_driver_axis_threshold or NULL for actions other than
340  *          INPUT_ACTION_AXIS_THRESHOLD
341 **/
342 float *input_driver_get_float(enum input_action action);
343 
344 /**
345  * If the action is INPUT_ACTION_MAX_USERS, return the current
346  * input_driver_max_users.
347  *
348  * @return value of input_driver_axis_threshold or NULL for actions other than
349  *          INPUT_ACTION_AXIS_THRESHOLD
350 **/
351 unsigned *input_driver_get_uint(enum input_action action);
352 
353 /**
354  * Get an enumerated list of all joypad driver names
355  *
356  * @return String listing of all joypad driver names, separated by '|'.
357  **/
358 const char* config_get_joypad_driver_options(void);
359 
360 /**
361  * Initialize a joypad driver of name ident. If ident points to NULL or a
362  * zero-length string, equivalent to calling input_joypad_init_first().
363  *
364  * @param ident  identifier of driver to initialize.
365  *
366  * @return The joypad driver if found, otherwise NULL.
367  **/
368 const input_device_driver_t *input_joypad_init_driver(
369       const char *ident, void *data);
370 
371 /**
372  * Takes as input analog key identifiers and converts them to corresponding
373  * bind IDs ident_minus and ident_plus.
374  *
375  * @param idx          Analog key index (eg RETRO_DEVICE_INDEX_ANALOG_LEFT)
376  * @param ident        Analog key identifier (eg RETRO_DEVICE_ID_ANALOG_X)
377  * @param ident_minus  Bind ID minus, will be set by function.
378  * @param ident_plus   Bind ID plus,  will be set by function.
379  */
380 #define input_conv_analog_id_to_bind_id(idx, ident, ident_minus, ident_plus) \
381    switch ((idx << 1) | ident) \
382    { \
383       case (RETRO_DEVICE_INDEX_ANALOG_LEFT << 1) | RETRO_DEVICE_ID_ANALOG_X: \
384          ident_minus = RARCH_ANALOG_LEFT_X_MINUS; \
385          ident_plus  = RARCH_ANALOG_LEFT_X_PLUS; \
386          break; \
387       case (RETRO_DEVICE_INDEX_ANALOG_LEFT << 1) | RETRO_DEVICE_ID_ANALOG_Y: \
388          ident_minus = RARCH_ANALOG_LEFT_Y_MINUS; \
389          ident_plus  = RARCH_ANALOG_LEFT_Y_PLUS; \
390          break; \
391       case (RETRO_DEVICE_INDEX_ANALOG_RIGHT << 1) | RETRO_DEVICE_ID_ANALOG_X: \
392          ident_minus = RARCH_ANALOG_RIGHT_X_MINUS; \
393          ident_plus  = RARCH_ANALOG_RIGHT_X_PLUS; \
394          break; \
395       case (RETRO_DEVICE_INDEX_ANALOG_RIGHT << 1) | RETRO_DEVICE_ID_ANALOG_Y: \
396          ident_minus = RARCH_ANALOG_RIGHT_Y_MINUS; \
397          ident_plus  = RARCH_ANALOG_RIGHT_Y_PLUS; \
398          break; \
399    }
400 
401 /**
402  * Registers a newly connected pad with RetroArch.
403  *
404  * @param port    Joystick number
405  * @param driver  Handle for joypad driver handling joystick's input
406  **/
407 void input_pad_connect(unsigned port, input_device_driver_t *driver);
408 
409 
410 /*****************************************************************************/
411 #ifdef HAVE_HID
412 #include "include/hid_driver.h"
413 
414 /**
415  * Get an enumerated list of all HID driver names
416  *
417  * @return String listing of all HID driver names, separated by '|'.
418  **/
419 const char* config_get_hid_driver_options(void);
420 
421 /**
422  * Finds first suitable HID driver and initializes.
423  *
424  * @return HID driver if found, otherwise NULL.
425  **/
426 const hid_driver_t *input_hid_init_first(void);
427 
428 /**
429  * Get a pointer to the HID driver data structure
430  *
431  * @return Pointer to hid_data struct
432  **/
433 const void *hid_driver_get_data(void);
434 
435 /**
436  * This should be called after we've invoked free() on the HID driver; the
437  * memory will have already been freed so we need to reset the pointer.
438  */
439 void hid_driver_reset_data(void);
440 
441 #endif /* HAVE_HID */
442 /*****************************************************************************/
443 
444 
445 /**
446  * line_complete callback (when carriage return is pressed)
447  *
448  * @param userdata User data which will be passed to subsequent callbacks.
449  * @param line      the line of input, which can be NULL.
450  **/
451 typedef void (*input_keyboard_line_complete_t)(void *userdata,
452       const char *line);
453 
454 /**
455  * Callback for keypress events
456  *
457  * @param userdata The user data that was passed through from the keyboard press callback.
458  * @param code      keycode
459  **/
460 typedef bool (*input_keyboard_press_t)(void *userdata, unsigned code);
461 
462 struct input_keyboard_ctx_wait
463 {
464    void *userdata;
465    input_keyboard_press_t cb;
466 };
467 
468 /**
469  * Called by drivers when keyboard events are fired. Interfaces with the global
470  * driver struct and libretro callbacks.
471  *
472  * @param down       Was Keycode pressed down?
473  * @param code       Keycode.
474  * @param character  Character inputted.
475  * @param mod        TODO/FIXME/???
476  **/
477 void input_keyboard_event(bool down, unsigned code, uint32_t character,
478       uint16_t mod, unsigned device);
479 
480 /**
481  * Set the name of the device in the specified port
482  *
483  * @param port
484  */
485 void input_config_set_device_name(unsigned port, const char *name);
486 
487 /**
488  * Set the formatted "display name" of the device in the specified port
489  *
490  * @param port
491  */
492 void input_config_set_device_display_name(unsigned port, const char *name);
493 
494 /**
495  * Set the configuration path for the device in the specified port
496  *
497  * @param port
498  * @param path The path of the device config.
499  */
500 void input_config_set_device_config_path(unsigned port, const char *path);
501 
502 /**
503  * Set the configuration name for the device in the specified port
504  *
505  * @param port
506  * @param name The name of the config to set.
507  */
508 void input_config_set_device_config_name(unsigned port, const char *name);
509 
510 /**
511  * Set the joypad driver for the device in the specified port
512  *
513  * @param port
514  * @param driver The driver to set the given port to.
515  */
516 void input_config_set_device_joypad_driver(unsigned port, const char *driver);
517 
518 /**
519  * Set the vendor ID (vid) for the device in the specified port
520  *
521  * @param port
522  * @param vid The VID to set the given device port to.
523  */
524 void input_config_set_device_vid(unsigned port, uint16_t vid);
525 
526 /**
527  * Set the pad ID (pid) for the device in the specified port
528  *
529  * @param port
530  * @param pid The PID to set the given device port to.
531  */
532 void input_config_set_device_pid(unsigned port, uint16_t pid);
533 
534 /**
535  * Sets the autoconfigured flag for the device in the specified port
536  *
537  * @param port
538  * @param autoconfigured Whether or nor the device is configured automatically.
539  */
540 void input_config_set_device_autoconfigured(unsigned port, bool autoconfigured);
541 
542 /**
543  * Sets the name index number for the device in the specified port
544  *
545  * @param port
546  * @param name_index The name index to set the device to use.
547  */
548 void input_config_set_device_name_index(unsigned port, unsigned name_index);
549 
550 /**
551  * Sets the device type of the specified port
552  *
553  * @param port
554  * @param id The device type (RETRO_DEVICE_JOYPAD, RETRO_DEVICE_MOUSE, etc)
555  */
556 void input_config_set_device(unsigned port, unsigned id);
557 
558 /**
559  * Registers a pad_connection_listener_interface with a function pointer that
560  * is called when a joypad is connected. Only used by the wiiu_joypad driver.
561  *
562  * @param listener  a struct that implements pad_connection_listener_interface
563  */
564 void set_connection_listener(pad_connection_listener_t *listener);
565 
566 /* Clear input_device_info */
567 void input_config_clear_device_name(unsigned port);
568 void input_config_clear_device_display_name(unsigned port);
569 void input_config_clear_device_config_path(unsigned port);
570 void input_config_clear_device_config_name(unsigned port);
571 void input_config_clear_device_joypad_driver(unsigned port);
572 
573 unsigned input_config_get_device_count(void);
574 
575 unsigned *input_config_get_device_ptr(unsigned port);
576 
577 unsigned input_config_get_device(unsigned port);
578 
579 /* Get input_device_info */
580 const char *input_config_get_device_name(unsigned port);
581 const char *input_config_get_device_display_name(unsigned port);
582 const char *input_config_get_device_config_path(unsigned port);
583 const char *input_config_get_device_config_name(unsigned port);
584 const char *input_config_get_device_joypad_driver(unsigned port);
585 
586 /**
587  * Retrieves the vendor id (vid) of a connected controller
588  *
589  * @param port
590  *
591  * @return the vendor id VID of the device
592  */
593 uint16_t input_config_get_device_vid(unsigned port);
594 
595 /**
596  * Retrieves the pad id (pad) of a connected controller
597  *
598  * @param port
599  *
600  * @return the port id PID of the device
601  */
602 uint16_t input_config_get_device_pid(unsigned port);
603 
604 /**
605  * Returns the value of the autoconfigured flag for the specified device
606  *
607  * @param port
608  *
609  * @return the autoconfigured flag
610  */
611 bool input_config_get_device_autoconfigured(unsigned port);
612 
613 /**
614  * Get the name index number for the device in this port
615  *
616  * @param port
617  *
618  * @return the name index for this device
619  */
620 unsigned input_config_get_device_name_index(unsigned port);
621 
622 
623 /*****************************************************************************/
624 
625 /**
626  * Retrieve the device name char pointer.
627  *
628  * @deprecated input_config_get_device_name_ptr is required by linuxraw_joypad
629  * and parport_joypad. These drivers should be refactored such that this
630  * low-level access is not required.
631  *
632  * @param port
633  *
634  * @return a pointer to the device name on the specified port
635  */
636 char *input_config_get_device_name_ptr(unsigned port);
637 
638 /**
639  * Get the size of the device name.
640  *
641  * @deprecated input_config_get_device_name_size is required by linuxraw_joypad
642  * and parport_joypad. These drivers should be refactored such that this
643  * low-level access is not required.
644  *
645  * @param port
646  *
647  * @return the size of the device name on the specified port
648  */
649 size_t input_config_get_device_name_size(unsigned port);
650 
651 /*****************************************************************************/
652 
653 /**
654  * Save the current keybinds on a port to the config file.
655  *
656  * @param conf  pointer to config file object
657  * @param user  user number (ie port - TODO: change to port nomenclature)
658  */
659 void input_config_save_keybinds_user(void *data, unsigned user);
660 
661 const struct retro_keybind *input_config_get_bind_auto(unsigned port, unsigned id);
662 
663 /**
664  * Save a key binding to the config file.
665  *
666  * @param conf    pointer to config file object
667  * @param prefix  prefix name of keybind
668  * @param base    base name of keybind
669  * @param bind    pointer to key binding object
670  * @param kb      save keyboard binds
671  */
672 void input_config_save_keybind(void *data, const char *prefix,
673       const char *base, const struct retro_keybind *bind,
674       bool save_empty);
675 
676 void input_config_reset_autoconfig_binds(unsigned port);
677 void input_config_reset(void);
678 
679 #if defined(ANDROID)
680 #define DEFAULT_MAX_PADS 8
681 #define ANDROID_KEYBOARD_PORT DEFAULT_MAX_PADS
682 #elif defined(_3DS)
683 #define DEFAULT_MAX_PADS 1
684 #elif defined(SWITCH) || defined(HAVE_LIBNX)
685 #define DEFAULT_MAX_PADS 8
686 #elif defined(WIIU)
687 #ifdef WIIU_HID
688 #define DEFAULT_MAX_PADS 16
689 #else
690 #define DEFAULT_MAX_PADS 5
691 #endif /* WIIU_HID */
692 #elif defined(DJGPP)
693 #define DEFAULT_MAX_PADS 1
694 #define DOS_KEYBOARD_PORT DEFAULT_MAX_PADS
695 #elif defined(XENON)
696 #define DEFAULT_MAX_PADS 4
697 #elif defined(VITA) || defined(SN_TARGET_PSP2)
698 #define DEFAULT_MAX_PADS 4
699 #elif defined(PSP)
700 #define DEFAULT_MAX_PADS 1
701 #elif defined(PS2)
702 #define DEFAULT_MAX_PADS 8
703 #elif defined(GEKKO) || defined(HW_RVL)
704 #define DEFAULT_MAX_PADS 4
705 #elif defined(HAVE_ODROIDGO2)
706 #define DEFAULT_MAX_PADS 1
707 #elif defined(__linux__) || (defined(BSD) && !defined(__MACH__))
708 #define DEFAULT_MAX_PADS 8
709 #elif defined(__QNX__)
710 #define DEFAULT_MAX_PADS 8
711 #elif defined(__PS3__)
712 #define DEFAULT_MAX_PADS 7
713 #elif defined(_XBOX)
714 #define DEFAULT_MAX_PADS 4
715 #elif defined(HAVE_XINPUT) && !defined(HAVE_DINPUT)
716 #define DEFAULT_MAX_PADS 4
717 #elif defined(DINGUX)
718 #define DEFAULT_MAX_PADS 2
719 #else
720 #define DEFAULT_MAX_PADS 16
721 #endif /* defined(ANDROID) */
722 
723 extern input_device_driver_t dinput_joypad;
724 extern input_device_driver_t linuxraw_joypad;
725 extern input_device_driver_t parport_joypad;
726 extern input_device_driver_t udev_joypad;
727 extern input_device_driver_t xinput_joypad;
728 extern input_device_driver_t sdl_joypad;
729 extern input_device_driver_t sdl_dingux_joypad;
730 extern input_device_driver_t ps4_joypad;
731 extern input_device_driver_t ps3_joypad;
732 extern input_device_driver_t psp_joypad;
733 extern input_device_driver_t ps2_joypad;
734 extern input_device_driver_t ctr_joypad;
735 extern input_device_driver_t switch_joypad;
736 extern input_device_driver_t xdk_joypad;
737 extern input_device_driver_t gx_joypad;
738 extern input_device_driver_t wiiu_joypad;
739 extern input_device_driver_t hid_joypad;
740 extern input_device_driver_t android_joypad;
741 extern input_device_driver_t qnx_joypad;
742 extern input_device_driver_t mfi_joypad;
743 extern input_device_driver_t dos_joypad;
744 extern input_device_driver_t rwebpad_joypad;
745 
746 extern input_driver_t input_android;
747 extern input_driver_t input_sdl;
748 extern input_driver_t input_sdl_dingux;
749 extern input_driver_t input_dinput;
750 extern input_driver_t input_x;
751 extern input_driver_t input_ps4;
752 extern input_driver_t input_ps3;
753 extern input_driver_t input_psp;
754 extern input_driver_t input_ps2;
755 extern input_driver_t input_ctr;
756 extern input_driver_t input_switch;
757 extern input_driver_t input_xenon360;
758 extern input_driver_t input_gx;
759 extern input_driver_t input_wiiu;
760 extern input_driver_t input_xinput;
761 extern input_driver_t input_uwp;
762 extern input_driver_t input_linuxraw;
763 extern input_driver_t input_udev;
764 extern input_driver_t input_cocoa;
765 extern input_driver_t input_qnx;
766 extern input_driver_t input_rwebinput;
767 extern input_driver_t input_dos;
768 extern input_driver_t input_winraw;
769 extern input_driver_t input_wayland;
770 
771 #ifdef HAVE_HID
772 extern hid_driver_t iohidmanager_hid;
773 extern hid_driver_t btstack_hid;
774 extern hid_driver_t libusb_hid;
775 extern hid_driver_t wiiusb_hid;
776 #endif /* HAVE_HID */
777 
778 typedef struct menu_input_ctx_line
779 {
780    const char *label;
781    const char *label_setting;
782    unsigned type;
783    unsigned idx;
784    input_keyboard_line_complete_t cb;
785 } menu_input_ctx_line_t;
786 
787 const char *menu_input_dialog_get_label_setting_buffer(void);
788 
789 const char *menu_input_dialog_get_label_buffer(void);
790 
791 const char *menu_input_dialog_get_buffer(void);
792 
793 unsigned menu_input_dialog_get_kb_idx(void);
794 
795 bool menu_input_dialog_start_search(void);
796 
797 bool menu_input_dialog_get_display_kb(void);
798 
799 bool menu_input_dialog_start(menu_input_ctx_line_t *line);
800 
801 void menu_input_dialog_end(void);
802 
803 RETRO_END_DECLS
804 
805 #endif /* __INPUT_DRIVER__H */
806