Add reading mapper config

This commit is contained in:
Alexander Batalov 2023-07-21 11:10:15 +03:00
parent f6cfc1fa3a
commit 7a45ac72f0
2 changed files with 19 additions and 3 deletions

View File

@ -125,10 +125,26 @@ bool gameConfigInit(bool isMapper, int argc, char** argv)
char* ch = strrchr(executable, '\\');
if (ch != NULL) {
*ch = '\0';
snprintf(gGameConfigFilePath, sizeof(gGameConfigFilePath), "%s\\%s", executable, GAME_CONFIG_FILE_NAME);
if (isMapper) {
snprintf(gGameConfigFilePath,
sizeof(gGameConfigFilePath),
"%s\\%s",
executable,
MAPPER_CONFIG_FILE_NAME);
} else {
snprintf(gGameConfigFilePath,
sizeof(gGameConfigFilePath),
"%s\\%s",
executable,
GAME_CONFIG_FILE_NAME);
}
*ch = '\\';
} else {
strcpy(gGameConfigFilePath, GAME_CONFIG_FILE_NAME);
if (isMapper) {
strcpy(gGameConfigFilePath, MAPPER_CONFIG_FILE_NAME);
} else {
strcpy(gGameConfigFilePath, GAME_CONFIG_FILE_NAME);
}
}
// Read contents of `fallout2.cfg` into config. The values from the file

View File

@ -5,8 +5,8 @@
namespace fallout {
// The file name of the main config file.
#define GAME_CONFIG_FILE_NAME "fallout2.cfg"
#define MAPPER_CONFIG_FILE_NAME "mapper2.cfg"
#define GAME_CONFIG_SYSTEM_KEY "system"
#define GAME_CONFIG_PREFERENCES_KEY "preferences"