1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-03 00:38:44 +00:00

(Menu) Menu driver no longer uses a duplicate system info

struct
This commit is contained in:
twinaphex 2017-05-28 17:21:57 +02:00
parent c74104f8c9
commit 3fbed8df27
11 changed files with 150 additions and 156 deletions

View File

@ -1643,30 +1643,25 @@ bool command_event(enum event_command cmd, void *data)
case CMD_EVENT_LOAD_CORE_PERSIST:
{
#ifdef HAVE_MENU
bool *ptr = NULL;
core_info_ctx_find_t info_find;
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))
{
core_info_ctx_find_t info_find;
#if defined(HAVE_DYNAMIC)
if (string_is_empty(path_get(RARCH_PATH_CORE)))
return false;
if (string_is_empty(path_get(RARCH_PATH_CORE)))
return false;
#endif
libretro_get_system_info(
path_get(RARCH_PATH_CORE),
system,
ptr);
info_find.path = path_get(RARCH_PATH_CORE);
libretro_get_system_info(
path_get(RARCH_PATH_CORE),
system,
&system_info->load_no_content);
info_find.path = path_get(RARCH_PATH_CORE);
if (!core_info_load(&info_find))
{
if (!core_info_load(&info_find))
{
#ifdef HAVE_DYNAMIC
return false;
return false;
#endif
}
}
#endif
}
@ -1773,7 +1768,6 @@ 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,10 +1777,10 @@ bool command_event(enum event_command cmd, void *data)
return false;
#ifdef HAVE_DYNAMIC
path_clear(RARCH_PATH_CORE);
#else
rarch_ctl(RARCH_CTL_SYSTEM_INFO_FREE, NULL);
#endif
core_unload_game();
core_unload();
#endif
}
break;
case CMD_EVENT_QUIT:

1
core.h
View File

@ -60,6 +60,7 @@ typedef struct rarch_system_info
unsigned rotation;
unsigned performance_level;
bool load_no_content;
const char *input_desc_btn[MAX_USERS][RARCH_FIRST_META_KEY];
char valid_extensions[255];

View File

@ -380,7 +380,9 @@ bool core_unload_game(void)
{
video_driver_free_hw_context();
audio_driver_stop();
current_core.retro_unload_game();
current_core.game_loaded = false;
return true;
}

View File

@ -1798,70 +1798,75 @@ static int mui_list_push(void *data, void *userdata,
ret = 0;
break;
case DISPLAYLIST_MAIN_MENU:
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
entry.data = menu;
entry.info = info;
entry.parse_type = PARSE_ACTION;
entry.add_empty_entry = false;
if (!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
{
entry.enum_idx = MENU_ENUM_LABEL_CONTENT_SETTINGS;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
}
rarch_system_info_t *system = runloop_get_system_info();
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
if (menu_driver_ctl(RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT, NULL))
{
entry.enum_idx = MENU_ENUM_LABEL_START_CORE;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
}
entry.data = menu;
entry.info = info;
entry.parse_type = PARSE_ACTION;
entry.add_empty_entry = false;
if (!string_is_empty(system->info.library_name) &&
!string_is_equal(system->info.library_name,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE)))
{
entry.enum_idx = MENU_ENUM_LABEL_CONTENT_SETTINGS;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
}
if (system->load_no_content)
{
entry.enum_idx = MENU_ENUM_LABEL_START_CORE;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
}
#ifndef HAVE_DYNAMIC
if (frontend_driver_has_fork())
if (frontend_driver_has_fork())
#endif
{
entry.enum_idx = MENU_ENUM_LABEL_CORE_LIST;
{
entry.enum_idx = MENU_ENUM_LABEL_CORE_LIST;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
}
entry.enum_idx = MENU_ENUM_LABEL_LOAD_CONTENT_LIST;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
}
entry.enum_idx = MENU_ENUM_LABEL_LOAD_CONTENT_LIST;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
entry.enum_idx = MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
entry.enum_idx = MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
#if defined(HAVE_NETWORKING)
entry.enum_idx = MENU_ENUM_LABEL_ONLINE_UPDATER;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
entry.enum_idx = MENU_ENUM_LABEL_ONLINE_UPDATER;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
entry.enum_idx = MENU_ENUM_LABEL_NETPLAY;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
entry.enum_idx = MENU_ENUM_LABEL_NETPLAY;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
#endif
entry.enum_idx = MENU_ENUM_LABEL_INFORMATION_LIST;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
entry.enum_idx = MENU_ENUM_LABEL_INFORMATION_LIST;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
#ifndef HAVE_DYNAMIC
entry.enum_idx = MENU_ENUM_LABEL_RESTART_RETROARCH;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
entry.enum_idx = MENU_ENUM_LABEL_RESTART_RETROARCH;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
#endif
entry.enum_idx = MENU_ENUM_LABEL_CONFIGURATIONS_LIST;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
entry.enum_idx = MENU_ENUM_LABEL_CONFIGURATIONS_LIST;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
entry.enum_idx = MENU_ENUM_LABEL_HELP_LIST;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
entry.enum_idx = MENU_ENUM_LABEL_HELP_LIST;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
#if !defined(IOS)
entry.enum_idx = MENU_ENUM_LABEL_QUIT_RETROARCH;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
entry.enum_idx = MENU_ENUM_LABEL_QUIT_RETROARCH;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
#endif
#if defined(HAVE_LAKKA)
entry.enum_idx = MENU_ENUM_LABEL_REBOOT;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
entry.enum_idx = MENU_ENUM_LABEL_REBOOT;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
entry.enum_idx = MENU_ENUM_LABEL_SHUTDOWN;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
entry.enum_idx = MENU_ENUM_LABEL_SHUTDOWN;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
#endif
info->need_push = true;
ret = 0;
info->need_push = true;
ret = 0;
}
break;
}
return ret;

View File

@ -4031,64 +4031,69 @@ static int xmb_list_push(void *data, void *userdata,
switch (type)
{
case DISPLAYLIST_MAIN_MENU:
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
entry.data = menu;
entry.info = info;
entry.parse_type = PARSE_ACTION;
entry.add_empty_entry = false;
if (!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
{
entry.enum_idx = MENU_ENUM_LABEL_CONTENT_SETTINGS;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
}
rarch_system_info_t *system = runloop_get_system_info();
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
if (menu_driver_ctl(RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT, NULL))
{
entry.enum_idx = MENU_ENUM_LABEL_START_CORE;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
}
entry.data = menu;
entry.info = info;
entry.parse_type = PARSE_ACTION;
entry.add_empty_entry = false;
if (!string_is_empty(system->info.library_name) &&
!string_is_equal(system->info.library_name,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE)))
{
entry.enum_idx = MENU_ENUM_LABEL_CONTENT_SETTINGS;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
}
if (system->load_no_content)
{
entry.enum_idx = MENU_ENUM_LABEL_START_CORE;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
}
#ifndef HAVE_DYNAMIC
if (frontend_driver_has_fork())
if (frontend_driver_has_fork())
#endif
{
entry.enum_idx = MENU_ENUM_LABEL_CORE_LIST;
{
entry.enum_idx = MENU_ENUM_LABEL_CORE_LIST;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
}
entry.enum_idx = MENU_ENUM_LABEL_LOAD_CONTENT_LIST;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
}
entry.enum_idx = MENU_ENUM_LABEL_LOAD_CONTENT_LIST;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
entry.enum_idx = MENU_ENUM_LABEL_ADD_CONTENT_LIST;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
entry.enum_idx = MENU_ENUM_LABEL_ADD_CONTENT_LIST;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
#if defined(HAVE_NETWORKING)
entry.enum_idx = MENU_ENUM_LABEL_ONLINE_UPDATER;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
entry.enum_idx = MENU_ENUM_LABEL_ONLINE_UPDATER;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
#endif
entry.enum_idx = MENU_ENUM_LABEL_INFORMATION_LIST;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
entry.enum_idx = MENU_ENUM_LABEL_INFORMATION_LIST;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
#ifndef HAVE_DYNAMIC
entry.enum_idx = MENU_ENUM_LABEL_RESTART_RETROARCH;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
entry.enum_idx = MENU_ENUM_LABEL_RESTART_RETROARCH;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
#endif
entry.enum_idx = MENU_ENUM_LABEL_CONFIGURATIONS_LIST;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
entry.enum_idx = MENU_ENUM_LABEL_CONFIGURATIONS_LIST;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
entry.enum_idx = MENU_ENUM_LABEL_HELP_LIST;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
entry.enum_idx = MENU_ENUM_LABEL_HELP_LIST;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
#if !defined(IOS)
entry.enum_idx = MENU_ENUM_LABEL_QUIT_RETROARCH;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
entry.enum_idx = MENU_ENUM_LABEL_QUIT_RETROARCH;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
#endif
entry.enum_idx = MENU_ENUM_LABEL_REBOOT;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
entry.enum_idx = MENU_ENUM_LABEL_REBOOT;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
entry.enum_idx = MENU_ENUM_LABEL_SHUTDOWN;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
info->need_push = true;
ret = 0;
entry.enum_idx = MENU_ENUM_LABEL_SHUTDOWN;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
info->need_push = true;
ret = 0;
}
break;
}
return ret;

