From 8e4683fa10eac95950bd3462744f3bb8b542864b Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 8 Sep 2016 14:25:14 +0200 Subject: [PATCH] Compiles without HAVE_MENU defined again --- frontend/drivers/platform_linux.c | 2 + menu/menu_setting.c | 87 ----------------------- setting_list.c | 112 ++++++++++++++++++++++++++++++ setting_list.h | 10 +++ 4 files changed, 124 insertions(+), 87 deletions(-) diff --git a/frontend/drivers/platform_linux.c b/frontend/drivers/platform_linux.c index 1829daa674..6e635e5b18 100644 --- a/frontend/drivers/platform_linux.c +++ b/frontend/drivers/platform_linux.c @@ -1876,6 +1876,7 @@ static void frontend_linux_init(void *data) static int frontend_linux_parse_drive_list(void *data) { +#ifdef HAVE_MENU file_list_t *list = (file_list_t*)data; #ifdef ANDROID @@ -1896,6 +1897,7 @@ static int frontend_linux_parse_drive_list(void *data) menu_entries_append_enum(list, "/", "", MSG_UNKNOWN, FILE_TYPE_DIRECTORY, 0, 0); +#endif return 0; } diff --git a/menu/menu_setting.c b/menu/menu_setting.c index ade3fda2b2..5d0c477d52 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -1374,46 +1374,6 @@ static void menu_input_st_string_cb(void *userdata, const char *str) menu_input_key_end_line(); } -static int setting_generic_action_ok_linefeed(void *data, bool wraparound) -{ - menu_input_ctx_line_t line; - input_keyboard_line_complete_t cb = NULL; - rarch_setting_t *setting = (rarch_setting_t*)data; - const char *short_description = menu_setting_get_short_description(setting); - - if (!setting) - return -1; - - (void)wraparound; - - switch (setting_get_type(setting)) - { - case ST_UINT: - cb = menu_input_st_uint_cb; - break; - case ST_HEX: - cb = menu_input_st_hex_cb; - break; - case ST_STRING: - case ST_STRING_OPTIONS: - cb = menu_input_st_string_cb; - break; - default: - break; - } - - line.label = short_description; - line.label_setting = setting->name; - line.type = 0; - line.idx = 0; - line.cb = cb; - - if (!menu_input_ctl(MENU_INPUT_CTL_START_LINE, &line)) - return -1; - - return 0; -} - static void get_string_representation_bind_device(void * data, char *s, size_t len) { @@ -1743,53 +1703,6 @@ void general_write_handler(void *data) command_event(rarch_cmd, NULL); } -static void setting_add_special_callbacks( - rarch_setting_t **list, - rarch_setting_info_t *list_info, - unsigned values) -{ - unsigned idx = list_info->index - 1; - - if (values & SD_FLAG_ALLOW_INPUT) - { - (*list)[idx].action_ok = setting_generic_action_ok_linefeed; - (*list)[idx].action_select = setting_generic_action_ok_linefeed; - - switch ((*list)[idx].type) - { - case ST_UINT: - (*list)[idx].action_cancel = NULL; - break; - case ST_HEX: - (*list)[idx].action_cancel = NULL; - break; - case ST_STRING: - (*list)[idx].action_start = setting_string_action_start_generic; - (*list)[idx].action_cancel = NULL; - break; - default: - break; - } - } -} - -void settings_data_list_current_add_flags( - rarch_setting_t **list, - rarch_setting_info_t *list_info, - unsigned values) -{ - (*list)[list_info->index - 1].flags |= values; - setting_add_special_callbacks(list, list_info, values); -} - -void settings_data_list_current_add_free_flags( - rarch_setting_t **list, - rarch_setting_info_t *list_info, - unsigned values) -{ - (*list)[list_info->index - 1].free_flags |= values; -} - #ifdef HAVE_OVERLAY static void overlay_enable_toggle_change_handler(void *data) { diff --git a/setting_list.c b/setting_list.c index b8e59b680f..ba15fc7ca5 100644 --- a/setting_list.c +++ b/setting_list.c @@ -166,9 +166,11 @@ static int setting_int_action_right_default(void *data, bool wraparound) { settings_t *settings = config_get_ptr(); +#ifdef HAVE_MENU if (settings && settings->menu.navigation.wraparound.enable) *setting->value.target.integer = min; else +#endif *setting->value.target.integer = max; } } @@ -176,6 +178,7 @@ static int setting_int_action_right_default(void *data, bool wraparound) return 0; } +#ifdef HAVE_MENU static int setting_bind_action_start(void *data) { unsigned bind_type; @@ -201,6 +204,7 @@ static int setting_bind_action_start(void *data) return 0; } +#endif static void setting_get_string_representation_hex(void *data, char *s, size_t len) @@ -264,9 +268,11 @@ static int setting_uint_action_right_default(void *data, bool wraparound) { settings_t *settings = config_get_ptr(); +#ifdef HAVE_MENU if (settings && settings->menu.navigation.wraparound.enable) *setting->value.target.unsigned_integer = min; else +#endif *setting->value.target.unsigned_integer = max; } } @@ -344,9 +350,11 @@ int setting_set_with_string_representation(rarch_setting_t* setting, { settings_t *settings = config_get_ptr(); +#ifdef HAVE_MENU if (settings && settings->menu.navigation.wraparound.enable) *setting->value.target.integer = min; else +#endif *setting->value.target.integer = max; } } @@ -362,9 +370,11 @@ int setting_set_with_string_representation(rarch_setting_t* setting, { settings_t *settings = config_get_ptr(); +#ifdef HAVE_MENU if (settings && settings->menu.navigation.wraparound.enable) *setting->value.target.unsigned_integer = min; else +#endif *setting->value.target.unsigned_integer = max; } } @@ -380,9 +390,11 @@ int setting_set_with_string_representation(rarch_setting_t* setting, { settings_t *settings = config_get_ptr(); +#ifdef HAVE_MENU if (settings && settings->menu.navigation.wraparound.enable) *setting->value.target.fraction = min; else +#endif *setting->value.target.fraction = max; } } @@ -454,9 +466,11 @@ static int setting_fraction_action_right_default( { settings_t *settings = config_get_ptr(); +#ifdef HAVE_MENU if (settings && settings->menu.navigation.wraparound.enable) *setting->value.target.fraction = min; else +#endif *setting->value.target.fraction = max; } } @@ -1018,7 +1032,11 @@ static rarch_setting_t setting_bind_setting(const char* name, result.change_handler = NULL; result.read_handler = NULL; +#ifdef HAVE_MENU result.action_start = setting_bind_action_start; +#else + result.action_start = NULL; +#endif result.action_left = NULL; result.action_right = NULL; result.action_up = NULL; @@ -1748,3 +1766,97 @@ bool END_SUB_GROUP( (*list)[list_info->index++] = value; return true; } + +#ifdef HAVE_MENU +static int setting_generic_action_ok_linefeed(void *data, bool wraparound) +{ + menu_input_ctx_line_t line; + input_keyboard_line_complete_t cb = NULL; + rarch_setting_t *setting = (rarch_setting_t*)data; + const char *short_description = menu_setting_get_short_description(setting); + + if (!setting) + return -1; + + (void)wraparound; + + switch (setting_get_type(setting)) + { + case ST_UINT: + cb = menu_input_st_uint_cb; + break; + case ST_HEX: + cb = menu_input_st_hex_cb; + break; + case ST_STRING: + case ST_STRING_OPTIONS: + cb = menu_input_st_string_cb; + break; + default: + break; + } + + line.label = short_description; + line.label_setting = setting->name; + line.type = 0; + line.idx = 0; + line.cb = cb; + + if (!menu_input_ctl(MENU_INPUT_CTL_START_LINE, &line)) + return -1; + + return 0; +} +#endif + +static void setting_add_special_callbacks( + rarch_setting_t **list, + rarch_setting_info_t *list_info, + unsigned values) +{ + unsigned idx = list_info->index - 1; + + if (values & SD_FLAG_ALLOW_INPUT) + { +#ifdef HAVE_MENU + (*list)[idx].action_ok = setting_generic_action_ok_linefeed; + (*list)[idx].action_select = setting_generic_action_ok_linefeed; +#else + (*list)[idx].action_ok = NULL; + (*list)[idx].action_select = NULL; +#endif + + switch ((*list)[idx].type) + { + case ST_UINT: + (*list)[idx].action_cancel = NULL; + break; + case ST_HEX: + (*list)[idx].action_cancel = NULL; + break; + case ST_STRING: + (*list)[idx].action_start = setting_string_action_start_generic; + (*list)[idx].action_cancel = NULL; + break; + default: + break; + } + } +} + +void settings_data_list_current_add_flags( + rarch_setting_t **list, + rarch_setting_info_t *list_info, + unsigned values) +{ + (*list)[list_info->index - 1].flags |= values; + setting_add_special_callbacks(list, list_info, values); +} + +void settings_data_list_current_add_free_flags( + rarch_setting_t **list, + rarch_setting_info_t *list_info, + unsigned values) +{ + (*list)[list_info->index - 1].free_flags |= values; +} diff --git a/setting_list.h b/setting_list.h index 886a9cf1f9..a63b43f5d7 100644 --- a/setting_list.h +++ b/setting_list.h @@ -357,6 +357,16 @@ int setting_generic_action_ok_default(void *data, bool wraparound); int setting_generic_action_start_default(void *data); +void settings_data_list_current_add_flags( + rarch_setting_t **list, + rarch_setting_info_t *list_info, + unsigned values); + +void settings_data_list_current_add_free_flags( + rarch_setting_t **list, + rarch_setting_info_t *list_info, + unsigned values); + rarch_setting_t setting_terminator_setting(void); RETRO_END_DECLS