Remove resource system voodoo and make some lines slightly more readable

This commit is contained in:
Magnus Norddahl 2025-04-13 14:49:04 +02:00
commit 9bc869e1a6
2 changed files with 13 additions and 14 deletions

View file

@ -742,11 +742,17 @@ FileReader FResourceFile::GetEntryReader(uint32_t entry, int readertype, int rea
else
{
FileReader fri;
if (readertype == READER_NEW || !mainThread) fri.OpenFile(FileName, Entries[entry].Position, Entries[entry].CompressedSize);
else fri.OpenFilePart(Reader, Entries[entry].Position, Entries[entry].CompressedSize);
if (readertype == READER_NEW || !mainThread)
fri.OpenFile(FileName, Entries[entry].Position, Entries[entry].CompressedSize);
else
fri.OpenFilePart(Reader, Entries[entry].Position, Entries[entry].CompressedSize);
int flags = DCF_TRANSFEROWNER | DCF_EXCEPTIONS;
if (readertype == READER_CACHED) flags |= DCF_CACHED;
else if (readerflags & READERFLAG_SEEKABLE) flags |= DCF_SEEKABLE;
if (readertype == READER_CACHED)
flags |= DCF_CACHED;
else if (readerflags & READERFLAG_SEEKABLE)
flags |= DCF_SEEKABLE;
OpenDecompressor(fr, fri, Entries[entry].Length, Entries[entry].Method, flags);
}
}

View file

@ -171,16 +171,9 @@ const VkCachedShaderLump* VkShaderCache::GetPrivateFile(const FString& lumpname)
FString GetStringFromLumpThreadsafe(int lump)
{
auto reader = fileSystem.OpenFileReader(lump, FileSys::READER_NEW, FileSys::READERFLAG_SEEKABLE);
if (reader.GetBuffer())
{
return FString(reader.GetBuffer(), reader.GetLength());
}
else
{
auto data = reader.Read();
return FString(static_cast<const char*>(data.data()), data.size());
}
auto reader = fileSystem.OpenFileReader(lump, FileSys::READER_NEW, 0);
auto data = reader.Read();
return FString(static_cast<const char*>(data.data()), data.size());
}
FString VkShaderCache::LoadPublicShaderLump(const char* lumpname)