View File

@ -6000,16 +6000,19 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
{
rarch_system_info_t *system = runloop_get_system_info();
(void)system;
if (system)
{
if ( !string_is_empty(system->info.library_name) &&
!string_is_equal(system->info.library_name,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE)))
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_CONTENT_SETTINGS,
PARSE_ACTION, false);
if (!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_CONTENT_SETTINGS,
PARSE_ACTION, false);
if (menu_driver_ctl(RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT, NULL))
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_START_CORE, PARSE_ACTION, false);
if (system->load_no_content)
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_START_CORE, PARSE_ACTION, false);
}
#ifndef HAVE_DYNAMIC

View File

@ -138,7 +138,6 @@ static menu_display_ctx_driver_t *menu_disp = NULL;
static bool menu_driver_pending_quick_menu = false;
static bool menu_driver_prevent_populate = false;
static bool menu_driver_load_no_content = false;
static bool menu_driver_alive = false;
static bool menu_driver_toggled = false;
static bool menu_driver_data_own = false;
@ -1685,7 +1684,6 @@ void menu_driver_destroy(void)
menu_driver_pending_quit = false;
menu_driver_pending_shutdown = false;
menu_driver_prevent_populate = false;
menu_driver_load_no_content = false;
menu_driver_alive = false;
menu_driver_data_own = false;
menu_driver_ctx = NULL;
@ -1851,22 +1849,6 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
}
menu_driver_data = NULL;
break;
case RARCH_MENU_CTL_LOAD_NO_CONTENT_GET:
{
bool **ptr = (bool**)data;
if (!ptr)
return false;
*ptr = (bool*)&menu_driver_load_no_content;
}
break;
case RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT:
return menu_driver_load_no_content;
case RARCH_MENU_CTL_SET_LOAD_NO_CONTENT:
menu_driver_load_no_content = true;
break;
case RARCH_MENU_CTL_UNSET_LOAD_NO_CONTENT:
menu_driver_load_no_content = false;
break;
case RARCH_MENU_CTL_LIST_GET_ENTRY:
{
menu_ctx_list_t *list = (menu_ctx_list_t*)data;

View File

@ -99,10 +99,6 @@ enum rarch_menu_ctl_state
RARCH_MENU_CTL_SET_OWN_DRIVER,
RARCH_MENU_CTL_UNSET_OWN_DRIVER,
RARCH_MENU_CTL_OWNS_DRIVER,
RARCH_MENU_CTL_LOAD_NO_CONTENT_GET,
RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT,
RARCH_MENU_CTL_SET_LOAD_NO_CONTENT,
RARCH_MENU_CTL_UNSET_LOAD_NO_CONTENT,
RARCH_MENU_CTL_PLAYLIST_FREE,
RARCH_MENU_CTL_PLAYLIST_INIT,
RARCH_MENU_CTL_PLAYLIST_GET,

View File

@ -1538,6 +1538,7 @@ 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);
runloop_system.subsystem.data = NULL;
@ -1557,8 +1558,14 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
runloop_frontend_key_event = NULL;
audio_driver_unset_callback();
runloop_system.info.library_name = NULL;
runloop_system.info.library_version = NULL;
runloop_system.info.valid_extensions = NULL;
runloop_system.info.need_fullpath = false;
runloop_system.info.block_extract = false;
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;

