diff --git a/configuration.c b/configuration.c index 19e4ec730a0..6812c455263 100644 --- a/configuration.c +++ b/configuration.c @@ -3571,6 +3571,7 @@ static bool config_load_file(global_t *global, char* libretro_directory = NULL; char* libretro_assets_directory = NULL; char* libretro_autoconfig_directory = NULL; + char* libretro_database_directory = NULL; char* libretro_system_directory = NULL; char* libretro_video_filter_directory = NULL; char* libretro_video_shader_directory = NULL; @@ -3855,6 +3856,12 @@ static bool config_load_file(global_t *global, strlcpy(path_settings[i].ptr, tmp_str, PATH_MAX_LENGTH); } +#if !IOS + if (config_get_path(conf, "libretro_directory", tmp_str, sizeof(tmp_str))) + configuration_set_string(settings, + settings->paths.directory_libretro, tmp_str); +#endif + #ifdef RARCH_CONSOLE if (conf) video_driver_load_settings(global, conf); @@ -3871,13 +3878,19 @@ static bool config_load_file(global_t *global, } libretro_autoconfig_directory = getenv("LIBRETRO_AUTOCONFIG_DIRECTORY"); - if (libretro_autoconfig_directory) + if (libretro_autoconfig_directory) /* override configuration value */ configuration_set_string(settings, settings->paths.directory_autoconfig, libretro_autoconfig_directory); + libretro_database_directory = getenv("LIBRETRO_DATABASE_DIRECTORY"); + if (libretro_database_directory) /* override configuration value */ + configuration_set_string(settings, + settings->paths.path_content_database, + libretro_database_directory); + libretro_system_directory = getenv("LIBRETRO_SYSTEM_DIRECTORY"); - if (libretro_system_directory) + if (libretro_system_directory) /* override configuration value */ configuration_set_string(settings, settings->paths.directory_system, libretro_system_directory); diff --git a/docs/retroarch.6 b/docs/retroarch.6 index bc1ac8dfff7..f26a1219f0a 100644 --- a/docs/retroarch.6 +++ b/docs/retroarch.6 @@ -1,6 +1,6 @@ .\" retroarch.6: -.TH "RETROARCH" "6" "January 16, 2025" "RETROARCH" "System Manager's Manual: retroarch" +.TH "RETROARCH" "6" "January 18, 2025" "RETROARCH" "System Manager's Manual: retroarch" .SH NAME @@ -261,6 +261,12 @@ Specify the directory where RetroArch looks for controller auto-configuration files, overriding the value of the "joypad_autoconfig_dir" configuration file option. +.TP +\fBLIBRETRO_DATABASE_DIRECTORY\fR +Specify the directory where RetroArch looks for database files, +overriding the value of the "content_database_path" configuration file +option. + .TP \fBLIBRETRO_SYSTEM_DIRECTORY\fR Specify the directory where RetroArch looks for system files, diff --git a/frontend/drivers/platform_unix.c b/frontend/drivers/platform_unix.c index 447a2f246df..b451d880748 100644 --- a/frontend/drivers/platform_unix.c +++ b/frontend/drivers/platform_unix.c @@ -1325,6 +1325,7 @@ static void frontend_unix_get_env(int *argc, const char* libretro_directory = getenv("LIBRETRO_DIRECTORY"); const char* libretro_assets_directory = getenv("LIBRETRO_ASSETS_DIRECTORY"); const char* libretro_autoconfig_directory = getenv("LIBRETRO_AUTOCONFIG_DIRECTORY"); + const char* libretro_database_directory = getenv("LIBRETRO_DATABASE_DIRECTORY"); const char* libretro_system_directory = getenv("LIBRETRO_SYSTEM_DIRECTORY"); const char* libretro_video_filter_directory = getenv("LIBRETRO_VIDEO_FILTER_DIRECTORY"); const char* libretro_video_shader_directory = getenv("LIBRETRO_VIDEO_SHADER_DIRECTORY"); @@ -1889,8 +1890,13 @@ static void frontend_unix_get_env(int *argc, "records_config", sizeof(g_defaults.dirs[DEFAULT_DIR_RECORD_CONFIG])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_RECORD_OUTPUT], base_path, "records", sizeof(g_defaults.dirs[DEFAULT_DIR_RECORD_OUTPUT])); - fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_DATABASE], base_path, - "database/rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE])); + if (!string_is_empty(libretro_database_directory)) + strlcpy(g_defaults.dirs[DEFAULT_DIR_DATABASE], + libretro_database_directory, + sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE])); + else + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_DATABASE], base_path, + "database/rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE])); if (!string_is_empty(libretro_video_shader_directory)) strlcpy(g_defaults.dirs[DEFAULT_DIR_SHADER], libretro_video_shader_directory, diff --git a/frontend/drivers/platform_win32.c b/frontend/drivers/platform_win32.c index 4726df08d38..534dc73c9df 100644 --- a/frontend/drivers/platform_win32.c +++ b/frontend/drivers/platform_win32.c @@ -568,6 +568,7 @@ static void frontend_win32_env_get(int *argc, char *argv[], const char *libretro_directory = getenv("LIBRETRO_DIRECTORY"); const char *libretro_assets_directory = getenv("LIBRETRO_ASSETS_DIRECTORY"); const char* libretro_autoconfig_directory = getenv("LIBRETRO_AUTOCONFIG_DIRECTORY"); + const char* libretro_database_directory = getenv("LIBRETRO_DATABASE_DIRECTORY"); const char* libretro_system_directory = getenv("LIBRETRO_SYSTEM_DIRECTORY"); const char* libretro_video_filter_directory = getenv("LIBRETRO_VIDEO_FILTER_DIRECTORY"); const char* libretro_video_shader_directory = getenv("LIBRETRO_VIDEO_SHADER_DIRECTORY"); @@ -595,8 +596,13 @@ static void frontend_win32_env_get(int *argc, char *argv[], ":\\filters\\video", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER])); fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_CHEATS], ":\\cheats", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS])); - fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_DATABASE], - ":\\database\\rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE])); + if (!string_is_empty(libretro_database_directory)) + strlcpy(g_defaults.dirs[DEFAULT_DIR_DATABASE], + libretro_database_directory, + sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE])); + else + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_DATABASE], + ":\\database\\rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE])); fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_PLAYLIST], ":\\playlists", sizeof(g_defaults.dirs[DEFAULT_DIR_PLAYLIST])); fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_RECORD_CONFIG], diff --git a/retroarch.c b/retroarch.c index 27aa4d2a0f2..1350094f310 100644 --- a/retroarch.c +++ b/retroarch.c @@ -6519,7 +6519,27 @@ static void retroarch_print_help(const char *arg0) "Path for the save state files (*.state). (DEPRECATED, use --appendconfig and savestate_directory)\n" , sizeof(buf) - _len); + /* Flush buffer here to avoid the error "error: string length ‘752’ + * is greater than the length ‘509’ ISO C90 compilers are required + * to support" */ fputs(buf, stdout); + +#if defined(__linux__) || defined(__GNU__) || (defined(BSD) && !defined(__MACH__)) + buf[0] = '\0'; + _len = 0; + _len += strlcpy(buf + _len, + "\nThe following environment variables are supported:\n\n" + " LIBRETRO_ASSETS_DIRECTORY\n" + " LIBRETRO_AUTOCONFIG_DIRECTORY\n" + " LIBRETRO_DATABASE_DIRECTORY\n" + " LIBRETRO_DIRECTORY\n" + " LIBRETRO_SYSTEM_DIRECTORY\n" + " LIBRETRO_VIDEO_FILTER_DIRECTORY\n" + " LIBRETRO_VIDEO_SHADER_DIRECTORY\n\n" + "Refer to `man 6 retroarch' for a description of what they do.\n" + , sizeof(buf) - _len); + fputs(buf, stdout); +#endif } #ifdef HAVE_DYNAMIC