mirror of
https://github.com/libretro/RetroArch
synced 2025-02-02 05:54:16 +00:00
Use same system as dynamic cores to get system info.
This commit is contained in:
parent
fdaf6ffead
commit
ef79734e7c
@ -1013,6 +1013,8 @@ bool event_cmd_ctl(enum event_command cmd, void *data)
|
||||
|
||||
libretro_get_system_info(settings->libretro, system,
|
||||
ptr);
|
||||
#else
|
||||
libretro_get_system_info_static(system, ptr);
|
||||
#endif
|
||||
info_find.path = settings->libretro;
|
||||
|
||||
|
4
driver.c
4
driver.c
@ -288,10 +288,6 @@ static void menu_update_libretro_info(void)
|
||||
if (!info)
|
||||
return;
|
||||
|
||||
#ifndef HAVE_DYNAMIC
|
||||
retro_get_system_info(info);
|
||||
#endif
|
||||
|
||||
event_cmd_ctl(EVENT_CMD_CORE_INFO_INIT, NULL);
|
||||
event_cmd_ctl(EVENT_CMD_LOAD_CORE_PERSIST, NULL);
|
||||
}
|
||||
|
70
dynamic.c
70
dynamic.c
@ -113,7 +113,23 @@ libretro_find_controller_description(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef HAVE_DYNAMIC
|
||||
/**
|
||||
* libretro_free_system_info:
|
||||
* @info : Pointer to system info information.
|
||||
*
|
||||
* Frees system information.
|
||||
**/
|
||||
void libretro_free_system_info(struct retro_system_info *info)
|
||||
{
|
||||
if (!info)
|
||||
return;
|
||||
|
||||
free((void*)info->library_name);
|
||||
free((void*)info->library_version);
|
||||
free((void*)info->valid_extensions);
|
||||
memset(info, 0, sizeof(*info));
|
||||
}
|
||||
|
||||
static bool *load_no_content_hook;
|
||||
|
||||
static bool environ_cb_get_system_info(unsigned cmd, void *data)
|
||||
@ -131,6 +147,42 @@ static bool environ_cb_get_system_info(unsigned cmd, void *data)
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifndef HAVE_DYNAMIC
|
||||
bool libretro_get_system_info_static(struct retro_system_info *info,
|
||||
bool *load_no_content)
|
||||
{
|
||||
struct retro_system_info dummy_info = {0};
|
||||
|
||||
if (load_no_content)
|
||||
{
|
||||
load_no_content_hook = load_no_content;
|
||||
|
||||
/* load_no_content gets set in this callback. */
|
||||
retro_set_environment(environ_cb_get_system_info);
|
||||
|
||||
/* It's possible that we just set get_system_info callback
|
||||
* to the currently running core.
|
||||
*
|
||||
* Make sure we reset it to the actual environment callback.
|
||||
* Ignore any environment callbacks here in case we're running
|
||||
* on the non-current core. */
|
||||
ignore_environment_cb = true;
|
||||
retro_set_environment(rarch_environment_cb);
|
||||
ignore_environment_cb = false;
|
||||
}
|
||||
|
||||
retro_get_system_info(&dummy_info);
|
||||
memcpy(info, &dummy_info, sizeof(*info));
|
||||
|
||||
info->library_name = strdup(dummy_info.library_name);
|
||||
info->library_version = strdup(dummy_info.library_version);
|
||||
if (dummy_info.valid_extensions)
|
||||
info->valid_extensions = strdup(dummy_info.valid_extensions);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DYNAMIC
|
||||
/**
|
||||
* libretro_get_environment_info:
|
||||
* @func : Function pointer for get_environment_info.
|
||||
@ -238,22 +290,6 @@ bool libretro_get_system_info(const char *path,
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* libretro_free_system_info:
|
||||
* @info : Pointer to system info information.
|
||||
*
|
||||
* Frees system information.
|
||||
**/
|
||||
void libretro_free_system_info(struct retro_system_info *info)
|
||||
{
|
||||
if (!info)
|
||||
return;
|
||||
|
||||
free((void*)info->library_name);
|
||||
free((void*)info->library_version);
|
||||
free((void*)info->valid_extensions);
|
||||
memset(info, 0, sizeof(*info));
|
||||
}
|
||||
static void load_dynamic_core(void)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
16
dynamic.h
16
dynamic.h
@ -72,6 +72,21 @@ void libretro_get_environment_info(void (*)(retro_environment_t),
|
||||
**/
|
||||
bool libretro_get_system_info(const char *path,
|
||||
struct retro_system_info *info, bool *load_no_content);
|
||||
#else
|
||||
/**
|
||||
* libretro_get_system_info_static:
|
||||
* @info : System info information.
|
||||
* @load_no_content : If true, core should be able to auto-start
|
||||
* without any content loaded.
|
||||
*
|
||||
* Gets system info from the current statically linked libretro library.
|
||||
* The struct returned must be freed as strings are allocated dynamically.
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
bool libretro_get_system_info_static(struct retro_system_info *info,
|
||||
bool *load_no_content);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* libretro_free_system_info:
|
||||
@ -80,7 +95,6 @@ bool libretro_get_system_info(const char *path,
|
||||
* Frees system information.
|
||||
**/
|
||||
void libretro_free_system_info(struct retro_system_info *info);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* libretro_get_current_core_pathname:
|
||||
|
@ -423,10 +423,8 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
|
||||
}
|
||||
break;
|
||||
case RARCH_MENU_CTL_SYSTEM_INFO_DEINIT:
|
||||
#ifdef HAVE_DYNAMIC
|
||||
libretro_free_system_info(&menu_driver_system);
|
||||
memset(&menu_driver_system, 0, sizeof(struct retro_system_info));
|
||||
#endif
|
||||
break;
|
||||
case RARCH_MENU_CTL_RENDER_MESSAGEBOX:
|
||||
if (menu_driver_ctx->render_messagebox)
|
||||
|
Loading…
x
Reference in New Issue
Block a user