Reintroduce menu widgets, implement new runloop_msg_queue

This commit is contained in:
natinusala 2019-02-21 10:23:21 +01:00
parent 239f3febc6
commit 42325ea368
4 changed files with 2137 additions and 4 deletions

View File

@ -26,6 +26,10 @@
#ifdef HAVE_MENU
#include "menu/menu_driver.h"
#include "menu/menu_driver.h"
#ifdef HAVE_MENU_WIDGETS
#include "menu/widgets/menu_widgets.h"
#endif
#endif
#include "dynamic.h"
@ -385,6 +389,13 @@ void drivers_init(int flags)
core_info_init_current_core();
#ifdef HAVE_MENU
#ifdef HAVE_MENU_WIDGETS
if (video_driver_has_widgets())
{
menu_widgets_init(video_is_threaded);
menu_widgets_context_reset(video_is_threaded);
}
#endif
if (flags & DRIVER_VIDEO_MASK)
{
@ -486,6 +497,15 @@ bool driver_ctl(enum driver_ctl_state state, void *data)
switch (state)
{
case RARCH_DRIVER_CTL_DEINIT:
#if defined(HAVE_MENU) && defined(HAVE_MENU_WIDGETS)
/* Tear down menu widgets no matter what
* in case the handle is lost in the threaded
* video driver in the meantime
* (breaking video_driver_has_widgets) */
menu_widgets_context_destroy();
menu_widgets_free();
#endif
video_driver_destroy();
audio_driver_destroy();
input_driver_destroy();

File diff suppressed because it is too large Load Diff

View File

@ -21,4 +21,59 @@
#include <queues/task_queue.h>
#include <queues/message_queue.h>
#endif
#define DEFAULT_BACKDROP 0.75f
#define MSG_QUEUE_PENDING_MAX 32
#define MSG_QUEUE_ONSCREEN_MAX 4
#define MSG_QUEUE_ANIMATION_DURATION 330
#define VOLUME_DURATION 3000
#define SCREENSHOT_DURATION_IN 66
#define SCREENSHOT_DURATION_OUT SCREENSHOT_DURATION_IN*10
#define SCREENSHOT_NOTIFICATION_DURATION 4000
#define TASK_FINISHED_DURATION 3000
#define HOURGLASS_INTERVAL 5000
#define HOURGLASS_DURATION 1000
void menu_widgets_init(bool video_is_threaded);
void menu_widgets_free(void);
bool menu_widgets_ready(void);
bool menu_widgets_msg_queue_push(const char *msg,
unsigned duration,
char *title,
enum message_queue_icon icon, enum message_queue_category category,
unsigned prio, bool flush);
bool menu_widgets_volume_update_and_show(void);
bool menu_widgets_set_fps_text(char *fps_text);
void menu_widgets_iterate(void);
bool menu_widgets_set_paused(bool is_paused);
bool menu_widgets_set_fast_forward(bool is_fast_forward);
bool menu_widgets_set_rewind(bool is_rewind);
bool menu_widgets_task_msg_queue_push(retro_task_t *task,
const char *msg,
unsigned prio, unsigned duration,
bool flush);
void menu_widgets_take_screenshot(void);
void menu_widgets_screenshot_taken(const char *shotname, const char *filename);
void menu_widgets_start_load_content_animation(const char *content_name, bool remove_extension);
void menu_widgets_cleanup_load_content_animation(void);
void menu_widgets_context_reset(bool is_threaded);
void menu_widgets_context_destroy(void);
/* All the functions below should be called in
* the video driver - once they are all added, set
* enable_menu_widgets to true for that driver */
void menu_widgets_frame(video_frame_info_t *video_info);
#endif

View File

@ -64,6 +64,9 @@
#include "menu/menu_input.h"
#include "menu/widgets/menu_dialog.h"
#include "menu/widgets/menu_input_dialog.h"
#ifdef HAVE_MENU_WIDGETS
#include "menu/widgets/menu_widgets.h"
#endif
#endif
#ifdef HAVE_CHEEVOS
@ -2531,12 +2534,14 @@ global_t *global_get_ptr(void)
return &g_extern;
}
void runloop_task_msg_queue_push(retro_task_t *task,
const char *msg,
void runloop_task_msg_queue_push(retro_task_t *task, const char *msg,
unsigned prio, unsigned duration,
bool flush)
{
runloop_msg_queue_push(msg, prio, duration, flush, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
#if defined(HAVE_MENU) && defined(HAVE_MENU_WIDGETS)
if (!video_driver_has_widgets() || !menu_widgets_task_msg_queue_push(task, msg, prio, duration, flush))
#endif
runloop_msg_queue_push(msg, prio, duration, flush, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
void runloop_msg_queue_push(const char *msg,
@ -2547,6 +2552,12 @@ void runloop_msg_queue_push(const char *msg,
{
runloop_ctx_msg_info_t msg_info;
#if defined(HAVE_MENU) && defined(HAVE_MENU_WIDGETS)
/* People have 60FPS in mind when they use runloop_msg_queue_push */
if (video_driver_has_widgets() && menu_widgets_msg_queue_push(msg, duration / 60 * 1000, title, icon, category, prio, flush))
return;
#endif
#ifdef HAVE_THREADS
runloop_msg_queue_lock();
#endif
@ -2924,6 +2935,10 @@ static enum runloop_state runloop_check_state(
#if defined(HAVE_MENU)
menu_animation_update();
#ifdef HAVE_MENU_WIDGETS
menu_widgets_iterate();
#endif
if (menu_is_alive)
{
enum menu_action action;