mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-19 02:38:32 +00:00
AGS: Implemented "localuserconf" option in cmdline and global config
From upstream 109a9d985f498ed31308e2e97e1b97fa306c87c0
This commit is contained in:
parent
1955beaf0f
commit
e37ab7b725
@ -269,6 +269,8 @@ FSLocation GetGameUserConfigDir() {
|
||||
return FSLocation(_GP(usetup).user_conf_dir);
|
||||
else if (Path::IsRelativePath(dir)) // relative dir is resolved relative to the game data dir
|
||||
return FSLocation(_GP(ResPaths).DataDir, dir);
|
||||
else if (_GP(usetup).local_user_conf) // directive to use game dir location
|
||||
return FSLocation(_GP(ResPaths).DataDir);
|
||||
// For absolute dir, we assume it's a special directory prepared for AGS engine
|
||||
// and therefore amend it with a game own subdir
|
||||
return FSLocation(dir, _GP(game).saveGameFolderName);
|
||||
|
@ -24,6 +24,7 @@
|
||||
namespace AGS3 {
|
||||
|
||||
GameSetup::GameSetup() {
|
||||
local_user_conf = false;
|
||||
audio_backend = 1;
|
||||
no_speech_pack = false;
|
||||
textheight = 0;
|
||||
|
@ -68,6 +68,7 @@ struct GameSetup {
|
||||
String opt_voice_dir; // optional custom install voice-over dir path
|
||||
//
|
||||
String conf_path; // a read-only config path (if set the regular config is ignored)
|
||||
bool local_user_conf; // search for user config in the game directory
|
||||
String user_conf_dir; // directory to read and write user config in
|
||||
String user_data_dir; // directory to write savedgames and user files to
|
||||
String shared_data_dir; // directory to write shared game files to
|
||||
|
@ -964,6 +964,15 @@ void engine_read_config(ConfigTree &cfg) {
|
||||
}
|
||||
}
|
||||
|
||||
// Handle directive to search for the user config inside the game directory;
|
||||
// this option may come either from command line or default/global config.
|
||||
_GP(usetup).local_user_conf |= INIreadint(cfg, "misc", "localuserconf", 0) != 0;
|
||||
if (_GP(usetup).local_user_conf) { // Test if the file is writeable, if it is then both engine and setup
|
||||
// applications may actually use it fully as a user config, otherwise
|
||||
// fallback to default behavior.
|
||||
_GP(usetup).local_user_conf = File::TestWriteFile(def_cfg_file);
|
||||
}
|
||||
|
||||
// Read user configuration file
|
||||
String user_cfg_file = find_user_cfg_file();
|
||||
if (Path::ComparePaths(user_cfg_file, def_cfg_file) != 0 &&
|
||||
|
@ -211,6 +211,8 @@ int main_process_cmdline(ConfigTree &cfg, int argc, const char *argv[]) {
|
||||
ee++;
|
||||
} else if (ags_stricmp(arg, "--conf") == 0 && (argc > ee + 1)) {
|
||||
_GP(usetup).conf_path = argv[++ee];
|
||||
} else if (ags_stricmp(arg, "--localuserconf") == 0) {
|
||||
_GP(usetup).local_user_conf = true;
|
||||
} else if (ags_stricmp(arg, "--localuserconf") == 0) {
|
||||
_GP(usetup).user_conf_dir = ".";
|
||||
} else if ((ags_stricmp(arg, "--user-conf-dir") == 0) && (argc > ee + 1)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user