Merge pull request #1979 from fr500/master

Various fixes
This commit is contained in:
Twinaphex 2015-07-16 09:25:06 +02:00
commit badf8bdaad
8 changed files with 47 additions and 27 deletions

View File

@ -548,8 +548,8 @@ static void event_deinit_core(bool reinit)
strlcpy(global->savestate_dir,orig_savestate_dir,sizeof(global->savestate_dir));
/* restore system directory if it was set to <content dir> */
if(orig_system_dir_empty)
strlcpy(settings->system_directory,"",sizeof(settings->system_directory));
if(settings->system_in_content_dir)
settings->system_directory[0] = '\0';
/* auto overrides: reload the original config */
if(global->overrides_active)

View File

@ -1714,10 +1714,14 @@ static bool config_load_file(const char *path, bool set_defaults)
{
RARCH_WARN("system_directory is not set in config. Assuming system directory is same folder as game: \"%s\".\n",
settings->system_directory);
settings->system_in_content_dir = true;
}
if (!strcmp(settings->system_directory, "default"))
{
*settings->system_directory = '\0';
settings->system_in_content_dir = true;
}
config_read_keybinds_conf(conf);

View File

@ -303,6 +303,7 @@ typedef struct settings
char resampler_directory[PATH_MAX_LENGTH];
char screenshot_directory[PATH_MAX_LENGTH];
char system_directory[PATH_MAX_LENGTH];
bool system_in_content_dir;
char extraction_directory[PATH_MAX_LENGTH];
char playlist_directory[PATH_MAX_LENGTH];

View File

@ -751,8 +751,15 @@ bool rarch_environment_cb(unsigned cmd, void *data)
break;
case RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY:
if (!settings->system_directory || settings->system_directory[0] == '\0')
{
RARCH_WARN("SYSTEM DIR is empty, fill assume CONTENT DIR %s\n",global->fullpath);
fill_pathname_basedir(settings->system_directory, global->fullpath,
sizeof(settings->system_directory));
}
*(const char**)data = *settings->system_directory ?
settings->system_directory : NULL;
RARCH_LOG("Environ SYSTEM_DIRECTORY: \"%s\".\n",
settings->system_directory);
break;

View File

@ -48,8 +48,8 @@ void main_exit_save_config(void)
strlcpy(global->savestate_dir,orig_savestate_dir,sizeof(global->savestate_dir));
/* restore system directory if it was set to <content dir> */
if(orig_system_dir_empty)
strlcpy(settings->system_directory,"",sizeof(settings->system_directory));
if(settings->system_in_content_dir)
settings->system_directory[0] = '\0';
/* Save last core-specific config to the default config location,
* needed on consoles for core switching and reusing last good

View File

@ -629,6 +629,21 @@ static void handle_hotplug(android_input_t *android,
else if (strstr(device_name, "SideWinder"))
strlcpy(name_buf, "SideWinder Classic", sizeof(name_buf));
}
else if (strstr(device_name, "NVIDIA Corporation NVIDIA Controller v01.01"))
{
/* Built-in shield contrlleris always user 1. FIXME: This is kinda ugly.
* We really need to find a way to detect useless input devices
* like gpio-keys in a general way.
*/
*port = 0;
strlcpy(name_buf, device_name, sizeof(name_buf));
}
else if (strstr(device_name, "Virtual") || strstr(device_name, "gpio") && strstr(android->pad_states[0].name,"NVIDIA Corporation NVIDIA Controller v01.01"))
{
/* If built-in shield controller is detected bind the virtual and gpio devices to the same port*/
*port = 0;
strlcpy(name_buf, "NVIDIA Corporation NVIDIA Controller v01.01", sizeof(name_buf));
}
else if (
strstr(device_name, "PLAYSTATION(R)3") ||
strstr(device_name, "Dualshock3") ||
@ -637,15 +652,6 @@ static void handle_hotplug(android_input_t *android,
strlcpy(name_buf, "PlayStation3", sizeof(name_buf));
else if (strstr(device_name, "MOGA"))
strlcpy(name_buf, "Moga IME", sizeof(name_buf));
else if (strstr(device_name, "NVIDIA Corporation NVIDIA Controller v01.01"))
{
/* Shield is always user 1. FIXME: This is kinda ugly.
* We really need to find a way to detect useless input devices
* like gpio-keys in a general way.
*/
*port = 0;
strlcpy(name_buf, device_name, sizeof(name_buf));
}
else if (device_name[0] != '\0')
strlcpy(name_buf, device_name, sizeof(name_buf));

View File

@ -120,7 +120,7 @@ static void input_autoconfigure_joypad_add(
/* This will be the case if input driver is reinitialized.
* No reason to spam autoconfigure messages every time. */
bool block_osd_spam = settings &&
settings->input.autoconfigured[params->idx] && *params->name;
settings->input.autoconfigured[params->idx] && *params->name;
if (!settings)
return;
@ -136,8 +136,9 @@ static void input_autoconfigure_joypad_add(
snprintf(msg, sizeof(msg), "%s configured in port #%u.",
params->name, params->idx);
if (!block_osd_spam)
rarch_main_msg_queue_push(msg, 0, 60, false);
if (!block_osd_spam)
rarch_main_msg_queue_push(msg, 0, 60, false);
RARCH_LOG("%s\n", msg);
}

View File

@ -61,7 +61,6 @@
char orig_savestate_dir[PATH_MAX_LENGTH];
char orig_savefile_dir[PATH_MAX_LENGTH];
bool orig_system_dir_empty = false;
/* Descriptive names for options without short variant. Please keep the name in
sync with the option name. Order does not matter. */
@ -314,11 +313,12 @@ static void set_special_paths(char **argv, unsigned num_content)
/* If this is already set,
* do not overwrite it as this was initialized before in
* a menu or otherwise. */
if (settings->system_directory[0] == '\0')
orig_system_dir_empty = true;
if (!*settings->system_directory)
if (!settings->system_directory || settings->system_directory[0] == '\0')
{
RARCH_WARN("SYSTEM DIR is empty, assume CONTENT DIR %s\n",argv[0]);
fill_pathname_basedir(settings->system_directory, argv[0],
sizeof(settings->system_directory));
}
}
void set_paths_redirect(const char *path)
@ -355,7 +355,7 @@ void set_paths_redirect(const char *path)
}
/* per-core states: append the library_name to the save location */
if (settings->sort_savestates_enable)
if (settings->sort_savestates_enable && global->savefile_dir[0] != '\0')
{
strlcpy(orig_savestate_dir,
global->savestate_dir,
@ -429,12 +429,13 @@ void rarch_set_paths(const char *path)
/* If this is already set, do not overwrite it
* as this was initialized before in a menu or otherwise. */
if (*settings->system_directory)
return;
if (settings->system_directory[0] == '\0')
orig_system_dir_empty = true;
fill_pathname_basedir(settings->system_directory, path,
sizeof(settings->system_directory));
if (!settings->system_directory || settings->system_directory[0] == '\0')
{
RARCH_WARN("SYSTEM DIR is empty, fill assume CONTENT DIR %s\n",path);
fill_pathname_basedir(settings->system_directory, path,
sizeof(settings->system_directory));
}
}