mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
- enable embedding of blood.rff and sounds.rff in mod archives when playing Blood
Some mods provide pregenerated resources, this allows loading them without picking them apart first.
This commit is contained in:
parent
f87e40131f
commit
a15ac43722
7 changed files with 14 additions and 17 deletions
|
@ -293,7 +293,7 @@ bool F7ZFile::Open(bool quiet, LumpFilterInfo *filter)
|
|||
lump_p->Owner = this;
|
||||
lump_p->Flags = LUMPF_FULLPATH|LUMPF_COMPRESSED;
|
||||
lump_p->Position = i;
|
||||
lump_p->CheckEmbedded();
|
||||
lump_p->CheckEmbedded(filter);
|
||||
lump_p++;
|
||||
}
|
||||
// Resize the lump record array to its actual size
|
||||
|
|
|
@ -209,7 +209,7 @@ void FDirectory::AddEntry(const char *fullpath, int size)
|
|||
lump_p->LumpSize = size;
|
||||
lump_p->Owner = this;
|
||||
lump_p->Flags = 0;
|
||||
lump_p->CheckEmbedded();
|
||||
lump_p->CheckEmbedded(nullptr);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ bool FPakFile::Open(bool quiet, LumpFilterInfo* filter)
|
|||
Lumps[i].Owner = this;
|
||||
Lumps[i].Position = LittleLong(fileinfo[i].filepos);
|
||||
Lumps[i].LumpSize = LittleLong(fileinfo[i].filelen);
|
||||
Lumps[i].CheckEmbedded();
|
||||
Lumps[i].CheckEmbedded(filter);
|
||||
}
|
||||
GenerateHash();
|
||||
PostProcessArchive(&Lumps[0], sizeof(Lumps[0]), filter);
|
||||
|
|
|
@ -337,7 +337,7 @@ bool FZipFile::Open(bool quiet, LumpFilterInfo* filter)
|
|||
lump_p->CRC32 = zip_fh->CRC32;
|
||||
lump_p->CompressedSize = LittleLong(zip_fh->CompressedSize);
|
||||
lump_p->Position = LittleLong(zip_fh->LocalHeaderOffset);
|
||||
lump_p->CheckEmbedded();
|
||||
lump_p->CheckEmbedded(filter);
|
||||
|
||||
lump_p++;
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ static bool IsWadInFolder(const FResourceFile* const archive, const char* const
|
|||
return 0 == filePath.CompareNoCase(resPath);
|
||||
}
|
||||
|
||||
void FResourceLump::CheckEmbedded()
|
||||
void FResourceLump::CheckEmbedded(LumpFilterInfo* lfi)
|
||||
{
|
||||
// Checks for embedded archives
|
||||
const char *c = strstr(FullName, ".wad");
|
||||
|
@ -130,22 +130,13 @@ void FResourceLump::CheckEmbedded()
|
|||
{
|
||||
Flags |= LUMPF_EMBEDDED;
|
||||
}
|
||||
/* later
|
||||
else
|
||||
else if (lfi) for (auto& fstr : lfi->embeddings)
|
||||
{
|
||||
if (c==NULL) c = strstr(Name, ".zip");
|
||||
if (c==NULL) c = strstr(Name, ".pk3");
|
||||
if (c==NULL) c = strstr(Name, ".7z");
|
||||
if (c==NULL) c = strstr(Name, ".pak");
|
||||
if (c && strlen(c) <= 4)
|
||||
if (!stricmp(FullName, fstr))
|
||||
{
|
||||
// Mark all embedded archives in any directory
|
||||
Flags |= LUMPF_EMBEDDED;
|
||||
memset(Name, 0, 8);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ struct LumpFilterInfo
|
|||
// The following are for checking if the root directory of a zip can be removed.
|
||||
TArray<FString> reservedFolders;
|
||||
TArray<FString> requiredPrefixes;
|
||||
TArray<FString> embeddings;
|
||||
std::function<void()> postprocessFunc;
|
||||
};
|
||||
|
||||
|
@ -111,7 +112,7 @@ public:
|
|||
virtual int GetIndexNum() const { return -1; }
|
||||
virtual int GetNamespace() const { return 0; }
|
||||
void LumpNameSetup(FString iname);
|
||||
void CheckEmbedded();
|
||||
void CheckEmbedded(LumpFilterInfo* lfi);
|
||||
virtual FCompressedBuffer GetRawData();
|
||||
|
||||
void *Lock(); // validates the cache and increases the refcount.
|
||||
|
|
|
@ -388,6 +388,11 @@ void InitFileSystem(TArray<GrpEntry>& groups)
|
|||
LumpFilterInfo lfi;
|
||||
for (auto p : iwad_folders) lfi.reservedFolders.Push(p);
|
||||
for (auto p = iwad_reserved(); *p; p++) lfi.requiredPrefixes.Push(*p);
|
||||
if (isBlood())
|
||||
{
|
||||
lfi.embeddings.Push("blood.rff");
|
||||
lfi.embeddings.Push("sounds.rff");
|
||||
}
|
||||
|
||||
lfi.dotFilter = LumpFilter;
|
||||
|
||||
|
|
Loading…
Reference in a new issue