From 6c775ef170dfdbb01d4ceae837047580c1a16a2c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 15 Aug 2019 15:42:24 +0200 Subject: [PATCH] These functions always return true --- menu/widgets/menu_widgets.c | 8 ++------ menu/widgets/menu_widgets.h | 4 ++-- retroarch.c | 14 ++++++++++++-- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/menu/widgets/menu_widgets.c b/menu/widgets/menu_widgets.c index c57e42325a..4a2cf7e1d6 100644 --- a/menu/widgets/menu_widgets.c +++ b/menu/widgets/menu_widgets.c @@ -2294,7 +2294,7 @@ static void menu_widgets_generic_message_fadeout(void *userdata) menu_animation_push(&entry); } -bool menu_widgets_set_message(char *msg) +void menu_widgets_set_message(char *msg) { menu_animation_ctx_tag tag = (uintptr_t) &generic_message_timer; menu_timer_ctx_entry_t timer; @@ -2312,8 +2312,6 @@ bool menu_widgets_set_message(char *msg) timer.userdata = NULL; menu_timer_start(&generic_message_timer, &timer); - - return true; } static void menu_widgets_libretro_message_fadeout(void *userdata) @@ -2333,7 +2331,7 @@ static void menu_widgets_libretro_message_fadeout(void *userdata) menu_animation_push(&entry); } -bool menu_widgets_set_libretro_message(const char *msg, unsigned duration) +void menu_widgets_set_libretro_message(const char *msg, unsigned duration) { menu_animation_ctx_tag tag = (uintptr_t) &libretro_message_timer; menu_timer_ctx_entry_t timer; @@ -2354,6 +2352,4 @@ bool menu_widgets_set_libretro_message(const char *msg, unsigned duration) /* Compute text width */ libretro_message_width = font_driver_get_message_width(font_regular, msg, (unsigned)strlen(msg), 1) + simple_widget_padding * 2; - - return true; } diff --git a/menu/widgets/menu_widgets.h b/menu/widgets/menu_widgets.h index 12f596477a..60d8f6916a 100644 --- a/menu/widgets/menu_widgets.h +++ b/menu/widgets/menu_widgets.h @@ -75,10 +75,10 @@ void menu_widgets_context_destroy(void); bool menu_widgets_push_achievement(const char *title, const char *badge); /* Warning: not thread safe! */ -bool menu_widgets_set_message(char *message); +void menu_widgets_set_message(char *message); /* Warning: not thread safe! */ -bool menu_widgets_set_libretro_message(const char *message, unsigned duration); +void menu_widgets_set_libretro_message(const char *message, unsigned duration); /* All the functions below should be called in * the video driver - once they are all added, set diff --git a/retroarch.c b/retroarch.c index 5c382972f1..38ec063656 100644 --- a/retroarch.c +++ b/retroarch.c @@ -2201,10 +2201,15 @@ bool command_set_shader(const char *arg) snprintf(msg, sizeof(msg), "Shader: \"%s\"", arg ? path_basename(arg) : "null"); #ifdef HAVE_MENU_WIDGETS - if (!menu_widgets_inited || !menu_widgets_set_message(msg)) + if (!menu_widgets_inited) +#endif + { +#ifdef HAVE_MENU_WIDGETS + menu_widgets_set_message(msg); #endif runloop_msg_queue_push(msg, 1, 120, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); + } RARCH_LOG("%s \"%s\".\n", msg_hash_to_str(MSG_APPLYING_SHADER), arg); @@ -6729,9 +6734,14 @@ static bool rarch_environment_cb(unsigned cmd, void *data) const struct retro_message *msg = (const struct retro_message*)data; RARCH_LOG("Environ SET_MESSAGE: %s\n", msg->msg); #ifdef HAVE_MENU_WIDGETS - if (!menu_widgets_inited || !menu_widgets_set_libretro_message(msg->msg, roundf((float)msg->frames / 60.0f * 1000.0f))) + if (!menu_widgets_inited) +#endif + { +#ifdef HAVE_MENU_WIDGETS + menu_widgets_set_libretro_message(msg->msg, roundf((float)msg->frames / 60.0f * 1000.0f)); #endif runloop_msg_queue_push(msg->msg, 3, msg->frames, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); + } break; }