(PS3) Clean up Salamander implementation

This commit is contained in:
twinaphex 2014-06-04 22:44:37 +02:00
parent a23b1ad2d7
commit 1374226c6a

View File

@ -69,63 +69,33 @@ static void find_and_set_first_file(void)
static void frontend_ps3_salamander_init(void)
{
CellPadData pad_data;
cellPadInit(7);
//normal executable loading path
char tmp_str[PATH_MAX];
bool config_file_exists = false;
cellPadGetData(0, &pad_data);
if (path_file_exists(default_paths.config_path))
config_file_exists = true;
if(pad_data.button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_TRIANGLE)
if (config_file_exists)
{
//override path, boot first executable in cores directory
RARCH_LOG("Fallback - Will boot first executable in RetroArch cores/ directory.\n");
config_file_t * conf = config_file_new(default_paths.config_path);
config_get_array(conf, "libretro_path", tmp_str, sizeof(tmp_str));
config_file_free(conf);
strlcpy(libretro_path, tmp_str, sizeof(libretro_path));
}
if (!config_file_exists || !strcmp(libretro_path, ""))
find_and_set_first_file();
}
else
RARCH_LOG("Start [%s] found in retroarch.cfg.\n", libretro_path);
if (!config_file_exists)
{
//normal executable loading path
char tmp_str[PATH_MAX];
bool config_file_exists = false;
if (path_file_exists(default_paths.config_path))
config_file_exists = true;
//try to find CORE executable
char core_executable[1024];
fill_pathname_join(core_executable, default_paths.core_dir, "CORE.SELF", sizeof(core_executable));
if(path_file_exists(core_executable))
{
//Start CORE executable
strlcpy(libretro_path, core_executable, sizeof(libretro_path));
RARCH_LOG("Start [%s].\n", libretro_path);
}
else
{
if (config_file_exists)
{
config_file_t * conf = config_file_new(default_paths.config_path);
config_get_array(conf, "libretro_path", tmp_str, sizeof(tmp_str));
config_file_free(conf);
strlcpy(libretro_path, tmp_str, sizeof(libretro_path));
}
if (!config_file_exists || !strcmp(libretro_path, ""))
find_and_set_first_file();
else
RARCH_LOG("Start [%s] found in retroarch.cfg.\n", libretro_path);
if (!config_file_exists)
{
config_file_t *new_conf = config_file_new(NULL);
config_set_string(new_conf, "libretro_path", libretro_path);
config_file_write(new_conf, default_paths.config_path);
config_file_free(new_conf);
}
}
config_file_t *new_conf = config_file_new(NULL);
config_set_string(new_conf, "libretro_path", libretro_path);
config_file_write(new_conf, default_paths.config_path);
config_file_free(new_conf);
}
cellPadEnd();
}
#endif