diff --git a/src/openrct2/PlatformEnvironment.cpp b/src/openrct2/PlatformEnvironment.cpp index 6e42dd791b..fd396880b3 100644 --- a/src/openrct2/PlatformEnvironment.cpp +++ b/src/openrct2/PlatformEnvironment.cpp @@ -22,6 +22,7 @@ class PlatformEnvironment final : public IPlatformEnvironment { private: u8string _basePath[DIRBASE_COUNT]; + bool _usingRctClassic{}; public: explicit PlatformEnvironment(DIRBASE_VALUES basePaths) @@ -45,9 +46,11 @@ public: { default: case DIRBASE::RCT1: - case DIRBASE::RCT2: directoryName = DirectoryNamesRCT2[static_cast(did)]; break; + case DIRBASE::RCT2: + directoryName = _usingRctClassic ? "Assets" : DirectoryNamesRCT2[static_cast(did)]; + break; case DIRBASE::OPENRCT2: case DIRBASE::USER: case DIRBASE::CONFIG: @@ -86,6 +89,12 @@ public: void SetBasePath(DIRBASE base, u8string_view path) override { _basePath[static_cast(base)] = path; + + if (base == DIRBASE::RCT2) + { + // Check whether the RCT2 base is RCT2 or RCT Classic + _usingRctClassic = Platform::IsRCT2ClassicPath(path); + } } private: diff --git a/src/openrct2/drawing/Drawing.Sprite.cpp b/src/openrct2/drawing/Drawing.Sprite.cpp index 1c30498000..f9673ea1a0 100644 --- a/src/openrct2/drawing/Drawing.Sprite.cpp +++ b/src/openrct2/drawing/Drawing.Sprite.cpp @@ -199,7 +199,7 @@ bool gfx_load_g1(const IPlatformEnvironment& env) log_verbose("gfx_load_g1(...)"); try { - auto path = Path::Combine(env.GetDirectoryPath(DIRBASE::RCT2, DIRID::DATA), u8"g1.dat"); + auto path = env.FindFile(DIRBASE::RCT2, DIRID::DATA, u8"g1.dat"); auto fs = FileStream(path, FILE_MODE_OPEN); _g1.header = fs.ReadValue(); diff --git a/src/openrct2/platform/Platform.h b/src/openrct2/platform/Platform.h index 0a827fcd7d..2a62b6c737 100644 --- a/src/openrct2/platform/Platform.h +++ b/src/openrct2/platform/Platform.h @@ -87,6 +87,7 @@ namespace Platform bool ProcessIsElevated(); float GetDefaultScale(); + bool IsRCT2ClassicPath(std::string_view path); bool OriginalGameDataExists(std::string_view path); std::string GetUsername(); diff --git a/src/openrct2/platform/Shared.cpp b/src/openrct2/platform/Shared.cpp index e64f0ca90d..7b25d7d68e 100644 --- a/src/openrct2/platform/Shared.cpp +++ b/src/openrct2/platform/Shared.cpp @@ -94,10 +94,21 @@ namespace Platform return outTime; } + bool IsRCT2ClassicPath(std::string_view path) + { + auto combinedPath = Path::ResolveCasing(Path::Combine(path, u8"Assets", u8"g1.dat")); + return File::Exists(combinedPath); + } + bool OriginalGameDataExists(std::string_view path) { - std::string combinedPath = Path::ResolveCasing(Path::Combine(path, u8"Data", u8"g1.dat")); - return File::Exists(combinedPath); + // Check if path is RCT2 + auto combinedPath = Path::ResolveCasing(Path::Combine(path, u8"Data", u8"g1.dat")); + if (File::Exists(combinedPath)) + return true; + + // Check if path is RCT Classic + return IsRCT2ClassicPath(path); } std::string SanitiseFilename(std::string_view originalName)