Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: stop removing extensions of soundaliases #284

Merged
merged 1 commit into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderSoundBank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
17 changes: 1 addition & 16 deletions src/ObjLoading/ObjContainer/SoundBank/SoundBankWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,21 +225,6 @@ class SoundBankWriterImpl : public SoundBankWriter
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()
{
GoTo(DATA_OFFSET);
Expand All @@ -251,7 +236,7 @@ class SoundBankWriterImpl : public SoundBankWriter
size_t soundSize;
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);
return false;
Expand Down