mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 09:40:06 +00:00
(Menu) Add init_assets/free_assets to menu_context
This commit is contained in:
parent
3d016bd5bc
commit
a4d5c3c99c
@ -27,7 +27,6 @@
|
||||
#include "../../driver.h"
|
||||
#include "../../file.h"
|
||||
#include "../../file_ext.h"
|
||||
#include "menu_context.h"
|
||||
#include "../../input/input_common.h"
|
||||
|
||||
#include "../../compat/posix_string.h"
|
||||
@ -384,7 +383,7 @@ bool load_menu_game(void)
|
||||
|
||||
void menu_init(void)
|
||||
{
|
||||
if (!menu_ctx_init_first(&menu_ctx, &rgui))
|
||||
if (!menu_ctx_init_first(&menu_ctx, ((void**)&rgui)))
|
||||
{
|
||||
RARCH_ERR("Could not initialize menu.\n");
|
||||
rarch_fail(1, "menu_init()");
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include "../../performance.h"
|
||||
#include "../../core_info.h"
|
||||
#include "menu_context.h"
|
||||
|
||||
#ifdef HAVE_RGUI
|
||||
#define MENU_TEXTURE_FULLSCREEN false
|
||||
@ -377,9 +378,7 @@ void menu_key_event(bool down, unsigned keycode, uint32_t character, uint16_t ke
|
||||
void menu_populate_entries(void *data, unsigned menu_type);
|
||||
unsigned menu_type_is(unsigned type);
|
||||
|
||||
#ifdef HAVE_RMENU
|
||||
void rgui_init_textures(void *data);
|
||||
#endif
|
||||
extern const menu_ctx_driver_t *menu_ctx;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -45,9 +45,11 @@ const menu_ctx_driver_t *menu_ctx_find_driver(const char *ident)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool menu_ctx_init_first(const menu_ctx_driver_t **driver, rgui_handle_t **handle)
|
||||
bool menu_ctx_init_first(const menu_ctx_driver_t **driver, void **data)
|
||||
{
|
||||
unsigned i;
|
||||
rgui_handle_t **handle = (rgui_handle_t**)data;
|
||||
|
||||
if (!menu_ctx_drivers[0])
|
||||
return false;
|
||||
|
||||
|
@ -28,11 +28,13 @@
|
||||
|
||||
typedef struct menu_ctx_driver
|
||||
{
|
||||
void (*set_texture)(void*, bool);
|
||||
void (*render_messagebox)(void*, const char*);
|
||||
void (*render)(void*);
|
||||
void (*set_texture)(void*, bool);
|
||||
void (*render_messagebox)(void*, const char*);
|
||||
void (*render)(void*);
|
||||
void* (*init)(void);
|
||||
void (*free)(void*);
|
||||
void (*free)(void*);
|
||||
void (*init_assets)(void*);
|
||||
void (*free_assets)(void*);
|
||||
|
||||
// Human readable string.
|
||||
const char *ident;
|
||||
@ -43,6 +45,6 @@ extern const menu_ctx_driver_t menu_ctx_rmenu_xui;
|
||||
extern const menu_ctx_driver_t menu_ctx_rgui;
|
||||
|
||||
const menu_ctx_driver_t *menu_ctx_find_driver(const char *ident); // Finds driver with ident. Does not initialize.
|
||||
bool menu_ctx_init_first(const menu_ctx_driver_t **driver, rgui_handle_t **handle); // Finds first suitable driver and initializes.
|
||||
bool menu_ctx_init_first(const menu_ctx_driver_t **driver, void **handle); // Finds first suitable driver and initializes.
|
||||
|
||||
#endif
|
||||
|
@ -948,9 +948,9 @@ int menu_set_settings(void *data, unsigned setting, unsigned action)
|
||||
g_extern.lifecycle_state &= ~(1ULL << MODE_VIDEO_PAL_TEMPORAL_ENABLE);
|
||||
}
|
||||
driver.video->restart();
|
||||
#ifdef HAVE_RMENU
|
||||
rgui_init_textures(rgui);
|
||||
#endif
|
||||
|
||||
if (menu_ctx && menu_ctx->init_assets)
|
||||
menu_ctx->init_assets(rgui);
|
||||
}
|
||||
break;
|
||||
case RGUI_SETTINGS_VIDEO_PAL60:
|
||||
@ -967,7 +967,8 @@ int menu_set_settings(void *data, unsigned setting, unsigned action)
|
||||
g_extern.lifecycle_state |= (1ULL << MODE_VIDEO_PAL_TEMPORAL_ENABLE);
|
||||
|
||||
driver.video->restart();
|
||||
rgui_init_textures(rgui);
|
||||
if (menu_ctx && menu_ctx->init_assets)
|
||||
menu_ctx->init_assets(rgui);
|
||||
}
|
||||
break;
|
||||
case RGUI_ACTION_START:
|
||||
@ -976,7 +977,8 @@ int menu_set_settings(void *data, unsigned setting, unsigned action)
|
||||
g_extern.lifecycle_state &= ~(1ULL << MODE_VIDEO_PAL_TEMPORAL_ENABLE);
|
||||
|
||||
driver.video->restart();
|
||||
rgui_init_textures(rgui);
|
||||
if (menu_ctx && menu_ctx->init_assets)
|
||||
menu_ctx->init_assets(rgui);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -583,5 +583,7 @@ const menu_ctx_driver_t menu_ctx_rgui = {
|
||||
rgui_render,
|
||||
rgui_init,
|
||||
rgui_free,
|
||||
NULL,
|
||||
NULL,
|
||||
"rgui",
|
||||
};
|
||||
|
@ -66,7 +66,7 @@ static void render_background(rgui_handle_t *rgui)
|
||||
{
|
||||
}
|
||||
|
||||
static void rgui_render_messagebox(void *data, const char *message)
|
||||
static void rmenu_render_messagebox(void *data, const char *message)
|
||||
{
|
||||
font_params_t font_parms;
|
||||
|
||||
@ -110,7 +110,7 @@ static void rgui_render_messagebox(void *data, const char *message)
|
||||
}
|
||||
|
||||
|
||||
static void rgui_render(void *data)
|
||||
static void rmenu_render(void *data)
|
||||
{
|
||||
if (!render_normal)
|
||||
{
|
||||
@ -392,7 +392,7 @@ void rmenu_set_texture(void *data, bool enable)
|
||||
}
|
||||
}
|
||||
|
||||
void rgui_init_textures(void *data)
|
||||
static void rmenu_init_assets(void *data)
|
||||
{
|
||||
rgui_handle_t *rgui = (rgui_handle_t*)data;
|
||||
#ifdef HAVE_MENU_PANEL
|
||||
@ -405,19 +405,19 @@ void rgui_init_textures(void *data)
|
||||
rmenu_set_texture(rgui, true);
|
||||
}
|
||||
|
||||
static void *rgui_init(void)
|
||||
static void *rmenu_init(void)
|
||||
{
|
||||
rgui_handle_t *rgui = (rgui_handle_t*)calloc(1, sizeof(*rgui));
|
||||
|
||||
menu_texture = (struct texture_image*)calloc(1, sizeof(*menu_texture));
|
||||
menu_panel = (struct texture_image*)calloc(1, sizeof(*menu_panel));
|
||||
|
||||
rgui_init_textures(rgui);
|
||||
rmenu_init_assets(rgui);
|
||||
|
||||
return rgui;
|
||||
}
|
||||
|
||||
static void rgui_free(void *data)
|
||||
static void rmenu_free_assets(void *data)
|
||||
{
|
||||
#ifdef _XBOX1
|
||||
if (menu_panel->vertex_buf)
|
||||
@ -456,6 +456,11 @@ static void rgui_free(void *data)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void rmenu_free(void *data)
|
||||
{
|
||||
rmenu_free_assets(data);
|
||||
}
|
||||
|
||||
int rgui_input_postprocess(void *data, uint64_t old_state)
|
||||
{
|
||||
(void)data;
|
||||
@ -476,9 +481,11 @@ int rgui_input_postprocess(void *data, uint64_t old_state)
|
||||
|
||||
const menu_ctx_driver_t menu_ctx_rmenu = {
|
||||
rmenu_set_texture,
|
||||
rgui_render_messagebox,
|
||||
rgui_render,
|
||||
rgui_init,
|
||||
rgui_free,
|
||||
rmenu_render_messagebox,
|
||||
rmenu_render,
|
||||
rmenu_init,
|
||||
rmenu_free,
|
||||
rmenu_init_assets,
|
||||
rmenu_free_assets,
|
||||
"rmenu",
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user