- fixed music lookup for user maps.

This was only looking for real files, but instead needs to check the file system. The game directory's content will always be part of that so other checks are counterproductive.
This commit is contained in:
Christoph Oelckers 2021-12-26 12:45:15 +01:00
parent 99b069d122
commit 7204b7c616
2 changed files with 18 additions and 6 deletions

View file

@ -1668,3 +1668,20 @@ FResourceLump* FileSystem::GetFileAt(int no)
return FileInfo[no].lump;
}
#include "c_dispatch.h"
CCMD(fs_dir)
{
int numfiles = fileSystem.GetNumEntries();
for (int i = 0; i < numfiles; i++)
{
auto container = fileSystem.GetResourceFileFullName(fileSystem.GetFileContainer(i));
auto fn1 = fileSystem.GetFileFullName(i);
auto fns = fileSystem.GetFileShortName(i);
auto fnid = fileSystem.GetResourceId(i);
auto length = fileSystem.FileLength(i);
bool hidden = fileSystem.FindFile(fn1) != i;
Printf(PRINT_NONOTIFY, "%s%-64s %-15s (%5d) %10d %s %s\n", hidden? TEXTCOLOR_RED : TEXTCOLOR_UNTRANSLATED, fn1, fns, fnid, length, container, hidden ? "(h)" : "");
}
}

View file

@ -75,15 +75,10 @@ FString G_SetupFilenameBasedMusic(const char* fn, const char* defmusic)
FString name = StripExtension(fn);
FString test;
// Test if a real file with this name exists with all known extensions for music.
for (auto& ext : knownMusicExts)
{
test.Format("%s.%s", name.GetChars(), ext);
if (FileExists(test)) return test;
#ifdef __unix__
test.Format("%s.%s", name.GetChars(), FString(ext).MakeLower().GetChars());
if (FileExists(test)) return test;
#endif
if (fileSystem.FileExists(test)) return test;
}
return defmusic;
}