Add config property for RCT1 path

This commit is contained in:
Ted John 2016-12-29 19:06:31 +00:00
parent 68ed96194f
commit 30c738e91c
6 changed files with 15 additions and 13 deletions

View File

@ -368,7 +368,8 @@ namespace OpenRCT2
utf8 path[260];
std::string basePaths[4];
basePaths[(size_t)DIRBASE::RCT2] = std::string(gRCT2AddressAppPath);
basePaths[(size_t)DIRBASE::RCT1] = String::ToStd(gConfigGeneral.rct1_path);
basePaths[(size_t)DIRBASE::RCT2] = String::ToStd(gConfigGeneral.rct2_path);
platform_get_openrct_data_path(path, sizeof(path));
basePaths[(size_t)DIRBASE::OPENRCT2] = std::string(path);
platform_get_user_directory(path, nullptr, sizeof(path));

View File

@ -46,7 +46,6 @@ public:
switch (base) {
default:
case DIRBASE::RCT1:
throw Exception("Not implemented");
case DIRBASE::RCT2:
directoryName = DirectoryNamesRCT2[(size_t)did];
break;

View File

@ -382,7 +382,7 @@ static exitcode_t HandleCommandSetRCT2(CommandLineArgEnumerator * enumerator)
// Update RCT2 path in config
config_set_defaults();
config_open_default();
String::DiscardDuplicate(&gConfigGeneral.game_path, path);
String::DiscardDuplicate(&gConfigGeneral.rct2_path, path);
if (config_save_default())
{
Console::WriteFormat("Updating RCT2 path to '%s'.", path);

View File

@ -182,7 +182,8 @@ config_property_definition _generalDefinitions[] = {
{ offsetof(general_configuration, fullscreen_mode), "fullscreen_mode", CONFIG_VALUE_TYPE_UINT8, 0, NULL },
{ offsetof(general_configuration, fullscreen_height), "fullscreen_height", CONFIG_VALUE_TYPE_SINT32, -1, NULL },
{ offsetof(general_configuration, fullscreen_width), "fullscreen_width", CONFIG_VALUE_TYPE_SINT32, -1, NULL },
{ offsetof(general_configuration, game_path), "game_path", CONFIG_VALUE_TYPE_STRING, { .value_string = NULL }, NULL },
{ offsetof(general_configuration, rct1_path), "rct1_path", CONFIG_VALUE_TYPE_STRING, { .value_string = NULL }, NULL },
{ offsetof(general_configuration, rct2_path), "game_path", CONFIG_VALUE_TYPE_STRING, { .value_string = NULL }, NULL },
{ offsetof(general_configuration, landscape_smoothing), "landscape_smoothing", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL },
{ offsetof(general_configuration, language), "language", CONFIG_VALUE_TYPE_UINT16, LANGUAGE_ENGLISH_UK, _languageEnum },
{ offsetof(general_configuration, measurement_format), "measurement_format", CONFIG_VALUE_TYPE_UINT8, MEASUREMENT_FORMAT_METRIC, _measurementFormatEnum },
@ -932,9 +933,9 @@ bool config_find_or_browse_install_directory()
utf8 *installPath;
if (config_find_rct2_path(path)) {
SafeFree(gConfigGeneral.game_path);
gConfigGeneral.game_path = malloc(strlen(path) + 1);
safe_strcpy(gConfigGeneral.game_path, path, MAX_PATH);
SafeFree(gConfigGeneral.rct2_path);
gConfigGeneral.rct2_path = malloc(strlen(path) + 1);
safe_strcpy(gConfigGeneral.rct2_path, path, MAX_PATH);
} else {
if (gOpenRCT2Headless) {
return false;
@ -945,8 +946,8 @@ bool config_find_or_browse_install_directory()
if (installPath == NULL)
return false;
SafeFree(gConfigGeneral.game_path);
gConfigGeneral.game_path = installPath;
SafeFree(gConfigGeneral.rct2_path);
gConfigGeneral.rct2_path = installPath;
if (platform_original_game_data_exists(installPath))
return true;

View File

@ -144,7 +144,8 @@ typedef struct general_configuration {
uint8 play_intro;
uint8 confirmation_prompt;
uint8 screenshot_format;
utf8string game_path;
utf8string rct1_path;
utf8string rct2_path;
sint8 measurement_format;
sint8 temperature_format;
sint8 currency_format;

View File

@ -218,8 +218,8 @@ int rct2_init_directories()
if (str_is_null_or_empty(gCustomRCT2DataPath)) {
// check install directory
if (!platform_original_game_data_exists(gConfigGeneral.game_path)) {
log_verbose("install directory does not exist or invalid directory selected, %s", gConfigGeneral.game_path);
if (!platform_original_game_data_exists(gConfigGeneral.rct2_path)) {
log_verbose("install directory does not exist or invalid directory selected, %s", gConfigGeneral.rct2_path);
if (!config_find_or_browse_install_directory()) {
utf8 path[MAX_PATH];
config_get_default_path(path, sizeof(path));
@ -227,7 +227,7 @@ int rct2_init_directories()
return 0;
}
}
safe_strcpy(gRCT2AddressAppPath, gConfigGeneral.game_path, sizeof(gRCT2AddressAppPath));
safe_strcpy(gRCT2AddressAppPath, gConfigGeneral.rct2_path, sizeof(gRCT2AddressAppPath));
} else {
safe_strcpy(gRCT2AddressAppPath, gCustomRCT2DataPath, sizeof(gRCT2AddressAppPath));
}