mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 06:44:27 +00:00
- Move disp_get_ptr to gfx_display.c
- Move menu_driver_init to menu_driver.c, and turn menu_driver_init_internal into static function
This commit is contained in:
parent
d819251ffd
commit
b1410c72e5
@ -31,6 +31,14 @@
|
|||||||
/* Small 1x1 white texture used for blending purposes */
|
/* Small 1x1 white texture used for blending purposes */
|
||||||
static uintptr_t gfx_white_texture;
|
static uintptr_t gfx_white_texture;
|
||||||
|
|
||||||
|
/* ptr alignment */
|
||||||
|
static gfx_display_t dispgfx_st = {0};
|
||||||
|
|
||||||
|
gfx_display_t *disp_get_ptr(void)
|
||||||
|
{
|
||||||
|
return &dispgfx_st;
|
||||||
|
}
|
||||||
|
|
||||||
static bool gfx_display_null_font_init_first(
|
static bool gfx_display_null_font_init_first(
|
||||||
void **font_handle, void *video_data,
|
void **font_handle, void *video_data,
|
||||||
const char *font_path, float font_size,
|
const char *font_path, float font_size,
|
||||||
@ -1060,7 +1068,7 @@ int gfx_display_osk_ptr_at_pos(void *data, int x, int y,
|
|||||||
void gfx_display_get_fb_size(unsigned *fb_width,
|
void gfx_display_get_fb_size(unsigned *fb_width,
|
||||||
unsigned *fb_height, size_t *fb_pitch)
|
unsigned *fb_height, size_t *fb_pitch)
|
||||||
{
|
{
|
||||||
gfx_display_t *p_disp = disp_get_ptr();
|
gfx_display_t *p_disp = &dispgfx_st;
|
||||||
*fb_width = p_disp->framebuf_width;
|
*fb_width = p_disp->framebuf_width;
|
||||||
*fb_height = p_disp->framebuf_height;
|
*fb_height = p_disp->framebuf_height;
|
||||||
*fb_pitch = p_disp->framebuf_pitch;
|
*fb_pitch = p_disp->framebuf_pitch;
|
||||||
@ -1069,20 +1077,20 @@ void gfx_display_get_fb_size(unsigned *fb_width,
|
|||||||
/* Set the display framebuffer's width. */
|
/* Set the display framebuffer's width. */
|
||||||
void gfx_display_set_width(unsigned width)
|
void gfx_display_set_width(unsigned width)
|
||||||
{
|
{
|
||||||
gfx_display_t *p_disp = disp_get_ptr();
|
gfx_display_t *p_disp = &dispgfx_st;
|
||||||
p_disp->framebuf_width = width;
|
p_disp->framebuf_width = width;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the display framebuffer's height. */
|
/* Set the display framebuffer's height. */
|
||||||
void gfx_display_set_height(unsigned height)
|
void gfx_display_set_height(unsigned height)
|
||||||
{
|
{
|
||||||
gfx_display_t *p_disp = disp_get_ptr();
|
gfx_display_t *p_disp = &dispgfx_st;
|
||||||
p_disp->framebuf_height = height;
|
p_disp->framebuf_height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gfx_display_set_framebuffer_pitch(size_t pitch)
|
void gfx_display_set_framebuffer_pitch(size_t pitch)
|
||||||
{
|
{
|
||||||
gfx_display_t *p_disp = disp_get_ptr();
|
gfx_display_t *p_disp = &dispgfx_st;
|
||||||
p_disp->framebuf_pitch = pitch;
|
p_disp->framebuf_pitch = pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1251,7 +1259,7 @@ void gfx_display_init_white_texture(void)
|
|||||||
|
|
||||||
void gfx_display_free(void)
|
void gfx_display_free(void)
|
||||||
{
|
{
|
||||||
gfx_display_t *p_disp = disp_get_ptr();
|
gfx_display_t *p_disp = &dispgfx_st;
|
||||||
video_coord_array_free(&p_disp->dispca);
|
video_coord_array_free(&p_disp->dispca);
|
||||||
|
|
||||||
p_disp->msg_force = false;
|
p_disp->msg_force = false;
|
||||||
@ -1265,7 +1273,7 @@ void gfx_display_free(void)
|
|||||||
|
|
||||||
void gfx_display_init(void)
|
void gfx_display_init(void)
|
||||||
{
|
{
|
||||||
gfx_display_t *p_disp = disp_get_ptr();
|
gfx_display_t *p_disp = &dispgfx_st;
|
||||||
video_coord_array_t *p_dispca = &p_disp->dispca;
|
video_coord_array_t *p_dispca = &p_disp->dispca;
|
||||||
|
|
||||||
p_disp->has_windowed = video_driver_has_windowed();
|
p_disp->has_windowed = video_driver_has_windowed();
|
||||||
|
@ -5198,7 +5198,7 @@ int menu_entries_get_core_title(char *s, size_t len)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool menu_driver_init_internal(
|
static bool menu_driver_init_internal(
|
||||||
gfx_display_t *p_disp,
|
gfx_display_t *p_disp,
|
||||||
settings_t *settings,
|
settings_t *settings,
|
||||||
bool video_is_threaded)
|
bool video_is_threaded)
|
||||||
@ -5261,6 +5261,36 @@ bool menu_driver_init_internal(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool menu_driver_init(bool video_is_threaded)
|
||||||
|
{
|
||||||
|
gfx_display_t *p_disp = disp_get_ptr();
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
|
struct menu_state *menu_st = menu_state_get_ptr();
|
||||||
|
|
||||||
|
command_event(CMD_EVENT_CORE_INFO_INIT, NULL);
|
||||||
|
command_event(CMD_EVENT_LOAD_CORE_PERSIST, NULL);
|
||||||
|
|
||||||
|
if ( menu_st->driver_data ||
|
||||||
|
menu_driver_init_internal(
|
||||||
|
p_disp,
|
||||||
|
settings,
|
||||||
|
video_is_threaded))
|
||||||
|
{
|
||||||
|
if (menu_st->driver_ctx && menu_st->driver_ctx->context_reset)
|
||||||
|
{
|
||||||
|
menu_st->driver_ctx->context_reset(menu_st->userdata,
|
||||||
|
video_is_threaded);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If driver initialisation failed, must reset
|
||||||
|
* driver id to 'unknown' */
|
||||||
|
p_disp->menu_driver_id = MENU_DRIVER_ID_UNKNOWN;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const char *menu_driver_ident(void)
|
const char *menu_driver_ident(void)
|
||||||
{
|
{
|
||||||
struct menu_state *menu_st = &menu_driver_state;
|
struct menu_state *menu_st = &menu_driver_state;
|
||||||
|
@ -859,11 +859,6 @@ const menu_ctx_driver_t *menu_driver_find_driver(
|
|||||||
const char *prefix,
|
const char *prefix,
|
||||||
bool verbosity_enabled);
|
bool verbosity_enabled);
|
||||||
|
|
||||||
bool menu_driver_init_internal(
|
|
||||||
gfx_display_t *p_disp,
|
|
||||||
settings_t *settings,
|
|
||||||
bool video_is_threaded);
|
|
||||||
|
|
||||||
extern const menu_ctx_driver_t *menu_ctx_drivers[];
|
extern const menu_ctx_driver_t *menu_ctx_drivers[];
|
||||||
|
|
||||||
RETRO_END_DECLS
|
RETRO_END_DECLS
|
||||||
|
58
retroarch.c
58
retroarch.c
@ -402,12 +402,6 @@ struct retro_system_av_info *video_viewport_get_system_av_info(void)
|
|||||||
return &p_rarch->video_driver_av_info;
|
return &p_rarch->video_driver_av_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx_display_t *disp_get_ptr(void)
|
|
||||||
{
|
|
||||||
struct rarch_state *p_rarch = &rarch_st;
|
|
||||||
return &p_rarch->dispgfx;
|
|
||||||
}
|
|
||||||
|
|
||||||
settings_t *config_get_ptr(void)
|
settings_t *config_get_ptr(void)
|
||||||
{
|
{
|
||||||
struct rarch_state *p_rarch = &rarch_st;
|
struct rarch_state *p_rarch = &rarch_st;
|
||||||
@ -1547,40 +1541,10 @@ static bool menu_driver_iterate(
|
|||||||
current_time) != -1);
|
current_time) != -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool menu_driver_init(bool video_is_threaded)
|
|
||||||
{
|
|
||||||
gfx_display_t *p_disp = &rarch_st.dispgfx;
|
|
||||||
settings_t *settings = rarch_st.configuration_settings;
|
|
||||||
struct menu_state *menu_st = menu_state_get_ptr();
|
|
||||||
|
|
||||||
command_event(CMD_EVENT_CORE_INFO_INIT, NULL);
|
|
||||||
command_event(CMD_EVENT_LOAD_CORE_PERSIST, NULL);
|
|
||||||
|
|
||||||
if ( menu_st->driver_data ||
|
|
||||||
menu_driver_init_internal(
|
|
||||||
p_disp,
|
|
||||||
settings,
|
|
||||||
video_is_threaded))
|
|
||||||
{
|
|
||||||
if (menu_st->driver_ctx && menu_st->driver_ctx->context_reset)
|
|
||||||
{
|
|
||||||
menu_st->driver_ctx->context_reset(menu_st->userdata,
|
|
||||||
video_is_threaded);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If driver initialisation failed, must reset
|
|
||||||
* driver id to 'unknown' */
|
|
||||||
p_disp->menu_driver_id = MENU_DRIVER_ID_UNKNOWN;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
|
bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
|
||||||
{
|
{
|
||||||
struct rarch_state *p_rarch = &rarch_st;
|
struct rarch_state *p_rarch = &rarch_st;
|
||||||
gfx_display_t *p_disp = &p_rarch->dispgfx;
|
gfx_display_t *p_disp = disp_get_ptr();
|
||||||
struct menu_state *menu_st = menu_state_get_ptr();
|
struct menu_state *menu_st = menu_state_get_ptr();
|
||||||
|
|
||||||
switch (state)
|
switch (state)
|
||||||
@ -7282,6 +7246,7 @@ static void command_event_reinit(struct rarch_state *p_rarch,
|
|||||||
bool video_fullscreen = settings->bools.video_fullscreen;
|
bool video_fullscreen = settings->bools.video_fullscreen;
|
||||||
bool adaptive_vsync = settings->bools.video_adaptive_vsync;
|
bool adaptive_vsync = settings->bools.video_adaptive_vsync;
|
||||||
unsigned swap_interval = settings->uints.video_swap_interval;
|
unsigned swap_interval = settings->uints.video_swap_interval;
|
||||||
|
gfx_display_t *p_disp = disp_get_ptr();
|
||||||
#endif
|
#endif
|
||||||
enum input_game_focus_cmd_type
|
enum input_game_focus_cmd_type
|
||||||
game_focus_cmd = GAME_FOCUS_CMD_REAPPLY;
|
game_focus_cmd = GAME_FOCUS_CMD_REAPPLY;
|
||||||
@ -7307,7 +7272,7 @@ static void command_event_reinit(struct rarch_state *p_rarch,
|
|||||||
command_event(CMD_EVENT_GAME_FOCUS_TOGGLE, &game_focus_cmd);
|
command_event(CMD_EVENT_GAME_FOCUS_TOGGLE, &game_focus_cmd);
|
||||||
|
|
||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
p_rarch->dispgfx.framebuf_dirty = true;
|
p_disp->framebuf_dirty = true;
|
||||||
if (video_fullscreen)
|
if (video_fullscreen)
|
||||||
video_driver_hide_mouse();
|
video_driver_hide_mouse();
|
||||||
if (menu_state_get_ptr()->alive && p_rarch->current_video->set_nonblock_state)
|
if (menu_state_get_ptr()->alive && p_rarch->current_video->set_nonblock_state)
|
||||||
@ -16439,7 +16404,7 @@ static unsigned menu_event(
|
|||||||
#else
|
#else
|
||||||
const input_device_driver_t *sec_joypad = NULL;
|
const input_device_driver_t *sec_joypad = NULL;
|
||||||
#endif
|
#endif
|
||||||
gfx_display_t *p_disp = &p_rarch->dispgfx;
|
gfx_display_t *p_disp = disp_get_ptr();
|
||||||
menu_input_pointer_hw_state_t *pointer_hw_state = &menu_st->input_pointer_hw_state;
|
menu_input_pointer_hw_state_t *pointer_hw_state = &menu_st->input_pointer_hw_state;
|
||||||
menu_handle_t *menu = menu_st->driver_data;
|
menu_handle_t *menu = menu_st->driver_data;
|
||||||
bool keyboard_mapping_blocked = p_rarch->keyboard_mapping_blocked;
|
bool keyboard_mapping_blocked = p_rarch->keyboard_mapping_blocked;
|
||||||
@ -22972,7 +22937,7 @@ void video_driver_build_info(video_frame_info_t *video_info)
|
|||||||
video_info->input_driver_nonblock_state = input_driver_st ?
|
video_info->input_driver_nonblock_state = input_driver_st ?
|
||||||
input_driver_st->nonblocking_flag : false;
|
input_driver_st->nonblocking_flag : false;
|
||||||
video_info->input_driver_grab_mouse_state = p_rarch->input_driver_grab_mouse_state;
|
video_info->input_driver_grab_mouse_state = p_rarch->input_driver_grab_mouse_state;
|
||||||
video_info->disp_userdata = &p_rarch->dispgfx;
|
video_info->disp_userdata = disp_get_ptr();
|
||||||
|
|
||||||
video_info->userdata = VIDEO_DRIVER_GET_PTR_INTERNAL(p_rarch);
|
video_info->userdata = VIDEO_DRIVER_GET_PTR_INTERNAL(p_rarch);
|
||||||
|
|
||||||
@ -23641,7 +23606,7 @@ static void drivers_init(struct rarch_state *p_rarch,
|
|||||||
struct menu_state *menu_st = menu_state_get_ptr();
|
struct menu_state *menu_st = menu_state_get_ptr();
|
||||||
#endif
|
#endif
|
||||||
bool video_is_threaded = VIDEO_DRIVER_IS_THREADED_INTERNAL();
|
bool video_is_threaded = VIDEO_DRIVER_IS_THREADED_INTERNAL();
|
||||||
gfx_display_t *p_disp = &p_rarch->dispgfx;
|
gfx_display_t *p_disp = disp_get_ptr();
|
||||||
#if defined(HAVE_GFX_WIDGETS)
|
#if defined(HAVE_GFX_WIDGETS)
|
||||||
bool video_font_enable = settings->bools.video_font_enable;
|
bool video_font_enable = settings->bools.video_font_enable;
|
||||||
bool menu_enable_widgets = settings->bools.menu_enable_widgets;
|
bool menu_enable_widgets = settings->bools.menu_enable_widgets;
|
||||||
@ -23768,7 +23733,7 @@ static void drivers_init(struct rarch_state *p_rarch,
|
|||||||
rarch_force_fullscreen;
|
rarch_force_fullscreen;
|
||||||
|
|
||||||
p_rarch->widgets_active = gfx_widgets_init(
|
p_rarch->widgets_active = gfx_widgets_init(
|
||||||
&p_rarch->dispgfx,
|
p_disp,
|
||||||
anim_get_ptr(),
|
anim_get_ptr(),
|
||||||
settings,
|
settings,
|
||||||
(uintptr_t)&p_rarch->widgets_active,
|
(uintptr_t)&p_rarch->widgets_active,
|
||||||
@ -27373,6 +27338,7 @@ static enum runloop_state runloop_check_state(
|
|||||||
menu_handle_t *menu = menu_st->driver_data;
|
menu_handle_t *menu = menu_st->driver_data;
|
||||||
unsigned menu_toggle_gamepad_combo = settings->uints.input_menu_toggle_gamepad_combo;
|
unsigned menu_toggle_gamepad_combo = settings->uints.input_menu_toggle_gamepad_combo;
|
||||||
unsigned quit_gamepad_combo = settings->uints.input_quit_gamepad_combo;
|
unsigned quit_gamepad_combo = settings->uints.input_quit_gamepad_combo;
|
||||||
|
gfx_display_t *p_disp = disp_get_ptr();
|
||||||
bool menu_driver_binding_state = menu_st->is_binding;
|
bool menu_driver_binding_state = menu_st->is_binding;
|
||||||
bool menu_is_alive = menu_st->alive;
|
bool menu_is_alive = menu_st->alive;
|
||||||
bool display_kb = menu_input_dialog_get_display_kb();
|
bool display_kb = menu_input_dialog_get_display_kb();
|
||||||
@ -27869,7 +27835,7 @@ static enum runloop_state runloop_check_state(
|
|||||||
|
|
||||||
RUNLOOP_MSG_QUEUE_LOCK(runloop_state);
|
RUNLOOP_MSG_QUEUE_LOCK(runloop_state);
|
||||||
gfx_widgets_iterate(
|
gfx_widgets_iterate(
|
||||||
&p_rarch->dispgfx,
|
p_disp,
|
||||||
settings,
|
settings,
|
||||||
p_rarch->video_driver_width,
|
p_rarch->video_driver_width,
|
||||||
p_rarch->video_driver_height,
|
p_rarch->video_driver_height,
|
||||||
@ -27972,7 +27938,7 @@ static enum runloop_state runloop_check_state(
|
|||||||
* and exit the function to go to the next frame.
|
* and exit the function to go to the next frame.
|
||||||
*/
|
*/
|
||||||
menu_entries_flush_stack(NULL, MENU_SETTINGS);
|
menu_entries_flush_stack(NULL, MENU_SETTINGS);
|
||||||
disp_get_ptr()->msg_force = true;
|
p_disp->msg_force = true;
|
||||||
|
|
||||||
generic_action_ok_displaylist_push("", NULL,
|
generic_action_ok_displaylist_push("", NULL,
|
||||||
"", 0, 0, 0, ACTION_OK_DL_CONTENT_SETTINGS);
|
"", 0, 0, 0, ACTION_OK_DL_CONTENT_SETTINGS);
|
||||||
@ -27982,7 +27948,7 @@ static enum runloop_state runloop_check_state(
|
|||||||
}
|
}
|
||||||
else if (!menu_driver_iterate(p_rarch,
|
else if (!menu_driver_iterate(p_rarch,
|
||||||
menu_st,
|
menu_st,
|
||||||
&p_rarch->dispgfx,
|
p_disp,
|
||||||
anim_get_ptr(),
|
anim_get_ptr(),
|
||||||
settings,
|
settings,
|
||||||
action, current_time))
|
action, current_time))
|
||||||
@ -28011,7 +27977,7 @@ static enum runloop_state runloop_check_state(
|
|||||||
BIT64_SET(menu->state, MENU_STATE_RENDER_FRAMEBUFFER);
|
BIT64_SET(menu->state, MENU_STATE_RENDER_FRAMEBUFFER);
|
||||||
|
|
||||||
if (BIT64_GET(menu->state, MENU_STATE_RENDER_FRAMEBUFFER))
|
if (BIT64_GET(menu->state, MENU_STATE_RENDER_FRAMEBUFFER))
|
||||||
p_rarch->dispgfx.framebuf_dirty = true;
|
p_disp->framebuf_dirty = true;
|
||||||
|
|
||||||
if (BIT64_GET(menu->state, MENU_STATE_RENDER_MESSAGEBOX)
|
if (BIT64_GET(menu->state, MENU_STATE_RENDER_MESSAGEBOX)
|
||||||
&& !string_is_empty(menu->menu_state_msg))
|
&& !string_is_empty(menu->menu_state_msg))
|
||||||
|
@ -992,7 +992,6 @@ struct rarch_state
|
|||||||
#ifdef HAVE_BSV_MOVIE
|
#ifdef HAVE_BSV_MOVIE
|
||||||
bsv_movie_t *bsv_movie_state_handle; /* ptr alignment */
|
bsv_movie_t *bsv_movie_state_handle; /* ptr alignment */
|
||||||
#endif
|
#endif
|
||||||
gfx_display_t dispgfx; /* ptr alignment */
|
|
||||||
input_keyboard_press_t keyboard_press_cb; /* ptr alignment */
|
input_keyboard_press_t keyboard_press_cb; /* ptr alignment */
|
||||||
retro_input_state_t input_state_callback_original; /* ptr alignment */
|
retro_input_state_t input_state_callback_original; /* ptr alignment */
|
||||||
struct retro_audio_callback audio_callback; /* ptr alignment */
|
struct retro_audio_callback audio_callback; /* ptr alignment */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user