mirror of
https://github.com/libretro/RetroArch
synced 2025-02-11 15:40:28 +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 "../../driver.h"
|
||||||
#include "../../file.h"
|
#include "../../file.h"
|
||||||
#include "../../file_ext.h"
|
#include "../../file_ext.h"
|
||||||
#include "menu_context.h"
|
|
||||||
#include "../../input/input_common.h"
|
#include "../../input/input_common.h"
|
||||||
|
|
||||||
#include "../../compat/posix_string.h"
|
#include "../../compat/posix_string.h"
|
||||||
@ -384,7 +383,7 @@ bool load_menu_game(void)
|
|||||||
|
|
||||||
void menu_init(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_ERR("Could not initialize menu.\n");
|
||||||
rarch_fail(1, "menu_init()");
|
rarch_fail(1, "menu_init()");
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include "../../performance.h"
|
#include "../../performance.h"
|
||||||
#include "../../core_info.h"
|
#include "../../core_info.h"
|
||||||
|
#include "menu_context.h"
|
||||||
|
|
||||||
#ifdef HAVE_RGUI
|
#ifdef HAVE_RGUI
|
||||||
#define MENU_TEXTURE_FULLSCREEN false
|
#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);
|
void menu_populate_entries(void *data, unsigned menu_type);
|
||||||
unsigned menu_type_is(unsigned type);
|
unsigned menu_type_is(unsigned type);
|
||||||
|
|
||||||
#ifdef HAVE_RMENU
|
extern const menu_ctx_driver_t *menu_ctx;
|
||||||
void rgui_init_textures(void *data);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -45,9 +45,11 @@ const menu_ctx_driver_t *menu_ctx_find_driver(const char *ident)
|
|||||||
return NULL;
|
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;
|
unsigned i;
|
||||||
|
rgui_handle_t **handle = (rgui_handle_t**)data;
|
||||||
|
|
||||||
if (!menu_ctx_drivers[0])
|
if (!menu_ctx_drivers[0])
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -33,6 +33,8 @@ typedef struct menu_ctx_driver
|
|||||||
void (*render)(void*);
|
void (*render)(void*);
|
||||||
void* (*init)(void);
|
void* (*init)(void);
|
||||||
void (*free)(void*);
|
void (*free)(void*);
|
||||||
|
void (*init_assets)(void*);
|
||||||
|
void (*free_assets)(void*);
|
||||||
|
|
||||||
// Human readable string.
|
// Human readable string.
|
||||||
const char *ident;
|
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;
|
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.
|
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
|
#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);
|
g_extern.lifecycle_state &= ~(1ULL << MODE_VIDEO_PAL_TEMPORAL_ENABLE);
|
||||||
}
|
}
|
||||||
driver.video->restart();
|
driver.video->restart();
|
||||||
#ifdef HAVE_RMENU
|
|
||||||
rgui_init_textures(rgui);
|
if (menu_ctx && menu_ctx->init_assets)
|
||||||
#endif
|
menu_ctx->init_assets(rgui);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RGUI_SETTINGS_VIDEO_PAL60:
|
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);
|
g_extern.lifecycle_state |= (1ULL << MODE_VIDEO_PAL_TEMPORAL_ENABLE);
|
||||||
|
|
||||||
driver.video->restart();
|
driver.video->restart();
|
||||||
rgui_init_textures(rgui);
|
if (menu_ctx && menu_ctx->init_assets)
|
||||||
|
menu_ctx->init_assets(rgui);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RGUI_ACTION_START:
|
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);
|
g_extern.lifecycle_state &= ~(1ULL << MODE_VIDEO_PAL_TEMPORAL_ENABLE);
|
||||||
|
|
||||||
driver.video->restart();
|
driver.video->restart();
|
||||||
rgui_init_textures(rgui);
|
if (menu_ctx && menu_ctx->init_assets)
|
||||||
|
menu_ctx->init_assets(rgui);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -583,5 +583,7 @@ const menu_ctx_driver_t menu_ctx_rgui = {
|
|||||||
rgui_render,
|
rgui_render,
|
||||||
rgui_init,
|
rgui_init,
|
||||||
rgui_free,
|
rgui_free,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
"rgui",
|
"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;
|
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)
|
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;
|
rgui_handle_t *rgui = (rgui_handle_t*)data;
|
||||||
#ifdef HAVE_MENU_PANEL
|
#ifdef HAVE_MENU_PANEL
|
||||||
@ -405,19 +405,19 @@ void rgui_init_textures(void *data)
|
|||||||
rmenu_set_texture(rgui, true);
|
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));
|
rgui_handle_t *rgui = (rgui_handle_t*)calloc(1, sizeof(*rgui));
|
||||||
|
|
||||||
menu_texture = (struct texture_image*)calloc(1, sizeof(*menu_texture));
|
menu_texture = (struct texture_image*)calloc(1, sizeof(*menu_texture));
|
||||||
menu_panel = (struct texture_image*)calloc(1, sizeof(*menu_panel));
|
menu_panel = (struct texture_image*)calloc(1, sizeof(*menu_panel));
|
||||||
|
|
||||||
rgui_init_textures(rgui);
|
rmenu_init_assets(rgui);
|
||||||
|
|
||||||
return rgui;
|
return rgui;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rgui_free(void *data)
|
static void rmenu_free_assets(void *data)
|
||||||
{
|
{
|
||||||
#ifdef _XBOX1
|
#ifdef _XBOX1
|
||||||
if (menu_panel->vertex_buf)
|
if (menu_panel->vertex_buf)
|
||||||
@ -456,6 +456,11 @@ static void rgui_free(void *data)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void rmenu_free(void *data)
|
||||||
|
{
|
||||||
|
rmenu_free_assets(data);
|
||||||
|
}
|
||||||
|
|
||||||
int rgui_input_postprocess(void *data, uint64_t old_state)
|
int rgui_input_postprocess(void *data, uint64_t old_state)
|
||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
@ -476,9 +481,11 @@ int rgui_input_postprocess(void *data, uint64_t old_state)
|
|||||||
|
|
||||||
const menu_ctx_driver_t menu_ctx_rmenu = {
|
const menu_ctx_driver_t menu_ctx_rmenu = {
|
||||||
rmenu_set_texture,
|
rmenu_set_texture,
|
||||||
rgui_render_messagebox,
|
rmenu_render_messagebox,
|
||||||
rgui_render,
|
rmenu_render,
|
||||||
rgui_init,
|
rmenu_init,
|
||||||
rgui_free,
|
rmenu_free,
|
||||||
|
rmenu_init_assets,
|
||||||
|
rmenu_free_assets,
|
||||||
"rmenu",
|
"rmenu",
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user