Add runloop_get_libretro_system_info

This commit is contained in:
twinaphex 2018-10-30 08:21:32 +01:00
parent 6c51c4458b
commit 51430e9e5f
6 changed files with 31 additions and 24 deletions

View File

@ -396,15 +396,14 @@ int menu_entries_get_title(char *s, size_t len)
int menu_entries_get_core_name(char *s, size_t len)
{
rarch_system_info_t *info = runloop_get_system_info();
struct retro_system_info *system = &info->info;
struct retro_system_info *system = runloop_get_libretro_system_info();
const char *core_name = NULL;
if (system)
core_name = system->library_name;
if (string_is_empty(core_name) && info)
core_name = info->info.library_name;
if (string_is_empty(core_name) && system)
core_name = system->library_name;
if (string_is_empty(core_name))
core_name = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE);
@ -417,10 +416,9 @@ int menu_entries_get_core_name(char *s, size_t len)
* (shown at the top of the UI). */
int menu_entries_get_core_title(char *s, size_t len)
{
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;
const char *core_name = NULL;
const char *core_version = NULL;
struct retro_system_info *system = runloop_get_libretro_system_info();
#if _MSC_VER == 1200
const char *extra_version = " msvc6";
#elif _MSC_VER == 1300
@ -451,13 +449,13 @@ int menu_entries_get_core_title(char *s, size_t len)
core_version = system->library_version;
}
if (string_is_empty(core_name) && info)
core_name = info->info.library_name;
if (string_is_empty(core_name) && system)
core_name = system->library_name;
if (string_is_empty(core_name))
core_name = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE);
if (!core_version && info)
core_version = info->info.library_version;
if (!core_version && system)
core_version = system->library_version;
if (!core_version)
core_version = "";

13
paths.c
View File

@ -67,6 +67,7 @@ void path_set_redirect(void)
const char *old_savefile_dir = dir_get(RARCH_DIR_SAVEFILE);
const char *old_savestate_dir = dir_get(RARCH_DIR_SAVESTATE);
rarch_system_info_t *info = runloop_get_system_info();
struct retro_system_info *system = runloop_get_libretro_system_info();
settings_t *settings = config_get_ptr();
new_savefile_dir[0] = new_savestate_dir[0] = '\0';
@ -76,10 +77,10 @@ void path_set_redirect(void)
strlcpy(new_savefile_dir, old_savefile_dir, path_size);
strlcpy(new_savestate_dir, old_savestate_dir, path_size);
if (info && !string_is_empty(info->info.library_name))
if (system && !string_is_empty(system->library_name))
{
#ifdef HAVE_MENU
if (!string_is_equal(info->info.library_name,
if (!string_is_equal(system->library_name,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE)))
#endif
check_library_name = true;
@ -94,7 +95,7 @@ void path_set_redirect(void)
fill_pathname_join(
new_savefile_dir,
old_savefile_dir,
info->info.library_name,
system->library_name,
path_size);
/* If path doesn't exist, try to create it,
@ -121,7 +122,7 @@ void path_set_redirect(void)
fill_pathname_join(
new_savestate_dir,
old_savestate_dir,
info->info.library_name,
system->library_name,
path_size);
/* If path doesn't exist, try to create it.
@ -173,7 +174,7 @@ void path_set_redirect(void)
{
fill_pathname_dir(global->name.savefile,
!string_is_empty(path_main_basename) ? path_main_basename :
info ? info->info.library_name : NULL,
system ? system->library_name : NULL,
file_path_str(FILE_PATH_SRM_EXTENSION),
sizeof(global->name.savefile));
RARCH_LOG("%s \"%s\".\n",
@ -185,7 +186,7 @@ void path_set_redirect(void)
{
fill_pathname_dir(global->name.savestate,
!string_is_empty(path_main_basename) ? path_main_basename :
info ? info->info.library_name : NULL,
system ? system->library_name : NULL,
file_path_str(FILE_PATH_STATE_EXTENSION),
sizeof(global->name.savestate));
RARCH_LOG("%s \"%s\".\n",

View File

@ -3593,3 +3593,9 @@ rarch_system_info_t *runloop_get_system_info(void)
{
return &runloop_system;
}
struct retro_system_info *runloop_get_libretro_system_info(void)
{
struct retro_system_info *system = &runloop_system.info;
return system;
}

View File

@ -387,6 +387,8 @@ bool retroarch_is_on_main_thread(void);
rarch_system_info_t *runloop_get_system_info(void);
struct retro_system_info *runloop_get_libretro_system_info(void);
#ifdef HAVE_THREADS
void runloop_msg_queue_lock(void);

View File

@ -896,9 +896,8 @@ static bool task_load_content(content_ctx_info_t *content_info,
{
size_t tmp_size = PATH_MAX_LENGTH * sizeof(char);
char *tmp = (char*)malloc(tmp_size);
rarch_system_info_t *sys_info = runloop_get_system_info();
const char *path_content = path_get(RARCH_PATH_CONTENT);
struct retro_system_info *info = sys_info ? &sys_info->info : NULL;
struct retro_system_info *info = runloop_get_libretro_system_info();
tmp[0] = '\0';

View File

@ -56,8 +56,6 @@ 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 = runloop_get_system_info();
struct retro_system_info *system = &info->info;
if (!state)
return;
@ -69,6 +67,8 @@ static void netplay_crc_scan_callback(void *task_data,
if (!string_is_empty(state->core_path) && !string_is_empty(state->content_path)
&& !state->contentless && !state->current)
{
struct retro_system_info *system = runloop_get_libretro_system_info();
RARCH_LOG("[lobby] loading core %s with content file %s\n",
state->core_path, state->content_path);
@ -89,13 +89,14 @@ static void netplay_crc_scan_callback(void *task_data,
if (!string_is_empty(state->core_path) && !string_is_empty(state->content_path)
&& state->contentless)
{
content_ctx_info_t content_info = {0};
content_ctx_info_t content_info = {0};
struct retro_system_info *system = runloop_get_libretro_system_info();
RARCH_LOG("[lobby] loading contentless core %s\n", state->core_path);
command_event(CMD_EVENT_NETPLAY_INIT_DIRECT_DEFERRED, state->hostname);
if (!string_is_equal(info->info.library_name, state->core_name))
if (!string_is_equal(system->library_name, state->core_name))
task_push_load_new_core(state->core_path, NULL,
&content_info, CORE_TYPE_PLAIN, NULL, NULL);