(PS3/GX/XDK) Refactor find_and_set_first_file

This commit is contained in:
twinaphex 2014-06-04 23:42:40 +02:00
parent 413822c32c
commit c86281e5b8
3 changed files with 15 additions and 19 deletions

View File

@ -53,14 +53,14 @@ extern void system_exec_wii(const char *path, bool should_load_game);
#ifdef IS_SALAMANDER #ifdef IS_SALAMANDER
char libretro_path[PATH_MAX]; char libretro_path[PATH_MAX];
static void find_and_set_first_file(void) static void find_and_set_first_file(const char *ext)
{ {
//Last fallback - we'll need to start the first executable file //Last fallback - we'll need to start the first executable file
// we can find in the RetroArch cores directory // we can find in the RetroArch cores directory
char first_file[PATH_MAX] = {0}; char first_file[PATH_MAX] = {0};
find_first_libretro_core(first_file, sizeof(first_file), find_first_libretro_core(first_file, sizeof(first_file),
default_paths.core_dir, "dol"); default_paths.core_dir, ext);
if(first_file) if(first_file)
{ {
@ -93,7 +93,7 @@ static void frontend_gx_salamander_init(void)
} }
if(!config_file_exists || !strcmp(libretro_path, "")) if(!config_file_exists || !strcmp(libretro_path, ""))
find_and_set_first_file(); find_and_set_first_file("dol");
else else
{ {
RARCH_LOG("Start [%s] found in retroarch.cfg.\n", libretro_path); RARCH_LOG("Start [%s] found in retroarch.cfg.\n", libretro_path);

View File

@ -49,13 +49,14 @@ SYS_PROCESS_PARAM(1001, 0x200000)
char libretro_path[512]; char libretro_path[512];
static void find_and_set_first_file(void) static void find_and_set_first_file(const char *ext)
{ {
//Last fallback - we'll need to start the first executable file //Last fallback - we'll need to start the first executable file
// we can find in the RetroArch cores directory // we can find in the RetroArch cores directory
char first_file[PATH_MAX]; char first_file[PATH_MAX];
find_first_libretro_core(first_file, sizeof(first_file), default_paths.core_dir, "SELF"); find_first_libretro_core(first_file, sizeof(first_file),
default_paths.core_dir, ext);
if(first_file) if(first_file)
{ {
@ -84,7 +85,7 @@ static void frontend_ps3_salamander_init(void)
} }
if (!config_file_exists || !strcmp(libretro_path, "")) if (!config_file_exists || !strcmp(libretro_path, ""))
find_and_set_first_file(); find_and_set_first_file("SELF");
else else
RARCH_LOG("Start [%s] found in retroarch.cfg.\n", libretro_path); RARCH_LOG("Start [%s] found in retroarch.cfg.\n", libretro_path);

View File

@ -30,27 +30,18 @@
#ifdef IS_SALAMANDER #ifdef IS_SALAMANDER
char libretro_path[512]; char libretro_path[512];
static void find_and_set_first_file(void) static void find_and_set_first_file(const char *ext)
{ {
//Last fallback - we'll need to start the first executable file //Last fallback - we'll need to start the first executable file
// we can find in the RetroArch cores directory // we can find in the RetroArch cores directory
char first_file[PATH_MAX]; char first_file[PATH_MAX] = {0};
find_first_libretro_core(first_file, sizeof(first_file), find_first_libretro_core(first_file, sizeof(first_file),
#if defined(_XBOX360) default_paths.core_dir, ext);
"game:", "xex"
#elif defined(_XBOX1)
"D:", "xbe"
#endif
);
if(first_file) if(first_file)
{ {
#ifdef _XBOX1
fill_pathname_join(libretro_path, default_paths.core_dir, first_file, sizeof(libretro_path)); fill_pathname_join(libretro_path, default_paths.core_dir, first_file, sizeof(libretro_path));
#else
strlcpy(libretro_path, first_file, sizeof(libretro_path));
#endif
RARCH_LOG("libretro_path now set to: %s.\n", libretro_path); RARCH_LOG("libretro_path now set to: %s.\n", libretro_path);
} }
else else
@ -77,7 +68,11 @@ static void frontend_xdk_salamander_init(void)
if(!config_file_exists || !strcmp(libretro_path, "")) if(!config_file_exists || !strcmp(libretro_path, ""))
{ {
find_and_set_first_file(); #if defined(_XBOX360)
find_and_set_first_file("xex");
#elif defined(_XBOX1)
find_and_set_first_file("xbe");
#endif
} }
else else
{ {