mirror of
https://github.com/libretro/RetroArch
synced 2025-04-17 11:43:00 +00:00
(360/PS3) rarch_manage_libretro_set_first_file - no more dependency on
HAVE_CONFIGFILE
This commit is contained in:
parent
eca9b3ddc9
commit
10ad19bf76
@ -195,7 +195,12 @@ static void init_settings (bool load_libretro_path)
|
||||
|
||||
#ifdef HAVE_LIBRETRO_MANAGEMENT
|
||||
if(load_libretro_path)
|
||||
rarch_manage_libretro_set_first_file(SYS_CONFIG_FILE, "game:\\", ".xex");
|
||||
{
|
||||
CONFIG_GET_STRING(libretro, "libretro_path");
|
||||
|
||||
if(!strcmp(g_settings.libretro, ""))
|
||||
rarch_manage_libretro_set_first_file("game:\\", ".xex");
|
||||
}
|
||||
#endif
|
||||
|
||||
// g_settings
|
||||
|
@ -610,67 +610,58 @@ bool rarch_manage_libretro_install(const char *full_path, const char *path, cons
|
||||
return return_code;
|
||||
}
|
||||
|
||||
#ifdef HAVE_CONFIGFILE
|
||||
void rarch_manage_libretro_set_first_file(const char * conf_name, const char *libretro_path, const char * exe_ext)
|
||||
void rarch_manage_libretro_set_first_file(const char *libretro_path, const char * exe_ext)
|
||||
{
|
||||
#ifdef _XBOX
|
||||
char fname_tmp[PATH_MAX];
|
||||
#endif
|
||||
|
||||
config_file_t * conf = config_file_new(conf_name);
|
||||
//We need to set libretro to the first entry in the cores
|
||||
//directory so that it will be saved to the config file
|
||||
|
||||
CONFIG_GET_STRING(libretro, "libretro_path");
|
||||
char ** dir_list = dir_list_new(libretro_path, exe_ext);
|
||||
|
||||
if(!strcmp(g_settings.libretro, ""))
|
||||
if (!dir_list)
|
||||
{
|
||||
//We need to set libretro to the first entry in the cores
|
||||
//directory so that it will be saved to the config file
|
||||
|
||||
char ** dir_list = dir_list_new(libretro_path, exe_ext);
|
||||
|
||||
if (!dir_list)
|
||||
{
|
||||
RARCH_ERR("Couldn't read directory.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
const char * first_exe = dir_list[0];
|
||||
|
||||
if(first_exe)
|
||||
{
|
||||
#ifdef _XBOX
|
||||
fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp));
|
||||
|
||||
if(strcmp(fname_tmp, "RetroArch-Salamander.xex") == 0)
|
||||
{
|
||||
RARCH_WARN("First entry is RetroArch Salamander itself, increment entry by one and check if it exists.\n");
|
||||
first_exe = dir_list[1];
|
||||
fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp));
|
||||
|
||||
if(!first_exe)
|
||||
{
|
||||
RARCH_ERR("Unlikely error happened - no second entry - no choice but to set it to RetroArch Salamander\n");
|
||||
first_exe = dir_list[0];
|
||||
fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp));
|
||||
}
|
||||
}
|
||||
|
||||
RARCH_LOG("Set first entry in libretro core dir to libretro path: [%s].\n", fname_tmp);
|
||||
snprintf(g_settings.libretro, sizeof(g_settings.libretro), "game:\\%s", fname_tmp);
|
||||
#else
|
||||
RARCH_LOG("Set first entry in libretro core dir to libretro path: [%s].\n", first_exe);
|
||||
strlcpy(g_settings.libretro, first_exe, sizeof(g_settings.libretro));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
RARCH_ERR("Failed to set first .xex entry to libretro path.\n");
|
||||
}
|
||||
|
||||
dir_list_free(dir_list);
|
||||
RARCH_ERR("Couldn't read directory.\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const char * first_exe = dir_list[0];
|
||||
|
||||
if(first_exe)
|
||||
{
|
||||
#ifdef _XBOX
|
||||
fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp));
|
||||
|
||||
if(strcmp(fname_tmp, "RetroArch-Salamander.xex") == 0)
|
||||
{
|
||||
RARCH_WARN("First entry is RetroArch Salamander itself, increment entry by one and check if it exists.\n");
|
||||
first_exe = dir_list[1];
|
||||
fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp));
|
||||
|
||||
if(!first_exe)
|
||||
{
|
||||
RARCH_ERR("Unlikely error happened - no second entry - no choice but to set it to RetroArch Salamander\n");
|
||||
first_exe = dir_list[0];
|
||||
fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp));
|
||||
}
|
||||
}
|
||||
|
||||
RARCH_LOG("Set first entry in libretro core dir to libretro path: [%s].\n", fname_tmp);
|
||||
snprintf(g_settings.libretro, sizeof(g_settings.libretro), "game:\\%s", fname_tmp);
|
||||
#else
|
||||
RARCH_LOG("Set first entry in libretro core dir to libretro path: [%s].\n", first_exe);
|
||||
strlcpy(g_settings.libretro, first_exe, sizeof(g_settings.libretro));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
RARCH_ERR("Failed to set first .xex entry to libretro path.\n");
|
||||
}
|
||||
|
||||
dir_list_free(dir_list);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*============================================================
|
||||
|
@ -106,7 +106,7 @@ void rarch_input_set_keybind(unsigned player, unsigned keybind_action, uint64_t
|
||||
============================================================ */
|
||||
|
||||
bool rarch_manage_libretro_install(const char *full_path, const char *path, const char *exe_ext);
|
||||
void rarch_manage_libretro_set_first_file(const char * conf_name, const char *libretro_path, const char * exe_ext);
|
||||
void rarch_manage_libretro_set_first_file(const char *libretro_path, const char * exe_ext);
|
||||
#endif
|
||||
|
||||
/*============================================================
|
||||
|
@ -165,7 +165,12 @@ static void init_settings(bool load_libretro_path)
|
||||
|
||||
#ifdef HAVE_LIBRETRO_MANAGEMENT
|
||||
if(load_libretro_path)
|
||||
rarch_manage_libretro_set_first_file(SYS_CONFIG_FILE, LIBRETRO_DIR_PATH, ".SELF");
|
||||
{
|
||||
CONFIG_GET_STRING(libretro, "libretro_path");
|
||||
|
||||
if(!strcmp(g_settings.libretro, ""))
|
||||
rarch_manage_libretro_set_first_file(LIBRETRO_DIR_PATH, ".SELF");
|
||||
}
|
||||
#endif
|
||||
|
||||
CONFIG_GET_STRING(cheat_database, "cheat_database");
|
||||
|
Loading…
x
Reference in New Issue
Block a user