Cut down on code duplication
This commit is contained in:
parent
c1b3ef6661
commit
78b030d8b8
82
retroarch.c
82
retroarch.c
|
@ -4875,16 +4875,17 @@ bool menu_entries_ctl(enum menu_entries_ctl_state state, void *data)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void menu_display_handle_thumbnail_upload(retro_task_t *task,
|
static void menu_display_common_image_upload(
|
||||||
void *task_data,
|
void *task_data,
|
||||||
void *user_data, const char *err)
|
void *user_data,
|
||||||
|
unsigned type)
|
||||||
{
|
{
|
||||||
menu_ctx_load_image_t load_image_info;
|
menu_ctx_load_image_t load_image_info;
|
||||||
struct rarch_state *p_rarch = &rarch_st;
|
|
||||||
struct texture_image *img = (struct texture_image*)task_data;
|
struct texture_image *img = (struct texture_image*)task_data;
|
||||||
|
struct rarch_state *p_rarch = &rarch_st;
|
||||||
|
|
||||||
load_image_info.data = img;
|
load_image_info.data = img;
|
||||||
load_image_info.type = MENU_IMAGE_THUMBNAIL;
|
load_image_info.type = type;
|
||||||
|
|
||||||
if ( p_rarch->menu_driver_ctx
|
if ( p_rarch->menu_driver_ctx
|
||||||
&& p_rarch->menu_driver_ctx->load_image)
|
&& p_rarch->menu_driver_ctx->load_image)
|
||||||
|
@ -4896,71 +4897,48 @@ void menu_display_handle_thumbnail_upload(retro_task_t *task,
|
||||||
free(user_data);
|
free(user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TODO/FIXME - seems only RGUI uses this - can this be
|
||||||
void menu_display_handle_left_thumbnail_upload(retro_task_t *task,
|
* 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 *task_data,
|
||||||
void *user_data, const char *err)
|
void *user_data, const char *err)
|
||||||
{
|
{
|
||||||
menu_ctx_load_image_t load_image_info;
|
menu_display_common_image_upload(task_data, user_data,
|
||||||
struct rarch_state *p_rarch = &rarch_st;
|
MENU_IMAGE_THUMBNAIL);
|
||||||
struct texture_image *img = (struct texture_image*)task_data;
|
|
||||||
|
|
||||||
load_image_info.data = img;
|
|
||||||
load_image_info.type = MENU_IMAGE_LEFT_THUMBNAIL;
|
|
||||||
|
|
||||||
if ( p_rarch->menu_driver_ctx
|
|
||||||
&& p_rarch->menu_driver_ctx->load_image)
|
|
||||||
p_rarch->menu_driver_ctx->load_image(p_rarch->menu_userdata,
|
|
||||||
load_image_info.data, load_image_info.type);
|
|
||||||
|
|
||||||
image_texture_free(img);
|
|
||||||
free(img);
|
|
||||||
free(user_data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void menu_display_handle_savestate_thumbnail_upload(retro_task_t *task,
|
void menu_display_handle_left_thumbnail_upload(
|
||||||
|
retro_task_t *task,
|
||||||
void *task_data,
|
void *task_data,
|
||||||
void *user_data, const char *err)
|
void *user_data, const char *err)
|
||||||
{
|
{
|
||||||
menu_ctx_load_image_t load_image_info;
|
menu_display_common_image_upload(task_data, user_data,
|
||||||
struct rarch_state *p_rarch = &rarch_st;
|
MENU_IMAGE_LEFT_THUMBNAIL);
|
||||||
struct texture_image *img = (struct texture_image*)task_data;
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
load_image_info.data = img;
|
void menu_display_handle_savestate_thumbnail_upload(
|
||||||
load_image_info.type = MENU_IMAGE_SAVESTATE_THUMBNAIL;
|
retro_task_t *task,
|
||||||
|
void *task_data,
|
||||||
if ( p_rarch->menu_driver_ctx
|
void *user_data, const char *err)
|
||||||
&& p_rarch->menu_driver_ctx->load_image)
|
{
|
||||||
p_rarch->menu_driver_ctx->load_image(p_rarch->menu_userdata,
|
menu_display_common_image_upload(task_data, user_data,
|
||||||
load_image_info.data, load_image_info.type);
|
MENU_IMAGE_SAVESTATE_THUMBNAIL);
|
||||||
|
|
||||||
image_texture_free(img);
|
|
||||||
free(img);
|
|
||||||
free(user_data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Function that gets called when we want to load in a
|
/* Function that gets called when we want to load in a
|
||||||
* new menu wallpaper.
|
* new menu wallpaper.
|
||||||
*/
|
*/
|
||||||
void menu_display_handle_wallpaper_upload(retro_task_t *task,
|
void menu_display_handle_wallpaper_upload(
|
||||||
|
retro_task_t *task,
|
||||||
void *task_data,
|
void *task_data,
|
||||||
void *user_data, const char *err)
|
void *user_data, const char *err)
|
||||||
{
|
{
|
||||||
menu_ctx_load_image_t load_image_info;
|
menu_display_common_image_upload(task_data, user_data,
|
||||||
struct rarch_state *p_rarch = &rarch_st;
|
MENU_IMAGE_WALLPAPER);
|
||||||
struct texture_image *img = (struct texture_image*)task_data;
|
|
||||||
|
|
||||||
load_image_info.data = img;
|
|
||||||
load_image_info.type = MENU_IMAGE_WALLPAPER;
|
|
||||||
|
|
||||||
if ( p_rarch->menu_driver_ctx
|
|
||||||
&& p_rarch->menu_driver_ctx->load_image)
|
|
||||||
p_rarch->menu_driver_ctx->load_image(p_rarch->menu_userdata,
|
|
||||||
load_image_info.data, load_image_info.type);
|
|
||||||
|
|
||||||
image_texture_free(img);
|
|
||||||
free(img);
|
|
||||||
free(user_data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue