Move menu_driver_init_internal to menu_driver.c

This commit is contained in:
twinaphex 2021-09-28 09:32:11 +02:00
parent 9727be4de6
commit 9e26012751
3 changed files with 70 additions and 65 deletions

View File

@ -5195,3 +5195,66 @@ int menu_entries_get_core_title(char *s, size_t len)
return 0;
}
bool menu_driver_init_internal(
gfx_display_t *p_disp,
settings_t *settings,
bool video_is_threaded)
{
menu_ctx_environment_t menu_environ;
struct menu_state *menu_st = &menu_driver_state;;
if (menu_st->driver_ctx)
{
const char *ident = menu_st->driver_ctx->ident;
/* ID must be set first, since it is required for
* the proper determination of pixel/dpi scaling
* parameters (and some menu drivers fetch the
* current pixel/dpi scale during 'menu_driver_ctx->init()') */
if (ident)
p_disp->menu_driver_id = menu_driver_set_id(ident);
else
p_disp->menu_driver_id = MENU_DRIVER_ID_UNKNOWN;
if (menu_st->driver_ctx->init)
{
menu_st->driver_data = (menu_handle_t*)
menu_st->driver_ctx->init(&menu_st->userdata,
video_is_threaded);
menu_st->driver_data->userdata = menu_st->userdata;
menu_st->driver_data->driver_ctx = menu_st->driver_ctx;
}
}
if (!menu_st->driver_data || !rarch_menu_init(
menu_st,
&menu_st->dialog_st,
menu_st->driver_ctx,
&menu_st->input_state,
&menu_st->input_pointer_hw_state,
settings))
return false;
gfx_display_init();
/* TODO/FIXME - can we get rid of this? Is this needed? */
configuration_set_string(settings,
settings->arrays.menu_driver, menu_st->driver_ctx->ident);
if (menu_st->driver_ctx->lists_init)
{
if (!menu_st->driver_ctx->lists_init(menu_st->driver_data))
return false;
}
else
generic_menu_init_list(menu_st, settings);
/* Initialise menu screensaver */
menu_environ.type = MENU_ENVIRON_DISABLE_SCREENSAVER;
menu_environ.data = NULL;
menu_st->input_last_time_us = cpu_features_get_time_usec();
menu_st->screensaver_active = false;
menu_st->screensaver_supported = menu_driver_ctl(RARCH_MENU_CTL_ENVIRONMENT, &menu_environ);
return true;
}

View File

@ -852,6 +852,11 @@ void menu_input_search_cb(void *userdata, const char *str);
void menu_input_key_event(bool down, unsigned keycode,
uint32_t character, uint16_t mod);
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[];
RETRO_END_DECLS

View File

@ -1514,73 +1514,10 @@ static bool menu_driver_iterate(
current_time) != -1);
}
static bool menu_driver_init_internal(
gfx_display_t *p_disp,
settings_t *settings,
bool video_is_threaded)
{
struct menu_state *menu_st = menu_state_get_ptr();
menu_ctx_environment_t menu_environ;
if (menu_st->driver_ctx)
{
const char *ident = menu_st->driver_ctx->ident;
/* ID must be set first, since it is required for
* the proper determination of pixel/dpi scaling
* parameters (and some menu drivers fetch the
* current pixel/dpi scale during 'menu_driver_ctx->init()') */
if (ident)
p_disp->menu_driver_id = menu_driver_set_id(ident);
else
p_disp->menu_driver_id = MENU_DRIVER_ID_UNKNOWN;
if (menu_st->driver_ctx->init)
{
menu_st->driver_data = (menu_handle_t*)
menu_st->driver_ctx->init(&menu_st->userdata,
video_is_threaded);
menu_st->driver_data->userdata = menu_st->userdata;
menu_st->driver_data->driver_ctx = menu_st->driver_ctx;
}
}
if (!menu_st->driver_data || !rarch_menu_init(
menu_st,
&menu_st->dialog_st,
menu_st->driver_ctx,
&menu_st->input_state,
&menu_st->input_pointer_hw_state,
settings))
return false;
gfx_display_init();
/* TODO/FIXME - can we get rid of this? Is this needed? */
configuration_set_string(settings,
settings->arrays.menu_driver, menu_st->driver_ctx->ident);
if (menu_st->driver_ctx->lists_init)
{
if (!menu_st->driver_ctx->lists_init(menu_st->driver_data))
return false;
}
else
generic_menu_init_list(menu_st, settings);
/* Initialise menu screensaver */
menu_environ.type = MENU_ENVIRON_DISABLE_SCREENSAVER;
menu_environ.data = NULL;
menu_st->input_last_time_us = cpu_features_get_time_usec();
menu_st->screensaver_active = false;
menu_st->screensaver_supported = menu_driver_ctl(RARCH_MENU_CTL_ENVIRONMENT, &menu_environ);
return true;
}
bool menu_driver_init(bool video_is_threaded)
{
gfx_display_t *p_disp = &rarch_st.dispgfx;
settings_t *settings = &rarch_st.configuration_settings;
settings_t *settings = rarch_st.configuration_settings;
struct menu_state *menu_st = menu_state_get_ptr();
command_event(CMD_EVENT_CORE_INFO_INIT, NULL);
@ -5067,7 +5004,7 @@ bool command_read_memory(command_t *cmd, const char *arg)
unsigned int nbytes = 0;
unsigned int alloc_size = 0;
unsigned int address = -1;
unsigned int len = 0;
size_t len = 0;
unsigned int max_bytes = 0;
const rarch_system_info_t* system = &runloop_state.system;