From 05cef19e9899c2fda0ad5ce06ebfd78f0252e06b Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 10 Jan 2015 00:03:04 +0100 Subject: [PATCH] Document input_context.c --- input/input_context.c | 27 +++++++++++++++++++++++++++ input/input_context.h | 43 +++++++++++++++++++++++++++++++++---------- 2 files changed, 60 insertions(+), 10 deletions(-) diff --git a/input/input_context.c b/input/input_context.c index 16cf3458a3..22870afffc 100644 --- a/input/input_context.c +++ b/input/input_context.c @@ -71,6 +71,13 @@ rarch_joypad_driver_t *joypad_drivers[] = { NULL, }; +/** + * config_get_joypad_driver_options: + * + * Get an enumerated list of all joypad driver names, separated by '|'. + * + * Returns: string listing of all joypad driver names, separated by '|'. + **/ const char* config_get_joypad_driver_options(void) { union string_list_elem_attr attr; @@ -227,6 +234,7 @@ const struct input_key_map input_config_key_map[] = { static enum retro_key find_rk_bind(const char *str) { size_t i; + for (i = 0; input_config_key_map[i].str; i++) { if (strcasecmp(input_config_key_map[i].str, str) == 0) @@ -244,6 +252,17 @@ enum retro_key input_translate_str_to_rk(const char *str) return find_rk_bind(str); } +/** + * input_joypad_init_driver: + * @ident : identifier of driver to initialize. + * + * Initialize a joypad driver of name @ident. + * + * If ident points to NULL or a zero-length string, + * equivalent to calling input_joypad_init_first(). + * + * Returns: joypad driver if found, otherwise NULL. + **/ const rarch_joypad_driver_t *input_joypad_init_driver(const char *ident) { unsigned i; @@ -264,9 +283,17 @@ const rarch_joypad_driver_t *input_joypad_init_driver(const char *ident) return input_joypad_init_first(); } +/** + * input_joypad_init_first: + * + * Finds first suitable joypad driver and initializes. + * + * Returns: joypad driver if found, otherwise NULL. + **/ const rarch_joypad_driver_t *input_joypad_init_first(void) { unsigned i; + for (i = 0; joypad_drivers[i]; i++) { if (joypad_drivers[i]->init()) diff --git a/input/input_context.h b/input/input_context.h index e104e28a76..d5ceb01216 100644 --- a/input/input_context.h +++ b/input/input_context.h @@ -25,6 +25,8 @@ extern "C" { #include #include "../libretro.h" +typedef struct rarch_joypad_driver rarch_joypad_driver_t; + enum retro_rumble_effect; struct rarch_joypad_driver @@ -40,16 +42,6 @@ struct rarch_joypad_driver const char *ident; }; - -typedef struct rarch_joypad_driver rarch_joypad_driver_t; - -const char* config_get_joypad_driver_options(void); - -/* If ident points to NULL or a zero-length string, - * equivalent to calling input_joypad_init_first(). */ -const rarch_joypad_driver_t *input_joypad_init_driver(const char *ident); - -const rarch_joypad_driver_t *input_joypad_init_first(void); extern rarch_joypad_driver_t dinput_joypad; extern rarch_joypad_driver_t linuxraw_joypad; @@ -67,6 +59,37 @@ extern rarch_joypad_driver_t android_joypad; extern rarch_joypad_driver_t qnx_joypad; extern rarch_joypad_driver_t null_joypad; +/** + * config_get_joypad_driver_options: + * + * Get an enumerated list of all joypad driver names, separated by '|'. + * + * Returns: string listing of all joypad driver names, separated by '|'. + **/ +const char* config_get_joypad_driver_options(void); + +/** + * input_joypad_init_driver: + * @ident : identifier of driver to initialize. + * + * Initialize a joypad driver of name @ident. + * + * If ident points to NULL or a zero-length string, + * equivalent to calling input_joypad_init_first(). + * + * Returns: joypad driver if found, otherwise NULL. + **/ +const rarch_joypad_driver_t *input_joypad_init_driver(const char *ident); + +/** + * input_joypad_init_first: + * + * Finds first suitable joypad driver and initializes. + * + * Returns: joypad driver if found, otherwise NULL. + **/ +const rarch_joypad_driver_t *input_joypad_init_first(void); + #ifdef __cplusplus } #endif