fix: stop removing extensions of soundalises and guessing their extension later

This commit is contained in:
Jan 2024-10-12 18:54:50 +01:00
parent dadce3dcca
commit 0a423937f0
No known key found for this signature in database
GPG Key ID: 44B581F78FF5C57C
2 changed files with 2 additions and 19 deletions

View File

@ -515,9 +515,7 @@ namespace
if (!aliasFileName.m_value.empty()) if (!aliasFileName.m_value.empty())
{ {
fs::path p(aliasFileName.m_value); alias.assetFileName = memory.Dup(aliasFileName.m_value.c_str());
p.replace_extension();
alias.assetFileName = memory.Dup(p.string().c_str());
alias.assetId = Common::SND_HashName(alias.assetFileName); alias.assetId = Common::SND_HashName(alias.assetFileName);
} }

View File

@ -225,21 +225,6 @@ public:
return false; return false;
} }
bool GuessFilenameAndLoadFile(const std::string& filePath, const SoundBankEntryInfo& sound, std::unique_ptr<char[]>& soundData, size_t& soundSize)
{
fs::path pathWithExtension = fs::path(filePath).concat(".wav");
auto file = m_asset_search_path->Open(pathWithExtension.string());
if (file.IsOpen())
return LoadWavFile(file, sound, soundData, soundSize);
pathWithExtension = fs::path(filePath).concat(".flac");
file = m_asset_search_path->Open(pathWithExtension.string());
if (file.IsOpen())
return LoadFlacFile(file, pathWithExtension.string(), sound, soundData, soundSize);
return false;
}
bool WriteEntries() bool WriteEntries()
{ {
GoTo(DATA_OFFSET); GoTo(DATA_OFFSET);
@ -251,7 +236,7 @@ public:
size_t soundSize; size_t soundSize;
std::unique_ptr<char[]> soundData; std::unique_ptr<char[]> soundData;
if (!LoadFileByExtension(soundFilePath, sound, soundData, soundSize) && !GuessFilenameAndLoadFile(soundFilePath, sound, soundData, soundSize)) if (!LoadFileByExtension(soundFilePath, sound, soundData, soundSize))
{ {
std::cerr << std::format("Unable to find a compatible file for sound {}\n", soundFilePath); std::cerr << std::format("Unable to find a compatible file for sound {}\n", soundFilePath);
return false; return false;