mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-20 09:34:09 +00:00
Simplify libretro_get_system_info
This commit is contained in:
parent
d0b0246ee4
commit
ba58eaf9fe
80
dynamic.c
80
dynamic.c
@ -297,10 +297,32 @@ static dylib_t libretro_get_system_info_lib(const char *path,
|
||||
return lib;
|
||||
}
|
||||
#else
|
||||
static bool libretro_get_system_info_static(struct retro_system_info *info,
|
||||
static void libretro_get_system_info_static(struct retro_system_info *info,
|
||||
bool *load_no_content)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* libretro_get_system_info:
|
||||
* @path : Path to libretro library.
|
||||
* @info : Pointer to system info information.
|
||||
* @load_no_content : If true, core should be able to auto-start
|
||||
* without any content loaded.
|
||||
*
|
||||
* Gets system info from an arbitrary lib.
|
||||
* The struct returned must be freed as strings are allocated dynamically.
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
bool libretro_get_system_info(const char *path,
|
||||
struct retro_system_info *info, bool *load_no_content)
|
||||
{
|
||||
struct retro_system_info dummy_info;
|
||||
#ifdef HAVE_DYNAMIC
|
||||
dylib_t lib;
|
||||
#endif
|
||||
|
||||
dummy_info.library_name = NULL;
|
||||
dummy_info.library_version = NULL;
|
||||
@ -308,6 +330,13 @@ static bool libretro_get_system_info_static(struct retro_system_info *info,
|
||||
dummy_info.need_fullpath = false;
|
||||
dummy_info.block_extract = false;
|
||||
|
||||
#ifdef HAVE_DYNAMIC
|
||||
lib = libretro_get_system_info_lib(
|
||||
path, &dummy_info, load_no_content);
|
||||
|
||||
if (!lib)
|
||||
return false;
|
||||
#else
|
||||
if (load_no_content)
|
||||
{
|
||||
load_no_content_hook = load_no_content;
|
||||
@ -327,6 +356,8 @@ static bool libretro_get_system_info_static(struct retro_system_info *info,
|
||||
}
|
||||
|
||||
retro_get_system_info(&dummy_info);
|
||||
#endif
|
||||
|
||||
memcpy(info, &dummy_info, sizeof(*info));
|
||||
|
||||
if (!string_is_empty(dummy_info.library_name))
|
||||
@ -336,59 +367,14 @@ static bool libretro_get_system_info_static(struct retro_system_info *info,
|
||||
|
||||
if (dummy_info.valid_extensions)
|
||||
info->valid_extensions = strdup(dummy_info.valid_extensions);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* libretro_get_system_info:
|
||||
* @path : Path to libretro library.
|
||||
* @info : Pointer to system info information.
|
||||
* @load_no_content : If true, core should be able to auto-start
|
||||
* without any content loaded.
|
||||
*
|
||||
* Gets system info from an arbitrary lib.
|
||||
* The struct returned must be freed as strings are allocated dynamically.
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
bool libretro_get_system_info(const char *path,
|
||||
struct retro_system_info *info, bool *load_no_content)
|
||||
{
|
||||
#ifdef HAVE_DYNAMIC
|
||||
dylib_t lib;
|
||||
struct retro_system_info dummy_info;
|
||||
|
||||
dummy_info.library_name = NULL;
|
||||
dummy_info.library_version = NULL;
|
||||
dummy_info.valid_extensions = NULL;
|
||||
dummy_info.need_fullpath = false;
|
||||
dummy_info.block_extract = false;
|
||||
|
||||
lib = libretro_get_system_info_lib(
|
||||
path, &dummy_info, load_no_content);
|
||||
|
||||
if (!lib)
|
||||
return false;
|
||||
|
||||
memcpy(info, &dummy_info, sizeof(*info));
|
||||
if (!string_is_empty(dummy_info.library_name))
|
||||
info->library_name = strdup(dummy_info.library_name);
|
||||
if (!string_is_empty(dummy_info.library_version))
|
||||
info->library_version = strdup(dummy_info.library_version);
|
||||
|
||||
if (dummy_info.valid_extensions)
|
||||
info->valid_extensions = strdup(dummy_info.valid_extensions);
|
||||
|
||||
dylib_close(lib);
|
||||
#else
|
||||
if (!libretro_get_system_info_static(info, load_no_content))
|
||||
return false;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* load_symbols:
|
||||
* @type : Type of core to be loaded.
|
||||
|
Loading…
x
Reference in New Issue
Block a user