Maintain the actual on-disk path (FResourceEntry::SystemFilePath) for the directory filesystem, because the FResourceEntry::FileName can be modified by game filter-s

This commit is contained in:
Vasilii Shirokii 2023-12-23 17:00:32 +00:00 committed by Christoph Oelckers
parent c05d6224ba
commit 90d672e345
2 changed files with 7 additions and 1 deletions

View file

@ -105,6 +105,7 @@ struct FResourceEntry
uint16_t Flags;
uint16_t Method;
int16_t Namespace;
const char* SystemFilePath;
};
void SetMainThread();

View file

@ -131,6 +131,7 @@ int FDirectory::AddDirectory(const char *dirpath, LumpFilterInfo* filter, FileSy
}
// for internal access we use the normalized form of the relative path.
Entries[count].FileName = NormalizeFileName(entry.FilePathRel.c_str());
Entries[count].SystemFilePath = stringpool->Strdup(Entries[count].FileName);
Entries[count].CompressedSize = Entries[count].Length = entry.Length;
Entries[count].Flags = RESFF_FULLPATH;
Entries[count].ResourceID = -1;
@ -153,6 +154,7 @@ int FDirectory::AddDirectory(const char *dirpath, LumpFilterInfo* filter, FileSy
bool FDirectory::Open(LumpFilterInfo* filter, FileSystemMessageFunc Printf)
{
NumLumps = AddDirectory(FileName, filter, Printf);
PostProcessArchive(filter);
return true;
}
@ -167,7 +169,10 @@ FileReader FDirectory::GetEntryReader(uint32_t entry, int readertype, int)
FileReader fr;
if (entry < NumLumps)
{
std::string fn = mBasePath; fn += Entries[entry].FileName;
std::string fn = mBasePath;
fn += Entries[entry].SystemFilePath ?
Entries[entry].SystemFilePath :
Entries[entry].FileName;
fr.OpenFile(fn.c_str());
if (readertype == READER_CACHED)
{