mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-03-30 22:51:01 +00:00
- 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 306 additions and 223 deletions
|
@ -581,7 +581,8 @@ file( GLOB HEADER_FILES
|
|||
common/statusbar/*.h
|
||||
common/fonts/*.h
|
||||
common/objects/*.h
|
||||
common/filesystem/*.h
|
||||
common/filesystem/include/*.h
|
||||
common/filesystem/source/*.h
|
||||
common/platform/posix/cocoa/*.h
|
||||
common/platform/posix/sdl/*.h
|
||||
common/platform/win32/*.h
|
||||
|
@ -1206,23 +1207,23 @@ set( ZDOOM_SOURCES
|
|||
common/thirdparty/math/tanh.c
|
||||
common/thirdparty/math/fastsin.cpp
|
||||
|
||||
common/filesystem/filesystem.cpp
|
||||
common/filesystem/ancientzip.cpp
|
||||
common/filesystem/file_7z.cpp
|
||||
common/filesystem/file_grp.cpp
|
||||
common/filesystem/file_lump.cpp
|
||||
common/filesystem/file_rff.cpp
|
||||
common/filesystem/file_wad.cpp
|
||||
common/filesystem/file_zip.cpp
|
||||
common/filesystem/file_pak.cpp
|
||||
common/filesystem/file_whres.cpp
|
||||
common/filesystem/file_ssi.cpp
|
||||
common/filesystem/file_directory.cpp
|
||||
common/filesystem/resourcefile.cpp
|
||||
common/filesystem/files.cpp
|
||||
common/filesystem/files_decompress.cpp
|
||||
common/filesystem/fs_findfile.cpp
|
||||
common/filesystem/fs_stringpool.cpp
|
||||
common/filesystem/source/filesystem.cpp
|
||||
common/filesystem/source/ancientzip.cpp
|
||||
common/filesystem/source/file_7z.cpp
|
||||
common/filesystem/source/file_grp.cpp
|
||||
common/filesystem/source/file_lump.cpp
|
||||
common/filesystem/source/file_rff.cpp
|
||||
common/filesystem/source/file_wad.cpp
|
||||
common/filesystem/source/file_zip.cpp
|
||||
common/filesystem/source/file_pak.cpp
|
||||
common/filesystem/source/file_whres.cpp
|
||||
common/filesystem/source/file_ssi.cpp
|
||||
common/filesystem/source/file_directory.cpp
|
||||
common/filesystem/source/resourcefile.cpp
|
||||
common/filesystem/source/files.cpp
|
||||
common/filesystem/source/files_decompress.cpp
|
||||
common/filesystem/source/fs_findfile.cpp
|
||||
common/filesystem/source/fs_stringpool.cpp
|
||||
|
||||
)
|
||||
|
||||
|
@ -1269,7 +1270,7 @@ include_directories(
|
|||
common/textures/hires
|
||||
common/textures
|
||||
common/models
|
||||
common/filesystem
|
||||
common/filesystem/include
|
||||
common/utility
|
||||
common/console
|
||||
common/engine
|
||||
|
@ -1470,6 +1471,8 @@ source_group("Common\\Objects" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/
|
|||
source_group("Common\\Menu" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/menu/.+")
|
||||
source_group("Common\\Fonts" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/fonts/.+")
|
||||
source_group("Common\\File System" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/filesystem/.+")
|
||||
source_group("Common\\File System\\Include" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/filesystem/include/.+")
|
||||
source_group("Common\\File System\\Source" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/filesystem/source/.+")
|
||||
source_group("Common\\Scripting" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/scripting/.+")
|
||||
source_group("Common\\Scripting\\Interface" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/scripting/interface/.+")
|
||||
source_group("Common\\Scripting\\Frontend" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/scripting/frontend/.+" FILES ${CMAKE_CURRENT_BINARY_DIR}/zcc-parse.c ${CMAKE_CURRENT_BINARY_DIR}/zcc-parse.h)
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#include "s_music.h"
|
||||
#include "filereadermusicinterface.h"
|
||||
|
||||
using namespace FileSys;
|
||||
|
||||
|
||||
void I_InitSoundFonts();
|
||||
|
@ -192,7 +193,7 @@ static void SetupWgOpn()
|
|||
{
|
||||
return;
|
||||
}
|
||||
FileData data = fileSystem.ReadFile(lump);
|
||||
auto data = fileSystem.ReadFile(lump);
|
||||
ZMusic_SetWgOpn(data.GetMem(), (uint32_t)data.GetSize());
|
||||
}
|
||||
|
||||
|
@ -204,7 +205,7 @@ static void SetupDMXGUS()
|
|||
{
|
||||
return;
|
||||
}
|
||||
FileData data = fileSystem.ReadFile(lump);
|
||||
auto data = fileSystem.ReadFile(lump);
|
||||
ZMusic_SetDmxGus(data.GetMem(), (uint32_t)data.GetSize());
|
||||
}
|
||||
|
||||
|
|
|
@ -40,10 +40,9 @@
|
|||
#include "i_system.h"
|
||||
#include "filereadermusicinterface.h"
|
||||
#include <zmusic.h>
|
||||
#include "resourcefile.h"
|
||||
#include "fs_filesystem.h"
|
||||
#include "version.h"
|
||||
#include "fs_findfile.h"
|
||||
#include "resourcefile.h"
|
||||
#include "i_interface.h"
|
||||
#include "configfile.h"
|
||||
#include "printf.h"
|
||||
|
@ -402,7 +401,7 @@ void FSoundFontManager::CollectSoundfonts()
|
|||
{
|
||||
if (stricmp (key, "Path") == 0)
|
||||
{
|
||||
FileList list;
|
||||
FileSys::FileList list;
|
||||
|
||||
FString dir;
|
||||
|
||||
|
@ -410,7 +409,7 @@ void FSoundFontManager::CollectSoundfonts()
|
|||
FixPathSeperator(dir);
|
||||
if (dir.IsNotEmpty())
|
||||
{
|
||||
if (ScanDirectory(list, dir.GetChars(), "*", true))
|
||||
if (FileSys::ScanDirectory(list, dir.GetChars(), "*", true))
|
||||
{
|
||||
for(auto& entry : list)
|
||||
{
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
#include "i_specialpaths.h"
|
||||
#include "configfile.h"
|
||||
#include "c_cvars.h"
|
||||
#include "md5.h"
|
||||
|
||||
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
#include "zstring.h"
|
||||
#include "tarray.h"
|
||||
#include "name.h"
|
||||
#include "files.h"
|
||||
#include <zmusic.h>
|
||||
|
||||
class FileReader;
|
||||
class SoundStream;
|
||||
|
||||
|
||||
|
|
|
@ -40,8 +40,8 @@
|
|||
#include "i_soundinternal.h"
|
||||
#include "zstring.h"
|
||||
#include <zmusic.h>
|
||||
#include "files.h"
|
||||
|
||||
class FileReader;
|
||||
struct FSoundChan;
|
||||
|
||||
enum EStartSoundFlags
|
||||
|
|
|
@ -201,8 +201,8 @@ UNSAFE_CCMD (dir)
|
|||
bpath = path;
|
||||
}
|
||||
|
||||
FileList list;
|
||||
if (!ScanDirectory(list, bpath, base, true))
|
||||
FileSys::FileList list;
|
||||
if (!FileSys::ScanDirectory(list, bpath, base, true))
|
||||
{
|
||||
Printf ("Nothing matching %s\n", path.GetChars());
|
||||
}
|
||||
|
|
6
src/common/engine/files.h
Normal file
6
src/common/engine/files.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
#pragma once
|
||||
#include "fs_files.h"
|
||||
|
||||
using FileSys::FileReader;
|
||||
using FileSys::FileWriter;
|
||||
using FileSys::BufferWriter;
|
7
src/common/engine/filesystem.h
Normal file
7
src/common/engine/filesystem.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
#pragma once
|
||||
#include "fs_filesystem.h"
|
||||
|
||||
using FileSys::FileSystem;
|
||||
using FileSys::FResourceFile;
|
||||
|
||||
inline FileSys::FileSystem fileSystem;
|
|
@ -3,8 +3,7 @@
|
|||
#include <stdint.h>
|
||||
#include "memarena.h"
|
||||
#include "palentry.h"
|
||||
|
||||
class FileReader;
|
||||
#include "files.h"
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
|
@ -57,6 +57,8 @@
|
|||
#include "base64.h"
|
||||
#include "vm.h"
|
||||
|
||||
using namespace FileSys;
|
||||
|
||||
extern DObject *WP_NOCHANGE;
|
||||
bool save_full = false; // for testing. Should be removed afterward.
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <stdint.h>
|
||||
#include <type_traits>
|
||||
#include "tarray.h"
|
||||
#include "file_zip.h"
|
||||
#include "tflags.h"
|
||||
#include "vectors.h"
|
||||
#include "palentry.h"
|
||||
|
@ -80,7 +79,7 @@ public:
|
|||
void SetUniqueSoundNames() { soundNamesAreUnique = true; }
|
||||
bool OpenWriter(bool pretty = true);
|
||||
bool OpenReader(const char *buffer, size_t length);
|
||||
bool OpenReader(FCompressedBuffer *input);
|
||||
bool OpenReader(FileSys::FCompressedBuffer *input);
|
||||
void Close();
|
||||
void ReadObjects(bool hubtravel);
|
||||
bool BeginObject(const char *name);
|
||||
|
@ -91,7 +90,7 @@ public:
|
|||
unsigned GetSize(const char *group);
|
||||
const char *GetKey();
|
||||
const char *GetOutput(unsigned *len = nullptr);
|
||||
FCompressedBuffer GetCompressedOutput();
|
||||
FileSys::FCompressedBuffer GetCompressedOutput();
|
||||
// The sprite serializer is a special case because it is needed by the VM to handle its 'spriteid' type.
|
||||
virtual FSerializer &Sprite(const char *key, int32_t &spritenum, int32_t *def);
|
||||
// This is only needed by the type system.
|
||||
|
|
|
@ -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
|
|
@ -91,7 +91,7 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
// Read the font's configuration.
|
||||
// This will not be done for the default fonts, because they are not atomic and the default content does not need it.
|
||||
|
||||
std::vector<FolderEntry> folderdata;
|
||||
std::vector<FileSys::FolderEntry> folderdata;
|
||||
if (filetemplate != nullptr)
|
||||
{
|
||||
FStringf path("fonts/%s/", filetemplate);
|
||||
|
@ -398,7 +398,7 @@ public:
|
|||
}
|
||||
|
||||
};
|
||||
void FFont::ReadSheetFont(std::vector<FolderEntry> &folderdata, int width, int height, const DVector2 &Scale)
|
||||
void FFont::ReadSheetFont(std::vector<FileSys::FolderEntry> &folderdata, int width, int height, const DVector2 &Scale)
|
||||
{
|
||||
TMap<int, FGameTexture*> charMap;
|
||||
int minchar = INT_MAX;
|
||||
|
|
|
@ -58,7 +58,7 @@ struct HexDataSource
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void ParseDefinition(FResourceLump* font)
|
||||
void ParseDefinition(FileSys::FResourceLump* font)
|
||||
{
|
||||
FScanner sc;
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ FSingleLumpFont::FSingleLumpFont (const char *name, int lump) : FFont(lump)
|
|||
|
||||
FontName = name;
|
||||
|
||||
FileData data1 = fileSystem.ReadFile (lump);
|
||||
auto data1 = fileSystem.ReadFile (lump);
|
||||
auto data = data1.GetBytes();
|
||||
|
||||
if (data[0] == 0xE1 && data[1] == 0xE6 && data[2] == 0xD5 && data[3] == 0x1A)
|
||||
|
@ -474,7 +474,7 @@ void FSingleLumpFont::LoadBMF(int lump, const uint8_t *data)
|
|||
|
||||
void FSingleLumpFont::CheckFON1Chars()
|
||||
{
|
||||
FileData memLump = fileSystem.ReadFile(Lump);
|
||||
auto memLump = fileSystem.ReadFile(Lump);
|
||||
auto data = memLump.GetBytes();
|
||||
const uint8_t* data_p;
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ FFont *V_GetFont(const char *name, const char *fontlumpname)
|
|||
int lump = -1;
|
||||
int folderfile = -1;
|
||||
|
||||
std::vector<FolderEntry> folderdata;
|
||||
std::vector<FileSys::FolderEntry> folderdata;
|
||||
FStringf path("fonts/%s/", name);
|
||||
|
||||
// Use a folder-based font only if it comes from a later file than the single lump version.
|
||||
|
|
|
@ -175,7 +175,7 @@ protected:
|
|||
|
||||
void FixXMoves();
|
||||
|
||||
void ReadSheetFont(std::vector<FolderEntry> &folderdata, int width, int height, const DVector2 &Scale);
|
||||
void ReadSheetFont(std::vector<FileSys::FolderEntry> &folderdata, int width, int height, const DVector2 &Scale);
|
||||
|
||||
EFontType Type = EFontType::Unknown;
|
||||
FName AltFontName = NAME_None;
|
||||
|
|
|
@ -1519,7 +1519,7 @@ void M_ParseMenuDefs()
|
|||
DefaultOptionMenuSettings->Reset();
|
||||
OptionSettings.mLinespacing = 17;
|
||||
|
||||
int IWADMenu = fileSystem.CheckNumForName("MENUDEF", ns_global, fileSystem.GetIwadNum());
|
||||
int IWADMenu = fileSystem.CheckNumForName("MENUDEF", FileSys::ns_global, fileSystem.GetIwadNum());
|
||||
|
||||
while ((lump = fileSystem.FindLump ("MENUDEF", &lastlump)) != -1)
|
||||
{
|
||||
|
|
|
@ -297,7 +297,7 @@ unsigned FSavegameManagerBase::ExtractSaveData(int index)
|
|||
!node->bOldVersion &&
|
||||
(resf = FResourceFile::OpenResourceFile(node->Filename.GetChars(), true)) != nullptr)
|
||||
{
|
||||
FResourceLump *info = resf->FindLump("info.json");
|
||||
auto info = resf->FindLump("info.json");
|
||||
if (info == nullptr)
|
||||
{
|
||||
// this should not happen because the file has already been verified.
|
||||
|
@ -315,7 +315,7 @@ unsigned FSavegameManagerBase::ExtractSaveData(int index)
|
|||
|
||||
SaveCommentString = ExtractSaveComment(arc);
|
||||
|
||||
FResourceLump *pic = resf->FindLump("savepic.png");
|
||||
auto pic = resf->FindLump("savepic.png");
|
||||
if (pic != nullptr)
|
||||
{
|
||||
FileReader picreader;
|
||||
|
|
|
@ -172,7 +172,7 @@ unsigned FindModel(const char * path, const char * modelfile, bool silent)
|
|||
}
|
||||
|
||||
int len = fileSystem.FileLength(lump);
|
||||
FileData lumpd = fileSystem.ReadFile(lump);
|
||||
auto lumpd = fileSystem.ReadFile(lump);
|
||||
const char * buffer = lumpd.GetString();
|
||||
|
||||
if ( (size_t)fullname.LastIndexOf("_d.3d") == fullname.Len()-5 )
|
||||
|
|
|
@ -270,7 +270,7 @@ void IQMModel::LoadGeometry()
|
|||
{
|
||||
try
|
||||
{
|
||||
FileData lumpdata = fileSystem.ReadFile(mLumpNum);
|
||||
auto lumpdata = fileSystem.ReadFile(mLumpNum);
|
||||
IQMFileReader reader(lumpdata.GetMem(), (int)lumpdata.GetSize());
|
||||
|
||||
Vertices.Resize(NumVertices);
|
||||
|
|
|
@ -177,7 +177,7 @@ bool FDMDModel::Load(const char * path, int lumpnum, const char * buffer, int le
|
|||
void FDMDModel::LoadGeometry()
|
||||
{
|
||||
static int axis[3] = { VX, VY, VZ };
|
||||
FileData lumpdata = fileSystem.ReadFile(mLumpNum);
|
||||
auto lumpdata = fileSystem.ReadFile(mLumpNum);
|
||||
auto buffer = lumpdata.GetString();
|
||||
texCoords = new FTexCoord[info.numTexCoords];
|
||||
memcpy(texCoords, buffer + info.offsetTexCoords, info.numTexCoords * sizeof(FTexCoord));
|
||||
|
@ -501,7 +501,7 @@ void FMD2Model::LoadGeometry()
|
|||
{
|
||||
static int axis[3] = { VX, VY, VZ };
|
||||
uint8_t *md2_frames;
|
||||
FileData lumpdata = fileSystem.ReadFile(mLumpNum);
|
||||
auto lumpdata = fileSystem.ReadFile(mLumpNum);
|
||||
auto buffer = lumpdata.GetString();
|
||||
|
||||
texCoords = new FTexCoord[info.numTexCoords];
|
||||
|
|
|
@ -189,7 +189,7 @@ bool FMD3Model::Load(const char * path, int lumpnum, const char * buffer, int le
|
|||
|
||||
void FMD3Model::LoadGeometry()
|
||||
{
|
||||
FileData lumpdata = fileSystem.ReadFile(mLumpNum);
|
||||
auto lumpdata = fileSystem.ReadFile(mLumpNum);
|
||||
auto buffer = lumpdata.GetString();
|
||||
md3_header_t * hdr = (md3_header_t *)buffer;
|
||||
md3_surface_t * surf = (md3_surface_t*)(buffer + LittleLong(hdr->Ofs_Surfaces));
|
||||
|
|
|
@ -70,9 +70,9 @@ bool FUE1Model::Load( const char *filename, int lumpnum, const char *buffer, int
|
|||
void FUE1Model::LoadGeometry()
|
||||
{
|
||||
const char *buffer, *buffer2;
|
||||
FileData lump = fileSystem.ReadFile(mDataLump);
|
||||
auto lump = fileSystem.ReadFile(mDataLump);
|
||||
buffer = lump.GetString();
|
||||
FileData lump2 = fileSystem.ReadFile(mAnivLump);
|
||||
auto lump2 = fileSystem.ReadFile(mAnivLump);
|
||||
buffer2 = lump2.GetString();
|
||||
// map structures
|
||||
dhead = (const d3dhead*)(buffer);
|
||||
|
|
|
@ -161,7 +161,7 @@ FVoxel *R_LoadKVX(int lumpnum)
|
|||
int mip, maxmipsize;
|
||||
int i, j, n;
|
||||
|
||||
FileData lump = fileSystem.ReadFile(lumpnum); // FileData adds an extra 0 byte to the end.
|
||||
auto lump = fileSystem.ReadFile(lumpnum); // FileData adds an extra 0 byte to the end.
|
||||
auto rawvoxel = lump.GetBytes();
|
||||
int voxelsize = (int)(lump.GetSize()-1);
|
||||
|
||||
|
|
|
@ -383,11 +383,11 @@ bool FShader::Load(const char * name, const char * vert_prog_lump_, const char *
|
|||
|
||||
int vp_lump = fileSystem.CheckNumForFullName(vert_prog_lump, 0);
|
||||
if (vp_lump == -1) I_Error("Unable to load '%s'", vert_prog_lump.GetChars());
|
||||
FileData vp_data = fileSystem.ReadFile(vp_lump);
|
||||
auto vp_data = fileSystem.ReadFile(vp_lump);
|
||||
|
||||
int fp_lump = fileSystem.CheckNumForFullName(frag_prog_lump, 0);
|
||||
if (fp_lump == -1) I_Error("Unable to load '%s'", frag_prog_lump.GetChars());
|
||||
FileData fp_data = fileSystem.ReadFile(fp_lump);
|
||||
auto fp_data = fileSystem.ReadFile(fp_lump);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "hw_shadowmap.h"
|
||||
#include "hw_levelmesh.h"
|
||||
#include "buffers.h"
|
||||
#include "files.h"
|
||||
|
||||
|
||||
struct FPortalSceneState;
|
||||
|
@ -90,7 +91,6 @@ EXTERN_CVAR(Int, win_h)
|
|||
EXTERN_CVAR(Bool, win_maximized)
|
||||
|
||||
struct FColormap;
|
||||
class FileWriter;
|
||||
enum FTextureFormat : uint32_t;
|
||||
class FModelRenderer;
|
||||
struct SamplerUniform;
|
||||
|
|
|
@ -473,7 +473,7 @@ FString VkShaderManager::LoadPrivateShaderLump(const char *lumpname)
|
|||
{
|
||||
int lump = fileSystem.CheckNumForFullName(lumpname, 0);
|
||||
if (lump == -1) I_Error("Unable to load '%s'", lumpname);
|
||||
FileData data = fileSystem.ReadFile(lump);
|
||||
auto data = fileSystem.ReadFile(lump);
|
||||
return GetStringFromLump(lump);
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ FGenericStartScreen::FGenericStartScreen(int max_progress)
|
|||
: FStartScreen(max_progress)
|
||||
{
|
||||
// at this point we do not have a working texture manager yet, so we have to do the lookup via the file system
|
||||
int startup_lump = fileSystem.CheckNumForName("GZDOOM", ns_graphics);
|
||||
int startup_lump = fileSystem.CheckNumForName("GZDOOM", FileSys::ns_graphics);
|
||||
|
||||
StartupBitmap.Create(640, 480);
|
||||
ClearBlock(StartupBitmap, { 0, 0, 0, 255 }, 0, 0, 640, 480);
|
||||
|
|
|
@ -81,9 +81,9 @@ FHexenStartScreen::FHexenStartScreen(int max_progress)
|
|||
: FStartScreen(max_progress)
|
||||
{
|
||||
// at this point we do not have a working texture manager yet, so we have to do the lookup via the file system
|
||||
int startup_lump = fileSystem.CheckNumForName("STARTUP", ns_graphics);
|
||||
int netnotch_lump = fileSystem.CheckNumForName("NETNOTCH", ns_graphics);
|
||||
int notch_lump = fileSystem.CheckNumForName("NOTCH", ns_graphics);
|
||||
int startup_lump = fileSystem.CheckNumForName("STARTUP", FileSys::ns_graphics);
|
||||
int netnotch_lump = fileSystem.CheckNumForName("NETNOTCH", FileSys::ns_graphics);
|
||||
int notch_lump = fileSystem.CheckNumForName("NOTCH", FileSys::ns_graphics);
|
||||
|
||||
// For backwards compatibility we also need to look in the default namespace, because these were previously not handled as graphics.
|
||||
if (startup_lump == -1) startup_lump = fileSystem.CheckNumForName("STARTUP");
|
||||
|
|
|
@ -119,7 +119,7 @@ FStrifeStartScreen::FStrifeStartScreen(int max_progress)
|
|||
// Load the animated overlays.
|
||||
for (size_t i = 0; i < countof(StrifeStartupPicNames); ++i)
|
||||
{
|
||||
int lumpnum = fileSystem.CheckNumForName(StrifeStartupPicNames[i], ns_graphics);
|
||||
int lumpnum = fileSystem.CheckNumForName(StrifeStartupPicNames[i], FileSys::ns_graphics);
|
||||
if (lumpnum < 0) lumpnum = fileSystem.CheckNumForName(StrifeStartupPicNames[i]);
|
||||
|
||||
if (lumpnum >= 0)
|
||||
|
|
|
@ -103,7 +103,7 @@ FAnmTexture::FAnmTexture (int lumpnum, int w, int h)
|
|||
|
||||
void FAnmTexture::ReadFrame(uint8_t *pixels, uint8_t *palette)
|
||||
{
|
||||
FileData lump = fileSystem.ReadFile (SourceLump);
|
||||
auto lump = fileSystem.ReadFile (SourceLump);
|
||||
auto source = lump.GetBytes();
|
||||
|
||||
anim_t anim;
|
||||
|
|
|
@ -92,7 +92,7 @@ FAutomapTexture::FAutomapTexture (int lumpnum)
|
|||
PalettedPixels FAutomapTexture::CreatePalettedPixels(int conversion)
|
||||
{
|
||||
int x, y;
|
||||
FileData data = fileSystem.ReadFile (SourceLump);
|
||||
auto data = fileSystem.ReadFile (SourceLump);
|
||||
auto indata = data.GetBytes();
|
||||
|
||||
PalettedPixels Pixels(Width * Height);
|
||||
|
|
|
@ -120,7 +120,7 @@ FIMGZTexture::FIMGZTexture (int lumpnum, uint16_t w, uint16_t h, int16_t l, int1
|
|||
|
||||
PalettedPixels FIMGZTexture::CreatePalettedPixels(int conversion)
|
||||
{
|
||||
FileData lump = fileSystem.ReadFile (SourceLump);
|
||||
auto lump = fileSystem.ReadFile (SourceLump);
|
||||
auto imgz = (const ImageHeader *)lump.GetMem();
|
||||
const uint8_t *data = (const uint8_t *)&imgz[1];
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ PalettedPixels FPatchTexture::CreatePalettedPixels(int conversion)
|
|||
const column_t *maxcol;
|
||||
int x;
|
||||
|
||||
FileData lump = fileSystem.ReadFile (SourceLump);
|
||||
auto lump = fileSystem.ReadFile (SourceLump);
|
||||
const patch_t *patch = (const patch_t *)lump.GetMem();
|
||||
|
||||
maxcol = (const column_t *)((const uint8_t *)patch + fileSystem.FileLength (SourceLump) - 3);
|
||||
|
@ -284,7 +284,7 @@ void FPatchTexture::DetectBadPatches ()
|
|||
// Check if this patch is likely to be a problem.
|
||||
// It must be 256 pixels tall, and all its columns must have exactly
|
||||
// one post, where each post has a supposed length of 0.
|
||||
FileData lump = fileSystem.ReadFile (SourceLump);
|
||||
auto lump = fileSystem.ReadFile (SourceLump);
|
||||
const patch_t *realpatch = (patch_t *)lump.GetMem();
|
||||
const uint32_t *cofs = realpatch->columnofs;
|
||||
int x, x2 = LittleShort(realpatch->width);
|
||||
|
|
|
@ -172,7 +172,7 @@ FRawPageTexture::FRawPageTexture (int lumpnum)
|
|||
|
||||
PalettedPixels FRawPageTexture::CreatePalettedPixels(int conversion)
|
||||
{
|
||||
FileData lump = fileSystem.ReadFile (SourceLump);
|
||||
auto lump = fileSystem.ReadFile (SourceLump);
|
||||
auto source = lump.GetBytes();
|
||||
const uint8_t *source_p = source;
|
||||
uint8_t *dest_p;
|
||||
|
@ -204,8 +204,8 @@ int FRawPageTexture::CopyPixels(FBitmap *bmp, int conversion)
|
|||
if (mPaletteLump < 0) return FImageSource::CopyPixels(bmp, conversion);
|
||||
else
|
||||
{
|
||||
FileData lump = fileSystem.ReadFile(SourceLump);
|
||||
FileData plump = fileSystem.ReadFile(mPaletteLump);
|
||||
auto lump = fileSystem.ReadFile(SourceLump);
|
||||
auto plump = fileSystem.ReadFile(mPaletteLump);
|
||||
auto source = lump.GetBytes();
|
||||
auto psource = plump.GetBytes();
|
||||
PalEntry paldata[256];
|
||||
|
|
|
@ -164,7 +164,7 @@ FStartupTexture::FStartupTexture (int lumpnum)
|
|||
Height = 480;
|
||||
bUseGamePalette = false;
|
||||
|
||||
FileData lump = fileSystem.ReadFile (SourceLump);
|
||||
auto lump = fileSystem.ReadFile (SourceLump);
|
||||
auto source = lump.GetBytes();
|
||||
|
||||
// Initialize the bitmap palette.
|
||||
|
@ -233,7 +233,7 @@ void PlanarToChunky(T* dest, const uint8_t* src, const T* remap, int width, int
|
|||
|
||||
PalettedPixels FStartupTexture::CreatePalettedPixels(int conversion)
|
||||
{
|
||||
FileData lump = fileSystem.ReadFile (SourceLump);
|
||||
auto lump = fileSystem.ReadFile (SourceLump);
|
||||
auto source = lump.GetBytes();
|
||||
const uint8_t *remap = ImageHelpers::GetRemap(conversion == luminance);
|
||||
|
||||
|
@ -253,7 +253,7 @@ PalettedPixels FStartupTexture::CreatePalettedPixels(int conversion)
|
|||
|
||||
int FStartupTexture::CopyPixels(FBitmap *bmp, int conversion)
|
||||
{
|
||||
FileData lump = fileSystem.ReadFile (SourceLump);
|
||||
auto lump = fileSystem.ReadFile (SourceLump);
|
||||
auto source = lump.GetBytes();
|
||||
PlanarToChunky((uint32_t*)bmp->GetPixels(), source + 48, startuppalette32, Width, Height);
|
||||
return 0;
|
||||
|
@ -281,7 +281,7 @@ FNotchTexture::FNotchTexture (int lumpnum, int width, int height)
|
|||
|
||||
PalettedPixels FNotchTexture::CreatePalettedPixels(int conversion)
|
||||
{
|
||||
FileData lump = fileSystem.ReadFile (SourceLump);
|
||||
auto lump = fileSystem.ReadFile (SourceLump);
|
||||
auto source = lump.GetBytes();
|
||||
const uint8_t *remap = ImageHelpers::GetRemap(conversion == luminance);
|
||||
|
||||
|
@ -304,7 +304,7 @@ PalettedPixels FNotchTexture::CreatePalettedPixels(int conversion)
|
|||
|
||||
int FNotchTexture::CopyPixels(FBitmap *bmp, int conversion)
|
||||
{
|
||||
FileData lump = fileSystem.ReadFile (SourceLump);
|
||||
auto lump = fileSystem.ReadFile (SourceLump);
|
||||
auto source = lump.GetBytes();
|
||||
|
||||
auto Work = (uint32_t*)bmp->GetPixels();
|
||||
|
@ -338,7 +338,7 @@ FStrifeStartupTexture::FStrifeStartupTexture (int lumpnum, int w, int h)
|
|||
|
||||
PalettedPixels FStrifeStartupTexture::CreatePalettedPixels(int conversion)
|
||||
{
|
||||
FileData lump = fileSystem.ReadFile (SourceLump);
|
||||
auto lump = fileSystem.ReadFile (SourceLump);
|
||||
auto source = lump.GetBytes();
|
||||
PalettedPixels Pixels(Width*Height);
|
||||
const uint8_t *remap = ImageHelpers::GetRemap(conversion == luminance);
|
||||
|
|
|
@ -182,7 +182,7 @@ void FGameTexture::AddAutoMaterials()
|
|||
if (this->*(layer.pointer) == nullptr) // only if no explicit assignment had been done.
|
||||
{
|
||||
FStringf lookup("%s%s%s", layer.path, fullname ? "" : "auto/", searchname.GetChars());
|
||||
auto lump = fileSystem.CheckNumForFullName(lookup, false, ns_global, true);
|
||||
auto lump = fileSystem.CheckNumForFullName(lookup, false, FileSys::ns_global, true);
|
||||
if (lump != -1)
|
||||
{
|
||||
auto bmtex = TexMan.FindGameTexture(fileSystem.GetFileFullName(lump), ETextureType::Any, FTextureManager::TEXMAN_TryAny);
|
||||
|
@ -199,7 +199,7 @@ void FGameTexture::AddAutoMaterials()
|
|||
if (!this->Layers || this->Layers.get()->*(layer.pointer) == nullptr) // only if no explicit assignment had been done.
|
||||
{
|
||||
FStringf lookup("%s%s%s", layer.path, fullname ? "" : "auto/", searchname.GetChars());
|
||||
auto lump = fileSystem.CheckNumForFullName(lookup, false, ns_global, true);
|
||||
auto lump = fileSystem.CheckNumForFullName(lookup, false, FileSys::ns_global, true);
|
||||
if (lump != -1)
|
||||
{
|
||||
auto bmtex = TexMan.FindGameTexture(fileSystem.GetFileFullName(lump), ETextureType::Any, FTextureManager::TEXMAN_TryAny);
|
||||
|
|
|
@ -47,7 +47,6 @@ enum ESSType
|
|||
SS_BGRA
|
||||
};
|
||||
|
||||
class FileWriter;
|
||||
// PNG Writing --------------------------------------------------------------
|
||||
|
||||
// Start writing an 8-bit palettized PNG file.
|
||||
|
@ -82,13 +81,13 @@ struct PNGHandle
|
|||
uint32_t Size;
|
||||
};
|
||||
|
||||
FileReader File;
|
||||
FileSys::FileReader File;
|
||||
bool bDeleteFilePtr;
|
||||
TArray<Chunk> Chunks;
|
||||
TArray<char *> TextChunks;
|
||||
unsigned int ChunkPt;
|
||||
|
||||
PNGHandle(FileReader &file);
|
||||
PNGHandle(FileSys::FileReader &file);
|
||||
~PNGHandle();
|
||||
};
|
||||
|
||||
|
@ -96,7 +95,7 @@ struct PNGHandle
|
|||
// the signature, but also checking for the IEND chunk. CRC checking of
|
||||
// each chunk is not done. If it is valid, you get a PNGHandle to pass to
|
||||
// the following functions.
|
||||
PNGHandle *M_VerifyPNG (FileReader &file);
|
||||
PNGHandle *M_VerifyPNG (FileSys::FileReader &file);
|
||||
|
||||
// Finds a chunk in a PNG file. The file pointer will be positioned at the
|
||||
// beginning of the chunk data, and its length will be returned. A return
|
||||
|
@ -115,7 +114,7 @@ bool M_GetPNGText (PNGHandle *png, const char *keyword, char *buffer, size_t buf
|
|||
|
||||
// The file must be positioned at the start of the first IDAT. It reads
|
||||
// image data into the provided buffer. Returns true on success.
|
||||
bool M_ReadIDAT (FileReader &file, uint8_t *buffer, int width, int height, int pitch,
|
||||
bool M_ReadIDAT (FileSys::FileReader &file, uint8_t *buffer, int width, int height, int pitch,
|
||||
uint8_t bitdepth, uint8_t colortype, uint8_t interlace, unsigned int idatlen);
|
||||
|
||||
|
||||
|
|
|
@ -397,12 +397,12 @@ void FMultipatchTextureBuilder::AddTexturesLumps(int lump1, int lump2, int patch
|
|||
|
||||
if (lump1 >= 0)
|
||||
{
|
||||
FileData texdir = fileSystem.ReadFile(lump1);
|
||||
auto texdir = fileSystem.ReadFile(lump1);
|
||||
AddTexturesLump(texdir.GetMem(), fileSystem.FileLength(lump1), lump1, patcheslump, firstdup, true);
|
||||
}
|
||||
if (lump2 >= 0)
|
||||
{
|
||||
FileData texdir = fileSystem.ReadFile(lump2);
|
||||
auto texdir = fileSystem.ReadFile(lump2);
|
||||
AddTexturesLump(texdir.GetMem(), fileSystem.FileLength(lump2), lump2, patcheslump, firstdup, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "basics.h"
|
||||
#include "cmdlib.h"
|
||||
|
||||
using namespace FileSys;
|
||||
FTextureManager TexMan;
|
||||
|
||||
|
||||
|
|
|
@ -1018,7 +1018,7 @@ void uppercopy(char* to, const char* from)
|
|||
|
||||
FString GetStringFromLump(int lump)
|
||||
{
|
||||
FileData fd = fileSystem.ReadFile(lump);
|
||||
auto fd = fileSystem.ReadFile(lump);
|
||||
FString ScriptBuffer(fd.GetString(), fd.GetSize());
|
||||
ScriptBuffer.Truncate(strlen(ScriptBuffer.GetChars())); // this is necessary to properly truncate the generated string to not contain 0 bytes.
|
||||
return ScriptBuffer;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include "zstring.h"
|
||||
#include "files.h"
|
||||
|
||||
#if !defined(GUID_DEFINED)
|
||||
#define GUID_DEFINED
|
||||
|
@ -82,7 +83,6 @@ inline constexpr double Scale(double a, double b, double c)
|
|||
return (a * b) / c;
|
||||
}
|
||||
|
||||
class FileReader;
|
||||
struct MD5Context;
|
||||
|
||||
void md5Update(FileReader& file, MD5Context& md5, unsigned len);
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
inline ZMusicCustomReader *GetMusicReader(FileReader& fr)
|
||||
{
|
||||
using FileSys::FileReaderInterface;
|
||||
auto zcr = new ZMusicCustomReader;
|
||||
|
||||
zcr->handle = fr.GetInterface();
|
||||
|
|
|
@ -139,11 +139,11 @@ void D_AddWildFile(std::vector<std::string>& wadfiles, const char* value, const
|
|||
else
|
||||
{
|
||||
// Try pattern matching
|
||||
FileList list;
|
||||
FileSys::FileList list;
|
||||
auto path = ExtractFilePath(value);
|
||||
auto name = ExtractFileBase(value, true);
|
||||
if (path.IsEmpty()) path = ".";
|
||||
if (ScanDirectory(list, path, name, true))
|
||||
if (FileSys::ScanDirectory(list, path, name, true))
|
||||
{
|
||||
for(auto& entry : list)
|
||||
{
|
||||
|
@ -193,8 +193,8 @@ void D_AddConfigFiles(std::vector<std::string>& wadfiles, const char* section, c
|
|||
|
||||
void D_AddDirectory(std::vector<std::string>& wadfiles, const char* dir, const char *filespec, FConfigFile* config)
|
||||
{
|
||||
FileList list;
|
||||
if (ScanDirectory(list, dir, "*.wad", true))
|
||||
FileSys::FileList list;
|
||||
if (FileSys::ScanDirectory(list, dir, "*.wad", true))
|
||||
{
|
||||
for (auto& entry : list)
|
||||
{
|
||||
|
|
|
@ -929,7 +929,7 @@ int ReadPalette(int lumpnum, uint8_t* buffer)
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
FileData lump = fileSystem.ReadFile(lumpnum);
|
||||
auto lump = fileSystem.ReadFile(lumpnum);
|
||||
auto lumpmem = lump.GetBytes();
|
||||
memset(buffer, 0, 768);
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#ifndef __S_PLAYLIST_H__
|
||||
#define __S_PLAYLIST_H__
|
||||
|
||||
class FileReader;
|
||||
#include "files.h"
|
||||
|
||||
class FPlayList
|
||||
{
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include <string>
|
||||
#include "tarray.h"
|
||||
#include "utf8.h"
|
||||
#include "filesystem.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define PRINTFISH(x) __attribute__((format(printf, 2, x)))
|
||||
|
@ -117,8 +118,6 @@ enum ELumpNum
|
|||
{
|
||||
};
|
||||
|
||||
class FileSystem;
|
||||
|
||||
class FString
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -300,7 +300,7 @@ void FIWadManager::ParseIWadInfo(const char *fn, const char *data, int datasize,
|
|||
// Look for IWAD definition lump
|
||||
//
|
||||
//==========================================================================
|
||||
void GetReserved(LumpFilterInfo& lfi);
|
||||
void GetReserved(FileSys::LumpFilterInfo& lfi);
|
||||
|
||||
FIWadManager::FIWadManager(const char *firstfn, const char *optfn)
|
||||
{
|
||||
|
@ -385,7 +385,7 @@ int FIWadManager::CheckIWADInfo(const char* fn)
|
|||
{
|
||||
FileSystem check;
|
||||
|
||||
LumpFilterInfo lfi;
|
||||
FileSys::LumpFilterInfo lfi;
|
||||
GetReserved(lfi);
|
||||
|
||||
std::vector<std::string> filenames = { fn };
|
||||
|
@ -471,9 +471,9 @@ void FIWadManager::CollectSearchPaths()
|
|||
|
||||
void FIWadManager::AddIWADCandidates(const char *dir)
|
||||
{
|
||||
FileList list;
|
||||
FileSys::FileList list;
|
||||
|
||||
if (ScanDirectory(list, dir, "*", true))
|
||||
if (FileSys::ScanDirectory(list, dir, "*", true))
|
||||
{
|
||||
for(auto& entry : list)
|
||||
{
|
||||
|
|
|
@ -122,6 +122,8 @@
|
|||
#include "i_system.h" // for SHARE_DIR
|
||||
#endif // __unix__
|
||||
|
||||
using namespace FileSys;
|
||||
|
||||
EXTERN_CVAR(Bool, hud_althud)
|
||||
EXTERN_CVAR(Int, vr_mode)
|
||||
EXTERN_CVAR(Bool, cl_customizeinvulmap)
|
||||
|
|
|
@ -1981,7 +1981,7 @@ void G_DoLoadGame ()
|
|||
LoadGameError("TXT_COULDNOTREAD");
|
||||
return;
|
||||
}
|
||||
FResourceLump *info = resfile->FindLump("info.json");
|
||||
auto info = resfile->FindLump("info.json");
|
||||
if (info == nullptr)
|
||||
{
|
||||
LoadGameError("TXT_NOINFOJSON");
|
||||
|
@ -2408,7 +2408,7 @@ void G_DoSaveGame (bool okForQuicksave, bool forceQuicksave, FString filename, c
|
|||
}
|
||||
|
||||
auto picdata = savepic.GetBuffer();
|
||||
FCompressedBuffer bufpng = { picdata->Size(), picdata->Size(), METHOD_STORED, 0, static_cast<unsigned int>(crc32(0, &(*picdata)[0], picdata->Size())), (char*)&(*picdata)[0] };
|
||||
FCompressedBuffer bufpng = { picdata->Size(), picdata->Size(), FileSys::METHOD_STORED, 0, static_cast<unsigned int>(crc32(0, &(*picdata)[0], picdata->Size())), (char*)&(*picdata)[0] };
|
||||
|
||||
savegame_content.Push(bufpng);
|
||||
savegame_filenames.Push("savepic.png");
|
||||
|
|
|
@ -2004,7 +2004,7 @@ void G_ReadSnapshots(FResourceFile *resf)
|
|||
|
||||
for (unsigned j = 0; j < resf->LumpCount(); j++)
|
||||
{
|
||||
FResourceLump * resl = resf->GetLump(j);
|
||||
auto resl = resf->GetLump(j);
|
||||
if (resl != nullptr)
|
||||
{
|
||||
auto name = resl->getName();
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
#include "doomtype.h"
|
||||
#include "vectors.h"
|
||||
#include "sc_man.h"
|
||||
#include "file_zip.h"
|
||||
#include "g_mapinfo.h"
|
||||
|
||||
|
||||
using FileSys::FCompressedBuffer;
|
||||
extern bool savegamerestore;
|
||||
|
||||
void G_InitNew (const char *mapname, bool bTitleLevel);
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
#include "doomtype.h"
|
||||
#include "configfile.h"
|
||||
#include "files.h"
|
||||
|
||||
class FArgs;
|
||||
class FIWadManager;
|
||||
|
|
|
@ -392,7 +392,7 @@ void FDecalLib::ParseDecal (FScanner &sc)
|
|||
case DECAL_PIC:
|
||||
sc.MustGetString ();
|
||||
picnum = TexMan.CheckForTexture (sc.String, ETextureType::Any);
|
||||
if (!picnum.Exists() && (lumpnum = fileSystem.CheckNumForName (sc.String, ns_graphics)) >= 0)
|
||||
if (!picnum.Exists() && (lumpnum = fileSystem.CheckNumForName (sc.String, FileSys::ns_graphics)) >= 0)
|
||||
{
|
||||
picnum = TexMan.CreateTexture (lumpnum, ETextureType::Decal);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ void InitDoomFonts()
|
|||
if (fileSystem.CheckNumForName("FONTA_S") >= 0)
|
||||
{
|
||||
int wadfile = -1;
|
||||
auto a = fileSystem.CheckNumForName("FONTA33", ns_graphics);
|
||||
auto a = fileSystem.CheckNumForName("FONTA33", FileSys::ns_graphics);
|
||||
if (a != -1) wadfile = fileSystem.GetFileContainer(a);
|
||||
if (wadfile > fileSystem.GetIwadNum())
|
||||
{
|
||||
|
@ -32,10 +32,10 @@ void InitDoomFonts()
|
|||
SmallFont->SetCursor('[');
|
||||
}
|
||||
}
|
||||
else if (fileSystem.CheckNumForName("STCFN033", ns_graphics) >= 0)
|
||||
else if (fileSystem.CheckNumForName("STCFN033", FileSys::ns_graphics) >= 0)
|
||||
{
|
||||
int wadfile = -1;
|
||||
auto a = fileSystem.CheckNumForName("STCFN065", ns_graphics);
|
||||
auto a = fileSystem.CheckNumForName("STCFN065", FileSys::ns_graphics);
|
||||
if (a != -1) wadfile = fileSystem.GetFileContainer(a);
|
||||
if (wadfile > fileSystem.GetIwadNum())
|
||||
{
|
||||
|
@ -55,7 +55,7 @@ void InitDoomFonts()
|
|||
OriginalSmallFont = new FFont("OriginalSmallFont", "FONTA%02u", "defsmallfont", HU_FONTSTART, HU_FONTSIZE, 1, -1, -1, false, true);
|
||||
OriginalSmallFont->SetCursor('[');
|
||||
}
|
||||
else if (fileSystem.CheckNumForName("STCFN033", ns_graphics) >= 0)
|
||||
else if (fileSystem.CheckNumForName("STCFN033", FileSys::ns_graphics) >= 0)
|
||||
{
|
||||
OriginalSmallFont = new FFont("OriginalSmallFont", "STCFN%.3d", "defsmallfont", HU_FONTSTART, HU_FONTSIZE, HU_FONTSTART, -1, -1, false, true, true);
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ void InitDoomFonts()
|
|||
|
||||
if (!(SmallFont2 = V_GetFont("SmallFont2"))) // Only used by Strife
|
||||
{
|
||||
if (fileSystem.CheckNumForName("STBFN033", ns_graphics) >= 0)
|
||||
if (fileSystem.CheckNumForName("STBFN033", FileSys::ns_graphics) >= 0)
|
||||
{
|
||||
SmallFont2 = new FFont("SmallFont2", "STBFN%.3d", "defsmallfont2", HU_FONTSTART, HU_FONTSIZE, HU_FONTSTART, -1);
|
||||
}
|
||||
|
|
|
@ -2596,7 +2596,7 @@ void G_ParseMapInfo (FString basemapinfo)
|
|||
// If that exists we need to skip this one.
|
||||
|
||||
int wad = fileSystem.GetFileContainer(lump);
|
||||
int altlump = fileSystem.CheckNumForName("ZMAPINFO", ns_global, wad, true);
|
||||
int altlump = fileSystem.CheckNumForName("ZMAPINFO", FileSys::ns_global, wad, true);
|
||||
|
||||
if (altlump >= 0) continue;
|
||||
}
|
||||
|
@ -2604,9 +2604,9 @@ void G_ParseMapInfo (FString basemapinfo)
|
|||
{
|
||||
// MAPINFO and ZMAPINFO will override UMAPINFO if in the same WAD.
|
||||
int wad = fileSystem.GetFileContainer(lump);
|
||||
int altlump = fileSystem.CheckNumForName("ZMAPINFO", ns_global, wad, true);
|
||||
int altlump = fileSystem.CheckNumForName("ZMAPINFO", FileSys::ns_global, wad, true);
|
||||
if (altlump >= 0) continue;
|
||||
altlump = fileSystem.CheckNumForName("MAPINFO", ns_global, wad, true);
|
||||
altlump = fileSystem.CheckNumForName("MAPINFO", FileSys::ns_global, wad, true);
|
||||
if (altlump >= 0) continue;
|
||||
}
|
||||
if (nindex != 2)
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include "doomtype.h"
|
||||
#include "vectors.h"
|
||||
#include "sc_man.h"
|
||||
#include "file_zip.h"
|
||||
#include "screenjob.h"
|
||||
#include "hwrenderer/postprocessing/hw_postprocess.h"
|
||||
#include "hw_viewpointuniforms.h"
|
||||
|
@ -349,7 +348,7 @@ struct level_info_t
|
|||
FString AuthorName;
|
||||
int8_t WallVertLight, WallHorizLight;
|
||||
int musicorder;
|
||||
FCompressedBuffer Snapshot;
|
||||
FileSys::FCompressedBuffer Snapshot;
|
||||
TArray<acsdefered_t> deferred;
|
||||
float skyspeed1;
|
||||
float skyspeed2;
|
||||
|
|
|
@ -165,7 +165,7 @@ void D_LoadWadSettings ()
|
|||
|
||||
while ((lump = fileSystem.FindLump ("KEYCONF", &lastlump)) != -1)
|
||||
{
|
||||
FileData data = fileSystem.ReadFile (lump);
|
||||
auto data = fileSystem.ReadFile (lump);
|
||||
const char* conf = data.GetString();
|
||||
const char *eof = conf + data.GetSize();
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ void FTextureAnimator::InitSwitchList ()
|
|||
|
||||
if (lump != -1)
|
||||
{
|
||||
FileData lumpdata = fileSystem.ReadFile (lump);
|
||||
auto lumpdata = fileSystem.ReadFile (lump);
|
||||
auto alphSwitchList = lumpdata.GetString();
|
||||
const char *list_p;
|
||||
FSwitchDef *def1, *def2;
|
||||
|
|
|
@ -203,7 +203,7 @@ void FTextureAnimator::InitAnimated (void)
|
|||
int lumpnum = fileSystem.CheckNumForName ("ANIMATED");
|
||||
if (lumpnum != -1)
|
||||
{
|
||||
FileData animatedlump = fileSystem.ReadFile (lumpnum);
|
||||
auto animatedlump = fileSystem.ReadFile (lumpnum);
|
||||
int animatedlen = fileSystem.FileLength(lumpnum);
|
||||
auto animdefs = animatedlump.GetBytes();
|
||||
const uint8_t *anim_p;
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "colormatcher.h"
|
||||
#include "bitmap.h"
|
||||
#include "textures.h"
|
||||
#include "resourcefile.h"
|
||||
#include "fs_filesystem.h"
|
||||
#include "image.h"
|
||||
#include "animations.h"
|
||||
#include "texturemanager.h"
|
||||
|
@ -84,7 +84,7 @@ static int BuildPaletteTranslation(int lump)
|
|||
return false;
|
||||
}
|
||||
|
||||
FileData data = fileSystem.ReadFile(lump);
|
||||
auto data = fileSystem.ReadFile(lump);
|
||||
auto ipal = data.GetBytes();
|
||||
FRemapTable opal;
|
||||
|
||||
|
|
|
@ -520,7 +520,7 @@ void MapLoader::InitED()
|
|||
FScanner sc;
|
||||
|
||||
if (filename.IsEmpty()) return;
|
||||
int lump = fileSystem.CheckNumForFullName(filename, true, ns_global);
|
||||
int lump = fileSystem.CheckNumForFullName(filename, true, FileSys::ns_global);
|
||||
if (lump == -1) return;
|
||||
sc.OpenLumpNum(lump);
|
||||
|
||||
|
|
|
@ -736,14 +736,14 @@ static int FindGLNodesInWAD(int labellump)
|
|||
glheader.Format("GL_%s", fileSystem.GetFileFullName(labellump));
|
||||
if (glheader.Len()<=8)
|
||||
{
|
||||
int gllabel = fileSystem.CheckNumForName(glheader, ns_global, wadfile);
|
||||
int gllabel = fileSystem.CheckNumForName(glheader, FileSys::ns_global, wadfile);
|
||||
if (gllabel >= 0) return gllabel;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Before scanning the entire WAD directory let's check first whether
|
||||
// it is necessary.
|
||||
int gllabel = fileSystem.CheckNumForName("GL_LEVEL", ns_global, wadfile);
|
||||
int gllabel = fileSystem.CheckNumForName("GL_LEVEL", FileSys::ns_global, wadfile);
|
||||
|
||||
if (gllabel >= 0)
|
||||
{
|
||||
|
@ -753,7 +753,7 @@ static int FindGLNodesInWAD(int labellump)
|
|||
{
|
||||
if (fileSystem.GetFileContainer(lump)==wadfile)
|
||||
{
|
||||
FileData mem = fileSystem.ReadFile(lump);
|
||||
auto mem = fileSystem.ReadFile(lump);
|
||||
if (MatchHeader(fileSystem.GetFileFullName(labellump), GetStringFromLump(lump))) return lump;
|
||||
}
|
||||
}
|
||||
|
@ -1199,11 +1199,11 @@ bool MapLoader::CheckCachedNodes(MapData *map)
|
|||
|
||||
UNSAFE_CCMD(clearnodecache)
|
||||
{
|
||||
FileList list;
|
||||
FileSys::FileList list;
|
||||
FString path = M_GetCachePath(false);
|
||||
path += "/";
|
||||
|
||||
if (!ScanDirectory(list, path, "*", false))
|
||||
if (!FileSys::ScanDirectory(list, path, "*", false))
|
||||
{
|
||||
Printf("Unable to scan node cache directory %s\n", path.GetChars());
|
||||
return;
|
||||
|
|
|
@ -733,7 +733,7 @@ bool MapLoader::LoadExtendedNodes (FileReader &dalump, uint32_t id)
|
|||
if (compressed)
|
||||
{
|
||||
FileReader zip;
|
||||
if (zip.OpenDecompressor(dalump, -1, METHOD_ZLIB, false, true))
|
||||
if (zip.OpenDecompressor(dalump, -1, FileSys::METHOD_ZLIB, false, true))
|
||||
{
|
||||
LoadZNodes(zip, type);
|
||||
return true;
|
||||
|
@ -753,7 +753,7 @@ bool MapLoader::LoadExtendedNodes (FileReader &dalump, uint32_t id)
|
|||
{
|
||||
Printf("Error loading nodes: %s\n", error.GetMessage());
|
||||
}
|
||||
catch (FileSystemException& error)
|
||||
catch (FileSys::FileSystemException& error)
|
||||
{
|
||||
Printf("Error loading nodes: %s\n", error.what());
|
||||
}
|
||||
|
@ -1157,7 +1157,7 @@ void MapLoader::LoadSectors (MapData *map, FMissingTextureTracker &missingtex)
|
|||
template<class nodetype, class subsectortype>
|
||||
bool MapLoader::LoadNodes (MapData * map)
|
||||
{
|
||||
FileData data;
|
||||
FileSys::FileData data;
|
||||
int j;
|
||||
int k;
|
||||
nodetype *mn;
|
||||
|
@ -3338,7 +3338,7 @@ void MapLoader::LoadLightmap(MapData *map)
|
|||
return;
|
||||
|
||||
FileReader fr;
|
||||
if (!fr.OpenDecompressor(map->Reader(ML_LIGHTMAP), -1, METHOD_ZLIB, false, false))
|
||||
if (!fr.OpenDecompressor(map->Reader(ML_LIGHTMAP), -1, FileSys::METHOD_ZLIB, false, false))
|
||||
return;
|
||||
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
#include "nodebuild.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "files.h"
|
||||
|
||||
class FileReader;
|
||||
struct FStrifeDialogueNode;
|
||||
struct FStrifeDialogueReply;
|
||||
struct Response;
|
||||
|
|
|
@ -66,8 +66,8 @@ void FSavegameManager::ReadSaveStrings()
|
|||
|
||||
LastSaved = LastAccessed = -1;
|
||||
quickSaveSlot = nullptr;
|
||||
FileList list;
|
||||
if (ScanDirectory(list, G_GetSavegamesFolder().GetChars(), "*." SAVEGAME_EXT, true))
|
||||
FileSys::FileList list;
|
||||
if (FileSys::ScanDirectory(list, G_GetSavegamesFolder().GetChars(), "*." SAVEGAME_EXT, true))
|
||||
{
|
||||
for (auto& entry : list)
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ void FSavegameManager::ReadSaveStrings()
|
|||
{
|
||||
bool oldVer = false;
|
||||
bool missing = false;
|
||||
FResourceLump *info = savegame->FindLump("info.json");
|
||||
auto info = savegame->FindLump("info.json");
|
||||
if (info == nullptr)
|
||||
{
|
||||
// savegame info not found. This is not a savegame so leave it alone.
|
||||
|
|
|
@ -72,7 +72,5 @@ void P_ResumeConversation ();
|
|||
|
||||
void P_ConversationCommand (int netcode, int player, uint8_t **stream);
|
||||
|
||||
class FileReader;
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#ifndef __P_SETUP__
|
||||
#define __P_SETUP__
|
||||
|
||||
#include "resourcefile.h"
|
||||
#include "fs_filesystem.h"
|
||||
#include "doomdata.h"
|
||||
#include "r_defs.h"
|
||||
#include "nodebuild.h"
|
||||
|
|
|
@ -54,6 +54,8 @@
|
|||
#include "s_music.h"
|
||||
#include "texturemanager.h"
|
||||
|
||||
using namespace FileSys;
|
||||
|
||||
static FRandom pr_script("FScript");
|
||||
|
||||
// functions. FParser::SF_ means Script Function not, well.. heh, me
|
||||
|
|
|
@ -1930,7 +1930,7 @@ void FBehaviorContainer::LoadDefaultModules ()
|
|||
FScanner sc(lump);
|
||||
while (sc.GetString())
|
||||
{
|
||||
int acslump = fileSystem.CheckNumForName (sc.String, ns_acslibrary);
|
||||
int acslump = fileSystem.CheckNumForName (sc.String, FileSys::ns_acslibrary);
|
||||
if (acslump >= 0)
|
||||
{
|
||||
LoadModule (acslump);
|
||||
|
@ -2567,7 +2567,7 @@ bool FBehavior::Init(FLevelLocals *Level, int lumpnum, FileReader * fr, int len,
|
|||
if (parse[i])
|
||||
{
|
||||
FBehavior *module = NULL;
|
||||
int lump = fileSystem.CheckNumForName (&parse[i], ns_acslibrary);
|
||||
int lump = fileSystem.CheckNumForName (&parse[i], FileSys::ns_acslibrary);
|
||||
if (lump < 0)
|
||||
{
|
||||
Printf (TEXTCOLOR_RED "Could not find ACS library %s.\n", &parse[i]);
|
||||
|
|
|
@ -38,12 +38,12 @@
|
|||
#include "doomtype.h"
|
||||
#include "dthinker.h"
|
||||
#include "engineerrors.h"
|
||||
#include "files.h"
|
||||
|
||||
#define LOCAL_SIZE 20
|
||||
#define NUM_MAPVARS 128
|
||||
|
||||
class FFont;
|
||||
class FileReader;
|
||||
struct line_t;
|
||||
class FSerializer;
|
||||
|
||||
|
|
|
@ -828,16 +828,16 @@ static int SetupCrouchSprite(AActor *self, int crouchsprite)
|
|||
FString normspritename = sprites[self->SpawnState->sprite].name;
|
||||
FString crouchspritename = sprites[crouchsprite].name;
|
||||
|
||||
int spritenorm = fileSystem.CheckNumForName(normspritename + "A1", ns_sprites);
|
||||
int spritenorm = fileSystem.CheckNumForName(normspritename + "A1", FileSys::ns_sprites);
|
||||
if (spritenorm == -1)
|
||||
{
|
||||
spritenorm = fileSystem.CheckNumForName(normspritename + "A0", ns_sprites);
|
||||
spritenorm = fileSystem.CheckNumForName(normspritename + "A0", FileSys::ns_sprites);
|
||||
}
|
||||
|
||||
int spritecrouch = fileSystem.CheckNumForName(crouchspritename + "A1", ns_sprites);
|
||||
int spritecrouch = fileSystem.CheckNumForName(crouchspritename + "A1", FileSys::ns_sprites);
|
||||
if (spritecrouch == -1)
|
||||
{
|
||||
spritecrouch = fileSystem.CheckNumForName(crouchspritename + "A0", ns_sprites);
|
||||
spritecrouch = fileSystem.CheckNumForName(crouchspritename + "A0", FileSys::ns_sprites);
|
||||
}
|
||||
|
||||
if (spritenorm == -1 || spritecrouch == -1)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue