mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-22 20:11:14 +00:00
- cleanup.
This commit is contained in:
parent
eccbafc1bc
commit
c5b5b2b873
4 changed files with 9 additions and 29 deletions
|
@ -197,7 +197,7 @@ bool FWadFile::Open(LumpFilterInfo*, FileSystemMessageFunc Printf)
|
||||||
for(uint32_t i = 0; i < NumLumps; i++)
|
for(uint32_t i = 0; i < NumLumps; i++)
|
||||||
{
|
{
|
||||||
char n[9];
|
char n[9];
|
||||||
uppercopy(n, fileinfo[i].Name);
|
for(int j = 0; j < 8; j++) n[j] = toupper(fileinfo[i].Name[j]);
|
||||||
n[8] = 0;
|
n[8] = 0;
|
||||||
// This needs to be done differently. We cannot simply assume that all lumps where the first character's high bit is set are compressed without verification.
|
// This needs to be done differently. We cannot simply assume that all lumps where the first character's high bit is set are compressed without verification.
|
||||||
// This requires explicit toggling for precisely the files that need it.
|
// This requires explicit toggling for precisely the files that need it.
|
||||||
|
|
|
@ -43,9 +43,12 @@
|
||||||
#include "m_argv.h"
|
#include "m_argv.h"
|
||||||
#include "cmdlib.h"
|
#include "cmdlib.h"
|
||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
|
|
||||||
#include "m_crc32.h"
|
#include "m_crc32.h"
|
||||||
#include "printf.h"
|
|
||||||
|
#if __has_include("md5.h")
|
||||||
#include "md5.h"
|
#include "md5.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -352,7 +355,7 @@ void FileSystem::AddFile (const char *filename, FileReader *filer, LumpFilterInf
|
||||||
|
|
||||||
if (resfile != NULL)
|
if (resfile != NULL)
|
||||||
{
|
{
|
||||||
if (!batchrun && Printf)
|
if (Printf)
|
||||||
Printf(FSMessageLevel::Message, "adding %s, %d lumps\n", filename, resfile->LumpCount());
|
Printf(FSMessageLevel::Message, "adding %s, %d lumps\n", filename, resfile->LumpCount());
|
||||||
|
|
||||||
uint32_t lumpstart = FileInfo.Size();
|
uint32_t lumpstart = FileInfo.Size();
|
||||||
|
@ -379,6 +382,7 @@ void FileSystem::AddFile (const char *filename, FileReader *filer, LumpFilterInf
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if __has_include("md5.h")
|
||||||
if (hashfile)
|
if (hashfile)
|
||||||
{
|
{
|
||||||
uint8_t cksum[16];
|
uint8_t cksum[16];
|
||||||
|
@ -423,6 +427,7 @@ void FileSystem::AddFile (const char *filename, FileReader *filer, LumpFilterInf
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -895,12 +900,6 @@ LumpShortName& FileSystem::GetShortName(int i)
|
||||||
return FileInfo[i].shortName;
|
return FileInfo[i].shortName;
|
||||||
}
|
}
|
||||||
|
|
||||||
FString& FileSystem::GetLongName(int i)
|
|
||||||
{
|
|
||||||
if ((unsigned)i >= NumEntries) throw FileSystemException("GetLongName: Invalid index");
|
|
||||||
return FileInfo[i].longName;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FileSystem::RenameFile(int num, const char* newfn)
|
void FileSystem::RenameFile(int num, const char* newfn)
|
||||||
{
|
{
|
||||||
if ((unsigned)num >= NumEntries) throw FileSystemException("RenameFile: Invalid index");
|
if ((unsigned)num >= NumEntries) throw FileSystemException("RenameFile: Invalid index");
|
||||||
|
@ -1311,7 +1310,7 @@ void FileSystem::ReadFile (int lump, void *dest)
|
||||||
if (numread != size)
|
if (numread != size)
|
||||||
{
|
{
|
||||||
throw FileSystemException("W_ReadFile: only read %ld of %ld on '%s'\n",
|
throw FileSystemException("W_ReadFile: only read %ld of %ld on '%s'\n",
|
||||||
numread, size, GetLongName(lump).GetChars());
|
numread, size, FileInfo[lump].longName.GetChars());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
#include "files.h"
|
#include "files.h"
|
||||||
#include "tarray.h"
|
#include "tarray.h"
|
||||||
#include "cmdlib.h"
|
#include "cmdlib.h"
|
||||||
#include "zstring.h"
|
|
||||||
#include "resourcefile.h"
|
#include "resourcefile.h"
|
||||||
|
|
||||||
class FResourceFile;
|
class FResourceFile;
|
||||||
|
@ -85,10 +84,8 @@ public:
|
||||||
|
|
||||||
inline int CheckNumForName (const uint8_t *name) { return CheckNumForName ((const char *)name, ns_global); }
|
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 char *name) { return CheckNumForName (name, ns_global); }
|
||||||
inline int CheckNumForName (const FString &name) { return CheckNumForName (name.GetChars()); }
|
|
||||||
inline int CheckNumForName (const uint8_t *name, int ns) { return CheckNumForName ((const char *)name, ns); }
|
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 char *name) { return GetNumForName (name, ns_global); }
|
||||||
inline int GetNumForName (const FString &name) { return GetNumForName (name.GetChars(), ns_global); }
|
|
||||||
inline int GetNumForName (const uint8_t *name) { return GetNumForName ((const char *)name); }
|
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 GetNumForName (const uint8_t *name, int ns) { return GetNumForName ((const char *)name, ns); }
|
||||||
|
|
||||||
|
@ -105,25 +102,15 @@ public:
|
||||||
return FindFile(name) >= 0;
|
return FindFile(name) >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileExists(const FString& name)
|
|
||||||
{
|
|
||||||
return FindFile(name) >= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FileExists(const std::string& name)
|
bool FileExists(const std::string& name)
|
||||||
{
|
{
|
||||||
return FindFile(name.c_str()) >= 0;
|
return FindFile(name.c_str()) >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LumpShortName& GetShortName(int i); // may only be called before the hash chains are set up.
|
LumpShortName& GetShortName(int i); // may only be called before the hash chains are set up.
|
||||||
FString& GetLongName(int i); // may only be called before the hash chains are set up.
|
|
||||||
void RenameFile(int num, const char* fn);
|
void RenameFile(int num, const char* fn);
|
||||||
bool CreatePathlessCopy(const char* name, int id, int flags);
|
bool CreatePathlessCopy(const char* name, int id, int flags);
|
||||||
|
|
||||||
inline int CheckNumForFullName(const FString &name, bool trynormal = false, int namespc = ns_global) { return CheckNumForFullName(name.GetChars(), trynormal, namespc); }
|
|
||||||
inline int CheckNumForFullName (const FString &name, int wadfile) { return CheckNumForFullName(name.GetChars(), wadfile); }
|
|
||||||
inline int GetNumForFullName (const FString &name) { return GetNumForFullName(name.GetChars()); }
|
|
||||||
|
|
||||||
void ReadFile (int lump, void *dest);
|
void ReadFile (int lump, void *dest);
|
||||||
// These should only be used if the file data really needs padding.
|
// These should only be used if the file data really needs padding.
|
||||||
FileData ReadFile (int lump);
|
FileData ReadFile (int lump);
|
||||||
|
|
|
@ -63,12 +63,6 @@ bool IQMModel::Load(const char* path, int lumpnum, const char* buffer, int lengt
|
||||||
uint32_t num_extensions = reader.ReadUInt32();
|
uint32_t num_extensions = reader.ReadUInt32();
|
||||||
uint32_t ofs_extensions = reader.ReadUInt32();
|
uint32_t ofs_extensions = reader.ReadUInt32();
|
||||||
|
|
||||||
/*if (num_joints <= 0)
|
|
||||||
{
|
|
||||||
Printf("Invalid model: \"%s%s\", no joint data is present\n", path, fileSystem.GetLongName(mLumpNum).GetChars());
|
|
||||||
return false;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if (num_text == 0)
|
if (num_text == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue