mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-09 11:20:56 +00:00
WINTERMUTE: Correctly find .ogg version of .wav files
As it was, it didn't reliably work across platforms because it turned some\\windows\\path.wav into some/system/pathogg Note no "." before "ogg"; also since we use the new filename to search for the file inside DCPs, which use Windows naming, we don't want system-specific path format. Fixes #7088
This commit is contained in:
parent
2c81602454
commit
0cfd058943
@ -100,15 +100,14 @@ BaseSoundBuffer *BaseSoundMgr::addSound(const Common::String &filename, Audio::M
|
||||
BaseSoundBuffer *sound;
|
||||
|
||||
Common::String useFilename = filename;
|
||||
useFilename.toLowercase();
|
||||
// try to switch WAV to OGG file (if available)
|
||||
AnsiString ext = PathUtil::getExtension(filename);
|
||||
if (StringUtil::compareNoCase(ext, "wav")) {
|
||||
AnsiString path = PathUtil::getDirectoryName(filename);
|
||||
AnsiString name = PathUtil::getFileNameWithoutExtension(filename);
|
||||
|
||||
AnsiString newFile = PathUtil::combine(path, name + "ogg");
|
||||
if (BaseFileManager::getEngineInstance()->hasFile(newFile)) {
|
||||
useFilename = newFile;
|
||||
if (useFilename.hasSuffix(".wav")) {
|
||||
Common::String oggFilename = useFilename;
|
||||
oggFilename.erase(oggFilename.size() - 4);
|
||||
oggFilename = oggFilename + ".ogg";
|
||||
if (BaseFileManager::getEngineInstance()->hasFile(oggFilename)) {
|
||||
useFilename = oggFilename;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user