These functions always return true

This commit is contained in:
twinaphex 2019-08-15 15:42:24 +02:00
parent 17957e0816
commit 6c775ef170
3 changed files with 16 additions and 10 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -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;
}