Call menu_driver_render_messagebox from one place only

This commit is contained in:
twinaphex 2015-08-17 06:31:39 +02:00
parent fb3009d07a
commit 032abfffd4
3 changed files with 10 additions and 10 deletions

View File

@ -382,8 +382,6 @@ static int action_iterate_menu_viewport(char *s, size_t len,
base_msg, custom->x, custom->y, custom->width, custom->height); base_msg, custom->x, custom->y, custom->width, custom->height);
} }
menu_driver_render_messagebox(s);
if (!custom->width) if (!custom->width)
custom->width = stride_x; custom->width = stride_x;
if (!custom->height) if (!custom->height)
@ -470,11 +468,16 @@ static int action_iterate_main(const char *label, unsigned action)
action = MENU_ACTION_OK; action = MENU_ACTION_OK;
break; break;
case ITERATE_TYPE_BIND: case ITERATE_TYPE_BIND:
if (menu_input_bind_iterate()) if (menu_input_bind_iterate(msg, sizeof(msg)))
{
if (msg[0] != '\0')
do_messagebox = true;
menu_list_pop_stack(menu_list); menu_list_pop_stack(menu_list);
}
break; break;
case ITERATE_TYPE_VIEWPORT: case ITERATE_TYPE_VIEWPORT:
ret = action_iterate_menu_viewport(msg, sizeof(msg), label, action, hash); ret = action_iterate_menu_viewport(msg, sizeof(msg), label, action, hash);
do_messagebox = true;
break; break;
case ITERATE_TYPE_INFO: case ITERATE_TYPE_INFO:
ret = action_iterate_info(msg, sizeof(msg), label); ret = action_iterate_info(msg, sizeof(msg), label);

View File

@ -529,11 +529,10 @@ static int menu_input_bind_iterate_keyboard(int64_t current, int timeout)
return 0; return 0;
} }
int menu_input_bind_iterate(void) int menu_input_bind_iterate(char *s, size_t len)
{ {
int64_t current; int64_t current;
struct menu_bind_state binds; struct menu_bind_state binds;
char msg[PATH_MAX_LENGTH] = {0};
int timeout = 0; int timeout = 0;
menu_input_t *menu_input = menu_input_get_ptr(); menu_input_t *menu_input = menu_input_get_ptr();
driver_t *driver = driver_get_ptr(); driver_t *driver = driver_get_ptr();
@ -546,20 +545,18 @@ int menu_input_bind_iterate(void)
timeout = (menu_input->binds.timeout_end - current) / 1000000; timeout = (menu_input->binds.timeout_end - current) / 1000000;
if (bind_mode_kb) if (bind_mode_kb)
snprintf(msg, sizeof(msg), snprintf(s, len,
"[%s]\npress keyboard\n(timeout %d %s)", "[%s]\npress keyboard\n(timeout %d %s)",
input_config_bind_map[ input_config_bind_map[
menu_input->binds.begin - MENU_SETTINGS_BIND_BEGIN].desc, menu_input->binds.begin - MENU_SETTINGS_BIND_BEGIN].desc,
timeout, timeout,
menu_hash_to_str(MENU_VALUE_SECONDS)); menu_hash_to_str(MENU_VALUE_SECONDS));
else else
snprintf(msg, sizeof(msg), snprintf(s, len,
"[%s]\npress joypad\n(RETURN to skip)", "[%s]\npress joypad\n(RETURN to skip)",
input_config_bind_map[ input_config_bind_map[
menu_input->binds.begin - MENU_SETTINGS_BIND_BEGIN].desc); menu_input->binds.begin - MENU_SETTINGS_BIND_BEGIN].desc);
menu_driver_render_messagebox(msg);
if (bind_mode_kb) if (bind_mode_kb)
return menu_input_bind_iterate_keyboard(current, timeout); return menu_input_bind_iterate_keyboard(current, timeout);

View File

@ -193,7 +193,7 @@ void menu_input_st_string_callback(void *userdata, const char *str);
void menu_input_st_cheat_callback(void *userdata, const char *str); void menu_input_st_cheat_callback(void *userdata, const char *str);
int menu_input_bind_iterate(void); int menu_input_bind_iterate(char *s, size_t len);
unsigned menu_input_frame(retro_input_t input, retro_input_t trigger_state); unsigned menu_input_frame(retro_input_t input, retro_input_t trigger_state);