Start preparing to move menu_driver_render
This commit is contained in:
parent
881ef63b63
commit
82168c0925
|
@ -66,12 +66,13 @@ static enum action_iterate_type action_iterate_type(const char *label)
|
||||||
*
|
*
|
||||||
* Returns: 0 on success, -1 if we need to quit out of the loop.
|
* Returns: 0 on success, -1 if we need to quit out of the loop.
|
||||||
**/
|
**/
|
||||||
int generic_menu_iterate(menu_handle_t *menu, void *userdata, enum menu_action action)
|
int generic_menu_iterate(void *data, void *userdata, enum menu_action action)
|
||||||
{
|
{
|
||||||
enum action_iterate_type iterate_type;
|
enum action_iterate_type iterate_type;
|
||||||
unsigned file_type = 0;
|
unsigned file_type = 0;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
const char *label = NULL;
|
const char *label = NULL;
|
||||||
|
menu_handle_t *menu = (menu_handle_t*)data;
|
||||||
|
|
||||||
if (!menu)
|
if (!menu)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -31,7 +31,7 @@ enum action_iterate_type
|
||||||
ITERATE_TYPE_BIND
|
ITERATE_TYPE_BIND
|
||||||
};
|
};
|
||||||
|
|
||||||
int generic_menu_iterate(menu_handle_t *menu, void *userdata, enum menu_action action);
|
int generic_menu_iterate(void *data, void *userdata, enum menu_action action);
|
||||||
|
|
||||||
bool generic_menu_init_list(void *data);
|
bool generic_menu_init_list(void *data);
|
||||||
|
|
||||||
|
|
|
@ -1800,15 +1800,16 @@ static void ozone_populate_entries(void *data, const char *path, const char *lab
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ozone_menu_iterate(menu_handle_t *menu, void *userdata, enum menu_action action)
|
static int ozone_menu_iterate(void *data,
|
||||||
|
void *userdata, enum menu_action action)
|
||||||
{
|
{
|
||||||
int new_selection;
|
int new_selection;
|
||||||
enum menu_action new_action;
|
enum menu_action new_action;
|
||||||
menu_animation_ctx_tag tag;
|
menu_animation_ctx_tag tag;
|
||||||
|
|
||||||
file_list_t *selection_buf = NULL;
|
file_list_t *selection_buf = NULL;
|
||||||
ozone_handle_t *ozone = (ozone_handle_t*) userdata;
|
ozone_handle_t *ozone = (ozone_handle_t*) userdata;
|
||||||
unsigned horizontal_list_size = 0;
|
unsigned horizontal_list_size = 0;
|
||||||
|
menu_handle_t *menu = (menu_handle_t*)data;
|
||||||
|
|
||||||
if (!ozone)
|
if (!ozone)
|
||||||
return generic_menu_iterate(menu, userdata, action);
|
return generic_menu_iterate(menu, userdata, action);
|
||||||
|
|
|
@ -238,6 +238,11 @@ static retro_time_t menu_driver_datetime_last_time_us = 0;
|
||||||
* representation string */
|
* representation string */
|
||||||
static char menu_datetime_cache[255] = {0};
|
static char menu_datetime_cache[255] = {0};
|
||||||
|
|
||||||
|
menu_handle_t *menu_driver_get_ptr(void)
|
||||||
|
{
|
||||||
|
return menu_driver_data;
|
||||||
|
}
|
||||||
|
|
||||||
/* Returns the OSK key at a given position */
|
/* Returns the OSK key at a given position */
|
||||||
int menu_display_osk_ptr_at_pos(void *data, int x, int y,
|
int menu_display_osk_ptr_at_pos(void *data, int x, int y,
|
||||||
unsigned width, unsigned height)
|
unsigned width, unsigned height)
|
||||||
|
@ -2037,8 +2042,8 @@ bool menu_driver_render(bool is_idle, bool rarch_is_inited,
|
||||||
if (BIT64_GET(menu_driver_data->state, MENU_STATE_RENDER_MESSAGEBOX)
|
if (BIT64_GET(menu_driver_data->state, MENU_STATE_RENDER_MESSAGEBOX)
|
||||||
&& !string_is_empty(menu_driver_data->menu_state_msg))
|
&& !string_is_empty(menu_driver_data->menu_state_msg))
|
||||||
{
|
{
|
||||||
if (menu_driver_ctx->render_messagebox)
|
if (menu_driver_data->driver_ctx->render_messagebox)
|
||||||
menu_driver_ctx->render_messagebox(menu_userdata,
|
menu_driver_data->driver_ctx->render_messagebox(menu_userdata,
|
||||||
menu_driver_data->menu_state_msg);
|
menu_driver_data->menu_state_msg);
|
||||||
|
|
||||||
if (ui_companion_is_on_foreground())
|
if (ui_companion_is_on_foreground())
|
||||||
|
@ -2051,15 +2056,15 @@ bool menu_driver_render(bool is_idle, bool rarch_is_inited,
|
||||||
|
|
||||||
if (BIT64_GET(menu_driver_data->state, MENU_STATE_BLIT))
|
if (BIT64_GET(menu_driver_data->state, MENU_STATE_BLIT))
|
||||||
{
|
{
|
||||||
if (menu_driver_ctx->render)
|
if (menu_driver_data->driver_ctx->render)
|
||||||
menu_driver_ctx->render(menu_userdata, is_idle);
|
menu_driver_data->driver_ctx->render(menu_userdata, is_idle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (menu_driver_alive && !is_idle)
|
if (menu_driver_alive && !is_idle)
|
||||||
menu_display_libretro(is_idle, rarch_is_inited, rarch_is_dummy_core);
|
menu_display_libretro(is_idle, rarch_is_inited, rarch_is_dummy_core);
|
||||||
|
|
||||||
if (menu_driver_ctx->set_texture)
|
if (menu_driver_data->driver_ctx->set_texture)
|
||||||
menu_driver_ctx->set_texture();
|
menu_driver_data->driver_ctx->set_texture();
|
||||||
|
|
||||||
menu_driver_data->state = 0;
|
menu_driver_data->state = 0;
|
||||||
|
|
||||||
|
@ -2200,8 +2205,11 @@ static bool menu_driver_init_internal(bool video_is_threaded)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (menu_driver_ctx->init)
|
if (menu_driver_ctx->init)
|
||||||
|
{
|
||||||
menu_driver_data = (menu_handle_t*)
|
menu_driver_data = (menu_handle_t*)
|
||||||
menu_driver_ctx->init(&menu_userdata, video_is_threaded);
|
menu_driver_ctx->init(&menu_userdata, video_is_threaded);
|
||||||
|
menu_driver_data->driver_ctx = menu_driver_ctx;
|
||||||
|
}
|
||||||
|
|
||||||
if (!menu_driver_data || !menu_init(menu_driver_data))
|
if (!menu_driver_data || !menu_init(menu_driver_data))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
|
@ -240,98 +240,13 @@ typedef struct menu_display_ctx_driver
|
||||||
void (*scissor_end)(video_frame_info_t *video_info);
|
void (*scissor_end)(video_frame_info_t *video_info);
|
||||||
} menu_display_ctx_driver_t;
|
} menu_display_ctx_driver_t;
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
unsigned rpl_entry_selection_ptr;
|
|
||||||
size_t core_len;
|
|
||||||
uint64_t state;
|
|
||||||
|
|
||||||
char *core_buf;
|
|
||||||
char menu_state_msg[1024];
|
|
||||||
/* Scratchpad variables. These are used for instance
|
|
||||||
* by the filebrowser when having to store intermediary
|
|
||||||
* paths (subdirs/previous dirs/current dir/path, etc).
|
|
||||||
*/
|
|
||||||
char deferred_path[PATH_MAX_LENGTH];
|
|
||||||
char scratch_buf[PATH_MAX_LENGTH];
|
|
||||||
char scratch2_buf[PATH_MAX_LENGTH];
|
|
||||||
char db_playlist_file[PATH_MAX_LENGTH];
|
|
||||||
char filebrowser_label[PATH_MAX_LENGTH];
|
|
||||||
char detect_content_path[PATH_MAX_LENGTH];
|
|
||||||
|
|
||||||
/* This is used for storing intermediary variables
|
|
||||||
* that get used later on during menu actions -
|
|
||||||
* for instance, selecting a shader pass for a shader
|
|
||||||
* slot */
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
unsigned unsigned_var;
|
|
||||||
} scratchpad;
|
|
||||||
} menu_handle_t;
|
|
||||||
|
|
||||||
struct menu_display_ctx_draw
|
|
||||||
{
|
|
||||||
float x;
|
|
||||||
float y;
|
|
||||||
float *color;
|
|
||||||
const float *vertex;
|
|
||||||
const float *tex_coord;
|
|
||||||
unsigned width;
|
|
||||||
unsigned height;
|
|
||||||
uintptr_t texture;
|
|
||||||
size_t vertex_count;
|
|
||||||
struct video_coords *coords;
|
|
||||||
void *matrix_data;
|
|
||||||
enum menu_display_prim_type prim_type;
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
unsigned id;
|
|
||||||
const void *backend_data;
|
|
||||||
size_t backend_data_size;
|
|
||||||
bool active;
|
|
||||||
} pipeline;
|
|
||||||
float rotation;
|
|
||||||
float scale_factor;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct menu_display_ctx_rotate_draw
|
|
||||||
{
|
|
||||||
bool scale_enable;
|
|
||||||
float rotation;
|
|
||||||
float scale_x;
|
|
||||||
float scale_y;
|
|
||||||
float scale_z;
|
|
||||||
math_matrix_4x4 *matrix;
|
|
||||||
} menu_display_ctx_rotate_draw_t;
|
|
||||||
|
|
||||||
typedef struct menu_display_ctx_coord_draw
|
|
||||||
{
|
|
||||||
const float *ptr;
|
|
||||||
} menu_display_ctx_coord_draw_t;
|
|
||||||
|
|
||||||
typedef struct menu_display_ctx_datetime
|
|
||||||
{
|
|
||||||
char *s;
|
|
||||||
size_t len;
|
|
||||||
unsigned time_mode;
|
|
||||||
} menu_display_ctx_datetime_t;
|
|
||||||
|
|
||||||
typedef struct menu_display_ctx_powerstate
|
|
||||||
{
|
|
||||||
char *s;
|
|
||||||
size_t len;
|
|
||||||
unsigned percent;
|
|
||||||
bool battery_enabled;
|
|
||||||
bool charging;
|
|
||||||
} menu_display_ctx_powerstate_t;
|
|
||||||
|
|
||||||
typedef struct menu_ctx_driver
|
typedef struct menu_ctx_driver
|
||||||
{
|
{
|
||||||
/* Set a framebuffer texture. This is used for instance by RGUI. */
|
/* Set a framebuffer texture. This is used for instance by RGUI. */
|
||||||
void (*set_texture)(void);
|
void (*set_texture)(void);
|
||||||
/* Render a messagebox to the screen. */
|
/* Render a messagebox to the screen. */
|
||||||
void (*render_messagebox)(void *data, const char *msg);
|
void (*render_messagebox)(void *data, const char *msg);
|
||||||
int (*iterate)(menu_handle_t *menu, void *userdata, enum menu_action action);
|
int (*iterate)(void *data, void *userdata, enum menu_action action);
|
||||||
void (*render)(void *data, bool is_idle);
|
void (*render)(void *data, bool is_idle);
|
||||||
void (*frame)(void *data, video_frame_info_t *video_info);
|
void (*frame)(void *data, video_frame_info_t *video_info);
|
||||||
/* Initializes the menu driver. (setup) */
|
/* Initializes the menu driver. (setup) */
|
||||||
|
@ -407,6 +322,93 @@ typedef struct menu_ctx_driver
|
||||||
bool (*get_load_content_animation_data)(void *userdata, menu_texture_item *icon, char **playlist_name);
|
bool (*get_load_content_animation_data)(void *userdata, menu_texture_item *icon, char **playlist_name);
|
||||||
} menu_ctx_driver_t;
|
} menu_ctx_driver_t;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
unsigned rpl_entry_selection_ptr;
|
||||||
|
size_t core_len;
|
||||||
|
uint64_t state;
|
||||||
|
|
||||||
|
char *core_buf;
|
||||||
|
char menu_state_msg[1024];
|
||||||
|
/* Scratchpad variables. These are used for instance
|
||||||
|
* by the filebrowser when having to store intermediary
|
||||||
|
* paths (subdirs/previous dirs/current dir/path, etc).
|
||||||
|
*/
|
||||||
|
char deferred_path[PATH_MAX_LENGTH];
|
||||||
|
char scratch_buf[PATH_MAX_LENGTH];
|
||||||
|
char scratch2_buf[PATH_MAX_LENGTH];
|
||||||
|
char db_playlist_file[PATH_MAX_LENGTH];
|
||||||
|
char filebrowser_label[PATH_MAX_LENGTH];
|
||||||
|
char detect_content_path[PATH_MAX_LENGTH];
|
||||||
|
|
||||||
|
/* This is used for storing intermediary variables
|
||||||
|
* that get used later on during menu actions -
|
||||||
|
* for instance, selecting a shader pass for a shader
|
||||||
|
* slot */
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
unsigned unsigned_var;
|
||||||
|
} scratchpad;
|
||||||
|
const menu_ctx_driver_t *driver_ctx;
|
||||||
|
} menu_handle_t;
|
||||||
|
|
||||||
|
struct menu_display_ctx_draw
|
||||||
|
{
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
float *color;
|
||||||
|
const float *vertex;
|
||||||
|
const float *tex_coord;
|
||||||
|
unsigned width;
|
||||||
|
unsigned height;
|
||||||
|
uintptr_t texture;
|
||||||
|
size_t vertex_count;
|
||||||
|
struct video_coords *coords;
|
||||||
|
void *matrix_data;
|
||||||
|
enum menu_display_prim_type prim_type;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
unsigned id;
|
||||||
|
const void *backend_data;
|
||||||
|
size_t backend_data_size;
|
||||||
|
bool active;
|
||||||
|
} pipeline;
|
||||||
|
float rotation;
|
||||||
|
float scale_factor;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct menu_display_ctx_rotate_draw
|
||||||
|
{
|
||||||
|
bool scale_enable;
|
||||||
|
float rotation;
|
||||||
|
float scale_x;
|
||||||
|
float scale_y;
|
||||||
|
float scale_z;
|
||||||
|
math_matrix_4x4 *matrix;
|
||||||
|
} menu_display_ctx_rotate_draw_t;
|
||||||
|
|
||||||
|
typedef struct menu_display_ctx_coord_draw
|
||||||
|
{
|
||||||
|
const float *ptr;
|
||||||
|
} menu_display_ctx_coord_draw_t;
|
||||||
|
|
||||||
|
typedef struct menu_display_ctx_datetime
|
||||||
|
{
|
||||||
|
char *s;
|
||||||
|
size_t len;
|
||||||
|
unsigned time_mode;
|
||||||
|
} menu_display_ctx_datetime_t;
|
||||||
|
|
||||||
|
typedef struct menu_display_ctx_powerstate
|
||||||
|
{
|
||||||
|
char *s;
|
||||||
|
size_t len;
|
||||||
|
unsigned percent;
|
||||||
|
bool battery_enabled;
|
||||||
|
bool charging;
|
||||||
|
} menu_display_ctx_powerstate_t;
|
||||||
|
|
||||||
typedef struct menu_ctx_displaylist
|
typedef struct menu_ctx_displaylist
|
||||||
{
|
{
|
||||||
menu_displaylist_info_t *info;
|
menu_displaylist_info_t *info;
|
||||||
|
@ -702,6 +704,8 @@ void hex32_to_rgba_normalized(uint32_t hex, float* rgba, float alpha);
|
||||||
|
|
||||||
void menu_subsystem_populate(const struct retro_subsystem_info* subsystem, menu_displaylist_info_t *info);
|
void menu_subsystem_populate(const struct retro_subsystem_info* subsystem, menu_displaylist_info_t *info);
|
||||||
|
|
||||||
|
menu_handle_t *menu_driver_get_ptr(void);
|
||||||
|
|
||||||
extern uintptr_t menu_display_white_texture;
|
extern uintptr_t menu_display_white_texture;
|
||||||
|
|
||||||
extern menu_display_ctx_driver_t menu_display_ctx_gl;
|
extern menu_display_ctx_driver_t menu_display_ctx_gl;
|
||||||
|
|
Loading…
Reference in New Issue