- put the entire filesystem code into a namespace and created some subdirectories.
This commit is contained in:
parent
94c9ee4593
commit
ebb71cebf1
108 changed files with 308 additions and 225 deletions
|
|
@ -45,6 +45,8 @@
|
|||
|
||||
#include "tarray.h"
|
||||
|
||||
namespace FileSys {
|
||||
|
||||
class FileSystemException : public std::exception
|
||||
{
|
||||
protected:
|
||||
|
|
@ -271,7 +273,7 @@ public:
|
|||
{
|
||||
uint16_t v = 0;
|
||||
Read(&v, 2);
|
||||
return fs_private::LittleShort(v);
|
||||
return byteswap::LittleShort(v);
|
||||
}
|
||||
|
||||
int16_t ReadInt16()
|
||||
|
|
@ -283,7 +285,7 @@ public:
|
|||
{
|
||||
uint16_t v = 0;
|
||||
Read(&v, 2);
|
||||
return fs_private::BigShort(v);
|
||||
return byteswap::BigShort(v);
|
||||
}
|
||||
|
||||
int16_t ReadInt16BE()
|
||||
|
|
@ -295,7 +297,7 @@ public:
|
|||
{
|
||||
uint32_t v = 0;
|
||||
Read(&v, 4);
|
||||
return fs_private::LittleLong(v);
|
||||
return byteswap::LittleLong(v);
|
||||
}
|
||||
|
||||
int32_t ReadInt32()
|
||||
|
|
@ -307,7 +309,7 @@ public:
|
|||
{
|
||||
uint32_t v = 0;
|
||||
Read(&v, 4);
|
||||
return fs_private::BigLong(v);
|
||||
return byteswap::BigLong(v);
|
||||
}
|
||||
|
||||
int32_t ReadInt32BE()
|
||||
|
|
@ -394,5 +396,6 @@ public:
|
|||
TArray<unsigned char>&& TakeBuffer() { return std::move(mBuffer); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -8,10 +8,11 @@
|
|||
|
||||
|
||||
|
||||
#include "files.h"
|
||||
#include "cmdlib.h"
|
||||
#include "fs_files.h"
|
||||
#include "resourcefile.h"
|
||||
|
||||
namespace FileSys {
|
||||
|
||||
class FResourceFile;
|
||||
struct FResourceLump;
|
||||
|
||||
|
|
@ -92,31 +93,31 @@ public:
|
|||
int GetLastEntry(int wadnum) const noexcept;
|
||||
int GetEntryCount(int wadnum) const noexcept;
|
||||
|
||||
int CheckNumForName (const char *name, int namespc);
|
||||
int CheckNumForName (const char *name, int namespc, int wadfile, bool exact = true);
|
||||
int GetNumForName (const char *name, int namespc);
|
||||
int CheckNumForName (const char *name, int namespc) const;
|
||||
int CheckNumForName (const char *name, int namespc, int wadfile, bool exact = true) const;
|
||||
int GetNumForName (const char *name, int namespc) const;
|
||||
|
||||
inline int CheckNumForName (const uint8_t *name) { return CheckNumForName ((const char *)name, ns_global); }
|
||||
inline int CheckNumForName (const char *name) { return CheckNumForName (name, ns_global); }
|
||||
inline int CheckNumForName (const uint8_t *name, int ns) { return CheckNumForName ((const char *)name, ns); }
|
||||
inline int GetNumForName (const char *name) { return GetNumForName (name, ns_global); }
|
||||
inline int GetNumForName (const uint8_t *name) { return GetNumForName ((const char *)name); }
|
||||
inline int GetNumForName (const uint8_t *name, int ns) { return GetNumForName ((const char *)name, ns); }
|
||||
inline int CheckNumForName (const uint8_t *name) const { return CheckNumForName ((const char *)name, ns_global); }
|
||||
inline int CheckNumForName (const char *name) const { return CheckNumForName (name, ns_global); }
|
||||
inline int CheckNumForName (const uint8_t *name, int ns) const { return CheckNumForName ((const char *)name, ns); }
|
||||
inline int GetNumForName (const char *name) const { return GetNumForName (name, ns_global); }
|
||||
inline int GetNumForName (const uint8_t *name) const { return GetNumForName ((const char *)name); }
|
||||
inline int GetNumForName (const uint8_t *name, int ns) const { return GetNumForName ((const char *)name, ns); }
|
||||
|
||||
int CheckNumForFullName (const char *name, bool trynormal = false, int namespc = ns_global, bool ignoreext = false);
|
||||
int CheckNumForFullName (const char *name, int wadfile);
|
||||
int GetNumForFullName (const char *name);
|
||||
int FindFile(const char* name)
|
||||
int CheckNumForFullName (const char *cname, bool trynormal = false, int namespc = ns_global, bool ignoreext = false) const;
|
||||
int CheckNumForFullName (const char *name, int wadfile) const;
|
||||
int GetNumForFullName (const char *name) const;
|
||||
int FindFile(const char* name) const
|
||||
{
|
||||
return CheckNumForFullName(name);
|
||||
}
|
||||
|
||||
bool FileExists(const char* name)
|
||||
bool FileExists(const char* name) const
|
||||
{
|
||||
return FindFile(name) >= 0;
|
||||
}
|
||||
|
||||
bool FileExists(const std::string& name)
|
||||
bool FileExists(const std::string& name) const
|
||||
{
|
||||
return FindFile(name.c_str()) >= 0;
|
||||
}
|
||||
|
|
@ -140,7 +141,7 @@ public:
|
|||
int FindLumpFullName(const char* name, int* lastlump, bool noext = false);
|
||||
bool CheckFileName (int lump, const char *name); // [RH] True if lump's name == name
|
||||
|
||||
int FindFileWithExtensions(const char* name, const char* const* exts, int count);
|
||||
int FindFileWithExtensions(const char* name, const char* const* exts, int count) const;
|
||||
int FindResource(int resid, const char* type, int filenum = -1) const noexcept;
|
||||
int GetResource(int resid, const char* type, int filenum = -1) const;
|
||||
|
||||
|
|
@ -212,5 +213,4 @@ private:
|
|||
|
||||
};
|
||||
|
||||
extern FileSystem fileSystem;
|
||||
|
||||
}
|
||||
|
|
@ -5,6 +5,8 @@
|
|||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace FileSys {
|
||||
|
||||
struct FileListEntry
|
||||
{
|
||||
std::string FileName; // file name only
|
||||
|
|
@ -34,3 +36,4 @@ inline void FixPathSeparator(char* path)
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -17,9 +17,9 @@
|
|||
#include <libkern/OSByteOrder.h>
|
||||
#endif
|
||||
|
||||
namespace fs_private
|
||||
{
|
||||
|
||||
namespace FileSys {
|
||||
namespace byteswap {
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
inline unsigned short LittleShort(unsigned short x)
|
||||
|
|
@ -117,5 +117,6 @@ inline unsigned int BigLong (unsigned int x)
|
|||
|
||||
#endif // __BIG_ENDIAN__
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __M_SWAP_H__
|
||||
|
|
@ -6,8 +6,10 @@
|
|||
#include <limits.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include "files.h"
|
||||
#include "fs_files.h"
|
||||
|
||||
namespace FileSys {
|
||||
|
||||
class StringPool;
|
||||
std::string ExtractBaseName(const char* path, bool include_extension = false);
|
||||
void strReplace(std::string& str, const char* from, const char* to);
|
||||
|
|
@ -246,7 +248,6 @@ struct FMemoryLump : public FResourceLump
|
|||
};
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -46,6 +46,8 @@
|
|||
#include <stdlib.h>
|
||||
#include "ancientzip.h"
|
||||
|
||||
namespace FileSys {
|
||||
|
||||
/****************************************************************
|
||||
Bit-I/O variables and routines/macros
|
||||
|
||||
|
|
@ -433,3 +435,5 @@ int ShrinkLoop(unsigned char *out, unsigned int outsize, FileReader &_In, unsign
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
#pragma once
|
||||
#include "files.h"
|
||||
#include "fs_files.h"
|
||||
|
||||
namespace FileSys {
|
||||
|
||||
class FZipExploder
|
||||
{
|
||||
unsigned int Hold, Bits;
|
||||
|
|
@ -41,4 +43,5 @@ public:
|
|||
int Explode(unsigned char *out, unsigned int outsize, FileReader &in, unsigned int insize, int flags);
|
||||
};
|
||||
|
||||
int ShrinkLoop(unsigned char *out, unsigned int outsize, FileReader &in, unsigned int insize);
|
||||
int ShrinkLoop(unsigned char *out, unsigned int outsize, FileReader &in, unsigned int insize);
|
||||
}
|
||||
|
|
@ -40,7 +40,8 @@
|
|||
#include "fs_findfile.h"
|
||||
|
||||
|
||||
|
||||
namespace FileSys {
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
//
|
||||
// Interface classes to 7z library
|
||||
|
|
@ -374,4 +375,4 @@ FResourceFile *Check7Z(const char *filename, FileReader &file, LumpFilterInfo* f
|
|||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -40,6 +40,8 @@
|
|||
#include "fs_findfile.h"
|
||||
#include "fs_stringpool.h"
|
||||
|
||||
namespace FileSys {
|
||||
|
||||
std::string FS_FullPath(const char* directory);
|
||||
|
||||
#ifdef _WIN32
|
||||
|
|
@ -231,3 +233,4 @@ FResourceFile *CheckDir(const char *filename, bool nosubdirflag, LumpFilterInfo*
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -36,7 +36,8 @@
|
|||
#include "resourcefile.h"
|
||||
#include "fs_swap.h"
|
||||
|
||||
using namespace fs_private;
|
||||
namespace FileSys {
|
||||
using namespace byteswap;
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
@ -152,3 +153,4 @@ FResourceFile *CheckGRP(const char *filename, FileReader &file, LumpFilterInfo*
|
|||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include "resourcefile.h"
|
||||
|
||||
namespace FileSys {
|
||||
//==========================================================================
|
||||
//
|
||||
// Single lump
|
||||
|
|
@ -93,3 +94,4 @@ FResourceFile *CheckLump(const char *filename, FileReader &file, LumpFilterInfo*
|
|||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -34,8 +34,9 @@
|
|||
|
||||
#include "resourcefile.h"
|
||||
|
||||
using namespace fs_private;
|
||||
namespace FileSys {
|
||||
|
||||
using namespace byteswap;
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
|
@ -145,3 +146,4 @@ FResourceFile *CheckPak(const char *filename, FileReader &file, LumpFilterInfo*
|
|||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -36,7 +36,8 @@
|
|||
#include "resourcefile.h"
|
||||
#include "fs_swap.h"
|
||||
|
||||
using namespace fs_private;
|
||||
namespace FileSys {
|
||||
using namespace byteswap;
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
@ -260,4 +261,4 @@ FResourceFile *CheckRFF(const char *filename, FileReader &file, LumpFilterInfo*
|
|||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -35,6 +35,7 @@
|
|||
|
||||
#include "resourcefile.h"
|
||||
|
||||
namespace FileSys {
|
||||
//==========================================================================
|
||||
//
|
||||
// Build GRP file
|
||||
|
|
@ -152,3 +153,5 @@ FResourceFile* CheckSSI(const char* filename, FileReader& file, LumpFilterInfo*
|
|||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -35,11 +35,11 @@
|
|||
|
||||
#include <ctype.h>
|
||||
#include "resourcefile.h"
|
||||
#include "filesystem.h"
|
||||
#include "fs_filesystem.h"
|
||||
#include "fs_swap.h"
|
||||
|
||||
using namespace fs_private;
|
||||
|
||||
namespace FileSys {
|
||||
using namespace byteswap;
|
||||
|
||||
struct wadinfo_t
|
||||
{
|
||||
|
|
@ -485,3 +485,4 @@ FResourceFile *CheckWad(const char *filename, FileReader &file, LumpFilterInfo*
|
|||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -38,7 +38,8 @@
|
|||
#include "fs_stringpool.h"
|
||||
#include "fs_swap.h"
|
||||
|
||||
using namespace fs_private;
|
||||
namespace FileSys {
|
||||
using namespace byteswap;
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
@ -140,4 +141,5 @@ FResourceFile *CheckWHRes(const char *filename, FileReader &file, LumpFilterInfo
|
|||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -41,7 +41,8 @@
|
|||
#include "fs_findfile.h"
|
||||
#include "fs_swap.h"
|
||||
|
||||
using namespace fs_private;
|
||||
namespace FileSys {
|
||||
using namespace byteswap;
|
||||
|
||||
#define BUFREADCOMMENT (0x400)
|
||||
|
||||
|
|
@ -720,3 +721,5 @@ bool WriteZip(const char* filename, const FCompressedBuffer* content, size_t con
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "resourcefile.h"
|
||||
|
||||
namespace FileSys {
|
||||
//==========================================================================
|
||||
//
|
||||
// Zip Lump
|
||||
|
|
@ -45,5 +46,6 @@ public:
|
|||
virtual FResourceLump *GetLump(int no) { return ((unsigned)no < NumLumps)? &Lumps[no] : NULL; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -34,10 +34,10 @@
|
|||
*/
|
||||
|
||||
#include <string>
|
||||
#include "files.h"
|
||||
|
||||
using namespace fs_private;
|
||||
#include "fs_files.h"
|
||||
|
||||
namespace FileSys {
|
||||
|
||||
#ifdef _WIN32
|
||||
std::wstring toWide(const char* str);
|
||||
#endif
|
||||
|
|
@ -494,3 +494,5 @@ size_t BufferWriter::Write(const void *buffer, size_t len)
|
|||
memcpy(&mBuffer[ofs], buffer, len);
|
||||
return len;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -41,7 +41,10 @@
|
|||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "files.h"
|
||||
#include "fs_files.h"
|
||||
|
||||
namespace FileSys {
|
||||
using namespace byteswap;
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
@ -538,7 +541,7 @@ class DecompressorLZSS : public DecompressorBase
|
|||
return false;
|
||||
Stream.AvailIn -= 2;
|
||||
|
||||
uint16_t pos = fs_private::BigShort(*(uint16_t*)Stream.In);
|
||||
uint16_t pos = BigShort(*(uint16_t*)Stream.In);
|
||||
uint8_t len = (pos & 0xF)+1;
|
||||
pos >>= 4;
|
||||
Stream.In += 2;
|
||||
|
|
@ -752,3 +755,4 @@ bool FileReader::OpenDecompressor(FileReader &parent, Size length, int method, b
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -41,11 +41,13 @@
|
|||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "filesystem.h"
|
||||
#include "fs_filesystem.h"
|
||||
#include "fs_findfile.h"
|
||||
#include "md5.hpp"
|
||||
#include "fs_stringpool.h"
|
||||
|
||||
namespace FileSys {
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
#define NULL_INDEX (0xffffffff)
|
||||
|
|
@ -72,7 +74,7 @@ static uint32_t MakeHash(const char* str, size_t length = SIZE_MAX)
|
|||
|
||||
static void md5Hash(FileReader& reader, uint8_t* digest)
|
||||
{
|
||||
using namespace fs_private::md5;
|
||||
using namespace md5;
|
||||
|
||||
md5_state_t state;
|
||||
md5_init(&state);
|
||||
|
|
@ -187,8 +189,6 @@ static void PrintLastError (FileSystemMessageFunc Printf);
|
|||
|
||||
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
||||
|
||||
FileSystem fileSystem;
|
||||
|
||||
// CODE --------------------------------------------------------------------
|
||||
|
||||
FileSystem::FileSystem()
|
||||
|
|
@ -511,7 +511,7 @@ int FileSystem::CheckIfResourceFileLoaded (const char *name) noexcept
|
|||
// and namespace parameter
|
||||
//==========================================================================
|
||||
|
||||
int FileSystem::CheckNumForName (const char *name, int space)
|
||||
int FileSystem::CheckNumForName (const char *name, int space) const
|
||||
{
|
||||
union
|
||||
{
|
||||
|
|
@ -556,7 +556,7 @@ int FileSystem::CheckNumForName (const char *name, int space)
|
|||
return i != NULL_INDEX ? i : -1;
|
||||
}
|
||||
|
||||
int FileSystem::CheckNumForName (const char *name, int space, int rfnum, bool exact)
|
||||
int FileSystem::CheckNumForName (const char *name, int space, int rfnum, bool exact) const
|
||||
{
|
||||
union
|
||||
{
|
||||
|
|
@ -594,7 +594,7 @@ int FileSystem::CheckNumForName (const char *name, int space, int rfnum, bool ex
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
int FileSystem::GetNumForName (const char *name, int space)
|
||||
int FileSystem::GetNumForName (const char *name, int space) const
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -617,7 +617,7 @@ int FileSystem::GetNumForName (const char *name, int space)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
int FileSystem::CheckNumForFullName (const char *name, bool trynormal, int namespc, bool ignoreext)
|
||||
int FileSystem::CheckNumForFullName (const char *name, bool trynormal, int namespc, bool ignoreext) const
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
|
|
@ -650,7 +650,7 @@ int FileSystem::CheckNumForFullName (const char *name, bool trynormal, int names
|
|||
return -1;
|
||||
}
|
||||
|
||||
int FileSystem::CheckNumForFullName (const char *name, int rfnum)
|
||||
int FileSystem::CheckNumForFullName (const char *name, int rfnum) const
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
|
|
@ -678,7 +678,7 @@ int FileSystem::CheckNumForFullName (const char *name, int rfnum)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
int FileSystem::GetNumForFullName (const char *name)
|
||||
int FileSystem::GetNumForFullName (const char *name) const
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -698,7 +698,7 @@ int FileSystem::GetNumForFullName (const char *name)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
int FileSystem::FindFileWithExtensions(const char* name, const char *const *exts, int count)
|
||||
int FileSystem::FindFileWithExtensions(const char* name, const char *const *exts, int count) const
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
|
|
@ -1254,7 +1254,7 @@ unsigned FileSystem::GetFilesInFolder(const char *inpath, std::vector<FolderEntr
|
|||
if (strncmp(FileInfo[i].LongName, path.c_str(), path.length()) == 0)
|
||||
{
|
||||
// Only if it hasn't been replaced.
|
||||
if ((unsigned)fileSystem.CheckNumForFullName(FileInfo[i].LongName) == i)
|
||||
if ((unsigned)CheckNumForFullName(FileInfo[i].LongName) == i)
|
||||
{
|
||||
FolderEntry fe{ FileInfo[i].LongName, (uint32_t)i };
|
||||
result.push_back(fe);
|
||||
|
|
@ -1269,13 +1269,13 @@ unsigned FileSystem::GetFilesInFolder(const char *inpath, std::vector<FolderEntr
|
|||
// Find the highest resource file having content in the given folder.
|
||||
for (auto & entry : result)
|
||||
{
|
||||
int thisfile = fileSystem.GetFileContainer(entry.lumpnum);
|
||||
int thisfile = GetFileContainer(entry.lumpnum);
|
||||
if (thisfile > maxfile) maxfile = thisfile;
|
||||
}
|
||||
// Delete everything from older files.
|
||||
for (int i = (int)result.size() - 1; i >= 0; i--)
|
||||
{
|
||||
if (fileSystem.GetFileContainer(result[i].lumpnum) != maxfile) result.erase(result.begin() + i);
|
||||
if (GetFileContainer(result[i].lumpnum) != maxfile) result.erase(result.begin() + i);
|
||||
}
|
||||
}
|
||||
qsort(result.data(), result.size(), sizeof(FolderEntry), folderentrycmp);
|
||||
|
|
@ -1364,8 +1364,8 @@ FileReader FileSystem::ReopenFileReader(int lump, bool alwayscache)
|
|||
|
||||
if (rl->RefCount == 0 && rd != nullptr && !rd->GetBuffer() && !alwayscache && !(rl->Flags & LUMPF_COMPRESSED))
|
||||
{
|
||||
int fileno = fileSystem.GetFileContainer(lump);
|
||||
const char *filename = fileSystem.GetResourceFileFullName(fileno);
|
||||
int fileno = GetFileContainer(lump);
|
||||
const char *filename = GetResourceFileFullName(fileno);
|
||||
FileReader fr;
|
||||
if (fr.OpenFile(filename, rl->GetFileOffset(), rl->LumpSize))
|
||||
{
|
||||
|
|
@ -1579,3 +1579,5 @@ FResourceLump* FileSystem::GetFileAt(int no)
|
|||
{
|
||||
return FileInfo[no].lump;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -35,7 +35,8 @@
|
|||
#include "fs_findfile.h"
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace FileSys {
|
||||
|
||||
enum
|
||||
{
|
||||
ZPATH_MAX = 260
|
||||
|
|
@ -404,3 +405,4 @@ bool FS_DirEntryExists(const char* pathname, bool* isdir)
|
|||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -38,6 +38,8 @@
|
|||
#include <string.h>
|
||||
#include "fs_stringpool.h"
|
||||
|
||||
namespace FileSys {
|
||||
|
||||
struct StringPool::Block
|
||||
{
|
||||
Block *NextBlock;
|
||||
|
|
@ -124,3 +126,5 @@ const char* StringPool::Strdup(const char* str)
|
|||
strcpy(p, str);
|
||||
return p;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
namespace FileSys {
|
||||
// Storage for all the static strings the file system must hold.
|
||||
class StringPool
|
||||
{
|
||||
|
|
@ -25,3 +26,4 @@ public:
|
|||
bool shared;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
@ -69,7 +69,7 @@
|
|||
#include <stddef.h>
|
||||
#include <cstring>
|
||||
|
||||
namespace fs_private {
|
||||
namespace FileSys {
|
||||
/// Provides MD5 hashing functionality
|
||||
namespace md5 {
|
||||
|
||||
|
|
@ -39,6 +39,8 @@
|
|||
#include "md5.hpp"
|
||||
#include "fs_stringpool.h"
|
||||
|
||||
namespace FileSys {
|
||||
|
||||
std::string ExtractBaseName(const char* path, bool include_extension)
|
||||
{
|
||||
const char* src, * dot;
|
||||
|
|
@ -364,7 +366,7 @@ int lumpcmp(const void * a, const void * b)
|
|||
void FResourceFile::GenerateHash()
|
||||
{
|
||||
// hash the lump directory after sorting
|
||||
using namespace fs_private::md5;
|
||||
using namespace FileSys::md5;
|
||||
|
||||
auto n = snprintf(Hash, 48, "%08X-%04X-", (unsigned)Reader.GetLength(), NumLumps);
|
||||
|
||||
|
|
@ -745,4 +747,4 @@ int FExternalLump::FillCache()
|
|||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -7,6 +7,8 @@
|
|||
#define FORCE_PACKED
|
||||
#endif
|
||||
|
||||
namespace FileSys {
|
||||
|
||||
#pragma pack(1)
|
||||
// FZipCentralInfo
|
||||
struct FZipEndOfCentralDirectory
|
||||
|
|
@ -105,4 +107,5 @@ struct FZipLocalFileHeader
|
|||
// File header flags.
|
||||
#define ZF_ENCRYPTED 0x1
|
||||
|
||||
}
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue