From 0a423937f0aa5ec6bc487cb7a43ddabf08c46a04 Mon Sep 17 00:00:00 2001 From: Jan Date: Sat, 12 Oct 2024 18:54:50 +0100 Subject: [PATCH] fix: stop removing extensions of soundalises and guessing their extension later --- .../T6/AssetLoaders/AssetLoaderSoundBank.cpp | 4 +--- .../ObjContainer/SoundBank/SoundBankWriter.cpp | 17 +---------------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderSoundBank.cpp b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderSoundBank.cpp index 43a83b46..f42fe26e 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderSoundBank.cpp +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderSoundBank.cpp @@ -515,9 +515,7 @@ namespace if (!aliasFileName.m_value.empty()) { - fs::path p(aliasFileName.m_value); - p.replace_extension(); - alias.assetFileName = memory.Dup(p.string().c_str()); + alias.assetFileName = memory.Dup(aliasFileName.m_value.c_str()); alias.assetId = Common::SND_HashName(alias.assetFileName); } diff --git a/src/ObjLoading/ObjContainer/SoundBank/SoundBankWriter.cpp b/src/ObjLoading/ObjContainer/SoundBank/SoundBankWriter.cpp index a9f68319..6a68d6f8 100644 --- a/src/ObjLoading/ObjContainer/SoundBank/SoundBankWriter.cpp +++ b/src/ObjLoading/ObjContainer/SoundBank/SoundBankWriter.cpp @@ -225,21 +225,6 @@ public: return false; } - bool GuessFilenameAndLoadFile(const std::string& filePath, const SoundBankEntryInfo& sound, std::unique_ptr& 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() { GoTo(DATA_OFFSET); @@ -251,7 +236,7 @@ public: size_t soundSize; std::unique_ptr 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); return false;