diff --git a/src/openrct2/PlatformEnvironment.cpp b/src/openrct2/PlatformEnvironment.cpp index fd396880b3..3b83284de6 100644 --- a/src/openrct2/PlatformEnvironment.cpp +++ b/src/openrct2/PlatformEnvironment.cpp @@ -72,6 +72,19 @@ public: u8string FindFile(DIRBASE base, DIRID did, u8string_view fileName) const override { auto dataPath = GetDirectoryPath(base, did); + + std::string alternativeFilename; + if (_usingRctClassic && base == DIRBASE::RCT2 && did == DIRID::DATA) + { + // Special case, handle RCT Classic css ogg files + if (String::StartsWith(fileName, "css", true) && String::EndsWith(fileName, ".dat", true)) + { + alternativeFilename = fileName.substr(0, fileName.size() - 3); + alternativeFilename.append("ogg"); + fileName = alternativeFilename; + } + } + auto path = Path::ResolveCasing(Path::Combine(dataPath, fileName)); if (base == DIRBASE::RCT1 && did == DIRID::DATA && !File::Exists(path)) { @@ -83,6 +96,7 @@ public: path = alternativePath; } } + return path; } diff --git a/src/openrct2/object/MusicObject.cpp b/src/openrct2/object/MusicObject.cpp index c0e9ef215d..fd76562abe 100644 --- a/src/openrct2/object/MusicObject.cpp +++ b/src/openrct2/object/MusicObject.cpp @@ -185,9 +185,8 @@ ObjectAsset MusicObject::GetAsset(IReadObjectContext& context, std::string_view { if (path.find("$RCT2:DATA/") == 0) { - auto platformEnvironment = GetContext()->GetPlatformEnvironment(); - auto dir = platformEnvironment->GetDirectoryPath(DIRBASE::RCT2, DIRID::DATA); - auto path2 = Path::Combine(dir, std::string(path.substr(11))); + auto env = GetContext()->GetPlatformEnvironment(); + auto path2 = env->FindFile(DIRBASE::RCT2, DIRID::DATA, path.substr(11)); return ObjectAsset(path2); }