(Salamander) Clean up Wii/Xbox implementations too

This commit is contained in:
twinaphex 2014-06-04 22:48:38 +02:00
parent 1374226c6a
commit a8aa91e03f
2 changed files with 43 additions and 88 deletions

View File

@ -76,45 +76,32 @@ static void frontend_gx_salamander_init(void)
if (path_file_exists(default_paths.config_path))
config_file_exists = true;
//try to find CORE executable
char core_executable[PATH_MAX] = {0};
fill_pathname_join(core_executable, default_paths.core_dir, "CORE.dol", sizeof(core_executable));
if(path_file_exists(core_executable))
if(config_file_exists)
{
//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);
if (!conf) // stupid libfat bug or something; somtimes it says the file is there when it doesn't
config_file_exists = false;
else
{
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();
config_file_t * conf = config_file_new(default_paths.config_path);
if (!conf) // stupid libfat bug or something; somtimes it says the file is there when it doesn't
config_file_exists = false;
else
{
RARCH_LOG("Start [%s] found in retroarch.cfg.\n", libretro_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)
{
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);
}
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);
}
}

View File

@ -68,69 +68,37 @@ static void find_and_set_first_file(void)
static void frontend_xdk_salamander_init(void)
{
XINPUT_STATE state;
(void)state;
//WIP - no Xbox 1 controller input yet
#ifdef _XBOX360
XInputGetState(0, &state);
//normal executable loading path
char tmp_str[PATH_MAX];
bool config_file_exists = false;
if(state.Gamepad.wButtons & XINPUT_GAMEPAD_Y)
if(path_file_exists(default_paths.config_path))
config_file_exists = true;
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));
strlcpy(libretro_path, tmp_str, sizeof(libretro_path));
}
if(!config_file_exists || !strcmp(libretro_path, ""))
{
//override path, boot first executable in cores directory
RARCH_LOG("Fallback - Will boot first executable in RetroArch cores directory.\n");
find_and_set_first_file();
}
else
#endif
{
//normal executable loading path
char tmp_str[PATH_MAX];
bool config_file_exists = false;
RARCH_LOG("Start [%s] found in retroarch.cfg.\n", libretro_path);
}
if(path_file_exists(default_paths.config_path))
config_file_exists = true;
//try to find CORE executable
char core_executable[1024];
#if defined(_XBOX360)
strlcpy(core_executable, "game:\\CORE.xex", sizeof(core_executable));
#elif defined(_XBOX1)
fill_pathname_join(core_executable, "D:", "CORE.xbe", sizeof(core_executable));
#endif
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));
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);
}
}
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);
}
}
#else