Add RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY.

This commit is contained in:
Themaister 2012-06-12 00:28:34 +02:00
parent 649dd03fce
commit 4ee0bde039
5 changed files with 25 additions and 1 deletions

View File

@ -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:

View File

@ -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;

View File

@ -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
{

View File

@ -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)

View File

@ -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);