mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-23 15:52:55 +01:00
Support RCT Classic ride music
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user