Get rid of RARCH_MENU_CTL_SYSTEM_INFO_*

This commit is contained in:
twinaphex 2017-05-28 16:25:46 +02:00
parent ba58eaf9fe
commit c74104f8c9
11 changed files with 36 additions and 92 deletions

View File

@ -1644,10 +1644,8 @@ bool command_event(enum event_command cmd, void *data)
{
#ifdef HAVE_MENU
bool *ptr = NULL;
struct retro_system_info *system = NULL;
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_DEINIT, NULL);
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET, &system);
rarch_system_info_t *system_info = runloop_get_system_info();
struct retro_system_info *system = &system_info->info;
if (menu_driver_ctl(RARCH_MENU_CTL_LOAD_NO_CONTENT_GET, &ptr))
{
@ -1775,6 +1773,7 @@ bool command_event(enum event_command cmd, void *data)
content_get_status(&contentless, &is_inited);
rarch_ctl(RARCH_CTL_SYSTEM_INFO_FREE, NULL);
command_event(CMD_EVENT_AUTOSAVE_STATE, NULL);
command_event(CMD_EVENT_DISABLE_OVERRIDES, NULL);
command_event(CMD_EVENT_RESTORE_DEFAULT_SHADER_PRESET, NULL);
@ -1783,9 +1782,6 @@ bool command_event(enum event_command cmd, void *data)
if (!task_push_start_dummy_core(&content_info))
return false;
#ifdef HAVE_DYNAMIC
#ifdef HAVE_MENU
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_DEINIT, NULL);
#endif
path_clear(RARCH_PATH_CORE);
#else
core_unload_game();

View File

