diff --git a/src/openrct2/OpenRCT2.cpp b/src/openrct2/OpenRCT2.cpp index 746a3a8ea6..175cb0e4d2 100644 --- a/src/openrct2/OpenRCT2.cpp +++ b/src/openrct2/OpenRCT2.cpp @@ -15,6 +15,7 @@ utf8 gOpenRCT2StartupActionPath[512] = { 0 }; utf8 gExePath[MAX_PATH]; utf8 gCustomUserDataPath[MAX_PATH] = { 0 }; utf8 gCustomOpenrctDataPath[MAX_PATH] = { 0 }; +utf8 gCustomRCT1DataPath[MAX_PATH] = { 0 }; utf8 gCustomRCT2DataPath[MAX_PATH] = { 0 }; utf8 gCustomPassword[MAX_PATH] = { 0 }; diff --git a/src/openrct2/OpenRCT2.h b/src/openrct2/OpenRCT2.h index 3f836d5a4b..99cca367a0 100644 --- a/src/openrct2/OpenRCT2.h +++ b/src/openrct2/OpenRCT2.h @@ -40,6 +40,7 @@ extern utf8 gOpenRCT2StartupActionPath[512]; extern utf8 gExePath[MAX_PATH]; extern utf8 gCustomUserDataPath[MAX_PATH]; extern utf8 gCustomOpenrctDataPath[MAX_PATH]; +extern utf8 gCustomRCT1DataPath[MAX_PATH]; extern utf8 gCustomRCT2DataPath[MAX_PATH]; extern utf8 gCustomPassword[MAX_PATH]; extern bool gOpenRCT2Headless; diff --git a/src/openrct2/PlatformEnvironment.cpp b/src/openrct2/PlatformEnvironment.cpp index cf3a560ea7..4d042e428e 100644 --- a/src/openrct2/PlatformEnvironment.cpp +++ b/src/openrct2/PlatformEnvironment.cpp @@ -131,6 +131,10 @@ std::unique_ptr OpenRCT2::CreatePlatformEnvironment() basePaths[(size_t)DIRBASE::DOCUMENTATION] = Platform::GetDocsPath(); // Override paths that have been specified via the command line + if (!String::IsNullOrEmpty(gCustomRCT1DataPath)) + { + basePaths[(size_t)DIRBASE::RCT1] = gCustomRCT1DataPath; + } if (!String::IsNullOrEmpty(gCustomRCT2DataPath)) { basePaths[(size_t)DIRBASE::RCT2] = gCustomRCT2DataPath; @@ -160,8 +164,14 @@ std::unique_ptr OpenRCT2::CreatePlatformEnvironment() { config_save(configPath.c_str()); } - env->SetBasePath(DIRBASE::RCT1, String::ToStd(gConfigGeneral.rct1_path)); - env->SetBasePath(DIRBASE::RCT2, String::ToStd(gConfigGeneral.rct2_path)); + if (String::IsNullOrEmpty(gCustomRCT1DataPath)) + { + env->SetBasePath(DIRBASE::RCT1, String::ToStd(gConfigGeneral.rct1_path)); + } + if (String::IsNullOrEmpty(gCustomRCT2DataPath)) + { + env->SetBasePath(DIRBASE::RCT2, String::ToStd(gConfigGeneral.rct2_path)); + } // Log base paths log_verbose("DIRBASE::RCT1 : %s", env->GetDirectoryPath(DIRBASE::RCT1).c_str()); diff --git a/src/openrct2/cmdline/RootCommands.cpp b/src/openrct2/cmdline/RootCommands.cpp index ecc39e0682..142625744b 100644 --- a/src/openrct2/cmdline/RootCommands.cpp +++ b/src/openrct2/cmdline/RootCommands.cpp @@ -54,6 +54,7 @@ static bool _headless = false; static utf8* _password = nullptr; static utf8* _userDataPath = nullptr; static utf8* _openrctDataPath = nullptr; +static utf8* _rct1DataPath = nullptr; static utf8* _rct2DataPath = nullptr; static bool _silentBreakpad = false; @@ -74,6 +75,7 @@ static constexpr const CommandLineOptionDefinition StandardOptions[] { CMDLINE_TYPE_STRING, &_password, NAC, "password", "password needed to join the server" }, { CMDLINE_TYPE_STRING, &_userDataPath, NAC, "user-data-path", "path to the user data directory (containing config.ini)" }, { CMDLINE_TYPE_STRING, &_openrctDataPath, NAC, "openrct-data-path", "path to the OpenRCT2 data directory (containing languages)" }, + { CMDLINE_TYPE_STRING, &_rct1DataPath, NAC, "rct1-data-path", "path to the RollerCoaster Tycoon 1 data directory (containing data/csg1.dat)" }, { CMDLINE_TYPE_STRING, &_rct2DataPath, NAC, "rct2-data-path", "path to the RollerCoaster Tycoon 2 data directory (containing data/g1.dat)" }, #ifdef USE_BREAKPAD { CMDLINE_TYPE_SWITCH, &_silentBreakpad, NAC, "silent-breakpad", "make breakpad crash reporting silent" }, @@ -208,6 +210,12 @@ exitcode_t CommandLine::HandleCommandDefault() Memory::Free(_openrctDataPath); } + if (_rct1DataPath != nullptr) + { + String::Set(gCustomRCT1DataPath, Util::CountOf(gCustomRCT1DataPath), _rct1DataPath); + Memory::Free(_rct1DataPath); + } + if (_rct2DataPath != nullptr) { String::Set(gCustomRCT2DataPath, Util::CountOf(gCustomRCT2DataPath), _rct2DataPath);