View File

@ -756,12 +756,12 @@ static void menu_content_environment_get(int *argc, char *argv[],
void *args, void *params_data)
{
struct rarch_main_wrap *wrap_args = (struct rarch_main_wrap*)params_data;
rarch_system_info_t *sys_info = runloop_get_system_info();
if (!wrap_args)
return;
wrap_args->no_content = menu_driver_ctl(
RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT, NULL);
wrap_args->no_content = sys_info->load_no_content;
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_VERBOSITY, NULL))
wrap_args->verbose = verbosity_is_enabled();
@ -990,6 +990,7 @@ bool task_push_start_dummy_core(content_ctx_info_t *content_info)
char *error_string = NULL;
global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
rarch_system_info_t *sys_info = runloop_get_system_info();
if (!content_info)
return false;
@ -1039,9 +1040,7 @@ bool task_push_start_dummy_core(content_ctx_info_t *content_info)
/* Preliminary stuff that has to be done before we
* load the actual content. Can differ per mode. */
#ifdef HAVE_MENU
menu_driver_ctl(RARCH_MENU_CTL_UNSET_LOAD_NO_CONTENT, NULL);
#endif
sys_info->load_no_content = false;
rarch_ctl(RARCH_CTL_STATE_FREE, NULL);
rarch_ctl(RARCH_CTL_DATA_DEINIT, NULL);
rarch_ctl(RARCH_CTL_TASK_INIT, NULL);
@ -1086,6 +1085,7 @@ bool task_push_load_content_from_playlist_from_menu(
char *error_string = NULL;
global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
rarch_system_info_t *sys_info = runloop_get_system_info();
content_ctx.check_firmware_before_loading = settings->bools.check_firmware_before_loading;
content_ctx.is_ips_pref = rarch_ctl(RARCH_CTL_IS_IPS_PREF, NULL);
@ -1127,9 +1127,9 @@ bool task_push_load_content_from_playlist_from_menu(
/* Is content required by this core? */
if (fullpath)
menu_driver_ctl(RARCH_MENU_CTL_UNSET_LOAD_NO_CONTENT, NULL);
sys_info->load_no_content = false;
else
menu_driver_ctl(RARCH_MENU_CTL_SET_LOAD_NO_CONTENT, NULL);
sys_info->load_no_content = true;
/* On targets that have no dynamic core loading support, we'd
* execute the new core from this point. If this returns false,

View File

@ -278,12 +278,11 @@ static char** waiting_argv;
{
if (filenames.count == 1 && [filenames objectAtIndex:0])
{
struct retro_system_info *system = NULL;
NSString *__core = [filenames objectAtIndex:0];
const char *core_name = NULL;
rarch_system_info_t *info = runloop_get_system_info();
struct retro_system_info *system = &info->info;
NSString *__core = [filenames objectAtIndex:0];
const char *core_name = NULL;
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET, &system);
if (system)
core_name = system->library_name;
@ -320,6 +319,7 @@ static char** waiting_argv;
static void open_core_handler(ui_browser_window_state_t *state, bool result)
{
rarch_system_info_t *info = runloop_get_system_info();
if (!state)
return;
if (string_is_empty(state->result))
@ -332,8 +332,8 @@ static void open_core_handler(ui_browser_window_state_t *state, bool result)
rarch_ctl(RARCH_CTL_SET_LIBRETRO_PATH, (void*)state->result);
ui_companion_event_command(CMD_EVENT_LOAD_CORE);
if (menu_driver_ctl(RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT, NULL)
&& settings->bools.set_supports_no_game_enable)
if (info && info->load_no_content
&& settings->bools.set_supports_no_game_enable)
{
content_ctx_info_t content_info = {0};
path_clear(RARCH_PATH_CONTENT);
@ -354,11 +354,10 @@ static void open_document_handler(ui_browser_window_state_t *state, bool result)
if (!result)
return;
struct retro_system_info *system = 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);
if (system)
core_name = system->library_name;