diff --git a/src/game.cc b/src/game.cc index 648e501..47fadb1 100644 --- a/src/game.cc +++ b/src/game.cc @@ -1363,8 +1363,16 @@ static int gameDbInit() return -1; } + // SFALL: custom patch file name. + char* patch_filename = nullptr; + if (configGetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_PATCH_FILE, &patch_filename)) { + if (patch_filename == nullptr || *patch_file_name == '\0') { + patch_filename = "patch%03d.dat"; + } + } + for (patch_index = 0; patch_index < 1000; patch_index++) { - snprintf(filename, sizeof(filename), "patch%03d.dat", patch_index); + snprintf(filename, sizeof(filename), patch_filename, patch_index); if (compat_access(filename, 0) == 0) { dbOpen(filename, 0, NULL, 1); diff --git a/src/game_config.cc b/src/game_config.cc index 7063ec7..b3c0a1f 100644 --- a/src/game_config.cc +++ b/src/game_config.cc @@ -1,4 +1,5 @@ #include "game_config.h" +#include "sfall_config.h" #include #include @@ -120,6 +121,14 @@ 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, '\\'); @@ -136,14 +145,14 @@ bool gameConfigInit(bool isMapper, int argc, char** argv) sizeof(gGameConfigFilePath), "%s\\%s", executable, - GAME_CONFIG_FILE_NAME); + configFileName); } *ch = '\\'; } else { if (isMapper) { strcpy(gGameConfigFilePath, MAPPER_CONFIG_FILE_NAME); } else { - strcpy(gGameConfigFilePath, GAME_CONFIG_FILE_NAME); + strcpy(gGameConfigFilePath, configFileName); } } diff --git a/src/game_config.h b/src/game_config.h index 78a1299..0c76377 100644 --- a/src/game_config.h +++ b/src/game_config.h @@ -5,7 +5,7 @@ namespace fallout { -#define GAME_CONFIG_FILE_NAME "fallout2.cfg" +#define DEFAULT_GAME_CONFIG_FILE_NAME "fallout2.cfg" #define MAPPER_CONFIG_FILE_NAME "mapper2.cfg" #define GAME_CONFIG_SYSTEM_KEY "system" diff --git a/src/sfall_config.cc b/src/sfall_config.cc index 353bb37..85c2ce7 100644 --- a/src/sfall_config.cc +++ b/src/sfall_config.cc @@ -58,6 +58,9 @@ bool sfallConfigInit(int argc, char** argv) configSetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MOVIE_TIMER_ARTIMER3, 270); 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_MISC_KEY, SFALL_CONFIG_PATCH_FILE, ""); configSetString(&gSfallConfig, SFALL_CONFIG_SCRIPTS_KEY, SFALL_CONFIG_INI_CONFIG_FOLDER, ""); configSetString(&gSfallConfig, SFALL_CONFIG_SCRIPTS_KEY, SFALL_CONFIG_GLOBAL_SCRIPT_PATHS, ""); diff --git a/src/sfall_config.h b/src/sfall_config.h index da2c298..7d4b2fb 100644 --- a/src/sfall_config.h +++ b/src/sfall_config.h @@ -72,6 +72,9 @@ namespace fallout { #define SFALL_CONFIG_INI_CONFIG_FOLDER "IniConfigFolder" #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_PATCH_FILE "PatchFile" #define SFALL_CONFIG_BURST_MOD_DEFAULT_CENTER_MULTIPLIER 1 #define SFALL_CONFIG_BURST_MOD_DEFAULT_CENTER_DIVISOR 3 diff --git a/src/version.cc b/src/version.cc index 4422bd3..ca4f7ad 100644 --- a/src/version.cc +++ b/src/version.cc @@ -1,4 +1,5 @@ #include "version.h" +#include "sfall_config.h" #include @@ -7,7 +8,14 @@ namespace fallout { // 0x4B4580 void versionGetVersion(char* dest, size_t size) { - snprintf(dest, size, "FALLOUT II %d.%02d", VERSION_MAJOR, VERSION_MINOR); + // SFALL: custom version string. + char* versionString = nullptr; + if (configGetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_VERSION_STRING, &versionString)) { + if (*versionString == '\0') { + versionString = nullptr; + } + } + snprintf(dest, size, (versionString != nullptr ? versionString : "FALLOUT II %d.%02d"), VERSION_MAJOR, VERSION_MINOR); } } // namespace fallout