@ -614,19 +614,17 @@ end:
static int general_push(menu_displaylist_info_t *info,
unsigned id, enum menu_displaylist_ctl_state state)
{
struct retro_system_info *system_menu = NULL;
settings_t *settings = config_get_ptr();
core_info_list_t *list = NULL;
menu_handle_t *menu = NULL;
rarch_system_info_t *system = runloop_get_system_info();
struct retro_system_info *system_menu = &system->info;
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return menu_cbs_exit();
core_info_get_list(&list);
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET, &system_menu);
switch (id)
{
case PUSH_DEFAULT:
@ -656,7 +654,7 @@ static int general_push(menu_displaylist_info_t *info,
switch (id)
{
case PUSH_ARCHIVE_OPEN:
if (system_menu->valid_extensions)
if (system_menu && system_menu->valid_extensions)
{
if (*system_menu->valid_extensions)
strlcpy(info->exts, system_menu->valid_extensions,
@ -669,7 +667,7 @@ static int general_push(menu_displaylist_info_t *info,
if (menu_setting_get_browser_selection_type(info->setting) == ST_DIR)
{
}
else if (system_menu->valid_extensions)
else if (system_menu && system_menu->valid_extensions)
{
if (*system_menu->valid_extensions)
strlcpy(info->exts, system_menu->valid_extensions,
@ -691,7 +689,7 @@ static int general_push(menu_displaylist_info_t *info,
newstring[0] = '\0';
attr.i = 0;
if (system_menu->valid_extensions)
if (system_menu && system_menu->valid_extensions)
{
if (!string_is_empty(system_menu->valid_extensions))
{

View File

@ -1378,7 +1378,8 @@ static int action_ok_playlist_entry_collection(const char *path,
const char *core_name = NULL;
playlist_t *tmp_playlist = NULL;
menu_handle_t *menu = NULL;
rarch_system_info_t *info = NULL;
rarch_system_info_t *info = runloop_get_system_info();
struct retro_system_info *system = &info->info;
content_info.argc = 0;
content_info.argv = NULL;
@ -1408,14 +1409,12 @@ static int action_ok_playlist_entry_collection(const char *path,
playlist_get_index(playlist, selection_ptr,
&entry_path, &entry_label, &core_path, &core_name, NULL, NULL);
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET, &info);
/* If the currently loaded core's name is equal
* to the core name from the playlist entry,
* then we directly load this game with the current core.
*/
if (info &&
string_is_equal(info->info.library_name, core_name))
if (system &&
string_is_equal(system->library_name, core_name))
{
if (playlist_initialized)
playlist_free(tmp_playlist);

View File

@ -853,14 +853,11 @@ static size_t mui_list_get_size(void *data, enum menu_list_type type)
static int mui_get_core_title(char *s, size_t len)
{
struct retro_system_info *system = NULL;
settings_t *settings = config_get_ptr();
const char *core_name = NULL;
const char *core_version = NULL;
rarch_system_info_t *info = runloop_get_system_info();
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET,
&system);
struct retro_system_info *system = &info->info;
core_name = system->library_name;
core_version = system->library_version;

View File

@ -4476,10 +4476,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
{
const char *core_name = NULL;
struct retro_system_info *system = NULL;
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET,
&system);
rarch_system_info_t *system_info = runloop_get_system_info();
struct retro_system_info *system = &system_info->info;
if (system)
core_name = system->library_name;
@ -4594,10 +4592,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
{
const char *core_name = NULL;
struct retro_system_info *system = NULL;
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET,
&system);
rarch_system_info_t *system_info = runloop_get_system_info();
struct retro_system_info *system = &system_info->info;
if (system)
core_name = system->library_name;
@ -6002,6 +5998,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
case DISPLAYLIST_MAIN_MENU:
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
{
rarch_system_info_t *system = runloop_get_system_info();
(void)system;
if (!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_CONTENT_SETTINGS,

View File

@ -136,7 +136,6 @@ static const uint8_t *menu_display_font_framebuf = NULL;
static msg_queue_t *menu_display_msg_queue = NULL;
static menu_display_ctx_driver_t *menu_disp = NULL;
static struct retro_system_info menu_driver_system;
static bool menu_driver_pending_quick_menu = false;
static bool menu_driver_prevent_populate = false;
static bool menu_driver_load_no_content = false;
@ -1586,14 +1585,6 @@ bool menu_driver_list_clear(void *data)
static void menu_update_libretro_info(void)
{
struct retro_system_info *info = NULL;
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET,
&info);
if (!info)
return;
command_event(CMD_EVENT_CORE_INFO_INIT, NULL);
command_event(CMD_EVENT_LOAD_CORE_PERSIST, NULL);
}
@ -1781,24 +1772,6 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
*playlist = menu_driver_playlist;
}
break;
case RARCH_MENU_CTL_SYSTEM_INFO_GET:
{
struct retro_system_info **system =
(struct retro_system_info**)data;
if (!system)
return false;
*system = &menu_driver_system;
}
break;
case RARCH_MENU_CTL_SYSTEM_INFO_DEINIT:
#ifndef HAVE_DYNAMIC
if (frontend_driver_has_fork())
#endif
{
libretro_free_system_info(&menu_driver_system);
memset(&menu_driver_system, 0, sizeof(struct retro_system_info));
}
break;
case RARCH_MENU_CTL_SET_PREVENT_POPULATE:
menu_driver_prevent_populate = true;
break;
@ -1853,7 +1826,6 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
free(menu_userdata);
menu_userdata = NULL;
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_DEINIT, NULL);
if (menu_display_msg_queue)
msg_queue_free(menu_display_msg_queue);

View File

@ -103,8 +103,6 @@ enum rarch_menu_ctl_state
RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT,
RARCH_MENU_CTL_SET_LOAD_NO_CONTENT,
RARCH_MENU_CTL_UNSET_LOAD_NO_CONTENT,
RARCH_MENU_CTL_SYSTEM_INFO_DEINIT,
RARCH_MENU_CTL_SYSTEM_INFO_GET,
RARCH_MENU_CTL_PLAYLIST_FREE,
RARCH_MENU_CTL_PLAYLIST_INIT,
RARCH_MENU_CTL_PLAYLIST_GET,

View File

@ -265,15 +265,12 @@ int menu_entries_get_title(char *s, size_t len)
int menu_entries_get_core_name(char *s, size_t len)
{
struct retro_system_info *system = NULL;
rarch_system_info_t *info = NULL;
const char *core_name = NULL;
rarch_system_info_t *info = runloop_get_system_info();
struct retro_system_info *system = &info->info;
const char *core_name = NULL;
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET,
&system);
core_name = system->library_name;
info = runloop_get_system_info();
if (system)
core_name = system->library_name;
if (string_is_empty(core_name) && info)
core_name = info->info.library_name;
@ -303,17 +300,16 @@ bool menu_entries_current_core_is_no_core(void)
* (shown at the top of the UI). */
int menu_entries_get_core_title(char *s, size_t len)
{
struct retro_system_info *system = NULL;
rarch_system_info_t *info = NULL;
const char *core_name = NULL;
const char *core_version = NULL;
rarch_system_info_t *info = runloop_get_system_info();
struct retro_system_info *system = &info->info;
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET,
&system);
core_name = system->library_name;
core_version = system->library_version;
info = runloop_get_system_info();
if (system)
{
core_name = system->library_name;
core_version = system->library_version;
}
if (string_is_empty(core_name) && info)
core_name = info->info.library_name;

View File

@ -1537,7 +1537,6 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
}
break;
case RARCH_CTL_SYSTEM_INFO_FREE:
/* No longer valid. */
if (runloop_system.subsystem.data)
free(runloop_system.subsystem.data);
@ -1559,6 +1558,7 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
audio_driver_unset_callback();
memset(&runloop_system, 0, sizeof(rarch_system_info_t));
memset(&runloop_system.info, 0, sizeof(struct retro_system_info));
break;
case RARCH_CTL_SET_FRAME_TIME_LAST:
runloop_frame_time_last = 0;
@ -2144,12 +2144,6 @@ bool retroarch_main_quit(void)
command_event(CMD_EVENT_DISABLE_OVERRIDES, NULL);
command_event(CMD_EVENT_RESTORE_DEFAULT_SHADER_PRESET, NULL);
#ifdef HAVE_DYNAMIC
#ifdef HAVE_MENU
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_DEINIT, NULL);
#endif
#endif
runloop_shutdown_initiated = true;
rarch_menu_running_finished();

View File

@ -839,11 +839,6 @@ static bool task_load_content(content_ctx_info_t *content_info,
if (sys_info)
info = &sys_info->info;
#ifdef HAVE_MENU
if (launched_from_menu)
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET, &info);
#endif
strlcpy(tmp, path_get(RARCH_PATH_CONTENT), sizeof(tmp));
if (!launched_from_menu)

View File

@ -56,15 +56,14 @@ static void netplay_crc_scan_callback(void *task_data,
{
netplay_crc_handle_t *state = (netplay_crc_handle_t*)task_data;
content_ctx_info_t content_info = {0};
rarch_system_info_t *info = NULL;
rarch_system_info_t *info = runloop_get_system_info();
struct retro_system_info *system = &info->info;
if (!state)
return;
fflush(stdout);
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET, &info);
#ifdef HAVE_MENU
/* regular core with content file */
if (!string_is_empty(state->core_path) && !string_is_empty(state->content_path)
@ -75,7 +74,7 @@ static void netplay_crc_scan_callback(void *task_data,
command_event(CMD_EVENT_NETPLAY_INIT_DIRECT_DEFERRED, state->hostname);
if (string_is_equal(info->info.library_name, state->core_name))
if (system && string_is_equal(system->library_name, state->core_name))
task_push_load_content_with_core_from_menu(
state->content_path, &content_info,
CORE_TYPE_PLAIN, NULL, NULL);