diff --git a/dynamic.c b/dynamic.c index c0d2a8d542..61120b5818 100644 --- a/dynamic.c +++ b/dynamic.c @@ -317,11 +317,18 @@ static bool environment_cb(unsigned cmd, void *data) } case RETRO_ENVIRONMENT_SHUTDOWN: + RARCH_LOG("Environ SHUTDOWN.\n"); g_extern.system.shutdown = true; break; case RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVEL: g_extern.system.performance_level = *(const unsigned*)data; + RARCH_LOG("Environ PERFORMANCE_LEVEL: %u.\n", g_extern.system.performance_level); + break; + + case RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY: + *(const char **)data = *g_settings.system_directory ? g_settings.system_directory : NULL; + RARCH_LOG("Environ SYSTEM_DIRECTORY: \"%s\".\n", g_settings.system_directory); break; default: diff --git a/general.h b/general.h index 796079c323..fc59c3a0f2 100644 --- a/general.h +++ b/general.h @@ -169,6 +169,7 @@ struct settings char cheat_settings_path[PATH_MAX]; char screenshot_directory[PATH_MAX]; + char system_directory[PATH_MAX]; bool rewind_enable; size_t rewind_buffer_size; diff --git a/libretro.h b/libretro.h index e497aff58d..28ea262041 100755 --- a/libretro.h +++ b/libretro.h @@ -121,7 +121,7 @@ extern "C" { // Requests the frontend to shutdown. // Should only be used if game has a specific // way to shutdown the game from a menu item or similar. - + // #define RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVEL 8 // const unsigned * -- // Gives a hint to the frontend how demanding this implementation @@ -142,6 +142,15 @@ extern "C" { // as certain games an implementation can play might be // particularily demanding. // If called, it should be called in retro_load_game(). + // +#define RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY 9 + // const char ** -- + // Returns the "system" directory of the frontend. + // This directory can be used to store system specific ROMs such as BIOSes, configuration data, etc. + // The returned value can be NULL. + // If so, no such directory is defined, + // and it's up to the implementation to find a suitable directory. + struct retro_message { diff --git a/retroarch.cfg b/retroarch.cfg index 3cf0b40a3b..8781bfddef 100644 --- a/retroarch.cfg +++ b/retroarch.cfg @@ -26,6 +26,10 @@ # I.e.: "key1=value1;key2=value2;..." # environment_variables = +# Sets the "system" directory. +# Implementations can query for this directory to load BIOSes, system-specific configs, etc. +# system_directory = + #### Video # Video driver to use. "gl", "xvideo", "sdl" or "ext" (external API driver) diff --git a/settings.c b/settings.c index d72e7a9125..7d6e97c50a 100644 --- a/settings.c +++ b/settings.c @@ -486,6 +486,7 @@ bool config_load_file(const char *path) else RARCH_WARN("savefile_directory is not a directory, ignoring ....\n"); } + if (!g_extern.has_set_state_path && config_get_array(conf, "savestate_directory", tmp_str, sizeof(tmp_str))) { if (path_is_directory(tmp_str)) @@ -497,6 +498,8 @@ bool config_load_file(const char *path) RARCH_WARN("savestate_directory is not a directory, ignoring ...\n"); } + CONFIG_GET_STRING(system_directory, "system_directory"); + config_read_keybinds_conf(conf); config_file_free(conf);