mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-19 15:11:04 +00:00
fixed some filesystem issues with directories and compression.
This commit is contained in:
parent
1299a373de
commit
860a0c290b
10 changed files with 22 additions and 13 deletions
|
@ -101,7 +101,7 @@ int FDirectory::AddDirectory(const char *dirpath, LumpFilterInfo* filter, FileSy
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mBasePath = nullptr;
|
mBasePath = nullptr;
|
||||||
AllocateEntries(list.size());
|
AllocateEntries((int)list.size());
|
||||||
for(auto& entry : list)
|
for(auto& entry : list)
|
||||||
{
|
{
|
||||||
if (mBasePath == nullptr)
|
if (mBasePath == nullptr)
|
||||||
|
@ -122,7 +122,7 @@ int FDirectory::AddDirectory(const char *dirpath, LumpFilterInfo* filter, FileSy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (filter->filenamecheck == nullptr || filter->filenamecheck(fi.c_str(), entry.FilePath.c_str()))
|
if (filter == nullptr || filter->filenamecheck == nullptr || filter->filenamecheck(fi.c_str(), entry.FilePath.c_str()))
|
||||||
{
|
{
|
||||||
if (entry.Length > 0x7fffffff)
|
if (entry.Length > 0x7fffffff)
|
||||||
{
|
{
|
||||||
|
@ -131,7 +131,7 @@ int FDirectory::AddDirectory(const char *dirpath, LumpFilterInfo* filter, FileSy
|
||||||
}
|
}
|
||||||
// for internal access we use the normalized form of the relative path.
|
// for internal access we use the normalized form of the relative path.
|
||||||
Entries[count].FileName = NormalizeFileName(entry.FilePathRel.c_str());
|
Entries[count].FileName = NormalizeFileName(entry.FilePathRel.c_str());
|
||||||
Entries[count].Length = entry.Length;
|
Entries[count].CompressedSize = Entries[count].Length = entry.Length;
|
||||||
Entries[count].Flags = RESFF_FULLPATH;
|
Entries[count].Flags = RESFF_FULLPATH;
|
||||||
Entries[count].ResourceID = -1;
|
Entries[count].ResourceID = -1;
|
||||||
Entries[count].Method = METHOD_STORED;
|
Entries[count].Method = METHOD_STORED;
|
||||||
|
|
|
@ -88,7 +88,7 @@ static bool OpenGrp(FResourceFile* file, LumpFilterInfo* filter)
|
||||||
for(uint32_t i = 0; i < NumLumps; i++)
|
for(uint32_t i = 0; i < NumLumps; i++)
|
||||||
{
|
{
|
||||||
Entries[i].Position = Position;
|
Entries[i].Position = Position;
|
||||||
Entries[i].Length = LittleLong(fileinfo[i].Size);
|
Entries[i].CompressedSize = Entries[i].Length = LittleLong(fileinfo[i].Size);
|
||||||
Position += fileinfo[i].Size;
|
Position += fileinfo[i].Size;
|
||||||
Entries[i].Flags = 0;
|
Entries[i].Flags = 0;
|
||||||
Entries[i].Namespace = ns_global;
|
Entries[i].Namespace = ns_global;
|
||||||
|
|
|
@ -63,7 +63,7 @@ static bool OpenHog(FResourceFile* rf, LumpFilterInfo* filter)
|
||||||
|
|
||||||
FResourceEntry Entry;
|
FResourceEntry Entry;
|
||||||
Entry.Position = Reader->Tell();
|
Entry.Position = Reader->Tell();
|
||||||
Entry.Length = elength;
|
Entry.CompressedSize = Entry.Length = elength;
|
||||||
Entry.Flags = 0;
|
Entry.Flags = 0;
|
||||||
Entry.CRC32 = 0;
|
Entry.CRC32 = 0;
|
||||||
Entry.Namespace = ns_global;
|
Entry.Namespace = ns_global;
|
||||||
|
|
|
@ -48,7 +48,7 @@ static bool OpenLump(FResourceFile* file, LumpFilterInfo*)
|
||||||
Entries[0].Namespace = ns_global;
|
Entries[0].Namespace = ns_global;
|
||||||
Entries[0].ResourceID = -1;
|
Entries[0].ResourceID = -1;
|
||||||
Entries[0].Position = 0;
|
Entries[0].Position = 0;
|
||||||
Entries[0].Length = file->GetContainerReader()->GetLength();
|
Entries[0].CompressedSize = Entries[0].Length = file->GetContainerReader()->GetLength();
|
||||||
Entries[0].Method = METHOD_STORED;
|
Entries[0].Method = METHOD_STORED;
|
||||||
Entries[0].Flags = 0;
|
Entries[0].Flags = 0;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -58,7 +58,7 @@ static bool OpenMvl(FResourceFile* rf, LumpFilterInfo* filter)
|
||||||
uint32_t elength = Reader->ReadUInt32();
|
uint32_t elength = Reader->ReadUInt32();
|
||||||
|
|
||||||
Entries[i].Position = pos;
|
Entries[i].Position = pos;
|
||||||
Entries[i].Length = elength;
|
Entries[i].CompressedSize = Entries[i].Length = elength;
|
||||||
Entries[i].ResourceID = -1;
|
Entries[i].ResourceID = -1;
|
||||||
Entries[i].FileName = rf->NormalizeFileName(name);
|
Entries[i].FileName = rf->NormalizeFileName(name);
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ static bool OpenPak(FResourceFile* file, LumpFilterInfo* filter)
|
||||||
for(uint32_t i = 0; i < NumLumps; i++)
|
for(uint32_t i = 0; i < NumLumps; i++)
|
||||||
{
|
{
|
||||||
Entries[i].Position = LittleLong(fileinfo[i].filepos);
|
Entries[i].Position = LittleLong(fileinfo[i].filepos);
|
||||||
Entries[i].Length = LittleLong(fileinfo[i].filelen);
|
Entries[i].CompressedSize = Entries[i].Length = LittleLong(fileinfo[i].filelen);
|
||||||
Entries[i].Flags = RESFF_FULLPATH;
|
Entries[i].Flags = RESFF_FULLPATH;
|
||||||
Entries[i].Namespace = ns_global;
|
Entries[i].Namespace = ns_global;
|
||||||
Entries[i].ResourceID = -1;
|
Entries[i].ResourceID = -1;
|
||||||
|
|
|
@ -110,7 +110,7 @@ static bool OpenRFF(FResourceFile* file, LumpFilterInfo*)
|
||||||
for (uint32_t i = 0; i < NumLumps; ++i)
|
for (uint32_t i = 0; i < NumLumps; ++i)
|
||||||
{
|
{
|
||||||
Entries[i].Position = LittleLong(lumps[i].FilePos);
|
Entries[i].Position = LittleLong(lumps[i].FilePos);
|
||||||
Entries[i].Length = LittleLong(lumps[i].Size);
|
Entries[i].CompressedSize = Entries[i].Length = LittleLong(lumps[i].Size);
|
||||||
Entries[i].Flags = 0;
|
Entries[i].Flags = 0;
|
||||||
Entries[i].Method = METHOD_STORED;
|
Entries[i].Method = METHOD_STORED;
|
||||||
if (lumps[i].Flags & 0x10)
|
if (lumps[i].Flags & 0x10)
|
||||||
|
|
|
@ -63,7 +63,7 @@ static bool OpenSSI(FResourceFile* file, int version, int EntryCount, LumpFilter
|
||||||
int flength = Reader->ReadInt32();
|
int flength = Reader->ReadInt32();
|
||||||
|
|
||||||
Entries[i].Position = j;
|
Entries[i].Position = j;
|
||||||
Entries[i].Length = flength;
|
Entries[i].CompressedSize = Entries[i].Length = flength;
|
||||||
Entries[i].Flags = 0;
|
Entries[i].Flags = 0;
|
||||||
Entries[i].Namespace = ns_global;
|
Entries[i].Namespace = ns_global;
|
||||||
Entries[i].Method = METHOD_STORED;
|
Entries[i].Method = METHOD_STORED;
|
||||||
|
@ -76,7 +76,7 @@ static bool OpenSSI(FResourceFile* file, int version, int EntryCount, LumpFilter
|
||||||
std::swap(fn[strlength - 1], fn[strlength - 3]);
|
std::swap(fn[strlength - 1], fn[strlength - 3]);
|
||||||
|
|
||||||
Entries[i + 1].Position = j;
|
Entries[i + 1].Position = j;
|
||||||
Entries[i + 1].Length = flength;
|
Entries[i + 1].CompressedSize = Entries[i + 1].Length = flength;
|
||||||
Entries[i + 1].Flags = 0;
|
Entries[i + 1].Flags = 0;
|
||||||
Entries[i + 1].Namespace = ns_global;
|
Entries[i + 1].Namespace = ns_global;
|
||||||
Entries[i + 1].ResourceID = -1;
|
Entries[i + 1].ResourceID = -1;
|
||||||
|
|
|
@ -148,13 +148,22 @@ bool FWadFile::Open(LumpFilterInfo*, FileSystemMessageFunc Printf)
|
||||||
|
|
||||||
Entries[i].FileName = nullptr;
|
Entries[i].FileName = nullptr;
|
||||||
Entries[i].Position = isBigEndian ? BigLong(fileinfo[i].FilePos) : LittleLong(fileinfo[i].FilePos);
|
Entries[i].Position = isBigEndian ? BigLong(fileinfo[i].FilePos) : LittleLong(fileinfo[i].FilePos);
|
||||||
Entries[i].Length = isBigEndian ? BigLong(fileinfo[i].Size) : LittleLong(fileinfo[i].Size);
|
Entries[i].CompressedSize = Entries[i].Length = isBigEndian ? BigLong(fileinfo[i].Size) : LittleLong(fileinfo[i].Size);
|
||||||
|
|
||||||
Entries[i].Namespace = ns_global;
|
Entries[i].Namespace = ns_global;
|
||||||
Entries[i].Flags = ishigh? RESFF_SHORTNAME | RESFF_COMPRESSED : RESFF_SHORTNAME;
|
Entries[i].Flags = ishigh? RESFF_SHORTNAME | RESFF_COMPRESSED : RESFF_SHORTNAME;
|
||||||
Entries[i].Method = ishigh == 1? METHOD_LZSS : METHOD_STORED;
|
Entries[i].Method = ishigh == 1? METHOD_LZSS : METHOD_STORED;
|
||||||
Entries[i].FileName = stringpool->Strdup(n);
|
Entries[i].FileName = stringpool->Strdup(n);
|
||||||
// This doesn't set up the namespace yet.
|
// This doesn't set up the namespace yet.
|
||||||
}
|
}
|
||||||
|
for (uint32_t i = 0; i < NumLumps; i++)
|
||||||
|
{
|
||||||
|
if (Entries[i].Method == METHOD_LZSS)
|
||||||
|
{
|
||||||
|
// compressed size is implicit.
|
||||||
|
Entries[i].CompressedSize = (i == NumLumps - 1 ? Reader.GetLength() : Entries[i + 1].Position) - Entries[i].Position;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
GenerateHash(); // Do this before the lump processing below.
|
GenerateHash(); // Do this before the lump processing below.
|
||||||
|
|
|
@ -81,7 +81,7 @@ bool OpenWHRes(FResourceFile* file, LumpFilterInfo*)
|
||||||
std::string synthname = BaseName + num;
|
std::string synthname = BaseName + num;
|
||||||
|
|
||||||
Entries[i].Position = offset;
|
Entries[i].Position = offset;
|
||||||
Entries[i].Length = length;
|
Entries[i].CompressedSize = Entries[i].Length = length;
|
||||||
Entries[i].Flags = RESFF_FULLPATH;
|
Entries[i].Flags = RESFF_FULLPATH;
|
||||||
Entries[i].Namespace = ns_global;
|
Entries[i].Namespace = ns_global;
|
||||||
Entries[i].ResourceID = -1;
|
Entries[i].ResourceID = -1;
|
||||||
|
|
Loading…
Reference in a new issue