- fixed: FileSystem.CreatePathlessCopy must set the copy to not have a full path.

Otherwise it may evade special lookup rules for music and not be found
This commit is contained in:
Christoph Oelckers 2021-04-20 20:00:47 +02:00
parent 9e40e49c2c
commit 588fa5ffe2

View file

@ -63,12 +63,14 @@ struct FileSystem::LumpRecord
int rfnum; int rfnum;
int Namespace; int Namespace;
int resourceId; int resourceId;
int flags;
void SetFromLump(int filenum, FResourceLump* lmp) void SetFromLump(int filenum, FResourceLump* lmp)
{ {
lump = lmp; lump = lmp;
rfnum = filenum; rfnum = filenum;
linkedTexture = nullptr; linkedTexture = nullptr;
flags = 0;
if (lump->Flags & LUMPF_SHORTNAME) if (lump->Flags & LUMPF_SHORTNAME)
{ {
@ -487,7 +489,7 @@ int FileSystem::CheckNumForName (const char *name, int space)
// from a Zip return that. WADs don't know these namespaces and single lumps must // from a Zip return that. WADs don't know these namespaces and single lumps must
// work as well. // work as well.
if (space > ns_specialzipdirectory && lump.Namespace == ns_global && if (space > ns_specialzipdirectory && lump.Namespace == ns_global &&
!(lump.lump->Flags & LUMPF_FULLPATH)) break; !((lump.lump->Flags ^lump.flags) & LUMPF_FULLPATH)) break;
} }
i = NextLumpIndex[i]; i = NextLumpIndex[i];
} }
@ -796,7 +798,7 @@ int FileSystem::GetFileFlags (int lump)
return 0; return 0;
} }
return FileInfo[lump].lump->Flags; return FileInfo[lump].lump->Flags ^ FileInfo[lump].flags;
} }
//========================================================================== //==========================================================================
@ -1532,11 +1534,19 @@ bool FileSystem::CreatePathlessCopy(const char *name, int id, int /*flags*/)
auto oldlump = FileInfo[lump]; auto oldlump = FileInfo[lump];
int slash = oldlump.longName.LastIndexOf('/'); int slash = oldlump.longName.LastIndexOf('/');
if (slash == -1) return true; // already is pathless. // Note: already pathless entries must be duplica
if (slash == -1)
{
FileInfo[lump].flags = LUMPF_FULLPATH;
return true; // already is pathless.
}
// just create a new reference to the original data with a different name. // just create a new reference to the original data with a different name.
oldlump.longName = oldlump.longName.Mid(slash + 1); oldlump.longName = oldlump.longName.Mid(slash + 1);
oldlump.resourceId = id; oldlump.resourceId = id;
oldlump.flags = LUMPF_FULLPATH;
FileInfo.Push(oldlump); FileInfo.Push(oldlump);
return true; return true;
} }