move get _libretro_core_name to dynamic.c

This commit is contained in:
twinaphex 2013-03-22 20:54:33 +01:00
parent 8fb9ab16d4
commit 7e0afcf610
4 changed files with 33 additions and 33 deletions

View File

@ -256,6 +256,33 @@ static void load_symbols(void)
SYM(retro_get_memory_size);
}
void get_libretro_core_name(char *name, size_t size)
{
if (size == 0)
return;
struct retro_system_info info;
retro_get_system_info(&info);
const char *id = info.library_name ? info.library_name : "Unknown";
if (!id || strlen(id) >= size)
{
name[0] = '\0';
return;
}
name[strlen(id)] = '\0';
for (size_t i = 0; id[i] != '\0'; i++)
{
char c = id[i];
if (isspace(c) || isblank(c))
name[i] = '_';
else
name[i] = tolower(c);
}
}
void init_libretro_sym(void)
{
// Guarantee that we can do "dirty" casting.

View File

@ -52,6 +52,9 @@ bool libretro_get_system_info(const char *path, struct retro_system_info *info);
void libretro_free_system_info(struct retro_system_info *info);
#endif
// Transforms a library id to a name suitable as a pathname.
void get_libretro_core_name(char *name, size_t size);
extern void (*pretro_init)(void);
extern void (*pretro_deinit)(void);

View File

@ -115,39 +115,11 @@ static void verbose_log_init(void)
}
#ifdef HAVE_LIBRETRO_MANAGEMENT
// Transforms a library id to a name suitable as a pathname.
static void get_libretro_core_name(char *name, size_t size)
{
if (size == 0)
return;
struct retro_system_info info;
retro_get_system_info(&info);
const char *id = info.library_name ? info.library_name : "Unknown";
if (!id || strlen(id) >= size)
{
name[0] = '\0';
return;
}
name[strlen(id)] = '\0';
for (size_t i = 0; id[i] != '\0'; i++)
{
char c = id[i];
if (isspace(c) || isblank(c))
name[i] = '_';
else
name[i] = tolower(c);
}
}
// If a CORE executable of name CORE.extension exists, rename filename
// to a more sane name.
static bool install_libretro_core(const char *core_exe_path, const char *tmp_path, const char *extension)
{
// If a CORE executable of name CORE.extension exists, rename filename
// to a more sane name.
int ret = 0;
char tmp_path2[PATH_MAX], tmp_pathnewfile[PATH_MAX];

View File

@ -27,6 +27,4 @@ static void find_first_libretro_core(char *first_file,
const char * ext);
#endif
static void get_libretro_core_name(char *name, size_t size);
#endif