2018-11-22 14:45:52 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
|
|
|
* Copyright (C) 2018 - natinusala
|
|
|
|
*
|
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2020-02-17 00:43:40 +00:00
|
|
|
#ifndef _GFX_WIDGETS_H
|
|
|
|
#define _GFX_WIDGETS_H
|
2018-11-22 14:45:52 +00:00
|
|
|
|
2020-02-23 10:03:38 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "../config.h"
|
|
|
|
#endif
|
|
|
|
|
2021-09-30 13:29:57 +00:00
|
|
|
#include <retro_common_api.h>
|
2020-01-12 20:46:28 +00:00
|
|
|
#include <formats/image.h>
|
2018-11-22 14:45:52 +00:00
|
|
|
#include <queues/task_queue.h>
|
|
|
|
#include <queues/message_queue.h>
|
2020-06-08 03:09:42 +00:00
|
|
|
#include <queues/fifo_queue.h>
|
|
|
|
|
|
|
|
#ifdef HAVE_THREADS
|
|
|
|
#include <rthreads/rthreads.h>
|
|
|
|
#endif
|
2018-11-22 14:45:52 +00:00
|
|
|
|
2020-03-09 13:18:29 +00:00
|
|
|
#include "gfx_animation.h"
|
2021-04-07 22:51:10 +00:00
|
|
|
#include "gfx_display.h"
|
2020-03-09 13:18:29 +00:00
|
|
|
|
2019-02-21 09:23:21 +00:00
|
|
|
#define DEFAULT_BACKDROP 0.75f
|
|
|
|
|
|
|
|
#define MSG_QUEUE_PENDING_MAX 32
|
|
|
|
#define MSG_QUEUE_ONSCREEN_MAX 4
|
|
|
|
|
|
|
|
#define MSG_QUEUE_ANIMATION_DURATION 330
|
|
|
|
#define TASK_FINISHED_DURATION 3000
|
|
|
|
#define HOURGLASS_INTERVAL 5000
|
|
|
|
#define HOURGLASS_DURATION 1000
|
|
|
|
|
2020-03-11 09:28:04 +00:00
|
|
|
/* TODO: Colors for warning, error and success */
|
|
|
|
|
2020-03-09 13:18:29 +00:00
|
|
|
#define TEXT_COLOR_INFO 0xD8EEFFFF
|
|
|
|
#if 0
|
|
|
|
#define TEXT_COLOR_SUCCESS 0x22B14CFF
|
|
|
|
#define TEXT_COLOR_ERROR 0xC23B22FF
|
|
|
|
#endif
|
|
|
|
#define TEXT_COLOR_FAINT 0x878787FF
|
|
|
|
|
2021-09-30 13:29:57 +00:00
|
|
|
RETRO_BEGIN_DECLS
|
|
|
|
|
2020-06-08 03:09:42 +00:00
|
|
|
enum gfx_widgets_icon
|
|
|
|
{
|
|
|
|
MENU_WIDGETS_ICON_PAUSED = 0,
|
|
|
|
MENU_WIDGETS_ICON_FAST_FORWARD,
|
|
|
|
MENU_WIDGETS_ICON_REWIND,
|
|
|
|
MENU_WIDGETS_ICON_SLOW_MOTION,
|
|
|
|
|
|
|
|
MENU_WIDGETS_ICON_HOURGLASS,
|
|
|
|
MENU_WIDGETS_ICON_CHECK,
|
2024-02-26 04:23:08 +00:00
|
|
|
MENU_WIDGETS_ICON_ADD,
|
|
|
|
MENU_WIDGETS_ICON_EXIT,
|
2020-06-08 03:09:42 +00:00
|
|
|
|
|
|
|
MENU_WIDGETS_ICON_INFO,
|
|
|
|
|
|
|
|
MENU_WIDGETS_ICON_ACHIEVEMENT,
|
|
|
|
|
|
|
|
MENU_WIDGETS_ICON_LAST
|
|
|
|
};
|
|
|
|
|
2020-07-19 23:58:49 +00:00
|
|
|
enum notification_show_screenshot_duration
|
|
|
|
{
|
|
|
|
NOTIFICATION_SHOW_SCREENSHOT_DURATION_NORMAL = 0,
|
|
|
|
NOTIFICATION_SHOW_SCREENSHOT_DURATION_FAST,
|
|
|
|
NOTIFICATION_SHOW_SCREENSHOT_DURATION_VERY_FAST,
|
|
|
|
NOTIFICATION_SHOW_SCREENSHOT_DURATION_INSTANT,
|
|
|
|
NOTIFICATION_SHOW_SCREENSHOT_DURATION_LAST
|
|
|
|
};
|
|
|
|
|
2020-07-20 17:44:55 +00:00
|
|
|
enum notification_show_screenshot_flash
|
|
|
|
{
|
|
|
|
NOTIFICATION_SHOW_SCREENSHOT_FLASH_NORMAL = 0,
|
|
|
|
NOTIFICATION_SHOW_SCREENSHOT_FLASH_FAST,
|
|
|
|
NOTIFICATION_SHOW_SCREENSHOT_FLASH_OFF,
|
|
|
|
NOTIFICATION_SHOW_SCREENSHOT_FLASH_LAST
|
|
|
|
};
|
|
|
|
|
2022-12-30 15:55:38 +00:00
|
|
|
enum cheevos_appearance_anchor
|
|
|
|
{
|
|
|
|
CHEEVOS_APPEARANCE_ANCHOR_TOPLEFT = 0,
|
|
|
|
CHEEVOS_APPEARANCE_ANCHOR_TOPCENTER,
|
|
|
|
CHEEVOS_APPEARANCE_ANCHOR_TOPRIGHT,
|
|
|
|
CHEEVOS_APPEARANCE_ANCHOR_BOTTOMLEFT,
|
|
|
|
CHEEVOS_APPEARANCE_ANCHOR_BOTTOMCENTER,
|
|
|
|
CHEEVOS_APPEARANCE_ANCHOR_BOTTOMRIGHT,
|
|
|
|
CHEEVOS_APPEARANCE_ANCHOR_LAST
|
|
|
|
};
|
|
|
|
|
2023-05-30 18:30:37 +00:00
|
|
|
enum disp_widget_flags_enum
|
|
|
|
{
|
|
|
|
DISPWIDG_FLAG_TASK_FINISHED = (1 << 0),
|
|
|
|
DISPWIDG_FLAG_TASK_ERROR = (1 << 1),
|
|
|
|
DISPWIDG_FLAG_TASK_CANCELLED = (1 << 2),
|
|
|
|
DISPWIDG_FLAG_EXPIRATION_TIMER_STARTED = (1 << 3),
|
|
|
|
/* Is it currently doing the fade out animation ? */
|
|
|
|
DISPWIDG_FLAG_DYING = (1 << 4),
|
|
|
|
/* Has the timer expired ? if so, should be set to dying */
|
|
|
|
DISPWIDG_FLAG_EXPIRED = (1 << 5),
|
|
|
|
/* Unfold animation */
|
|
|
|
DISPWIDG_FLAG_UNFOLDED = (1 << 6),
|
2024-02-26 04:23:08 +00:00
|
|
|
DISPWIDG_FLAG_UNFOLDING = (1 << 7),
|
|
|
|
/* Color style */
|
|
|
|
DISPWIDG_FLAG_POSITIVE = (1 << 8),
|
|
|
|
DISPWIDG_FLAG_NEGATIVE = (1 << 9)
|
2023-05-30 18:30:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* There can only be one message animation at a time to
|
|
|
|
* avoid confusing users */
|
|
|
|
enum dispgfx_widget_flags
|
|
|
|
{
|
|
|
|
DISPGFX_WIDGET_FLAG_MSG_QUEUE_HAS_ICONS = (1 << 0),
|
|
|
|
DISPGFX_WIDGET_FLAG_PERSISTING = (1 << 1),
|
|
|
|
DISPGFX_WIDGET_FLAG_MOVING = (1 << 2),
|
|
|
|
DISPGFX_WIDGET_FLAG_INITED = (1 << 3)
|
|
|
|
};
|
|
|
|
|
2020-06-08 03:09:42 +00:00
|
|
|
/* This structure holds all objects + metadata
|
|
|
|
* corresponding to a particular font */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
font_data_t *font;
|
2020-08-14 16:36:09 +00:00
|
|
|
video_font_raster_block_t raster_block; /* ptr alignment */
|
|
|
|
size_t usage_count;
|
2020-06-08 03:09:42 +00:00
|
|
|
unsigned glyph_width;
|
|
|
|
float line_height;
|
|
|
|
float line_ascender;
|
|
|
|
float line_descender;
|
|
|
|
float line_centre_offset;
|
|
|
|
} gfx_widget_font_data_t;
|
|
|
|
|
|
|
|
/* Font data */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
gfx_widget_font_data_t regular;
|
|
|
|
gfx_widget_font_data_t bold;
|
|
|
|
gfx_widget_font_data_t msg_queue;
|
|
|
|
} gfx_widget_fonts_t;
|
|
|
|
|
2020-06-26 23:15:21 +00:00
|
|
|
typedef struct disp_widget_msg
|
2020-06-08 03:09:42 +00:00
|
|
|
{
|
|
|
|
char *msg;
|
|
|
|
char *msg_new;
|
2020-08-14 16:31:28 +00:00
|
|
|
retro_task_t *task_ptr;
|
|
|
|
|
|
|
|
uint32_t task_ident;
|
2022-09-01 23:10:28 +00:00
|
|
|
size_t msg_len;
|
2020-06-08 03:09:42 +00:00
|
|
|
unsigned duration;
|
|
|
|
unsigned text_height;
|
2020-08-14 16:31:28 +00:00
|
|
|
unsigned width;
|
2020-06-08 03:09:42 +00:00
|
|
|
|
2020-08-14 16:31:28 +00:00
|
|
|
float msg_transition_animation;
|
2020-06-08 03:09:42 +00:00
|
|
|
float offset_y;
|
|
|
|
float alpha;
|
2020-08-14 16:31:28 +00:00
|
|
|
float unfold;
|
|
|
|
float hourglass_rotation;
|
2022-07-06 12:41:15 +00:00
|
|
|
float hourglass_timer; /* float alignment */
|
|
|
|
float expiration_timer; /* float alignment */
|
2020-06-08 03:09:42 +00:00
|
|
|
|
2022-10-06 04:53:13 +00:00
|
|
|
uint16_t flags;
|
2020-08-14 16:31:28 +00:00
|
|
|
int8_t task_progress;
|
2020-06-08 03:09:42 +00:00
|
|
|
/* How many tasks have used this notification? */
|
|
|
|
uint8_t task_count;
|
2020-06-26 23:15:21 +00:00
|
|
|
} disp_widget_msg_t;
|
2020-06-08 03:09:42 +00:00
|
|
|
|
|
|
|
typedef struct dispgfx_widget
|
|
|
|
{
|
2020-08-14 16:31:28 +00:00
|
|
|
uint64_t gfx_widgets_frame_count;
|
|
|
|
|
|
|
|
#ifdef HAVE_THREADS
|
|
|
|
slock_t* current_msgs_lock;
|
|
|
|
#endif
|
2020-09-18 00:18:21 +00:00
|
|
|
fifo_buffer_t msg_queue;
|
2020-08-14 16:31:28 +00:00
|
|
|
disp_widget_msg_t* current_msgs[MSG_QUEUE_ONSCREEN_MAX];
|
2020-08-14 16:36:09 +00:00
|
|
|
gfx_widget_fonts_t gfx_widget_fonts; /* ptr alignment */
|
2020-06-08 03:09:42 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_TRANSLATE
|
2020-08-14 16:31:28 +00:00
|
|
|
uintptr_t ai_service_overlay_texture;
|
2020-06-08 03:09:42 +00:00
|
|
|
#endif
|
2020-08-14 16:31:28 +00:00
|
|
|
uintptr_t msg_queue_icon;
|
|
|
|
uintptr_t msg_queue_icon_outline;
|
|
|
|
uintptr_t msg_queue_icon_rect;
|
|
|
|
uintptr_t gfx_widgets_icons_textures[
|
|
|
|
MENU_WIDGETS_ICON_LAST];
|
|
|
|
uintptr_t gfx_widgets_generic_tag;
|
|
|
|
|
|
|
|
size_t current_msgs_size;
|
|
|
|
|
2020-06-08 03:09:42 +00:00
|
|
|
#ifdef HAVE_TRANSLATE
|
2020-08-14 16:31:28 +00:00
|
|
|
int ai_service_overlay_state;
|
2020-06-08 03:09:42 +00:00
|
|
|
#endif
|
2020-08-14 16:31:28 +00:00
|
|
|
|
2020-06-08 03:09:42 +00:00
|
|
|
unsigned last_video_width;
|
|
|
|
unsigned last_video_height;
|
|
|
|
unsigned msg_queue_kill;
|
|
|
|
/* Count of messages bound to a task in current_msgs */
|
|
|
|
unsigned msg_queue_tasks_count;
|
2020-06-17 15:07:04 +00:00
|
|
|
|
2020-06-08 03:09:42 +00:00
|
|
|
unsigned simple_widget_padding;
|
|
|
|
unsigned simple_widget_height;
|
|
|
|
|
|
|
|
/* Used for both generic and libretro messages */
|
|
|
|
unsigned generic_message_height;
|
|
|
|
|
|
|
|
unsigned msg_queue_height;
|
2024-02-27 04:59:43 +00:00
|
|
|
unsigned msg_queue_padding;
|
2020-06-08 03:09:42 +00:00
|
|
|
unsigned msg_queue_spacing;
|
|
|
|
unsigned msg_queue_rect_start_x;
|
|
|
|
unsigned msg_queue_internal_icon_size;
|
|
|
|
unsigned msg_queue_internal_icon_offset;
|
|
|
|
unsigned msg_queue_icon_size_x;
|
|
|
|
unsigned msg_queue_icon_size_y;
|
|
|
|
unsigned msg_queue_icon_offset_y;
|
|
|
|
unsigned msg_queue_scissor_start_x;
|
|
|
|
unsigned msg_queue_default_rect_width_menu_alive;
|
|
|
|
unsigned msg_queue_default_rect_width;
|
|
|
|
unsigned msg_queue_regular_padding_x;
|
|
|
|
unsigned msg_queue_regular_text_start;
|
|
|
|
unsigned msg_queue_task_text_start_x;
|
|
|
|
unsigned msg_queue_task_rect_start_x;
|
|
|
|
unsigned msg_queue_task_hourglass_x;
|
|
|
|
unsigned divider_width_1px;
|
|
|
|
|
2020-08-14 16:31:28 +00:00
|
|
|
float last_scale_factor;
|
2020-10-02 20:12:05 +00:00
|
|
|
float backdrop_orig[16];
|
2020-10-05 17:54:54 +00:00
|
|
|
float msg_queue_bg[16];
|
2020-10-05 17:59:15 +00:00
|
|
|
float pure_white[16];
|
2020-06-08 03:09:42 +00:00
|
|
|
#ifdef HAVE_TRANSLATE
|
2020-08-14 16:31:28 +00:00
|
|
|
unsigned ai_service_overlay_width;
|
|
|
|
unsigned ai_service_overlay_height;
|
2023-10-24 07:27:06 +00:00
|
|
|
unsigned ai_service_text_position;
|
|
|
|
char ai_service_text[255];
|
2020-06-08 03:09:42 +00:00
|
|
|
#endif
|
|
|
|
|
2022-10-07 09:08:17 +00:00
|
|
|
uint8_t flags;
|
|
|
|
|
2022-08-01 00:07:36 +00:00
|
|
|
char assets_pkg_dir[PATH_MAX_LENGTH];
|
|
|
|
char xmb_path[PATH_MAX_LENGTH]; /* TODO/FIXME - decouple from XMB */
|
|
|
|
char ozone_path[PATH_MAX_LENGTH]; /* TODO/FIXME - decouple from Ozone */
|
|
|
|
char ozone_regular_font_path[PATH_MAX_LENGTH]; /* TODO/FIXME - decouple from Ozone */
|
|
|
|
char ozone_bold_font_path[PATH_MAX_LENGTH]; /* TODO/FIXME - decouple from Ozone */
|
|
|
|
|
|
|
|
char monochrome_png_path[PATH_MAX_LENGTH];
|
|
|
|
char gfx_widgets_path[PATH_MAX_LENGTH];
|
2020-08-14 16:31:28 +00:00
|
|
|
char gfx_widgets_status_text[255];
|
|
|
|
|
2021-10-13 15:25:31 +00:00
|
|
|
bool active;
|
2020-06-08 03:09:42 +00:00
|
|
|
} dispgfx_widget_t;
|
|
|
|
|
2020-03-09 08:55:27 +00:00
|
|
|
/* A widget */
|
2022-10-07 09:08:17 +00:00
|
|
|
/* TODO/FIXME: cleanup all unused parameters */
|
2020-03-09 08:55:27 +00:00
|
|
|
struct gfx_widget
|
|
|
|
{
|
|
|
|
/* called when the widgets system is initialized
|
|
|
|
* -> initialize the widget here */
|
2021-04-07 22:51:10 +00:00
|
|
|
bool (*init)(gfx_display_t *p_disp,
|
|
|
|
gfx_animation_t *p_anim,
|
|
|
|
bool video_is_threaded, bool fullscreen);
|
2020-03-09 08:55:27 +00:00
|
|
|
|
|
|
|
/* called when the widgets system is freed
|
|
|
|
* -> free the widget here */
|
|
|
|
void (*free)(void);
|
|
|
|
|
|
|
|
/* called when the graphics context is reset
|
|
|
|
* -> (re)load the textures here */
|
|
|
|
void (*context_reset)(bool is_threaded,
|
|
|
|
unsigned width, unsigned height, bool fullscreen,
|
2020-03-11 10:44:45 +00:00
|
|
|
const char *dir_assets, char *font_path,
|
|
|
|
char* menu_png_path,
|
|
|
|
char* widgets_png_path);
|
2020-03-09 08:55:27 +00:00
|
|
|
|
|
|
|
/* called when the graphics context is destroyed
|
|
|
|
* -> release the textures here */
|
|
|
|
void (*context_destroy)(void);
|
|
|
|
|
|
|
|
/* called when the window resolution changes
|
|
|
|
* -> (re)layout the widget here */
|
2020-06-08 00:31:36 +00:00
|
|
|
void (*layout)(void *data,
|
|
|
|
bool is_threaded, const char *dir_assets, char *font_path);
|
2020-03-09 08:55:27 +00:00
|
|
|
|
|
|
|
/* called every frame on the main thread
|
|
|
|
* -> update the widget logic here */
|
2020-06-08 00:54:01 +00:00
|
|
|
void (*iterate)(void *user_data,
|
2020-03-09 08:55:27 +00:00
|
|
|
unsigned width, unsigned height, bool fullscreen,
|
|
|
|
const char *dir_assets, char *font_path,
|
|
|
|
bool is_threaded);
|
|
|
|
|
|
|
|
/* called every frame
|
|
|
|
* (on the video thread if threaded video is on)
|
2020-06-17 15:07:04 +00:00
|
|
|
* -- data is a video_frame_info_t
|
|
|
|
* -- userdata is a dispgfx_widget_t
|
2020-03-09 08:55:27 +00:00
|
|
|
* -> draw the widget here */
|
2020-06-08 00:31:36 +00:00
|
|
|
void (*frame)(void* data, void *userdata);
|
2020-03-09 08:55:27 +00:00
|
|
|
};
|
|
|
|
|
2020-03-09 13:18:29 +00:00
|
|
|
float gfx_widgets_get_thumbnail_scale_factor(
|
|
|
|
const float dst_width, const float dst_height,
|
|
|
|
const float image_width, const float image_height);
|
|
|
|
|
|
|
|
void gfx_widgets_draw_icon(
|
|
|
|
void *userdata,
|
2020-10-02 09:36:11 +00:00
|
|
|
void *data_disp,
|
2020-03-09 13:18:29 +00:00
|
|
|
unsigned video_width,
|
|
|
|
unsigned video_height,
|
|
|
|
unsigned icon_width,
|
|
|
|
unsigned icon_height,
|
|
|
|
uintptr_t texture,
|
|
|
|
float x, float y,
|
2022-07-06 09:40:59 +00:00
|
|
|
float radians,
|
|
|
|
float cosine,
|
|
|
|
float sine,
|
2020-03-09 13:18:29 +00:00
|
|
|
float *color);
|
|
|
|
|
2020-04-06 10:38:07 +00:00
|
|
|
void gfx_widgets_draw_text(
|
|
|
|
gfx_widget_font_data_t* font_data,
|
|
|
|
const char *text,
|
|
|
|
float x, float y,
|
|
|
|
int width, int height,
|
|
|
|
uint32_t color,
|
|
|
|
enum text_alignment text_align,
|
|
|
|
bool draw_outside);
|
|
|
|
|
|
|
|
void gfx_widgets_flush_text(
|
|
|
|
unsigned video_width, unsigned video_height,
|
|
|
|
gfx_widget_font_data_t* font_data);
|
|
|
|
|
2020-03-09 09:32:12 +00:00
|
|
|
typedef struct gfx_widget gfx_widget_t;
|
|
|
|
|
2020-03-11 11:35:01 +00:00
|
|
|
bool gfx_widgets_init(
|
2021-03-25 14:05:09 +00:00
|
|
|
void *data_disp,
|
2021-04-07 22:51:10 +00:00
|
|
|
void *data_anim,
|
2021-03-25 14:05:09 +00:00
|
|
|
void *settings_data,
|
2020-06-08 02:32:54 +00:00
|
|
|
uintptr_t widgets_active_ptr,
|
2020-03-11 11:35:01 +00:00
|
|
|
bool video_is_threaded,
|
|
|
|
unsigned width, unsigned height, bool fullscreen,
|
|
|
|
const char *dir_assets, char *font_path);
|
2020-06-07 23:41:21 +00:00
|
|
|
|
2021-09-30 02:40:15 +00:00
|
|
|
void gfx_widgets_deinit(bool widgets_persisting);
|
2019-02-21 09:23:21 +00:00
|
|
|
|
2020-02-17 00:43:40 +00:00
|
|
|
void gfx_widgets_msg_queue_push(
|
2019-06-18 19:24:42 +00:00
|
|
|
retro_task_t *task, const char *msg,
|
2019-02-21 09:23:21 +00:00
|
|
|
unsigned duration,
|
|
|
|
char *title,
|
2019-06-18 19:24:42 +00:00
|
|
|
enum message_queue_icon icon,
|
|
|
|
enum message_queue_category category,
|
2020-02-17 15:07:37 +00:00
|
|
|
unsigned prio, bool flush,
|
|
|
|
bool menu_is_alive);
|
2019-02-21 09:23:21 +00:00
|
|
|
|
2020-03-11 10:44:45 +00:00
|
|
|
void gfx_widget_volume_update_and_show(float new_volume,
|
2020-02-16 22:34:49 +00:00
|
|
|
bool mute);
|
2019-02-21 09:23:21 +00:00
|
|
|
|
2020-02-17 00:43:40 +00:00
|
|
|
void gfx_widgets_iterate(
|
2020-10-02 09:32:49 +00:00
|
|
|
void *data_disp,
|
2021-03-25 14:05:09 +00:00
|
|
|
void *settings_data,
|
2020-03-04 17:07:49 +00:00
|
|
|
unsigned width, unsigned height, bool fullscreen,
|
2020-02-16 22:38:24 +00:00
|
|
|
const char *dir_assets, char *font_path,
|
|
|
|
bool is_threaded);
|
2019-02-21 09:23:21 +00:00
|
|
|
|
2020-06-08 00:54:01 +00:00
|
|
|
void gfx_widget_screenshot_taken(void *data,
|
|
|
|
const char *shotname, const char *filename);
|
2019-02-21 09:23:21 +00:00
|
|
|
|
2019-10-23 21:15:14 +00:00
|
|
|
/* AI Service functions */
|
2020-02-23 10:03:38 +00:00
|
|
|
#ifdef HAVE_TRANSLATE
|
2020-02-17 00:43:40 +00:00
|
|
|
bool gfx_widgets_ai_service_overlay_load(
|
2020-06-11 01:27:01 +00:00
|
|
|
char* buffer, unsigned buffer_len,
|
|
|
|
enum image_type_enum image_type);
|
2019-10-23 21:15:14 +00:00
|
|
|
|
2021-09-30 02:40:15 +00:00
|
|
|
void gfx_widgets_ai_service_overlay_unload(void);
|
2020-02-23 10:03:38 +00:00
|
|
|
#endif
|
2019-10-23 21:15:14 +00:00
|
|
|
|
2020-06-17 15:07:04 +00:00
|
|
|
#ifdef HAVE_CHEEVOS
|
2023-01-04 17:42:35 +00:00
|
|
|
void gfx_widgets_update_cheevos_appearance(void);
|
2021-11-07 22:53:03 +00:00
|
|
|
void gfx_widgets_push_achievement(const char *title, const char* subtitle, const char *badge);
|
2020-09-24 15:25:56 +00:00
|
|
|
void gfx_widgets_set_leaderboard_display(unsigned id, const char* value);
|
2023-11-15 21:18:20 +00:00
|
|
|
void gfx_widgets_clear_leaderboard_displays(void);
|
2021-06-04 01:53:17 +00:00
|
|
|
void gfx_widgets_set_challenge_display(unsigned id, const char* badge);
|
2023-11-15 21:18:20 +00:00
|
|
|
void gfx_widgets_clear_challenge_displays(void);
|
2023-05-14 21:47:03 +00:00
|
|
|
void gfx_widget_set_achievement_progress(const char* badge, const char* progress);
|
2023-12-02 13:33:13 +00:00
|
|
|
void gfx_widget_set_cheevos_disconnect(bool visible);
|
2024-04-05 14:39:38 +00:00
|
|
|
void gfx_widget_set_cheevos_set_loading(bool visible);
|
2020-06-17 15:07:04 +00:00
|
|
|
#endif
|
2019-04-11 14:46:29 +00:00
|
|
|
|
2021-09-30 02:40:15 +00:00
|
|
|
/* TODO/FIXME/WARNING: Not thread safe! */
|
2020-08-24 12:26:40 +00:00
|
|
|
void gfx_widget_set_generic_message(
|
|
|
|
const char *message, unsigned duration);
|
2020-06-08 00:54:01 +00:00
|
|
|
void gfx_widget_set_libretro_message(
|
|
|
|
const char *message, unsigned duration);
|
2021-09-30 02:40:15 +00:00
|
|
|
void gfx_widget_set_progress_message(
|
2020-06-30 16:13:53 +00:00
|
|
|
const char *message, unsigned duration,
|
|
|
|
unsigned priority, int8_t progress);
|
2020-07-09 12:03:55 +00:00
|
|
|
bool gfx_widget_start_load_content_animation(void);
|
|
|
|
|
2019-02-21 09:23:21 +00:00
|
|
|
/* All the functions below should be called in
|
2019-04-11 14:46:29 +00:00
|
|
|
* the video driver - once they are all added, set
|
2019-02-21 09:23:21 +00:00
|
|
|
* enable_menu_widgets to true for that driver */
|
2020-02-17 00:43:40 +00:00
|
|
|
void gfx_widgets_frame(void *data);
|
2019-02-21 09:23:21 +00:00
|
|
|
|
2021-10-13 15:51:46 +00:00
|
|
|
bool gfx_widgets_ready(void);
|
|
|
|
|
2021-09-30 02:40:15 +00:00
|
|
|
dispgfx_widget_t *dispwidget_get_ptr(void);
|
2020-06-08 00:54:01 +00:00
|
|
|
|
2020-06-07 23:41:21 +00:00
|
|
|
extern const gfx_widget_t gfx_widget_screenshot;
|
|
|
|
extern const gfx_widget_t gfx_widget_volume;
|
|
|
|
extern const gfx_widget_t gfx_widget_generic_message;
|
|
|
|
extern const gfx_widget_t gfx_widget_libretro_message;
|
2020-06-30 16:13:53 +00:00
|
|
|
extern const gfx_widget_t gfx_widget_progress_message;
|
2020-07-09 12:03:55 +00:00
|
|
|
extern const gfx_widget_t gfx_widget_load_content_animation;
|
2020-06-07 23:41:21 +00:00
|
|
|
|
Netplay Stuff (#13375)
* Netplay Stuff
## PROTOCOL FALLBACK
In order to support older clients a protocol fallback system was introduced.
The host will no longer send its header automatically after a TCP connection is established, instead, it awaits for the client to send his before determining which protocol this connection is going to operate on.
Netplay has now two protocols, a low protocol and a high protocol; the low protocol is the minimum protocol it supports, while the high protocol is the highest protocol it can operate on.
To fully support older clients, a hack was necessary: sending the high protocol in the unused client's header salt field, while keeping the protocol field to the low protocol. Without this hack we would only be able to support older clients if a newer client was the host.
Any future system can make use of this system by checking connection->netplay_protocol, which is available for both the client and host.
## NETPLAY CHAT
Starting with protocol 6, netplay chat is available through the new NETPLAY_CMD_PLAYER_CHAT command.
Limitations of the command code, which causes a disconnection on unknown commands, makes this system not possible on protocol 5.
Protocol 5 connections can neither send nor receive chat, but other netplay operations are unaffected.
Clients send chat as a string to the server, and it's the server's sole responsability to relay chat messages.
As of now, sending chat uses RetroArch's input menu, while the display of on-screen chat uses a widget overlay and RetroArch's notifications as a fallback.
If a new overlay and/or input system is desired, no backwards compatibility changes need to be made.
Only clients in playing mode (as opposed to spectating mode) can send and receive chat.
## SETTINGS SHARING
Some settings are better used when both host and clients share the same configuration.
As of protocol 6, the following settings will be shared from host to clients (without altering a client's configuration file): input latency frames and allow pausing.
## NETPLAY TUNNEL/MITM
With the current MITM system being defunct (at least as of 1.9.X), a new system was in order to solve most if not all of the problems with the current system.
This new system uses a tunneling approach, which is similar to most VPN and tunneling services around.
Tunnel commands:
RATS[unique id] (RetroArch Tunnel Session) - 16 bytes -> When this command is sent with a zeroed unique id, the tunnel server interprets this as a netplay host wanting to create a new session, in this case, the same command is returned to the host, but now with its unique session id. When a client needs to connect to a host, this command is sent with the unique session id of the host, causing the tunnel server to send a RATL command to the host.
RATL[unique id] (RetroArch Tunnel Link) - 16 bytes -> The tunnel server sends this command to the host when a client wants to connect to the host. Once the host receives this command, it establishes a new connection to the tunnel server, sending this command together with the client's unique id through this new connection, causing the tunnel server to link this connection to the connection of the client.
RATP (RetroArch Tunnel Ping) - 4 bytes -> The tunnel server sends this command to verify that the host, whom the session belongs to, is still around. The host replies with the same command. A session is closed if the tunnel server can not verify that the host is alive.
Operations:
Host -> Instead of listening and accepting connections, it connects to the tunnel server, requests a new session and then monitor this connection for new linking requests. Once a request is received, it establishes a new connection to the tunnel server for linking with a client. The tunnel server's address and port are obtained by querying the lobby server. The host will publish its session id together with the rest of its info to the lobby server.
Client -> It connects to the tunnel server and then sends the session id of the host it wants to connect to. A host's session id is obtained from the json data sent by the lobby server.
Improvements (from current MITM system):
No longer a risk of TCP port exhaustion; we only use one port now at the tunnel server.
Very little cpu usage. About 95% net I/O bound now.
Future backwards compatible with any and all changes to netplay as it no longer runs any netplay logic at MITM servers.
No longer operates the host in client mode, which was a source of many of the current problems.
Cleaner and more maintainable system and code.
Notable functions:
netplay_mitm_query -> Grabs the tunnel's address and port from the lobby server.
init_tcp_socket -> Handles the creation and operation mode of the TCP socket based on whether it's host, host+MITM or client.
handle_mitm_connection -> Creates and completes linking connections and replies to ping commands (only 1 of each per call to not affect performance).
## MISC
Ping Limiter: If a client's estimated latency to the server is higher than this value, connection will be dropped just before finishing the netplay handshake.
Ping Counter: A ping counter (similar to the FPS one) can be shown in the bottom right corner of the screen, if you are connected to a host.
LAN Discovery: Refactored and moved to its own "Refresh Netplay LAN List" button.
## FIXES
Many minor fixes to the current netplay implementation are also included.
* Remove NETPLAY_TEST_BUILD
2021-12-19 15:58:01 +00:00
|
|
|
#ifdef HAVE_NETWORKING
|
|
|
|
extern const gfx_widget_t gfx_widget_netplay_chat;
|
|
|
|
extern const gfx_widget_t gfx_widget_netplay_ping;
|
|
|
|
#endif
|
|
|
|
|
2020-06-17 15:07:04 +00:00
|
|
|
#ifdef HAVE_CHEEVOS
|
|
|
|
extern const gfx_widget_t gfx_widget_achievement_popup;
|
2020-09-24 15:25:56 +00:00
|
|
|
extern const gfx_widget_t gfx_widget_leaderboard_display;
|
2020-06-17 15:07:04 +00:00
|
|
|
#endif
|
2020-06-07 23:41:21 +00:00
|
|
|
|
2021-09-30 13:29:57 +00:00
|
|
|
RETRO_END_DECLS
|
|
|
|
|
2019-05-04 16:26:57 +00:00
|
|
|
#endif
|