Move RGUI specific code to RGUI file

This commit is contained in:
libretroadmin 2023-05-06 20:16:59 +02:00
parent 42370ac57e
commit 02a849d440
5 changed files with 50 additions and 98 deletions

View File

@ -2304,6 +2304,28 @@ static void rgui_process_wallpaper(
| RGUI_FLAG_SHOW_WALLPAPER;
}
static void rgui_handle_thumbnail_upload(
retro_task_t *task,
void *task_data,
void *user_data, const char *err)
{
menu_display_common_image_upload(
(struct texture_image*)task_data,
user_data,
MENU_IMAGE_THUMBNAIL);
}
static void rgui_handle_left_thumbnail_upload(
retro_task_t *task,
void *task_data,
void *user_data, const char *err)
{
menu_display_common_image_upload(
(struct texture_image*)task_data,
user_data,
MENU_IMAGE_LEFT_THUMBNAIL);
}
static bool rgui_request_thumbnail(
thumbnail_t *thumbnail,
enum gfx_thumbnail_id thumbnail_id,
@ -2334,8 +2356,8 @@ static bool rgui_request_thumbnail(
video_driver_supports_rgba(),
0,
(thumbnail_id == GFX_THUMBNAIL_LEFT)
? menu_display_handle_left_thumbnail_upload
: menu_display_handle_thumbnail_upload,
? rgui_handle_left_thumbnail_upload
: rgui_handle_thumbnail_upload,
NULL))
{
*queue_size = *queue_size + 1;

View File

@ -1285,7 +1285,7 @@ static void menu_list_free_list(
file_list_free(list);
}
static bool menu_list_pop_stack(
static void menu_list_pop_stack(
const menu_ctx_driver_t *menu_driver_ctx,
void *menu_userdata,
menu_list_t *list,
@ -1294,27 +1294,25 @@ static bool menu_list_pop_stack(
{
file_list_t *menu_list = MENU_LIST_GET(list, (unsigned)idx);
if (!menu_list)
return false;
if (menu_list->size != 0)
if (menu_list)
{
menu_ctx_list_t list_info;
if (menu_list->size != 0)
{
menu_ctx_list_t list_info;
list_info.list = menu_list;
list_info.idx = menu_list->size - 1;
list_info.list_size = menu_list->size - 1;
list_info.list = menu_list;
list_info.idx = menu_list->size - 1;
list_info.list_size = menu_list->size - 1;
menu_driver_list_free(menu_driver_ctx, &list_info);
menu_driver_list_free(menu_driver_ctx, &list_info);
}
file_list_pop(menu_list, directory_ptr);
if ( menu_driver_ctx &&
menu_driver_ctx->list_set_selection)
menu_driver_ctx->list_set_selection(menu_userdata,
menu_list);
}
file_list_pop(menu_list, directory_ptr);
if ( menu_driver_ctx &&
menu_driver_ctx->list_set_selection)
menu_driver_ctx->list_set_selection(menu_userdata,
menu_list);
return true;
}
static int menu_list_flush_stack_type(const char *needle, const char *label,
@ -3899,13 +3897,12 @@ void menu_entries_build_scroll_indices(
menu_st->scroll.index_size++;
}
static void menu_display_common_image_upload(
const menu_ctx_driver_t *menu_driver_ctx,
void *menu_userdata,
struct texture_image *img,
void *user_data,
unsigned type)
void menu_display_common_image_upload(void *data, void *user_data, unsigned type)
{
struct texture_image *img = (struct texture_image*)data;
struct menu_state *menu_st = &menu_driver_state;
const menu_ctx_driver_t *menu_driver_ctx = menu_st->driver_ctx;
void *menu_userdata = menu_st->userdata;
if ( menu_driver_ctx
&& menu_driver_ctx->load_image)
menu_driver_ctx->load_image(menu_userdata,
@ -4650,53 +4647,6 @@ bool menu_entries_ctl(enum menu_entries_ctl_state state, void *data)
return true;
}
/* TODO/FIXME - seems only RGUI uses this - can this be
* refactored away or we can have one common function used
* across all menu drivers? */
#ifdef HAVE_RGUI
void menu_display_handle_thumbnail_upload(
retro_task_t *task,
void *task_data,
void *user_data, const char *err)
{
struct menu_state *menu_st = &menu_driver_state;
menu_display_common_image_upload(
menu_st->driver_ctx,
menu_st->userdata,
(struct texture_image*)task_data,
user_data,
MENU_IMAGE_THUMBNAIL);
}
void menu_display_handle_left_thumbnail_upload(
retro_task_t *task,
void *task_data,
void *user_data, const char *err)
{
struct menu_state *menu_st = &menu_driver_state;
menu_display_common_image_upload(
menu_st->driver_ctx,
menu_st->userdata,
(struct texture_image*)task_data,
user_data,
MENU_IMAGE_LEFT_THUMBNAIL);
}
#endif
void menu_display_handle_savestate_thumbnail_upload(
retro_task_t *task,
void *task_data,
void *user_data, const char *err)
{
struct menu_state *menu_st = &menu_driver_state;
menu_display_common_image_upload(
menu_st->driver_ctx,
menu_st->userdata,
(struct texture_image*)task_data,
user_data,
MENU_IMAGE_SAVESTATE_THUMBNAIL);
}
/* Function that gets called when we want to load in a
* new menu wallpaper.
*/
@ -4705,10 +4655,7 @@ void menu_display_handle_wallpaper_upload(
void *task_data,
void *user_data, const char *err)
{
struct menu_state *menu_st = &menu_driver_state;
menu_display_common_image_upload(
menu_st->driver_ctx,
menu_st->userdata,
(struct texture_image*)task_data,
user_data,
MENU_IMAGE_WALLPAPER);
@ -5034,7 +4981,7 @@ static bool menu_driver_init_internal(
{
const char *ident = menu_st->driver_ctx->ident;
/* ID must be set first, since it is required for
* the proper determination of pixel/dpi scaling
* the proper determination of pixel/DPI scaling
* parameters (and some menu drivers fetch the
* current pixel/dpi scale during 'menu_driver_ctx->init()') */
if (ident)

View File

@ -651,18 +651,6 @@ bool menu_driver_screensaver_supported(void);
retro_time_t menu_driver_get_current_time(void);
void menu_display_handle_thumbnail_upload(retro_task_t *task,
void *task_data,
void *user_data, const char *err);
void menu_display_handle_left_thumbnail_upload(retro_task_t *task,
void *task_data,
void *user_data, const char *err);
void menu_display_handle_savestate_thumbnail_upload(retro_task_t *task,
void *task_data,
void *user_data, const char *err);
void menu_display_timedate(gfx_display_ctx_datetime_t *datetime);
void menu_display_powerstate(gfx_display_ctx_powerstate_t *powerstate);
@ -847,6 +835,9 @@ bool menu_driver_iterate(
enum menu_action action,
retro_time_t current_time);
void menu_display_common_image_upload(void *data,
void *user_data, unsigned type);
size_t menu_update_fullscreen_thumbnail_label(
char *s, size_t len,
bool is_quick_menu, const char *title);

View File

@ -156,9 +156,9 @@ typedef struct menu_entry
enum msg_hash_enums enum_idx;
uint8_t setting_type;
uint8_t flags;
char sublabel[MENU_SUBLABEL_MAX_LENGTH];
char path[255];
char label[255];
char sublabel[MENU_SUBLABEL_MAX_LENGTH];
char rich_label[255];
char value[255];
char password_value[255];

View File

@ -218,14 +218,6 @@ typedef struct menu_input
bool cancel_inhibit;
} menu_input_t;
typedef struct menu_input_ctx_hitbox
{
int32_t x1;
int32_t x2;
int32_t y1;
int32_t y2;
} menu_input_ctx_hitbox_t;
typedef struct key_desc
{
/* libretro key id */