add sfall custom game config filename
This commit is contained in:
parent
a7097e57e0
commit
6ab04cb591
|
@ -1,4 +1,5 @@
|
|||
#include "game_config.h"
|
||||
#include "sfall_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -120,15 +121,23 @@ bool gameConfigInit(bool isMapper, int argc, char** argv)
|
|||
configSetInt(&gGameConfig, GAME_CONFIG_MAPPER_KEY, GAME_CONFIG_SORT_SCRIPT_LIST_KEY, 0);
|
||||
}
|
||||
|
||||
// SFALL: custom config file name.
|
||||
char* configFileName = nullptr;
|
||||
if (configGetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_CONFIG_FILE, &configFileName)) {
|
||||
if (configFileName == nullptr || *configFileName == '\0') {
|
||||
configFileName = DEFAULT_GAME_CONFIG_FILE_NAME;
|
||||
}
|
||||
}
|
||||
|
||||
// Make `fallout2.cfg` file path.
|
||||
char* executable = argv[0];
|
||||
char* ch = strrchr(executable, '\\');
|
||||
if (ch != NULL) {
|
||||
*ch = '\0';
|
||||
snprintf(gGameConfigFilePath, sizeof(gGameConfigFilePath), "%s\\%s", executable, GAME_CONFIG_FILE_NAME);
|
||||
snprintf(gGameConfigFilePath, sizeof(gGameConfigFilePath), "%s\\%s", executable, configFileName);
|
||||
*ch = '\\';
|
||||
} else {
|
||||
strcpy(gGameConfigFilePath, GAME_CONFIG_FILE_NAME);
|
||||
strcpy(gGameConfigFilePath, configFileName);
|
||||
}
|
||||
|
||||
// Read contents of `fallout2.cfg` into config. The values from the file
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
namespace fallout {
|
||||
|
||||
// The file name of the main config file.
|
||||
#define GAME_CONFIG_FILE_NAME "fallout2.cfg"
|
||||
#define DEFAULT_GAME_CONFIG_FILE_NAME "fallout2.cfg"
|
||||
|
||||
#define GAME_CONFIG_SYSTEM_KEY "system"
|
||||
#define GAME_CONFIG_PREFERENCES_KEY "preferences"
|
||||
|
|
|
@ -59,6 +59,7 @@ bool sfallConfigInit(int argc, char** argv)
|
|||
configSetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MOVIE_TIMER_ARTIMER4, 360);
|
||||
configSetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_AUTO_QUICK_SAVE, 0);
|
||||
configSetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_VERSION_STRING, "");
|
||||
configSetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_CONFIG_FILE, "");
|
||||
|
||||
configSetString(&gSfallConfig, SFALL_CONFIG_SCRIPTS_KEY, SFALL_CONFIG_INI_CONFIG_FOLDER, "");
|
||||
configSetString(&gSfallConfig, SFALL_CONFIG_SCRIPTS_KEY, SFALL_CONFIG_GLOBAL_SCRIPT_PATHS, "");
|
||||
|
|
|
@ -73,6 +73,7 @@ namespace fallout {
|
|||
#define SFALL_CONFIG_GLOBAL_SCRIPT_PATHS "GlobalScriptPaths"
|
||||
#define SFALL_CONFIG_AUTO_QUICK_SAVE "AutoQuickSave"
|
||||
#define SFALL_CONFIG_VERSION_STRING "VersionString"
|
||||
#define SFALL_CONFIG_CONFIG_FILE "ConfigFile"
|
||||
|
||||
#define SFALL_CONFIG_BURST_MOD_DEFAULT_CENTER_MULTIPLIER 1
|
||||
#define SFALL_CONFIG_BURST_MOD_DEFAULT_CENTER_DIVISOR 3
|
||||
|
|
Loading…
Reference in New Issue