mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-19 15:52:53 +00:00
Merge pull request #284 from Laupetin/fix/guessing-sound-filenames
fix: stop removing extensions of soundaliases
This commit is contained in:
commit
bc0f42a18f
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user