got rid of FUncompressedFile and reenabled postprocessing.

This commit is contained in:
Christoph Oelckers 2023-12-12 21:16:02 +01:00
parent 10f743a0d6
commit 3e7ec9118f
13 changed files with 34 additions and 64 deletions

View file

@ -164,7 +164,7 @@ public:
return (entry < NumLumps) ? Entries[entry].Position : 0;
}
virtual FileReader GetEntryReader(uint32_t entry, bool newreader = true) = 0;
virtual FileReader GetEntryReader(uint32_t entry, bool newreader = true);
int GetEntryFlags(uint32_t entry)
{

View file

@ -291,6 +291,7 @@ bool F7ZFile::Open(LumpFilterInfo *filter, FileSystemMessageFunc Printf)
}
GenerateHash();
PostProcessArchive(filter);
return true;
}

View file

@ -33,7 +33,7 @@
**
*/
#include "resourcefile_internal.h"
#include "resourcefile.h"
#include "fs_swap.h"
namespace FileSys {
@ -71,7 +71,7 @@ struct GrpLump
//
//==========================================================================
class FGrpFile : public FUncompressedFile
class FGrpFile : public FResourceFile
{
public:
FGrpFile(const char * filename, FileReader &file, StringPool* sp);
@ -86,7 +86,7 @@ public:
//==========================================================================
FGrpFile::FGrpFile(const char *filename, FileReader &file, StringPool* sp)
: FUncompressedFile(filename, file, sp)
: FResourceFile(filename, file, sp)
{
}

View file

@ -32,7 +32,7 @@
**
*/
#include "resourcefile_internal.h"
#include "resourcefile.h"
namespace FileSys {
//==========================================================================
@ -41,7 +41,7 @@ namespace FileSys {
//
//==========================================================================
class FLumpFile : public FUncompressedFile
class FLumpFile : public FResourceFile
{
public:
FLumpFile(const char * filename, FileReader &file, StringPool* sp);
@ -56,7 +56,7 @@ public:
//==========================================================================
FLumpFile::FLumpFile(const char *filename, FileReader &file, StringPool* sp)
: FUncompressedFile(filename, file, sp)
: FResourceFile(filename, file, sp)
{
}

View file

@ -32,7 +32,7 @@
**
*/
#include "resourcefile_internal.h"
#include "resourcefile.h"
namespace FileSys {
@ -63,7 +63,7 @@ struct dpackheader_t
//
//==========================================================================
class FPakFile : public FUncompressedFile
class FPakFile : public FResourceFile
{
public:
FPakFile(const char * filename, FileReader &file, StringPool* sp);
@ -80,7 +80,7 @@ public:
//==========================================================================
FPakFile::FPakFile(const char *filename, FileReader &file, StringPool* sp)
: FUncompressedFile(filename, file, sp)
: FResourceFile(filename, file, sp)
{
}
@ -114,6 +114,7 @@ bool FPakFile::Open(LumpFilterInfo* filter)
Entries[i].FileName = NormalizeFileName(fileinfo[i].name);
}
GenerateHash();
PostProcessArchive(filter);
return true;
}

View file

@ -33,7 +33,7 @@
**
*/
#include "resourcefile_internal.h"
#include "resourcefile.h"
#include "fs_swap.h"
namespace FileSys {
@ -90,7 +90,7 @@ void BloodCrypt (void *data, int key, int len)
//
//==========================================================================
class FRFFFile : public FUncompressedFile
class FRFFFile : public FResourceFile
{
public:
@ -106,7 +106,7 @@ public:
//==========================================================================
FRFFFile::FRFFFile(const char *filename, FileReader &file, StringPool* sp)
: FUncompressedFile(filename, file, sp)
: FResourceFile(filename, file, sp)
{
}

View file

@ -33,7 +33,7 @@
**
*/
#include "resourcefile_internal.h"
#include "resourcefile.h"
namespace FileSys {
//==========================================================================
@ -42,7 +42,7 @@ namespace FileSys {
//
//==========================================================================
class FSSIFile : public FUncompressedFile
class FSSIFile : public FResourceFile
{
public:
FSSIFile(const char * filename, FileReader &file, StringPool* sp);
@ -57,7 +57,7 @@ public:
//==========================================================================
FSSIFile::FSSIFile(const char *filename, FileReader &file, StringPool* sp)
: FUncompressedFile(filename, file, sp)
: FResourceFile(filename, file, sp)
{
}

View file

@ -38,7 +38,7 @@
#include "fs_filesystem.h"
#include "fs_swap.h"
#include "fs_stringpool.h"
#include "resourcefile_internal.h"
#include "resourcefile.h"
namespace FileSys {
using namespace byteswap;
@ -64,7 +64,7 @@ struct wadlump_t
//
//==========================================================================
class FWadFile : public FUncompressedFile
class FWadFile : public FResourceFile
{
bool IsMarker(int lump, const char *marker);
void SetNamespace(const char *startmarker, const char *endmarker, namespace_t space, FileSystemMessageFunc Printf, bool flathack=false);
@ -85,7 +85,7 @@ public:
//==========================================================================
FWadFile::FWadFile(const char *filename, FileReader &file, StringPool* sp)
: FUncompressedFile(filename, file, sp)
: FResourceFile(filename, file, sp)
{
}

View file

@ -34,7 +34,7 @@
**
*/
#include "resourcefile_internal.h"
#include "resourcefile.h"
#include "fs_stringpool.h"
#include "fs_swap.h"
@ -47,7 +47,7 @@ namespace FileSys {
//
//==========================================================================
class FWHResFile : public FUncompressedFile
class FWHResFile : public FResourceFile
{
const char* BaseName;
public:
@ -63,7 +63,7 @@ public:
//==========================================================================
FWHResFile::FWHResFile(const char *filename, FileReader &file, StringPool* sp)
: FUncompressedFile(filename, file, sp)
: FResourceFile(filename, file, sp)
{
BaseName = stringpool->Strdup(ExtractBaseName(filename, false).c_str());
}

View file

@ -37,7 +37,7 @@
#include <stdexcept>
#include "w_zip.h"
#include "ancientzip.h"
#include "resourcefile_internal.h"
#include "resourcefile.h"
#include "fs_findfile.h"
#include "fs_swap.h"
#include "fs_stringpool.h"
@ -106,7 +106,7 @@ static uint32_t Zip_FindCentralDir(FileReader &fin, bool* zip64)
//
//==========================================================================
class FZipFile : public FUncompressedFile
class FZipFile : public FResourceFile
{
void SetEntryAddress(uint32_t entry) override;
@ -123,7 +123,7 @@ public:
//==========================================================================
FZipFile::FZipFile(const char * filename, FileReader &file, StringPool* sp)
: FUncompressedFile(filename, file, sp)
: FResourceFile(filename, file, sp)
{
}
@ -376,6 +376,7 @@ bool FZipFile::Open(LumpFilterInfo* filter, FileSystemMessageFunc Printf)
free(directory);
GenerateHash();
PostProcessArchive(filter);
return true;
}

View file

@ -41,7 +41,7 @@
#include <ctype.h>
#include <string.h>
#include "resourcefile_internal.h"
#include "resourcefile.h"
#include "fs_filesystem.h"
#include "fs_findfile.h"
#include "md5.hpp"

View file

@ -35,7 +35,7 @@
*/
#include <miniz.h>
#include "resourcefile_internal.h"
#include "resourcefile.h"
#include "md5.hpp"
#include "fs_stringpool.h"
#include "files_internal.h"
@ -335,11 +335,10 @@ void FResourceFile::GenerateHash()
void FResourceFile::PostProcessArchive(LumpFilterInfo *filter)
{
// only do this for archive types which contain full file names. All others are assumed to be pre-sorted.
//if (NumLumps < 2 || !(Entries[0].Flags & RESFF_FULLPATH)) return;
if (NumLumps < 2 || !(Entries[0].Flags & RESFF_FULLPATH)) return;
// Entries in archives are sorted alphabetically (for now skip the sorting because both arrays might disagree due to file name postprocessing.)
//qsort(lumps, NumLumps, lumpsize, lumpcmp);
//qsort(Entries, NumLumps, sizeof(Entries[0]), entrycmp);
// Entries in archives are sorted alphabetically.
qsort(Entries, NumLumps, sizeof(Entries[0]), entrycmp);
if (!filter) return;
// Filter out lumps using the same names as the Autoload.* sections
@ -534,27 +533,13 @@ int FResourceFile::FindEntry(const char *name)
}
//==========================================================================
//
// Base class for uncompressed resource files
//
//==========================================================================
FUncompressedFile::FUncompressedFile(const char *filename, StringPool* sp)
: FResourceFile(filename, sp)
{}
FUncompressedFile::FUncompressedFile(const char *filename, FileReader &r, StringPool* sp)
: FResourceFile(filename, r, sp)
{}
//==========================================================================
//
// Caches a lump's content and increases the reference counter
//
//==========================================================================
FileReader FUncompressedFile::GetEntryReader(uint32_t entry, bool newreader)
FileReader FResourceFile::GetEntryReader(uint32_t entry, bool newreader)
{
FileReader fr;
if (entry < NumLumps)

View file

@ -1,18 +0,0 @@
#pragma once
#include "resourcefile.h"
namespace FileSys {
// Base class for uncompressed resource files (WAD, GRP, PAK and single lumps)
class FUncompressedFile : public FResourceFile
{
protected:
FUncompressedFile(const char *filename, StringPool* sp);
FUncompressedFile(const char *filename, FileReader &r, StringPool* sp);
//FileData Read(int entry) override; todo later. It's only needed for optimization once everything works
FileReader GetEntryReader(uint32_t entry, bool) override;
};
}