mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-02-10 05:33:14 +00:00
Merge pull request #8335 from natinusala/master
Reintroduce menu widgets (only runloop_msg_queue for now)
This commit is contained in:
commit
adc9ecf4cc
20
driver.c
20
driver.c
@ -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();
|
||||
|
@ -82,9 +82,10 @@ static void *switch_ctx_init(video_frame_info_t *video_info, void *video_driver)
|
||||
|
||||
nx_ctx_ptr = ctx_nx;
|
||||
|
||||
#if 0
|
||||
/* Comment below to enable error checking */
|
||||
setenv("MESA_NO_ERROR", "1", 1);
|
||||
|
||||
#if 0
|
||||
/* Uncomment below to enable Mesa logging: */
|
||||
setenv("EGL_LOG_LEVEL", "debug", 1);
|
||||
setenv("MESA_VERBOSE", "all", 1);
|
||||
|
@ -737,7 +737,6 @@ static void materialui_render_label_value(
|
||||
{
|
||||
menu_entry_t entry;
|
||||
menu_animation_ctx_ticker_t ticker;
|
||||
static const char ticker_spacer[] = " | ";
|
||||
char label_str[255];
|
||||
char value_str[255];
|
||||
char *sublabel_str = NULL;
|
||||
@ -755,7 +754,7 @@ static void materialui_render_label_value(
|
||||
|
||||
/* Initial ticker configuration */
|
||||
ticker.type_enum = (enum menu_animation_ticker_type)settings->uints.menu_ticker_type;
|
||||
ticker.spacer = ticker_spacer;
|
||||
ticker.spacer = NULL;
|
||||
|
||||
label_str[0] = value_str[0] = '\0';
|
||||
|
||||
@ -1066,7 +1065,6 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
|
||||
menu_display_ctx_clearcolor_t clearcolor;
|
||||
|
||||
menu_animation_ctx_ticker_t ticker;
|
||||
static const char ticker_spacer[] = " | ";
|
||||
menu_display_ctx_draw_t draw;
|
||||
char msg[255];
|
||||
char title_buf[255];
|
||||
@ -1172,7 +1170,7 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
|
||||
|
||||
/* Initial ticker configuration */
|
||||
ticker.type_enum = (enum menu_animation_ticker_type)settings->uints.menu_ticker_type;
|
||||
ticker.spacer = ticker_spacer;
|
||||
ticker.spacer = NULL;
|
||||
|
||||
usable_width = width - (mui->margin * 2);
|
||||
|
||||
|
@ -848,7 +848,7 @@ static void ozone_draw_header(ozone_handle_t *ozone, video_frame_info_t *video_i
|
||||
{
|
||||
char title[255];
|
||||
menu_animation_ctx_ticker_t ticker;
|
||||
static const char* const ticker_spacer = TICKER_SPACER;
|
||||
static const char* const ticker_spacer = OZONE_TICKER_SPACER;
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned timedate_offset = 0;
|
||||
|
||||
|
@ -64,11 +64,11 @@ typedef struct ozone_handle ozone_handle_t;
|
||||
|
||||
#if defined(__APPLE__)
|
||||
/* UTF-8 support is currently broken on Apple devices... */
|
||||
#define TICKER_SPACER " | "
|
||||
#define OZONE_TICKER_SPACER " | "
|
||||
#else
|
||||
/* <EM SPACE><BULLET><EM SPACE>
|
||||
* UCN equivalent: "\u2003\u2022\u2003" */
|
||||
#define TICKER_SPACER "\xE2\x80\x83\xE2\x80\xA2\xE2\x80\x83"
|
||||
#define OZONE_TICKER_SPACER "\xE2\x80\x83\xE2\x80\xA2\xE2\x80\x83"
|
||||
#endif
|
||||
|
||||
struct ozone_handle
|
||||
|
@ -408,7 +408,7 @@ border_iterate:
|
||||
menu_texture_item tex;
|
||||
menu_entry_t entry;
|
||||
menu_animation_ctx_ticker_t ticker;
|
||||
static const char* const ticker_spacer = TICKER_SPACER;
|
||||
static const char* const ticker_spacer = OZONE_TICKER_SPACER;
|
||||
char entry_value[255];
|
||||
char rich_label[255];
|
||||
char entry_value_ticker[255];
|
||||
|
@ -110,7 +110,7 @@ void ozone_draw_sidebar(ozone_handle_t *ozone, video_frame_info_t *video_info)
|
||||
unsigned i, sidebar_height, selection_y, selection_old_y, horizontal_list_size;
|
||||
char console_title[255];
|
||||
menu_animation_ctx_ticker_t ticker;
|
||||
static const char* const ticker_spacer = TICKER_SPACER;
|
||||
static const char* const ticker_spacer = OZONE_TICKER_SPACER;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
/* Initial ticker configuration */
|
||||
|
@ -62,7 +62,7 @@
|
||||
#define RGUI_TERM_WIDTH(width) (((width - RGUI_TERM_START_X(width) - RGUI_TERM_START_X(width)) / (FONT_WIDTH_STRIDE)))
|
||||
#define RGUI_TERM_HEIGHT(width, height) (((height - RGUI_TERM_START_Y(height) - RGUI_TERM_START_X(width)) / (FONT_HEIGHT_STRIDE)) - 1)
|
||||
|
||||
#define TICKER_SPACER " | "
|
||||
#define RGUI_TICKER_SPACER " | "
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -1467,7 +1467,7 @@ static void rgui_frame(void *data, video_frame_info_t *video_info)
|
||||
static void rgui_render(void *data, bool is_idle)
|
||||
{
|
||||
menu_animation_ctx_ticker_t ticker;
|
||||
static const char* const ticker_spacer = TICKER_SPACER;
|
||||
static const char* const ticker_spacer = RGUI_TICKER_SPACER;
|
||||
unsigned x, y;
|
||||
size_t i, end, fb_pitch, old_start;
|
||||
unsigned fb_width, fb_height;
|
||||
@ -2263,7 +2263,7 @@ static void rgui_update_menu_sublabel(rgui_t *rgui)
|
||||
|
||||
if (!string_is_empty(entry.sublabel))
|
||||
{
|
||||
static const char* const sublabel_spacer = TICKER_SPACER;
|
||||
static const char* const sublabel_spacer = RGUI_TICKER_SPACER;
|
||||
struct string_list *list = NULL;
|
||||
size_t line_index;
|
||||
bool prev_line_empty = true;
|
||||
|
@ -2329,7 +2329,6 @@ static int stripes_draw_item(
|
||||
{
|
||||
float icon_x, icon_y, label_offset;
|
||||
menu_animation_ctx_ticker_t ticker;
|
||||
static const char ticker_spacer[] = " | ";
|
||||
char tmp[255];
|
||||
char *ticker_str = NULL;
|
||||
unsigned entry_type = 0;
|
||||
@ -2343,7 +2342,7 @@ static int stripes_draw_item(
|
||||
|
||||
/* Initial ticker configuration */
|
||||
ticker.type_enum = settings->uints.menu_ticker_type;
|
||||
ticker.spacer = ticker_spacer;
|
||||
ticker.spacer = NULL;
|
||||
|
||||
if (!node)
|
||||
goto iterate;
|
||||
|
@ -2803,7 +2803,6 @@ static int xmb_draw_item(
|
||||
float icon_x, icon_y, label_offset;
|
||||
menu_animation_ctx_ticker_t ticker;
|
||||
char tmp[255];
|
||||
static const char ticker_spacer[] = " | ";
|
||||
char *ticker_str = NULL;
|
||||
unsigned entry_type = 0;
|
||||
const float half_size = xmb->icon_size / 2.0f;
|
||||
@ -2816,7 +2815,7 @@ static int xmb_draw_item(
|
||||
|
||||
/* Initial ticker configuration */
|
||||
ticker.type_enum = (enum menu_animation_ticker_type)settings->uints.menu_ticker_type;
|
||||
ticker.spacer = ticker_spacer;
|
||||
ticker.spacer = NULL;
|
||||
|
||||
if (!node)
|
||||
goto iterate;
|
||||
|
@ -560,14 +560,13 @@ static void xui_render(void *data, bool is_idle)
|
||||
if (XuiHandleIsValid(m_menutitle))
|
||||
{
|
||||
menu_animation_ctx_ticker_t ticker;
|
||||
static const char ticker_spacer[] = " | ";
|
||||
menu_entries_get_title(title, sizeof(title));
|
||||
mbstowcs(strw_buffer, title, sizeof(strw_buffer) / sizeof(wchar_t));
|
||||
XuiTextElementSetText(m_menutitle, strw_buffer);
|
||||
|
||||
/* Initial ticker configuration */
|
||||
ticker.type_enum = settings->uints.menu_ticker_type;
|
||||
ticker.spacer = ticker_spacer;
|
||||
ticker.spacer = NULL;
|
||||
|
||||
ticker.s = title;
|
||||
ticker.len = RXUI_TERM_WIDTH(fb_width) - 3;
|
||||
|
@ -63,6 +63,8 @@ typedef struct menu_animation menu_animation_t;
|
||||
#define TICKER_SPEED 333
|
||||
#define TICKER_SLOW_SPEED 1600
|
||||
|
||||
static const char ticker_spacer_default[] = TICKER_SPACER_DEFAULT;
|
||||
|
||||
static menu_animation_t anim;
|
||||
static retro_time_t cur_time = 0;
|
||||
static retro_time_t old_time = 0;
|
||||
@ -658,10 +660,13 @@ bool menu_animation_update(void)
|
||||
return animation_is_active;
|
||||
}
|
||||
|
||||
bool menu_animation_ticker(const menu_animation_ctx_ticker_t *ticker)
|
||||
bool menu_animation_ticker(menu_animation_ctx_ticker_t *ticker)
|
||||
{
|
||||
size_t str_len = utf8len(ticker->str);
|
||||
|
||||
if (!ticker->spacer)
|
||||
ticker->spacer = ticker_spacer_default;
|
||||
|
||||
if ((size_t)str_len <= ticker->len)
|
||||
{
|
||||
utf8cpy(ticker->s,
|
||||
|
@ -25,6 +25,8 @@
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
#define TICKER_SPACER_DEFAULT " | ";
|
||||
|
||||
typedef float (*easing_cb) (float, float, float, float);
|
||||
typedef void (*tween_cb) (void*);
|
||||
|
||||
@ -149,7 +151,7 @@ void menu_animation_free(void);
|
||||
|
||||
bool menu_animation_update(void);
|
||||
|
||||
bool menu_animation_ticker(const menu_animation_ctx_ticker_t *ticker);
|
||||
bool menu_animation_ticker(menu_animation_ctx_ticker_t *ticker);
|
||||
|
||||
float menu_animation_get_delta_time(void);
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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
|
21
retroarch.c
21
retroarch.c
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user