- renamed FileRdr back to FileReader.

This commit is contained in:
Christoph Oelckers 2018-03-11 18:32:00 +01:00
parent 0be1ed252b
commit b939836846
91 changed files with 479 additions and 477 deletions

View file

@ -660,8 +660,6 @@ file( GLOB HEADER_FILES
g_inventory/*.h
intermission/*.h
menu/*.h
sound/oplsynth/*.h
sound/oplsynth/dosbox/*.h
posix/*.h
posix/cocoa/*.h
posix/sdl/*.h
@ -677,6 +675,9 @@ file( GLOB HEADER_FILES
scripting/decorate/*.h
scripting/zscript/*.h
scripting/vm/*.h
sound/midisources/*.h
sound/oplsynth/*.h
sound/oplsynth/dosbox/*.h
sound/timidity/*.h
sound/timiditypp/*.h
sound/wildmidi/*.h

View file

@ -2492,7 +2492,7 @@ bool D_LoadDehLump(int lumpnum)
bool D_LoadDehFile(const char *patchfile)
{
FileRdr fr;
FileReader fr;
if (fr.OpenFile(patchfile))
{

View file

@ -1959,7 +1959,7 @@ static FString CheckGameInfo(TArray<FString> & pwads)
if (!isdir)
{
FileRdr fr;
FileReader fr;
if (!fr.OpenFile(filename))
{
// Didn't find file

View file

@ -159,12 +159,12 @@ private:
class FileReaderRedirect : public FileReaderInterface
{
FileRdr *mReader = nullptr;
FileReader *mReader = nullptr;
long StartPos = 0;
long FilePos = 0;
public:
FileReaderRedirect(FileRdr &parent, long start, long length)
FileReaderRedirect(FileReader &parent, long start, long length)
{
mReader = &parent;
FilePos = start;
@ -195,7 +195,7 @@ public:
break;
}
if (offset < StartPos || offset > StartPos + Length) return -1; // out of scope
if (mReader->Seek(offset, FileRdr::SeekSet) == 0)
if (mReader->Seek(offset, FileReader::SeekSet) == 0)
{
FilePos = offset;
return 0;
@ -347,7 +347,7 @@ public:
//
//==========================================================================
bool FileRdr::OpenFile(const char *filename, FileRdr::Size start, FileRdr::Size length)
bool FileReader::OpenFile(const char *filename, FileReader::Size start, FileReader::Size length)
{
auto reader = new StdFileReader;
if (!reader->Open(filename, (long)start, (long)length)) return false;
@ -356,7 +356,7 @@ bool FileRdr::OpenFile(const char *filename, FileRdr::Size start, FileRdr::Size
return true;
}
bool FileRdr::OpenFilePart(FileRdr &parent, FileRdr::Size start, FileRdr::Size length)
bool FileReader::OpenFilePart(FileReader &parent, FileReader::Size start, FileReader::Size length)
{
auto reader = new FileReaderRedirect(parent, (long)start, (long)length);
Close();
@ -364,21 +364,21 @@ bool FileRdr::OpenFilePart(FileRdr &parent, FileRdr::Size start, FileRdr::Size l
return true;
}
bool FileRdr::OpenMemory(const void *mem, FileRdr::Size length)
bool FileReader::OpenMemory(const void *mem, FileReader::Size length)
{
Close();
mReader = new MemoryReader((const char *)mem, (long)length);
return true;
}
bool FileRdr::OpenMemoryArray(const void *mem, FileRdr::Size length)
bool FileReader::OpenMemoryArray(const void *mem, FileReader::Size length)
{
Close();
mReader = new MemoryArrayReader((const char *)mem, (long)length);
return true;
}
bool FileRdr::OpenMemoryArray(std::function<bool(TArray<uint8_t>&)> getter)
bool FileReader::OpenMemoryArray(std::function<bool(TArray<uint8_t>&)> getter)
{
auto reader = new MemoryArrayReader(nullptr, 0);
if (getter(reader->GetArray()))

View file

@ -107,16 +107,16 @@ public:
struct FResourceLump;
class FileRdr
class FileReader
{
friend struct FResourceLump; // needs access to the private constructor.
FileReaderInterface *mReader = nullptr;
FileRdr(const FileRdr &r) = delete;
FileRdr &operator=(const FileRdr &r) = delete;
FileReader(const FileReader &r) = delete;
FileReader &operator=(const FileReader &r) = delete;
explicit FileRdr(FileReaderInterface *r)
explicit FileReader(FileReaderInterface *r)
{
mReader = r;
}
@ -131,15 +131,15 @@ public:
typedef ptrdiff_t Size; // let's not use 'long' here.
FileRdr() {}
FileReader() {}
FileRdr(FileRdr &&r)
FileReader(FileReader &&r)
{
mReader = r.mReader;
r.mReader = nullptr;
}
FileRdr& operator =(FileRdr &&r)
FileReader& operator =(FileReader &&r)
{
Close();
mReader = r.mReader;
@ -148,7 +148,7 @@ public:
}
~FileRdr()
~FileReader()
{
Close();
}
@ -165,11 +165,11 @@ public:
}
bool OpenFile(const char *filename, Size start = 0, Size length = -1);
bool OpenFilePart(FileRdr &parent, Size start, Size length);
bool OpenFilePart(FileReader &parent, Size start, Size length);
bool OpenMemory(const void *mem, Size length); // read directly from the buffer
bool OpenMemoryArray(const void *mem, Size length); // read from a copy of the buffer.
bool OpenMemoryArray(std::function<bool(TArray<uint8_t>&)> getter); // read contents to a buffer and return a reader to it
bool OpenDecompressor(FileRdr &parent, Size length, int method, bool seekable); // creates a decompressor stream. 'seekable' uses a buffered version so that the Seek and Tell methods can be used.
bool OpenDecompressor(FileReader &parent, Size length, int method, bool seekable); // creates a decompressor stream. 'seekable' uses a buffered version so that the Seek and Tell methods can be used.
Size Tell() const
{

View file

@ -71,13 +71,13 @@ class DecompressorZ : public DecompressorBase
{
enum { BUFF_SIZE = 4096 };
FileRdr &File;
FileReader &File;
bool SawEOF;
z_stream Stream;
uint8_t InBuff[BUFF_SIZE];
public:
DecompressorZ (FileRdr &file, bool zip)
DecompressorZ (FileReader &file, bool zip)
: File(file), SawEOF(false)
{
int err;
@ -157,13 +157,13 @@ class DecompressorBZ2 : public DecompressorBase
{
enum { BUFF_SIZE = 4096 };
FileRdr &File;
FileReader &File;
bool SawEOF;
bz_stream Stream;
uint8_t InBuff[BUFF_SIZE];
public:
DecompressorBZ2 (FileRdr &file)
DecompressorBZ2 (FileReader &file)
: File(file), SawEOF(false)
{
int err;
@ -261,7 +261,7 @@ class DecompressorLZMA : public DecompressorBase
{
enum { BUFF_SIZE = 4096 };
FileRdr &File;
FileReader &File;
bool SawEOF;
CLzmaDec Stream;
size_t Size;
@ -271,7 +271,7 @@ class DecompressorLZMA : public DecompressorBase
public:
DecompressorLZMA (FileRdr &file, size_t uncompressed_size)
DecompressorLZMA (FileReader &file, size_t uncompressed_size)
: File(file), SawEOF(false)
{
uint8_t header[4 + LZMA_PROPS_SIZE];
@ -380,7 +380,7 @@ class DecompressorLZSS : public DecompressorBase
{
enum { BUFF_SIZE = 4096, WINDOW_SIZE = 4096, INTERNAL_BUFFER_SIZE = 128 };
FileRdr &File;
FileReader &File;
bool SawEOF;
uint8_t InBuff[BUFF_SIZE];
@ -498,7 +498,7 @@ class DecompressorLZSS : public DecompressorBase
}
public:
DecompressorLZSS(FileRdr &file) : File(file), SawEOF(false)
DecompressorLZSS(FileReader &file) : File(file), SawEOF(false)
{
Stream.State = STREAM_EMPTY;
Stream.WindowData = Stream.InternalBuffer = Stream.Window+WINDOW_SIZE;
@ -560,7 +560,7 @@ public:
};
bool FileRdr::OpenDecompressor(FileRdr &parent, Size length, int method, bool seekable)
bool FileReader::OpenDecompressor(FileReader &parent, Size length, int method, bool seekable)
{
DecompressorBase *dec = nullptr;
switch (method)

View file

@ -2801,7 +2801,7 @@ void G_DoPlayDemo (void)
{
FixPathSeperator (defdemoname);
DefaultExtension (defdemoname, ".lmp");
FileRdr fr;
FileReader fr;
if (!fr.OpenFile(defdemoname))
{
I_Error("Unable to open demo '%s'", defdemoname.GetChars());

View file

@ -121,7 +121,7 @@ void M_FindResponseFile (void)
if (added_stuff < limit)
{
// READ THE RESPONSE FILE INTO MEMORY
FileRdr fr;
FileReader fr;
if (!fr.OpenFile(Args->GetArg(i) + 1))
{ // [RH] Make this a warning, not an error.
Printf ("No such response file (%s)!\n", Args->GetArg(i) + 1);

View file

@ -75,7 +75,7 @@ struct IHDR
uint8_t Interlace;
};
PNGHandle::PNGHandle (FileRdr &file) : bDeleteFilePtr(true), ChunkPt(0)
PNGHandle::PNGHandle (FileReader &file) : bDeleteFilePtr(true), ChunkPt(0)
{
File = std::move(file);
}
@ -304,7 +304,7 @@ unsigned int M_NextPNGChunk (PNGHandle *png, uint32_t id)
{
if (png->Chunks[png->ChunkPt].ID == id)
{ // Found the chunk
png->File.Seek (png->Chunks[png->ChunkPt++].Offset, FileRdr::SeekSet);
png->File.Seek (png->Chunks[png->ChunkPt++].Offset, FileReader::SeekSet);
return png->Chunks[png->ChunkPt - 1].Size;
}
}
@ -369,7 +369,7 @@ bool M_GetPNGText (PNGHandle *png, const char *keyword, char *buffer, size_t buf
//
//==========================================================================
PNGHandle *M_VerifyPNG (FileRdr &filer)
PNGHandle *M_VerifyPNG (FileReader &filer)
{
PNGHandle::Chunk chunk;
PNGHandle *png;
@ -400,9 +400,9 @@ PNGHandle *M_VerifyPNG (FileRdr &filer)
chunk.Offset = 16;
chunk.Size = BigLong((unsigned int)data[0]);
png->Chunks.Push (chunk);
png->File.Seek (16, FileRdr::SeekSet);
png->File.Seek (16, FileReader::SeekSet);
while (png->File.Seek (chunk.Size + 4, FileRdr::SeekCur) == 0)
while (png->File.Seek (chunk.Size + 4, FileReader::SeekCur) == 0)
{
// If the file ended before an IEND was encountered, it's not a PNG.
if (png->File.Read (&data, 8) != 8)
@ -470,7 +470,7 @@ void M_FreePNG (PNGHandle *png)
//
//==========================================================================
bool M_ReadIDAT (FileRdr &file, uint8_t *buffer, int width, int height, int pitch,
bool M_ReadIDAT (FileReader &file, uint8_t *buffer, int width, int height, int pitch,
uint8_t bitdepth, uint8_t colortype, uint8_t interlace, unsigned int chunklen)
{
// Uninterlaced images are treated as a conceptual eighth pass by these tables.

View file

@ -73,13 +73,13 @@ struct PNGHandle
uint32_t Size;
};
FileRdr File;
FileReader File;
bool bDeleteFilePtr;
TArray<Chunk> Chunks;
TArray<char *> TextChunks;
unsigned int ChunkPt;
PNGHandle(FileRdr &file);
PNGHandle(FileReader &file);
~PNGHandle();
};
@ -87,7 +87,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 (FileRdr &file);
PNGHandle *M_VerifyPNG (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
@ -106,7 +106,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 (FileRdr &file, uint8_t *buffer, int width, int height, int pitch,
bool M_ReadIDAT (FileReader &file, uint8_t *buffer, int width, int height, int pitch,
uint8_t bitdepth, uint8_t colortype, uint8_t interlace, unsigned int idatlen);

View file

@ -95,7 +95,7 @@ void MD5Context::Update(const uint8_t *buf, unsigned len)
memcpy(in, buf, len);
}
void MD5Context::Update(FileRdr &file, unsigned len)
void MD5Context::Update(FileReader &file, unsigned len)
{
uint8_t readbuf[8192];
long t;
@ -269,7 +269,7 @@ CCMD (md5sum)
}
for (int i = 1; i < argv.argc(); ++i)
{
FileRdr fr;
FileReader fr;
if (!fr.OpenFile(argv[i]))
{
Printf("%s: %s\n", argv[i], strerror(errno));

View file

@ -18,7 +18,7 @@
#ifndef MD5_H
#define MD5_H
class FileRdr;
class FileReader;
struct MD5Context
{
@ -26,7 +26,7 @@ struct MD5Context
void Init();
void Update(const uint8_t *buf, unsigned len);
void Update(FileRdr &file, unsigned len);
void Update(FileReader &file, unsigned len);
void Final(uint8_t digest[16]);
private:

View file

@ -236,7 +236,7 @@ void FSavegameManager::ReadSaveStrings()
}
else // check for old formats.
{
FileRdr file;
FileReader file;
if (file.OpenFile(filepath))
{
PNGHandle *png;
@ -272,7 +272,7 @@ void FSavegameManager::ReadSaveStrings()
}
else
{
file.Seek(0, FileRdr::SeekSet);
file.Seek(0, FileReader::SeekSet);
if (file.Read(sig, 16) == 16)
{
@ -496,7 +496,7 @@ unsigned FSavegameManager::ExtractSaveData(int index)
FResourceLump *pic = resf->FindLump("savepic.png");
if (pic != nullptr)
{
FileRdr picreader;
FileReader picreader;
picreader.OpenMemoryArray([=](TArray<uint8_t> &array)
{

View file

@ -2116,7 +2116,7 @@ void FBehavior::StaticLoadDefaultModules ()
}
}
FBehavior *FBehavior::StaticLoadModule (int lumpnum, FileRdr *fr, int len)
FBehavior *FBehavior::StaticLoadModule (int lumpnum, FileReader *fr, int len)
{
if (lumpnum == -1 && fr == NULL) return NULL;
@ -2392,7 +2392,7 @@ FBehavior::FBehavior()
}
bool FBehavior::Init(int lumpnum, FileRdr * fr, int len)
bool FBehavior::Init(int lumpnum, FileReader * fr, int len)
{
uint8_t *object;
int i;

View file

@ -41,7 +41,7 @@
#define NUM_MAPVARS 128
class FFont;
class FileRdr;
class FileReader;
struct line_t;
@ -348,7 +348,7 @@ class FBehavior
public:
FBehavior ();
~FBehavior ();
bool Init(int lumpnum, FileRdr * fr = NULL, int len = 0);
bool Init(int lumpnum, FileReader * fr = NULL, int len = 0);
bool IsGood ();
uint8_t *FindChunk (uint32_t id) const;
@ -380,7 +380,7 @@ public:
BoundsCheckingArray<int32_t *, NUM_MAPVARS> MapVars;
static FBehavior *StaticLoadModule (int lumpnum, FileRdr *fr = nullptr, int len=0);
static FBehavior *StaticLoadModule (int lumpnum, FileReader *fr = nullptr, int len=0);
static void StaticLoadDefaultModules ();
static void StaticUnloadModules ();
static bool StaticCheckAllGood ();

View file

@ -116,9 +116,9 @@ static int ConversationMenuY;
static int ConversationPauseTic;
static int StaticLastReply;
static bool LoadScriptFile(int lumpnum, FileRdr &lump, int numnodes, bool include, int type);
static FStrifeDialogueNode *ReadRetailNode (FileRdr &lump, uint32_t &prevSpeakerType);
static FStrifeDialogueNode *ReadTeaserNode (FileRdr &lump, uint32_t &prevSpeakerType);
static bool LoadScriptFile(int lumpnum, FileReader &lump, int numnodes, bool include, int type);
static FStrifeDialogueNode *ReadRetailNode (FileReader &lump, uint32_t &prevSpeakerType);
static FStrifeDialogueNode *ReadTeaserNode (FileReader &lump, uint32_t &prevSpeakerType);
static void ParseReplies (FStrifeDialogueReply **replyptr, Response *responses);
static bool DrawConversationMenu ();
static void PickConversationReply (int replyindex);
@ -232,13 +232,13 @@ bool LoadScriptFile (const char *name, bool include, int type)
{
return false;
}
FileRdr lump = Wads.ReopenLumpReader (lumpnum);
FileReader lump = Wads.ReopenLumpReader (lumpnum);
bool res = LoadScriptFile(lumpnum, lump, Wads.LumpLength(lumpnum), include, type);
return res;
}
static bool LoadScriptFile(int lumpnum, FileRdr &lump, int numnodes, bool include, int type)
static bool LoadScriptFile(int lumpnum, FileReader &lump, int numnodes, bool include, int type)
{
int i;
uint32_t prevSpeakerType;
@ -246,7 +246,7 @@ static bool LoadScriptFile(int lumpnum, FileRdr &lump, int numnodes, bool includ
char buffer[4];
lump.Read(buffer, 4);
lump.Seek(-4, FileRdr::SeekCur);
lump.Seek(-4, FileReader::SeekCur);
// The binary format is so primitive that this check is enough to detect it.
bool isbinary = (buffer[0] == 0 || buffer[1] == 0 || buffer[2] == 0 || buffer[3] == 0);
@ -315,7 +315,7 @@ static bool LoadScriptFile(int lumpnum, FileRdr &lump, int numnodes, bool includ
//
//============================================================================
static FStrifeDialogueNode *ReadRetailNode (FileRdr &lump, uint32_t &prevSpeakerType)
static FStrifeDialogueNode *ReadRetailNode (FileReader &lump, uint32_t &prevSpeakerType)
{
FStrifeDialogueNode *node;
Speech speech;
@ -391,7 +391,7 @@ static FStrifeDialogueNode *ReadRetailNode (FileRdr &lump, uint32_t &prevSpeaker
//
//============================================================================
static FStrifeDialogueNode *ReadTeaserNode (FileRdr &lump, uint32_t &prevSpeakerType)
static FStrifeDialogueNode *ReadTeaserNode (FileReader &lump, uint32_t &prevSpeakerType)
{
FStrifeDialogueNode *node;
TeaserSpeech speech;

View file

@ -77,8 +77,8 @@ void P_ResumeConversation ();
void P_ConversationCommand (int netcode, int player, uint8_t **stream);
class FileRdr;
bool P_ParseUSDF(int lumpnum, FileRdr &lump, int lumplen);
class FileReader;
bool P_ParseUSDF(int lumpnum, FileReader &lump, int lumplen);
#endif

View file

@ -75,7 +75,7 @@ void P_GetPolySpots (MapData * lump, TArray<FNodeBuilder::FPolyStart> &spots, TA
CVAR(Bool, gl_cachenodes, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR(Float, gl_cachetime, 0.6f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
void P_LoadZNodes (FileRdr &dalump, uint32_t id);
void P_LoadZNodes (FileReader &dalump, uint32_t id);
static bool CheckCachedNodes(MapData *map);
static void CreateCachedNodes(MapData *map);
@ -215,7 +215,7 @@ bool P_CheckForGLNodes()
static int firstglvertex;
static bool format5;
static bool LoadGLVertexes(FileRdr &lump)
static bool LoadGLVertexes(FileReader &lump)
{
uint8_t *gldata;
int i;
@ -225,7 +225,7 @@ static bool LoadGLVertexes(FileRdr &lump)
auto gllen=lump.GetLength();
gldata = new uint8_t[gllen];
lump.Seek(0, FileRdr::SeekSet);
lump.Seek(0, FileReader::SeekSet);
lump.Read(gldata, gllen);
if (*(int *)gldata == gNd5)
@ -293,7 +293,7 @@ static inline int checkGLVertex3(int num)
//
//==========================================================================
static bool LoadGLSegs(FileRdr &lump)
static bool LoadGLSegs(FileReader &lump)
{
char *data;
int i;
@ -301,7 +301,7 @@ static bool LoadGLSegs(FileRdr &lump)
int numsegs = (int)lump.GetLength();
data= new char[numsegs];
lump.Seek(0, FileRdr::SeekSet);
lump.Seek(0, FileReader::SeekSet);
lump.Read(data, numsegs);
auto &segs = level.segs;
@ -437,14 +437,14 @@ static bool LoadGLSegs(FileRdr &lump)
//
//==========================================================================
static bool LoadGLSubsectors(FileRdr &lump)
static bool LoadGLSubsectors(FileReader &lump)
{
char * datab;
int i;
int numsubsectors = (int)lump.GetLength();
datab = new char[numsubsectors];
lump.Seek(0, FileRdr::SeekSet);
lump.Seek(0, FileReader::SeekSet);
lump.Read(datab, numsubsectors);
if (numsubsectors == 0)
@ -521,7 +521,7 @@ static bool LoadGLSubsectors(FileRdr &lump)
//
//==========================================================================
static bool LoadNodes (FileRdr &lump)
static bool LoadNodes (FileReader &lump)
{
const int NF_SUBSECTOR = 0x8000;
const int GL5_NF_SUBSECTOR = (1 << 31);
@ -539,7 +539,7 @@ static bool LoadNodes (FileRdr &lump)
if (numnodes == 0) return false;
level.nodes.Alloc(numnodes);
lump.Seek(0, FileRdr::SeekSet);
lump.Seek(0, FileReader::SeekSet);
basemn = mn = new mapnode_t[numnodes];
lump.Read(mn, lump.GetLength());
@ -599,7 +599,7 @@ static bool LoadNodes (FileRdr &lump)
if (numnodes == 0) return false;
level.nodes.Alloc(numnodes);
lump.Seek(0, FileRdr::SeekSet);
lump.Seek(0, FileReader::SeekSet);
basemn = mn = new gl5_mapnode_t[numnodes];
lump.Read(mn, lump.GetLength());
@ -660,7 +660,7 @@ static bool LoadNodes (FileRdr &lump)
//
//==========================================================================
static bool DoLoadGLNodes(FileRdr * lumps)
static bool DoLoadGLNodes(FileReader * lumps)
{
int missing = 0;
@ -857,7 +857,7 @@ bool P_LoadGLNodes(MapData * map)
if (!CheckCachedNodes(map))
{
FileRdr gwalumps[4];
FileReader gwalumps[4];
char path[256];
int li;
int lumpfile = Wads.GetLumpFile(map->lumpnum);
@ -1160,7 +1160,7 @@ static bool CheckCachedNodes(MapData *map)
uint32_t *verts = NULL;
FString path = CreateCacheName(map, false);
FileRdr fr;
FileReader fr;
if (!fr.OpenFile(path)) return false;

View file

@ -240,7 +240,7 @@ static int GetMapIndex(const char *mapname, int lastindex, const char *lumpname,
MapData *P_OpenMapData(const char * mapname, bool justcheck)
{
MapData * map = new MapData;
FileRdr * wadReader = nullptr;
FileReader * wadReader = nullptr;
bool externalfile = !strnicmp(mapname, "file:", 5);
if (externalfile)
@ -404,7 +404,7 @@ MapData *P_OpenMapData(const char * mapname, bool justcheck)
// Although we're using the resource system, we still want to be sure we're
// reading from a wad file.
wadReader->Seek(0, FileRdr::SeekSet);
wadReader->Seek(0, FileReader::SeekSet);
wadReader->Read(&id, sizeof(id));
if (id == IWAD_ID || id == PWAD_ID)
@ -855,7 +855,7 @@ void P_LoadVertexes (MapData * map)
//
//===========================================================================
void P_LoadZSegs (FileRdr &data)
void P_LoadZSegs (FileReader &data)
{
for (auto &seg : level.segs)
{
@ -890,7 +890,7 @@ void P_LoadZSegs (FileRdr &data)
//
//===========================================================================
void P_LoadGLZSegs (FileRdr &data, int type)
void P_LoadGLZSegs (FileReader &data, int type)
{
for (unsigned i = 0; i < level.subsectors.Size(); ++i)
{
@ -958,7 +958,7 @@ void P_LoadGLZSegs (FileRdr &data, int type)
//
//===========================================================================
void LoadZNodes(FileRdr &data, int glnodes)
void LoadZNodes(FileReader &data, int glnodes)
{
// Read extra vertices added during node building
unsigned int i;
@ -1082,7 +1082,7 @@ void LoadZNodes(FileRdr &data, int glnodes)
//
//===========================================================================
void P_LoadZNodes (FileRdr &dalump, uint32_t id)
void P_LoadZNodes (FileReader &dalump, uint32_t id)
{
int type;
bool compressed;
@ -1135,7 +1135,7 @@ void P_LoadZNodes (FileRdr &dalump, uint32_t id)
if (compressed)
{
FileRdr zip;
FileReader zip;
if (zip.OpenDecompressor(dalump, -1, METHOD_ZLIB, false))
{
LoadZNodes(zip, type);
@ -2487,12 +2487,12 @@ int P_DetermineTranslucency (int lumpnum)
PalEntry newcolor;
PalEntry newcolor2;
tranmap.Seek (GPalette.BlackIndex * 256 + GPalette.WhiteIndex, FileRdr::SeekSet);
tranmap.Seek (GPalette.BlackIndex * 256 + GPalette.WhiteIndex, FileReader::SeekSet);
tranmap.Read (&index, 1);
newcolor = GPalette.BaseColors[GPalette.Remap[index]];
tranmap.Seek (GPalette.WhiteIndex * 256 + GPalette.BlackIndex, FileRdr::SeekSet);
tranmap.Seek (GPalette.WhiteIndex * 256 + GPalette.BlackIndex, FileReader::SeekSet);
tranmap.Read (&index, 1);
newcolor2 = GPalette.BaseColors[GPalette.Remap[index]];
if (newcolor2.r == 255) // if black on white results in white it's either
@ -3842,7 +3842,7 @@ void P_SetupLevel (const char *lumpname, int position)
if (!ForceNodeBuild)
{
// Check for compressed nodes first, then uncompressed nodes
FileRdr *fr = nullptr;
FileReader *fr = nullptr;
uint32_t id = MAKE_ID('X','x','X','x'), idcheck = 0, idcheck2 = 0, idcheck3 = 0, idcheck4 = 0, idcheck5 = 0, idcheck6 = 0;
if (map->Size(ML_ZNODES) != 0)
@ -4280,3 +4280,4 @@ CCMD (lineloc)
lines[linenum].v2->fY());
}
#endif

View file

@ -38,9 +38,9 @@ private:
struct MapLump
{
char Name[8] = { 0 };
FileRdr Reader;
FileReader Reader;
} MapLumps[ML_MAX];
FileRdr nofile;
FileReader nofile;
public:
bool HasBehavior = false;
bool Encrypted = false;
@ -61,17 +61,17 @@ public:
if (lumpindex<countof(MapLumps))
{
file = &MapLumps[lumpindex].Reader;
file->Seek(0, FileRdr::SeekSet);
file->Seek(0, FileReader::SeekSet);
}
}
*/
FileRdr &Reader(unsigned int lumpindex)
FileReader &Reader(unsigned int lumpindex)
{
if (lumpindex < countof(MapLumps))
{
auto &file = MapLumps[lumpindex].Reader;
file.Seek(0, FileRdr::SeekSet);
file.Seek(0, FileReader::SeekSet);
return file;
}
return nofile;
@ -85,7 +85,7 @@ public:
if (size > 0)
{
auto &file = MapLumps[lumpindex].Reader;
file.Seek(0, FileRdr::SeekSet);
file.Seek(0, FileReader::SeekSet);
file.Read(buffer, size);
}
}

View file

@ -474,7 +474,7 @@ class USDFParser : public UDMFParserBase
//===========================================================================
public:
bool Parse(int lumpnum, FileRdr &lump, int lumplen)
bool Parse(int lumpnum, FileReader &lump, int lumplen)
{
char *buffer = new char[lumplen];
lump.Read(buffer, lumplen);
@ -532,7 +532,7 @@ public:
bool P_ParseUSDF(int lumpnum, FileRdr &lump, int lumplen)
bool P_ParseUSDF(int lumpnum, FileReader &lump, int lumplen)
{
USDFParser parse;

View file

@ -259,7 +259,7 @@ int FZipExploder::DecodeSF(TArray<HuffNode> &decoder, int numvals)
}
int FZipExploder::Explode(unsigned char *out, unsigned int outsize,
FileRdr &in, unsigned int insize,
FileReader &in, unsigned int insize,
int flags)
{
int c, i, minMatchLen = 3, len, dist;
@ -337,9 +337,9 @@ int FZipExploder::Explode(unsigned char *out, unsigned int outsize,
#define FREE_CODE HSIZE /* 0x2000 (code is unused or was cleared) */
#define HAS_CHILD (HSIZE << 1) /* 0x4000 (code has a child--do not clear) */
int ShrinkLoop(unsigned char *out, unsigned int outsize, FileRdr &_In, unsigned int InLeft)
int ShrinkLoop(unsigned char *out, unsigned int outsize, FileReader &_In, unsigned int InLeft)
{
FileRdr *In = &_In;
FileReader *In = &_In;
unsigned char ReadBuf[256];
unsigned short Parent[HSIZE];
unsigned char Value[HSIZE], Stack[HSIZE];

View file

@ -4,7 +4,7 @@
class FZipExploder
{
unsigned int Hold, Bits;
FileRdr *In;
FileReader *In;
unsigned int InLeft;
/****************************************************************
@ -38,7 +38,7 @@ class FZipExploder
int DecodeSFValue(const TArray<HuffNode> &currentTree);
int DecodeSF(TArray<HuffNode> &decoder, int numvals);
public:
int Explode(unsigned char *out, unsigned int outsize, FileRdr &in, unsigned int insize, int flags);
int Explode(unsigned char *out, unsigned int outsize, FileReader &in, unsigned int insize, int flags);
};
class CExplosionError : CRecoverableError
@ -47,4 +47,4 @@ public:
CExplosionError(const char *message) : CRecoverableError(message) {}
};
int ShrinkLoop(unsigned char *out, unsigned int outsize, FileRdr &in, unsigned int insize);
int ShrinkLoop(unsigned char *out, unsigned int outsize, FileReader &in, unsigned int insize);

View file

@ -58,9 +58,9 @@ extern ISzAlloc g_Alloc;
struct CZDFileInStream
{
ISeekInStream s;
FileRdr &File;
FileReader &File;
CZDFileInStream(FileRdr &_file)
CZDFileInStream(FileReader &_file)
: File(_file)
{
s.Read = Read;
@ -83,19 +83,19 @@ struct CZDFileInStream
static SRes Seek(const ISeekInStream *pp, Int64 *pos, ESzSeek origin)
{
CZDFileInStream *p = (CZDFileInStream *)pp;
FileRdr::ESeek move_method;
FileReader::ESeek move_method;
int res;
if (origin == SZ_SEEK_SET)
{
move_method = FileRdr::SeekSet;
move_method = FileReader::SeekSet;
}
else if (origin == SZ_SEEK_CUR)
{
move_method = FileRdr::SeekCur;
move_method = FileReader::SeekCur;
}
else if (origin == SZ_SEEK_END)
{
move_method = FileRdr::SeekEnd;
move_method = FileReader::SeekEnd;
}
else
{
@ -117,13 +117,13 @@ struct C7zArchive
Byte *OutBuffer;
size_t OutBufferSize;
C7zArchive(FileRdr &file) : ArchiveStream(file)
C7zArchive(FileReader &file) : ArchiveStream(file)
{
if (g_CrcTable[1] == 0)
{
CrcGenerateTable();
}
file.Seek(0, FileRdr::SeekSet);
file.Seek(0, FileReader::SeekSet);
LookToRead2_CreateVTable(&LookStream, false);
LookStream.realStream = &ArchiveStream.s;
LookToRead2_Init(&LookStream);
@ -192,7 +192,7 @@ class F7ZFile : public FResourceFile
C7zArchive *Archive;
public:
F7ZFile(const char * filename, FileRdr &filer);
F7ZFile(const char * filename, FileReader &filer);
bool Open(bool quiet);
virtual ~F7ZFile();
virtual FResourceLump *GetLump(int no) { return ((unsigned)no < NumLumps)? &Lumps[no] : NULL; }
@ -206,7 +206,7 @@ public:
//
//==========================================================================
F7ZFile::F7ZFile(const char * filename, FileRdr &filer)
F7ZFile::F7ZFile(const char * filename, FileReader &filer)
: FResourceFile(filename, filer)
{
Lumps = NULL;
@ -361,15 +361,15 @@ int F7ZLump::FillCache()
//
//==========================================================================
FResourceFile *Check7Z(const char *filename, FileRdr &file, bool quiet)
FResourceFile *Check7Z(const char *filename, FileReader &file, bool quiet)
{
char head[k7zSignatureSize];
if (file.GetLength() >= k7zSignatureSize)
{
file.Seek(0, FileRdr::SeekSet);
file.Seek(0, FileReader::SeekSet);
file.Read(&head, k7zSignatureSize);
file.Seek(0, FileRdr::SeekSet);
file.Seek(0, FileReader::SeekSet);
if (!memcmp(head, k7zSignature, k7zSignatureSize))
{
FResourceFile *rf = new F7ZFile(filename, file);

View file

@ -55,7 +55,7 @@
struct FDirectoryLump : public FResourceLump
{
virtual FileRdr NewReader();
virtual FileReader NewReader();
virtual int FillCache();
FString mFullPath;
@ -90,7 +90,7 @@ public:
//==========================================================================
FDirectory::FDirectory(const char * directory)
: FResourceFile(NULL, FileRdr())
: FResourceFile(NULL, FileReader())
{
FString dirname;
@ -287,9 +287,9 @@ void FDirectory::AddEntry(const char *fullpath, int size)
//
//==========================================================================
FileRdr FDirectoryLump::NewReader()
FileReader FDirectoryLump::NewReader()
{
FileRdr fr;
FileReader fr;
fr.OpenFile(mFullPath);
return fr;
}
@ -302,7 +302,7 @@ FileRdr FDirectoryLump::NewReader()
int FDirectoryLump::FillCache()
{
FileRdr fr;
FileReader fr;
Cache = new char[LumpSize];
if (!fr.OpenFile(mFullPath))
{

View file

@ -73,7 +73,7 @@ struct GrpLump
class FGrpFile : public FUncompressedFile
{
public:
FGrpFile(const char * filename, FileRdr &file);
FGrpFile(const char * filename, FileReader &file);
bool Open(bool quiet);
};
@ -84,7 +84,7 @@ public:
//
//==========================================================================
FGrpFile::FGrpFile(const char *filename, FileRdr &file)
FGrpFile::FGrpFile(const char *filename, FileReader &file)
: FUncompressedFile(filename, file)
{
Lumps = NULL;
@ -134,15 +134,15 @@ bool FGrpFile::Open(bool quiet)
//
//==========================================================================
FResourceFile *CheckGRP(const char *filename, FileRdr &file, bool quiet)
FResourceFile *CheckGRP(const char *filename, FileReader &file, bool quiet)
{
char head[12];
if (file.GetLength() >= 12)
{
file.Seek(0, FileRdr::SeekSet);
file.Seek(0, FileReader::SeekSet);
file.Read(&head, 12);
file.Seek(0, FileRdr::SeekSet);
file.Seek(0, FileReader::SeekSet);
if (!memcmp(head, "KenSilverman", 12))
{
FResourceFile *rf = new FGrpFile(filename, file);

View file

@ -46,7 +46,7 @@
class FLumpFile : public FUncompressedFile
{
public:
FLumpFile(const char * filename, FileRdr &file);
FLumpFile(const char * filename, FileReader &file);
bool Open(bool quiet);
};
@ -57,7 +57,7 @@ public:
//
//==========================================================================
FLumpFile::FLumpFile(const char *filename, FileRdr &file)
FLumpFile::FLumpFile(const char *filename, FileReader &file)
: FUncompressedFile(filename, file)
{
}
@ -95,7 +95,7 @@ bool FLumpFile::Open(bool quiet)
//
//==========================================================================
FResourceFile *CheckLump(const char *filename, FileRdr &file, bool quiet)
FResourceFile *CheckLump(const char *filename, FileReader &file, bool quiet)
{
// always succeeds
FResourceFile *rf = new FLumpFile(filename, file);

View file

@ -66,7 +66,7 @@ struct dpackheader_t
class FPakFile : public FUncompressedFile
{
public:
FPakFile(const char * filename, FileRdr &file);
FPakFile(const char * filename, FileReader &file);
bool Open(bool quiet);
};
@ -79,7 +79,7 @@ public:
//
//==========================================================================
FPakFile::FPakFile(const char *filename, FileRdr &file)
FPakFile::FPakFile(const char *filename, FileReader &file)
: FUncompressedFile(filename, file)
{
Lumps = NULL;
@ -100,7 +100,7 @@ bool FPakFile::Open(bool quiet)
header.dirofs = LittleLong(header.dirofs);
dpackfile_t *fileinfo = new dpackfile_t[NumLumps];
Reader.Seek (header.dirofs, FileRdr::SeekSet);
Reader.Seek (header.dirofs, FileReader::SeekSet);
Reader.Read (fileinfo, NumLumps * sizeof(dpackfile_t));
Lumps = new FUncompressedLump[NumLumps];
@ -127,15 +127,15 @@ bool FPakFile::Open(bool quiet)
//
//==========================================================================
FResourceFile *CheckPak(const char *filename, FileRdr &file, bool quiet)
FResourceFile *CheckPak(const char *filename, FileReader &file, bool quiet)
{
char head[4];
if (file.GetLength() >= 12)
{
file.Seek(0, FileRdr::SeekSet);
file.Seek(0, FileReader::SeekSet);
file.Read(&head, 4);
file.Seek(0, FileRdr::SeekSet);
file.Seek(0, FileReader::SeekSet);
if (!memcmp(head, "PACK", 4))
{
FResourceFile *rf = new FPakFile(filename, file);

View file

@ -75,7 +75,7 @@ struct RFFLump
struct FRFFLump : public FUncompressedLump
{
virtual FileRdr *GetReader();
virtual FileReader *GetReader();
virtual int FillCache();
uint32_t IndexNum;
@ -111,7 +111,7 @@ class FRFFFile : public FResourceFile
FRFFLump *Lumps;
public:
FRFFFile(const char * filename, FileRdr &file);
FRFFFile(const char * filename, FileReader &file);
virtual ~FRFFFile();
virtual bool Open(bool quiet);
virtual FResourceLump *GetLump(int no) { return ((unsigned)no < NumLumps)? &Lumps[no] : NULL; }
@ -124,7 +124,7 @@ public:
//
//==========================================================================
FRFFFile::FRFFFile(const char *filename, FileRdr &file)
FRFFFile::FRFFFile(const char *filename, FileReader &file)
: FResourceFile(filename, file)
{
Lumps = NULL;
@ -146,7 +146,7 @@ bool FRFFFile::Open(bool quiet)
NumLumps = LittleLong(header.NumLumps);
header.DirOfs = LittleLong(header.DirOfs);
lumps = new RFFLump[header.NumLumps];
Reader.Seek (header.DirOfs, FileRdr::SeekSet);
Reader.Seek (header.DirOfs, FileReader::SeekSet);
Reader.Read (lumps, header.NumLumps * sizeof(RFFLump));
BloodCrypt (lumps, header.DirOfs, header.NumLumps * sizeof(RFFLump));
@ -203,7 +203,7 @@ FRFFFile::~FRFFFile()
//
//==========================================================================
FileRdr *FRFFLump::GetReader()
FileReader *FRFFLump::GetReader()
{
// Don't return the reader if this lump is encrypted
// In that case always force caching of the lump
@ -247,15 +247,15 @@ int FRFFLump::FillCache()
//
//==========================================================================
FResourceFile *CheckRFF(const char *filename, FileRdr &file, bool quiet)
FResourceFile *CheckRFF(const char *filename, FileReader &file, bool quiet)
{
char head[4];
if (file.GetLength() >= 16)
{
file.Seek(0, FileRdr::SeekSet);
file.Seek(0, FileReader::SeekSet);
file.Read(&head, 4);
file.Seek(0, FileRdr::SeekSet);
file.Seek(0, FileReader::SeekSet);
if (!memcmp(head, "RFF\x1a", 4))
{
FResourceFile *rf = new FRFFFile(filename, file);

View file

@ -55,11 +55,11 @@ public:
int Position;
int GetFileOffset() { return Position; }
FileRdr *GetReader()
FileReader *GetReader()
{
if(!Compressed)
{
Owner->Reader.Seek(Position, FileRdr::SeekSet);
Owner->Reader.Seek(Position, FileReader::SeekSet);
return &Owner->Reader;
}
return NULL;
@ -79,12 +79,12 @@ public:
}
}
Owner->Reader.Seek(Position, FileRdr::SeekSet);
Owner->Reader.Seek(Position, FileReader::SeekSet);
Cache = new char[LumpSize];
if(Compressed)
{
FileRdr lzss;
FileReader lzss;
if (lzss.OpenDecompressor(Owner->Reader, LumpSize, METHOD_LZSS, false))
{
lzss.Read(Cache, LumpSize);
@ -113,7 +113,7 @@ class FWadFile : public FResourceFile
void SkinHack ();
public:
FWadFile(const char * filename, FileRdr &file);
FWadFile(const char * filename, FileReader &file);
~FWadFile();
void FindStrifeTeaserVoices ();
FResourceLump *GetLump(int lump) { return &Lumps[lump]; }
@ -129,7 +129,7 @@ public:
//
//==========================================================================
FWadFile::FWadFile(const char *filename, FileRdr &file)
FWadFile::FWadFile(const char *filename, FileReader &file)
: FResourceFile(filename, file)
{
Lumps = NULL;
@ -173,7 +173,7 @@ bool FWadFile::Open(bool quiet)
}
wadlump_t *fileinfo = new wadlump_t[NumLumps];
Reader.Seek (InfoTableOfs, FileRdr::SeekSet);
Reader.Seek (InfoTableOfs, FileReader::SeekSet);
Reader.Read (fileinfo, NumLumps * sizeof(wadlump_t));
Lumps = new FWadFileLump[NumLumps];
@ -475,15 +475,15 @@ void FWadFile::FindStrifeTeaserVoices ()
//
//==========================================================================
FResourceFile *CheckWad(const char *filename, FileRdr &file, bool quiet)
FResourceFile *CheckWad(const char *filename, FileReader &file, bool quiet)
{
char head[4];
if (file.GetLength() >= 12)
{
file.Seek(0, FileRdr::SeekSet);
file.Seek(0, FileReader::SeekSet);
file.Read(&head, 4);
file.Seek(0, FileRdr::SeekSet);
file.Seek(0, FileReader::SeekSet);
if (!memcmp(head, "IWAD", 4) || !memcmp(head, "PWAD", 4))
{
FResourceFile *rf = new FWadFile(filename, file);

View file

@ -51,7 +51,7 @@
//
//==========================================================================
static bool UncompressZipLump(char *Cache, FileRdr &Reader, int Method, int LumpSize, int CompressedSize, int GPFlags)
static bool UncompressZipLump(char *Cache, FileReader &Reader, int Method, int LumpSize, int CompressedSize, int GPFlags)
{
try
{
@ -67,7 +67,7 @@ static bool UncompressZipLump(char *Cache, FileRdr &Reader, int Method, int Lump
case METHOD_BZIP2:
case METHOD_LZMA:
{
FileRdr frz;
FileReader frz;
if (frz.OpenDecompressor(Reader, LumpSize, Method, false))
{
frz.Read(Cache, LumpSize);
@ -104,7 +104,7 @@ static bool UncompressZipLump(char *Cache, FileRdr &Reader, int Method, int Lump
bool FCompressedBuffer::Decompress(char *destbuffer)
{
FileRdr mr;
FileReader mr;
mr.OpenMemory(mBuffer, mCompressedSize);
return UncompressZipLump(destbuffer, mr, mMethod, mSize, mCompressedSize, mZipFlags);
}
@ -116,7 +116,7 @@ bool FCompressedBuffer::Decompress(char *destbuffer)
//
//-----------------------------------------------------------------------
static uint32_t Zip_FindCentralDir(FileRdr &fin)
static uint32_t Zip_FindCentralDir(FileReader &fin)
{
unsigned char buf[BUFREADCOMMENT + 4];
uint32_t FileSize;
@ -140,7 +140,7 @@ static uint32_t Zip_FindCentralDir(FileRdr &fin)
uReadSize = MIN<uint32_t>((BUFREADCOMMENT + 4), (FileSize - uReadPos));
if (fin.Seek(uReadPos, FileRdr::SeekSet) != 0) break;
if (fin.Seek(uReadPos, FileReader::SeekSet) != 0) break;
if (fin.Read(buf, (int32_t)uReadSize) != (int32_t)uReadSize) break;
@ -165,7 +165,7 @@ static uint32_t Zip_FindCentralDir(FileRdr &fin)
//
//==========================================================================
FZipFile::FZipFile(const char * filename, FileRdr &file)
FZipFile::FZipFile(const char * filename, FileReader &file)
: FResourceFile(filename, file)
{
Lumps = NULL;
@ -186,7 +186,7 @@ bool FZipFile::Open(bool quiet)
}
// Read the central directory info.
Reader.Seek(centraldir, FileRdr::SeekSet);
Reader.Seek(centraldir, FileReader::SeekSet);
Reader.Read(&info, sizeof(FZipEndOfCentralDirectory));
// No multi-disk zips!
@ -203,7 +203,7 @@ bool FZipFile::Open(bool quiet)
// Load the entire central directory. Too bad that this contains variable length entries...
int dirsize = LittleLong(info.DirectorySize);
void *directory = malloc(dirsize);
Reader.Seek(LittleLong(info.DirectoryOffset), FileRdr::SeekSet);
Reader.Seek(LittleLong(info.DirectoryOffset), FileReader::SeekSet);
Reader.Read(directory, dirsize);
char *dirptr = (char*)directory;
@ -386,7 +386,7 @@ FCompressedBuffer FZipLump::GetRawData()
{
FCompressedBuffer cbuf = { (unsigned)LumpSize, (unsigned)CompressedSize, Method, GPFlags, CRC32, new char[CompressedSize] };
if (Flags & LUMPFZIP_NEEDFILESTART) SetLumpAddress();
Owner->Reader.Seek(Position, FileRdr::SeekSet);
Owner->Reader.Seek(Position, FileReader::SeekSet);
Owner->Reader.Read(cbuf.mBuffer, CompressedSize);
return cbuf;
}
@ -405,7 +405,7 @@ void FZipLump::SetLumpAddress()
FZipLocalFileHeader localHeader;
int skiplen;
Owner->Reader.Seek(Position, FileRdr::SeekSet);
Owner->Reader.Seek(Position, FileReader::SeekSet);
Owner->Reader.Read(&localHeader, sizeof(localHeader));
skiplen = LittleShort(localHeader.NameLength) + LittleShort(localHeader.ExtraLength);
Position += sizeof(localHeader) + skiplen;
@ -418,14 +418,14 @@ void FZipLump::SetLumpAddress()
//
//==========================================================================
FileRdr *FZipLump::GetReader()
FileReader *FZipLump::GetReader()
{
// Don't return the reader if this lump is encrypted
// In that case always force caching of the lump
if (Method == METHOD_STORED)
{
if (Flags & LUMPFZIP_NEEDFILESTART) SetLumpAddress();
Owner->Reader.Seek(Position, FileRdr::SeekSet);
Owner->Reader.Seek(Position, FileReader::SeekSet);
return &Owner->Reader;
}
else return NULL;
@ -450,7 +450,7 @@ int FZipLump::FillCache()
return -1;
}
Owner->Reader.Seek(Position, FileRdr::SeekSet);
Owner->Reader.Seek(Position, FileReader::SeekSet);
Cache = new char[LumpSize];
UncompressZipLump(Cache, Owner->Reader, Method, LumpSize, CompressedSize, GPFlags);
RefCount = 1;
@ -476,15 +476,15 @@ int FZipLump::GetFileOffset()
//
//==========================================================================
FResourceFile *CheckZip(const char *filename, FileRdr &file, bool quiet)
FResourceFile *CheckZip(const char *filename, FileReader &file, bool quiet)
{
char head[4];
if (file.GetLength() >= (long)sizeof(FZipLocalFileHeader))
{
file.Seek(0, FileRdr::SeekSet);
file.Seek(0, FileReader::SeekSet);
file.Read(&head, 4);
file.Seek(0, FileRdr::SeekSet);
file.Seek(0, FileReader::SeekSet);
if (!memcmp(head, "PK\x3\x4", 4))
{
FResourceFile *rf = new FZipFile(filename, file);

View file

@ -22,7 +22,7 @@ struct FZipLump : public FResourceLump
int Position;
unsigned CRC32;
virtual FileRdr *GetReader();
virtual FileReader *GetReader();
virtual int FillCache();
private:
@ -43,7 +43,7 @@ class FZipFile : public FResourceFile
FZipLump *Lumps;
public:
FZipFile(const char * filename, FileRdr &file);
FZipFile(const char * filename, FileReader &file);
virtual ~FZipFile();
bool Open(bool quiet);
virtual FResourceLump *GetLump(int no) { return ((unsigned)no < NumLumps)? &Lumps[no] : NULL; }

View file

@ -212,11 +212,11 @@ FCompressedBuffer FResourceLump::GetRawData()
//==========================================================================
//
// Returns the owner's FileRdr if it can be used to access this lump
// Returns the owner's FileReader if it can be used to access this lump
//
//==========================================================================
FileRdr *FResourceLump::GetReader()
FileReader *FResourceLump::GetReader()
{
return NULL;
}
@ -227,9 +227,9 @@ FileRdr *FResourceLump::GetReader()
//
//==========================================================================
FileRdr FResourceLump::NewReader()
FileReader FResourceLump::NewReader()
{
return FileRdr(new FLumpReader(this));
return FileReader(new FLumpReader(this));
}
//==========================================================================
@ -276,20 +276,20 @@ int FResourceLump::ReleaseCache()
//
//==========================================================================
typedef FResourceFile * (*CheckFunc)(const char *filename, FileRdr &file, bool quiet);
typedef FResourceFile * (*CheckFunc)(const char *filename, FileReader &file, bool quiet);
FResourceFile *CheckWad(const char *filename, FileRdr &file, bool quiet);
FResourceFile *CheckGRP(const char *filename, FileRdr &file, bool quiet);
FResourceFile *CheckRFF(const char *filename, FileRdr &file, bool quiet);
FResourceFile *CheckPak(const char *filename, FileRdr &file, bool quiet);
FResourceFile *CheckZip(const char *filename, FileRdr &file, bool quiet);
FResourceFile *Check7Z(const char *filename, FileRdr &file, bool quiet);
FResourceFile *CheckLump(const char *filename,FileRdr &file, bool quiet);
FResourceFile *CheckWad(const char *filename, FileReader &file, bool quiet);
FResourceFile *CheckGRP(const char *filename, FileReader &file, bool quiet);
FResourceFile *CheckRFF(const char *filename, FileReader &file, bool quiet);
FResourceFile *CheckPak(const char *filename, FileReader &file, bool quiet);
FResourceFile *CheckZip(const char *filename, FileReader &file, bool quiet);
FResourceFile *Check7Z(const char *filename, FileReader &file, bool quiet);
FResourceFile *CheckLump(const char *filename,FileReader &file, bool quiet);
FResourceFile *CheckDir(const char *filename, bool quiet);
static CheckFunc funcs[] = { CheckWad, CheckZip, Check7Z, CheckPak, CheckGRP, CheckRFF, CheckLump };
FResourceFile *FResourceFile::DoOpenResourceFile(const char *filename, FileRdr &file, bool quiet, bool containeronly)
FResourceFile *FResourceFile::DoOpenResourceFile(const char *filename, FileReader &file, bool quiet, bool containeronly)
{
for(size_t i = 0; i < countof(funcs) - containeronly; i++)
{
@ -299,7 +299,7 @@ FResourceFile *FResourceFile::DoOpenResourceFile(const char *filename, FileRdr &
return NULL;
}
FResourceFile *FResourceFile::OpenResourceFile(const char *filename, FileRdr &file, bool quiet, bool containeronly)
FResourceFile *FResourceFile::OpenResourceFile(const char *filename, FileReader &file, bool quiet, bool containeronly)
{
return DoOpenResourceFile(filename, file, quiet, containeronly);
}
@ -307,7 +307,7 @@ FResourceFile *FResourceFile::OpenResourceFile(const char *filename, FileRdr &fi
FResourceFile *FResourceFile::OpenResourceFile(const char *filename, bool quiet, bool containeronly)
{
FileRdr file;
FileReader file;
if (!file.OpenFile(filename)) return nullptr;
return DoOpenResourceFile(filename, file, quiet, containeronly);
}
@ -323,7 +323,7 @@ FResourceFile *FResourceFile::OpenDirectory(const char *filename, bool quiet)
//
//==========================================================================
FResourceFile::FResourceFile(const char *filename, FileRdr &r)
FResourceFile::FResourceFile(const char *filename, FileReader &r)
{
if (filename != NULL) Filename = copystring(filename);
else Filename = NULL;
@ -605,9 +605,9 @@ FResourceLump *FResourceFile::FindLump(const char *name)
//
//==========================================================================
FileRdr *FUncompressedLump::GetReader()
FileReader *FUncompressedLump::GetReader()
{
Owner->Reader.Seek(Position, FileRdr::SeekSet);
Owner->Reader.Seek(Position, FileReader::SeekSet);
return &Owner->Reader;
}
@ -629,7 +629,7 @@ int FUncompressedLump::FillCache()
return -1;
}
Owner->Reader.Seek(Position, FileRdr::SeekSet);
Owner->Reader.Seek(Position, FileReader::SeekSet);
Cache = new char[LumpSize];
Owner->Reader.Read(Cache, LumpSize);
RefCount = 1;
@ -642,7 +642,7 @@ int FUncompressedLump::FillCache()
//
//==========================================================================
FUncompressedFile::FUncompressedFile(const char *filename, FileRdr &r)
FUncompressedFile::FUncompressedFile(const char *filename, FileReader &r)
: FResourceFile(filename, r)
{
Lumps = NULL;
@ -667,7 +667,7 @@ FExternalLump::FExternalLump(const char *_filename, int filesize)
if (filesize == -1)
{
FileRdr f;
FileReader f;
if (f.OpenFile(_filename))
{
@ -700,7 +700,7 @@ FExternalLump::~FExternalLump()
int FExternalLump::FillCache()
{
Cache = new char[LumpSize];
FileRdr f;
FileReader f;
if (f.OpenFile(filename))
{

View file

@ -62,8 +62,8 @@ struct FResourceLump
}
virtual ~FResourceLump();
virtual FileRdr *GetReader();
virtual FileRdr NewReader();
virtual FileReader *GetReader();
virtual FileReader NewReader();
virtual int GetFileOffset() { return -1; }
virtual int GetIndexNum() const { return 0; }
void LumpNameSetup(FString iname);
@ -81,12 +81,12 @@ protected:
class FResourceFile
{
public:
FileRdr Reader;
FileReader Reader;
const char *Filename;
protected:
uint32_t NumLumps;
FResourceFile(const char *filename, FileRdr &r);
FResourceFile(const char *filename, FileReader &r);
// for archives that can contain directories
void PostProcessArchive(void *lumps, size_t lumpsize);
@ -98,14 +98,14 @@ private:
int FilterLumpsByGameType(int gametype, void *lumps, size_t lumpsize, uint32_t max);
bool FindPrefixRange(FString filter, void *lumps, size_t lumpsize, uint32_t max, uint32_t &start, uint32_t &end);
void JunkLeftoverFilters(void *lumps, size_t lumpsize, uint32_t max);
static FResourceFile *DoOpenResourceFile(const char *filename, FileRdr &file, bool quiet, bool containeronly);
static FResourceFile *DoOpenResourceFile(const char *filename, FileReader &file, bool quiet, bool containeronly);
public:
static FResourceFile *OpenResourceFile(const char *filename, FileRdr &file, bool quiet = false, bool containeronly = false);
static FResourceFile *OpenResourceFile(const char *filename, FileReader &file, bool quiet = false, bool containeronly = false);
static FResourceFile *OpenResourceFile(const char *filename, bool quiet = false, bool containeronly = false);
static FResourceFile *OpenDirectory(const char *filename, bool quiet = false);
virtual ~FResourceFile();
FileRdr *GetReader() { return &Reader; }
FileReader *GetReader() { return &Reader; }
uint32_t LumpCount() const { return NumLumps; }
uint32_t GetFirstLump() const { return FirstLump; }
void SetFirstLump(uint32_t f) { FirstLump = f; }
@ -120,7 +120,7 @@ struct FUncompressedLump : public FResourceLump
{
int Position;
virtual FileRdr *GetReader();
virtual FileReader *GetReader();
virtual int FillCache();
virtual int GetFileOffset() { return Position; }
@ -134,7 +134,7 @@ protected:
FUncompressedLump * Lumps;
FUncompressedFile(const char *filename, FileRdr &r);
FUncompressedFile(const char *filename, FileReader &r);
virtual ~FUncompressedFile();
virtual FResourceLump *GetLump(int no) { return ((unsigned)no < NumLumps)? &Lumps[no] : NULL; }
@ -155,7 +155,7 @@ struct FExternalLump : public FResourceLump
struct FMemoryFile : public FUncompressedFile
{
FMemoryFile(const char *_filename, const void *sdata, int length)
: FUncompressedFile(_filename, FileRdr())
: FUncompressedFile(_filename, FileReader())
{
Reader.OpenMemoryArray(sdata, length);
}

View file

@ -54,7 +54,7 @@ bool FPlayList::ChangeList (const char *path)
{
FString playlistdir;
FString song;
FileRdr fr;
FileReader fr;
bool first;
bool pls;
int i;
@ -133,7 +133,7 @@ bool FPlayList::ChangeList (const char *path)
return Songs.Size() != 0;
}
FString FPlayList::NextLine (FileRdr &file)
FString FPlayList::NextLine (FileReader &file)
{
char buffer[512];
char *skipper;

View file

@ -34,7 +34,7 @@
#ifndef __S_PLAYLIST_H__
#define __S_PLAYLIST_H__
class FileRdr;
class FileReader;
class FPlayList
{
@ -53,7 +53,7 @@ public:
const char *GetSong (int position) const;
private:
static FString NextLine (FileRdr &file);
static FString NextLine (FileReader &file);
unsigned int Position;
TArray<FString> Songs;

View file

@ -2609,7 +2609,7 @@ bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force)
musicname += 7;
}
FileRdr reader;
FileReader reader;
if (!FileExists (musicname))
{
if ((lumpnum = Wads.CheckNumForFullName (musicname, true, ns_music)) == -1)

View file

@ -248,7 +248,7 @@ bool FScanner::OpenFile (const char *name)
{
Close ();
FileRdr fr;
FileReader fr;
if (!fr.OpenFile(name)) return false;
auto filesize = fr.GetLength();
auto filebuf = new uint8_t[filesize];

View file

@ -309,7 +309,7 @@ MusInfo *MusInfo::GetWaveDumper(const char *filename, int rate)
//
//==========================================================================
static MIDISource *CreateMIDISource(FileRdr &reader, EMIDIType miditype)
static MIDISource *CreateMIDISource(FileReader &reader, EMIDIType miditype)
{
MIDISource *source = nullptr;
switch (miditype)
@ -398,7 +398,7 @@ static EMIDIType IdentifyMIDIType(uint32_t *id, int size)
//
//==========================================================================
MusInfo *I_RegisterSong (FileRdr &reader, MidiDeviceSetting *device)
MusInfo *I_RegisterSong (FileReader &reader, MidiDeviceSetting *device)
{
MusInfo *info = nullptr;
const char *fmt;
@ -409,7 +409,7 @@ MusInfo *I_RegisterSong (FileRdr &reader, MidiDeviceSetting *device)
return nullptr;
}
if(reader.Read(id, 32) != 32 || reader.Seek(-32, FileRdr::SeekCur) != 0)
if(reader.Read(id, 32) != 32 || reader.Seek(-32, FileReader::SeekCur) != 0)
{
return nullptr;
}
@ -436,7 +436,7 @@ MusInfo *I_RegisterSong (FileRdr &reader, MidiDeviceSetting *device)
return nullptr;
}
if (reader.Read(id, 32) != 32 || reader.Seek(-32, FileRdr::SeekCur) != 0)
if (reader.Read(id, 32) != 32 || reader.Seek(-32, FileReader::SeekCur) != 0)
{
return nullptr;
}
@ -500,12 +500,12 @@ MusInfo *I_RegisterSong (FileRdr &reader, MidiDeviceSetting *device)
{
uint32_t subid;
reader.Seek(8, FileRdr::SeekCur);
reader.Seek(8, FileReader::SeekCur);
if (reader.Read (&subid, 4) != 4)
{
return nullptr;
}
reader.Seek(-12, FileRdr::SeekCur);
reader.Seek(-12, FileReader::SeekCur);
if (subid == (('C')|(('D')<<8)|(('D')<<16)|(('A')<<24)))
{
@ -709,7 +709,7 @@ static MIDISource *GetMIDISource(const char *fn)
auto wlump = Wads.OpenLumpReader(lump);
uint32_t id[32 / 4];
if (wlump.Read(id, 32) != 32 || wlump.Seek(-32, FileRdr::SeekCur) != 0)
if (wlump.Read(id, 32) != 32 || wlump.Seek(-32, FileReader::SeekCur) != 0)
{
Printf("Unable to read lump %s\n", src.GetChars());
return nullptr;

View file

@ -37,7 +37,7 @@
#include "doomdef.h"
#include "i_soundinternal.h"
class FileRdr;
class FileReader;
struct FOptionValues;
//
@ -55,7 +55,7 @@ void I_SetMusicVolume (float volume);
// Registers a song handle to song data.
class MusInfo;
struct MidiDeviceSetting;
MusInfo *I_RegisterSong (FileRdr &reader, MidiDeviceSetting *device);
MusInfo *I_RegisterSong (FileReader &reader, MidiDeviceSetting *device);
MusInfo *I_RegisterCDSong (int track, int cdid = 0);
// The base music class. Everything is derived from this --------------------

View file

@ -408,7 +408,7 @@ protected:
class StreamSong : public MusInfo
{
public:
StreamSong (FileRdr &reader);
StreamSong (FileReader &reader);
~StreamSong ();
void Play (bool looping, int subsong);
void Pause ();
@ -431,7 +431,7 @@ protected:
class OPLMUSSong : public StreamSong
{
public:
OPLMUSSong (FileRdr &reader, const char *args);
OPLMUSSong (FileReader &reader, const char *args);
~OPLMUSSong ();
void Play (bool looping, int subsong);
bool IsPlaying ();
@ -480,18 +480,18 @@ protected:
class CDDAFile : public CDSong
{
public:
CDDAFile (FileRdr &reader);
CDDAFile (FileReader &reader);
};
// Module played via foo_dumb -----------------------------------------------
MusInfo *MOD_OpenSong(FileRdr &reader);
MusInfo *MOD_OpenSong(FileReader &reader);
// Music played via Game Music Emu ------------------------------------------
const char *GME_CheckFormat(uint32_t header);
MusInfo *GME_OpenSong(FileRdr &reader, const char *fmt);
MusInfo *SndFile_OpenSong(FileRdr &fr);
MusInfo *GME_OpenSong(FileReader &reader, const char *fmt);
MusInfo *SndFile_OpenSong(FileReader &fr);
// --------------------------------------------------------------------------

View file

@ -159,7 +159,7 @@ public:
{
return NULL;
}
SoundStream *OpenStream (FileRdr &reader, int flags)
SoundStream *OpenStream (FileReader &reader, int flags)
{
return NULL;
}
@ -370,7 +370,7 @@ FString SoundRenderer::GatherStats ()
short *SoundRenderer::DecodeSample(int outlen, const void *coded, int sizebytes, ECodecType ctype)
{
FileRdr reader;
FileReader reader;
short *samples = (short*)calloc(1, outlen);
ChannelConfig chans;
SampleType type;
@ -578,7 +578,7 @@ std::pair<SoundHandle, bool> SoundRenderer::LoadSoundBuffered(FSoundLoadBuffer *
return std::make_pair(retval, true);
}
SoundDecoder *SoundRenderer::CreateDecoder(FileRdr &reader)
SoundDecoder *SoundRenderer::CreateDecoder(FileReader &reader)
{
SoundDecoder *decoder = NULL;
auto pos = reader.Tell();
@ -587,7 +587,7 @@ SoundDecoder *SoundRenderer::CreateDecoder(FileRdr &reader)
decoder = new SndFileDecoder;
if (decoder->open(reader))
return decoder;
reader.Seek(pos, FileRdr::SeekSet);
reader.Seek(pos, FileReader::SeekSet);
delete decoder;
decoder = NULL;
@ -596,7 +596,7 @@ SoundDecoder *SoundRenderer::CreateDecoder(FileRdr &reader)
decoder = new MPG123Decoder;
if (decoder->open(reader))
return decoder;
reader.Seek(pos, FileRdr::SeekSet);
reader.Seek(pos, FileReader::SeekSet);
delete decoder;
decoder = NULL;

View file

@ -38,7 +38,7 @@
#include "doomtype.h"
#include "i_soundinternal.h"
class FileRdr;
class FileReader;
enum ECodecType
{
@ -118,7 +118,7 @@ public:
// Streaming sounds.
virtual SoundStream *CreateStream (SoundStreamCallback callback, int buffbytes, int flags, int samplerate, void *userdata) = 0;
virtual SoundStream *OpenStream (FileRdr &reader, int flags) = 0;
virtual SoundStream *OpenStream (FileReader &reader, int flags) = 0;
// Starts a sound.
virtual FISoundChannel *StartSound (SoundHandle sfx, float vol, int pitch, int chanflags, FISoundChannel *reuse_chan) = 0;
@ -168,7 +168,7 @@ public:
virtual void DrawWaveDebug(int mode);
static SoundDecoder *CreateDecoder(FileRdr &reader);
static SoundDecoder *CreateDecoder(FileReader &reader);
};
extern SoundRenderer *GSnd;

View file

@ -50,7 +50,7 @@ FSoundFontManager sfmanager;
//
//==========================================================================
std::pair<FileRdr, FString> FSoundFontReader::LookupFile(const char *name)
std::pair<FileReader, FString> FSoundFontReader::LookupFile(const char *name)
{
if (!IsAbsPath(name))
{
@ -117,9 +117,9 @@ FSF2Reader::FSF2Reader(const char *fn)
//
//==========================================================================
FileRdr FSF2Reader::OpenMainConfigFile()
FileReader FSF2Reader::OpenMainConfigFile()
{
FileRdr fr;
FileReader fr;
if (mMainConfigForSF2.IsNotEmpty())
{
fr.OpenMemory(mMainConfigForSF2.GetChars(), mMainConfigForSF2.Len());
@ -127,9 +127,9 @@ FileRdr FSF2Reader::OpenMainConfigFile()
return fr;
}
FileRdr FSF2Reader::OpenFile(const char *name)
FileReader FSF2Reader::OpenFile(const char *name)
{
FileRdr fr;
FileReader fr;
if (mFilename.CompareNoCase(name) == 0)
{
fr.OpenFile(name);
@ -153,14 +153,14 @@ FZipPatReader::~FZipPatReader()
if (resf != nullptr) delete resf;
}
FileRdr FZipPatReader::OpenMainConfigFile()
FileReader FZipPatReader::OpenMainConfigFile()
{
return OpenFile("timidity.cfg");
}
FileRdr FZipPatReader::OpenFile(const char *name)
FileReader FZipPatReader::OpenFile(const char *name)
{
FileRdr fr;
FileReader fr;
if (resf != nullptr)
{
auto lump = resf->FindLump(name);
@ -195,7 +195,7 @@ FPatchSetReader::FPatchSetReader(const char *filename)
};
#endif
mAllowAbsolutePaths = true;
FileRdr fr;
FileReader fr;
if (fr.OpenFile(filename))
{
mFullPathToConfig = filename;
@ -225,19 +225,19 @@ FPatchSetReader::FPatchSetReader()
mAllowAbsolutePaths = true;
}
FileRdr FPatchSetReader::OpenMainConfigFile()
FileReader FPatchSetReader::OpenMainConfigFile()
{
FileRdr fr;
FileReader fr;
fr.OpenFile(mFullPathToConfig);
return fr;
}
FileRdr FPatchSetReader::OpenFile(const char *name)
FileReader FPatchSetReader::OpenFile(const char *name)
{
FString path;
if (IsAbsPath(name)) path = name;
else path = mBasePath + name;
FileRdr fr;
FileReader fr;
fr.OpenFile(path);
return fr;
}
@ -258,18 +258,18 @@ FLumpPatchSetReader::FLumpPatchSetReader(const char *filename)
if (mBasePath.Len() > 0 && mBasePath.Back() != '/') mBasePath += '/';
}
FileRdr FLumpPatchSetReader::OpenMainConfigFile()
FileReader FLumpPatchSetReader::OpenMainConfigFile()
{
return Wads.ReopenLumpReader(mLumpIndex);
}
FileRdr FLumpPatchSetReader::OpenFile(const char *name)
FileReader FLumpPatchSetReader::OpenFile(const char *name)
{
FString path;
if (IsAbsPath(name)) return FileRdr(); // no absolute paths in the lump directory.
if (IsAbsPath(name)) return FileReader(); // no absolute paths in the lump directory.
path = mBasePath + name;
auto index = Wads.CheckNumForFullName(path);
if (index < 0) return FileRdr();
if (index < 0) return FileReader();
return Wads.ReopenLumpReader(index);
}
@ -293,7 +293,7 @@ void FSoundFontManager::ProcessOneFile(const FString &fn)
if (!sfi.mName.CompareNoCase(fb)) return;
}
FileRdr fr;
FileReader fr;
if (fr.OpenFile(fn))
{
// Try to identify. We only accept .sf2 and .zip by content. All other archives are intentionally ignored.
@ -435,7 +435,7 @@ FSoundFontReader *FSoundFontManager::OpenSoundFont(const char *name, int allowed
// Next check if the file is a .sf file
if (allowed & SF_SF2)
{
FileRdr fr;
FileReader fr;
if (fr.OpenFile(name))
{
char head[16] = { 0};
@ -449,7 +449,7 @@ FSoundFontReader *FSoundFontManager::OpenSoundFont(const char *name, int allowed
}
if (allowed & SF_GUS)
{
FileRdr fr;
FileReader fr;
if (fr.OpenFile(name))
{
char head[16] = { 0 };

View file

@ -41,9 +41,9 @@ protected:
public:
virtual ~FSoundFontReader() {}
virtual FileRdr OpenMainConfigFile() = 0; // this is special because it needs to be synthesized for .sf files and set some restrictions for patch sets
virtual FileRdr OpenFile(const char *name) = 0;
std::pair<FileRdr , FString> LookupFile(const char *name);
virtual FileReader OpenMainConfigFile() = 0; // this is special because it needs to be synthesized for .sf files and set some restrictions for patch sets
virtual FileReader OpenFile(const char *name) = 0;
std::pair<FileReader , FString> LookupFile(const char *name);
void AddPath(const char *str);
virtual FString basePath() const
{
@ -63,8 +63,8 @@ class FSF2Reader : public FSoundFontReader
FString mFilename;
public:
FSF2Reader(const char *filename);
virtual FileRdr OpenMainConfigFile() override;
virtual FileRdr OpenFile(const char *name) override;
virtual FileReader OpenMainConfigFile() override;
virtual FileReader OpenFile(const char *name) override;
};
//==========================================================================
@ -79,8 +79,8 @@ class FZipPatReader : public FSoundFontReader
public:
FZipPatReader(const char *filename);
~FZipPatReader();
virtual FileRdr OpenMainConfigFile() override;
virtual FileRdr OpenFile(const char *name) override;
virtual FileReader OpenMainConfigFile() override;
virtual FileReader OpenFile(const char *name) override;
bool isOk() { return resf != nullptr; }
};
@ -97,8 +97,8 @@ class FLumpPatchSetReader : public FSoundFontReader
public:
FLumpPatchSetReader(const char *filename);
virtual FileRdr OpenMainConfigFile() override;
virtual FileRdr OpenFile(const char *name) override;
virtual FileReader OpenMainConfigFile() override;
virtual FileReader OpenFile(const char *name) override;
virtual FString basePath() const override
{
return mBasePath;
@ -120,8 +120,8 @@ class FPatchSetReader : public FSoundFontReader
public:
FPatchSetReader();
FPatchSetReader(const char *filename);
virtual FileRdr OpenMainConfigFile() override;
virtual FileRdr OpenFile(const char *name) override;
virtual FileReader OpenMainConfigFile() override;
virtual FileReader OpenFile(const char *name) override;
virtual FString basePath() const override
{
return mBasePath;

View file

@ -7,7 +7,7 @@
#include "vectors.h"
#include "tarray.h"
class FileRdr;
class FileReader;
// For convenience, this structure matches FMOD_REVERB_PROPERTIES.
// Since I can't very well #include system-specific stuff in the
@ -112,7 +112,7 @@ struct FISoundChannel
};
void FindLoopTags(FileRdr &fr, uint32_t *start, bool *startass, uint32_t *end, bool *endass);
void FindLoopTags(FileReader &fr, uint32_t *start, bool *startass, uint32_t *end, bool *endass);
enum SampleType
@ -143,7 +143,7 @@ struct SoundDecoder
virtual ~SoundDecoder() { }
protected:
virtual bool open(FileRdr &reader) = 0;
virtual bool open(FileReader &reader) = 0;
friend class SoundRenderer;
private:

View file

@ -76,7 +76,7 @@ public:
class MUSSong2 : public MIDISource
{
public:
MUSSong2(FileRdr &reader);
MUSSong2(FileReader &reader);
~MUSSong2();
protected:
@ -99,7 +99,7 @@ private:
class MIDISong2 : public MIDISource
{
public:
MIDISong2(FileRdr &reader);
MIDISong2(FileReader &reader);
~MIDISong2();
protected:
@ -153,7 +153,7 @@ protected:
class HMISong : public MIDISource
{
public:
HMISong(FileRdr &reader);
HMISong(FileReader &reader);
~HMISong();
protected:
@ -193,7 +193,7 @@ private:
class XMISong : public MIDISource
{
public:
XMISong(FileRdr &reader);
XMISong(FileReader &reader);
~XMISong();
protected:

View file

@ -126,7 +126,7 @@ struct HMISong::TrackInfo
//
//==========================================================================
HMISong::HMISong (FileRdr &reader)
HMISong::HMISong (FileReader &reader)
{
int len = (int)reader.GetLength();
if (len < 0x100)

View file

@ -88,7 +88,7 @@ static const uint8_t CtrlTranslate[15] =
//
//==========================================================================
MUSSong2::MUSSong2 (FileRdr &reader)
MUSSong2::MUSSong2 (FileReader &reader)
: MusHeader(0), MusBuffer(0)
{
uint8_t front[32];

View file

@ -99,7 +99,7 @@ struct MIDISong2::TrackInfo
//
//==========================================================================
MIDISong2::MIDISong2 (FileRdr &reader)
MIDISong2::MIDISong2 (FileReader &reader)
: MusHeader(0), Tracks(0)
{
int p;

View file

@ -105,7 +105,7 @@ struct XMISong::TrackInfo
//
//==========================================================================
XMISong::XMISong (FileRdr &reader)
XMISong::XMISong (FileReader &reader)
: MusHeader(0), Songs(0)
{
SongLen = (int)reader.GetLength();

View file

@ -87,7 +87,7 @@ off_t MPG123Decoder::file_lseek(void *handle, off_t offset, int whence)
return -1;
}
if(reader.Seek(offset, (FileRdr::ESeek)whence) != 0)
if(reader.Seek(offset, (FileReader::ESeek)whence) != 0)
return -1;
return (off_t)reader.Tell();
}
@ -109,7 +109,7 @@ MPG123Decoder::~MPG123Decoder()
}
}
bool MPG123Decoder::open(FileRdr &reader)
bool MPG123Decoder::open(FileReader &reader)
{
if(!inited)
{
@ -215,7 +215,7 @@ bool MPG123Decoder::seek(size_t ms_offset, bool ms, bool mayrestart)
mpg123_delete(MPG123);
MPG123 = 0;
}
Reader.Seek(0, FileRdr::SeekSet);
Reader.Seek(0, FileReader::SeekSet);
// Do not call open with our own reader variable, that would be catastrophic.
auto reader = std::move(Reader);
return open(reader);

View file

@ -30,13 +30,13 @@ struct MPG123Decoder : public SoundDecoder
virtual ~MPG123Decoder();
protected:
virtual bool open(FileRdr &reader);
virtual bool open(FileReader &reader);
private:
mpg123_handle *MPG123;
bool Done;
FileRdr Reader;
FileReader Reader;
static off_t file_lseek(void *handle, off_t offset, int whence);
static ssize_t file_read(void *handle, void *buffer, size_t bytes);

View file

@ -112,7 +112,7 @@ bool CDSong::IsPlaying ()
return m_Status != STATE_Stopped;
}
CDDAFile::CDDAFile (FileRdr &reader)
CDDAFile::CDDAFile (FileReader &reader)
: CDSong ()
{
uint32_t chunk;
@ -122,7 +122,7 @@ CDDAFile::CDDAFile (FileRdr &reader)
// I_RegisterSong already identified this as a CDDA file, so we
// just need to check the contents we're interested in.
reader.Seek(12, FileRdr::SeekCur);
reader.Seek(12, FileReader::SeekCur);
while (reader.Tell() < endpos)
{
@ -130,11 +130,11 @@ CDDAFile::CDDAFile (FileRdr &reader)
if (chunk != (('f')|(('m')<<8)|(('t')<<16)|((' ')<<24)))
{
reader.Read(&chunk, 4);
reader.Seek(chunk, FileRdr::SeekCur);
reader.Seek(chunk, FileReader::SeekCur);
}
else
{
reader.Seek(6, FileRdr::SeekCur);
reader.Seek(6, FileReader::SeekCur);
reader.Read(&track, 2);
reader.Read(&discid, 4);

View file

@ -550,7 +550,7 @@ static DUMBFILE_SYSTEM mem_dfs = {
//
//==========================================================================
DUMBFILE *dumb_read_allfile(dumbfile_mem_status *filestate, uint8_t *start, FileRdr &reader, int lenhave, int lenfull)
DUMBFILE *dumb_read_allfile(dumbfile_mem_status *filestate, uint8_t *start, FileReader &reader, int lenhave, int lenfull)
{
filestate->size = lenfull;
filestate->offset = 0;
@ -765,7 +765,7 @@ static void MOD_SetAutoChip(DUH *duh)
//
//==========================================================================
MusInfo *MOD_OpenSong(FileRdr &reader)
MusInfo *MOD_OpenSong(FileReader &reader)
{
DUH *duh = 0;
int headsize;
@ -902,7 +902,7 @@ MusInfo *MOD_OpenSong(FileRdr &reader)
{
if (!(f = dumb_read_allfile(&filestate, start, reader, headsize, size)))
{
reader.Seek(fpos, FileRdr::SeekSet);
reader.Seek(fpos, FileReader::SeekSet);
return NULL;
}
}
@ -943,7 +943,7 @@ MusInfo *MOD_OpenSong(FileRdr &reader)
else
{
// Reposition file pointer for other codecs to do their checks.
reader.Seek(fpos, FileRdr::SeekSet);
reader.Seek(fpos, FileReader::SeekSet);
}
if (filestate.ptr != (uint8_t *)start)
{

View file

@ -113,7 +113,7 @@ const char *GME_CheckFormat(uint32_t id)
//
//==========================================================================
MusInfo *GME_OpenSong(FileRdr &reader, const char *fmt)
MusInfo *GME_OpenSong(FileReader &reader, const char *fmt)
{
gme_type_t type;
gme_err_t err;
@ -140,7 +140,7 @@ MusInfo *GME_OpenSong(FileRdr &reader, const char *fmt)
{
delete[] song;
gme_delete(emu);
reader.Seek(fpos, FileRdr::SeekSet);
reader.Seek(fpos, FileReader::SeekSet);
return nullptr;
}
@ -151,7 +151,7 @@ MusInfo *GME_OpenSong(FileRdr &reader, const char *fmt)
{
Printf("Failed loading song: %s\n", err);
gme_delete(emu);
reader.Seek(fpos, FileRdr::SeekSet);
reader.Seek(fpos, FileReader::SeekSet);
return nullptr;
}
gme_set_stereo_depth(emu, clamp(*gme_stereodepth, 0.f, 1.f));

View file

@ -48,7 +48,7 @@
class SndFileSong : public StreamSong
{
public:
SndFileSong(FileRdr &reader, SoundDecoder *decoder, uint32_t loop_start, uint32_t loop_end, bool startass, bool endass);
SndFileSong(FileReader &reader, SoundDecoder *decoder, uint32_t loop_start, uint32_t loop_end, bool startass, bool endass);
~SndFileSong();
bool SetSubsong(int subsong);
void Play(bool looping, int subsong);
@ -56,7 +56,7 @@ public:
protected:
FCriticalSection CritSec;
FileRdr Reader;
FileReader Reader;
SoundDecoder *Decoder;
int Channels;
int SampleRate;
@ -105,7 +105,7 @@ CUSTOM_CVAR(Int, snd_streambuffersize, 64, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
//
//==========================================================================
static void ParseVorbisComments(FileRdr &fr, uint32_t *start, bool *startass, uint32_t *end, bool *endass)
static void ParseVorbisComments(FileReader &fr, uint32_t *start, bool *startass, uint32_t *end, bool *endass)
{
uint8_t vc_data[4];
@ -116,7 +116,7 @@ static void ParseVorbisComments(FileRdr &fr, uint32_t *start, bool *startass, ui
uint32_t vndr_len = vc_data[0] | (vc_data[1]<<8) | (vc_data[2]<<16) | (vc_data[3]<<24);
// Skip vendor string
if(fr.Seek(vndr_len, FileRdr::SeekCur) == -1)
if(fr.Seek(vndr_len, FileReader::SeekCur) == -1)
return;
// Following the vendor string is a 32LE integer for the number of
@ -136,7 +136,7 @@ static void ParseVorbisComments(FileRdr &fr, uint32_t *start, bool *startass, ui
if(length >= 128)
{
// If the comment is "big", skip it
if(fr.Seek(length, FileRdr::SeekCur) == -1)
if(fr.Seek(length, FileReader::SeekCur) == -1)
return;
continue;
}
@ -153,7 +153,7 @@ static void ParseVorbisComments(FileRdr &fr, uint32_t *start, bool *startass, ui
}
}
static void FindFlacComments(FileRdr &fr, uint32_t *loop_start, bool *startass, uint32_t *loop_end, bool *endass)
static void FindFlacComments(FileReader &fr, uint32_t *loop_start, bool *startass, uint32_t *loop_end, bool *endass)
{
// Already verified the fLaC marker, so we're 4 bytes into the file
bool lastblock = false;
@ -175,12 +175,12 @@ static void FindFlacComments(FileRdr &fr, uint32_t *loop_start, bool *startass,
return;
}
if(fr.Seek(blocksize, FileRdr::SeekCur) == -1)
if(fr.Seek(blocksize, FileReader::SeekCur) == -1)
break;
}
}
static void FindOggComments(FileRdr &fr, uint32_t *loop_start, bool *startass, uint32_t *loop_end, bool *endass)
static void FindOggComments(FileReader &fr, uint32_t *loop_start, bool *startass, uint32_t *loop_end, bool *endass)
{
uint8_t ogghead[27];
@ -237,7 +237,7 @@ static void FindOggComments(FileRdr &fr, uint32_t *loop_start, bool *startass, u
segsize -= 7;
}
if(fr.Seek(segsize, FileRdr::SeekCur) == -1)
if(fr.Seek(segsize, FileReader::SeekCur) == -1)
return;
}
@ -250,7 +250,7 @@ static void FindOggComments(FileRdr &fr, uint32_t *loop_start, bool *startass, u
}
}
void FindLoopTags(FileRdr &fr, uint32_t *start, bool *startass, uint32_t *end, bool *endass)
void FindLoopTags(FileReader &fr, uint32_t *start, bool *startass, uint32_t *end, bool *endass)
{
uint8_t signature[4];
@ -268,15 +268,15 @@ void FindLoopTags(FileRdr &fr, uint32_t *start, bool *startass, uint32_t *end, b
//
//==========================================================================
MusInfo *SndFile_OpenSong(FileRdr &fr)
MusInfo *SndFile_OpenSong(FileReader &fr)
{
fr.Seek(0, FileRdr::SeekSet);
fr.Seek(0, FileReader::SeekSet);
uint32_t loop_start = 0, loop_end = ~0u;
bool startass = false, endass = false;
FindLoopTags(fr, &loop_start, &startass, &loop_end, &endass);
fr.Seek(0, FileRdr::SeekSet);
fr.Seek(0, FileReader::SeekSet);
auto decoder = SoundRenderer::CreateDecoder(fr);
if (decoder == nullptr) return nullptr;
return new SndFileSong(fr, decoder, loop_start, loop_end, startass, endass);
@ -288,7 +288,7 @@ MusInfo *SndFile_OpenSong(FileRdr &fr)
//
//==========================================================================
SndFileSong::SndFileSong(FileRdr &reader, SoundDecoder *decoder, uint32_t loop_start, uint32_t loop_end, bool startass, bool endass)
SndFileSong::SndFileSong(FileReader &reader, SoundDecoder *decoder, uint32_t loop_start, uint32_t loop_end, bool startass, bool endass)
{
ChannelConfig iChannels;
SampleType Type;

View file

@ -69,7 +69,7 @@ void OPL_SetCore(const char *args)
if (args != NULL && *args >= '0' && *args < '4') current_opl_core = *args - '0';
}
OPLMUSSong::OPLMUSSong (FileRdr &reader, const char *args)
OPLMUSSong::OPLMUSSong (FileReader &reader, const char *args)
{
int samples = int(OPL_SAMPLE_RATE / 14);

View file

@ -85,7 +85,7 @@ StreamSong::~StreamSong ()
}
}
StreamSong::StreamSong (FileRdr &reader)
StreamSong::StreamSong (FileReader &reader)
{
m_Stream = GSnd->OpenStream (reader, SoundStream::Loop);
}

View file

@ -228,7 +228,7 @@ class OpenALSoundStream : public SoundStream
ALfloat Volume;
FileRdr Reader;
FileReader Reader;
SoundDecoder *Decoder;
static bool DecoderCallback(SoundStream *_sstream, void *ptr, int length, void *user)
{
@ -603,7 +603,7 @@ public:
return true;
}
bool Init(FileRdr &reader, bool loop)
bool Init(FileReader &reader, bool loop)
{
if(!SetupSource())
{
@ -1276,7 +1276,7 @@ std::pair<SoundHandle,bool> OpenALSoundRenderer::LoadSoundRaw(uint8_t *sfxdata,
std::pair<SoundHandle,bool> OpenALSoundRenderer::LoadSound(uint8_t *sfxdata, int length, bool monoize, FSoundLoadBuffer *pBuffer)
{
SoundHandle retval = { NULL };
FileRdr reader;
FileReader reader;
ALenum format = AL_NONE;
ChannelConfig chans;
SampleType type;
@ -1291,7 +1291,7 @@ std::pair<SoundHandle,bool> OpenALSoundRenderer::LoadSound(uint8_t *sfxdata, int
FindLoopTags(reader, &loop_start, &startass, &loop_end, &endass);
reader.Seek(0, FileRdr::SeekSet);
reader.Seek(0, FileReader::SeekSet);
std::unique_ptr<SoundDecoder> decoder(CreateDecoder(reader));
if (!decoder) return std::make_pair(retval, true);
@ -1529,7 +1529,7 @@ SoundStream *OpenALSoundRenderer::CreateStream(SoundStreamCallback callback, int
return stream;
}
SoundStream *OpenALSoundRenderer::OpenStream(FileRdr &reader, int flags)
SoundStream *OpenALSoundRenderer::OpenStream(FileReader &reader, int flags)
{
if(StreamThread.get_id() == std::thread::id())
StreamThread = std::thread(std::mem_fn(&OpenALSoundRenderer::BackgroundProc), this);

View file

@ -136,7 +136,7 @@ public:
// Streaming sounds.
virtual SoundStream *CreateStream(SoundStreamCallback callback, int buffbytes, int flags, int samplerate, void *userdata);
virtual SoundStream *OpenStream(FileRdr &reader, int flags);
virtual SoundStream *OpenStream(FileReader &reader, int flags);
// Starts a sound.
virtual FISoundChannel *StartSound(SoundHandle sfx, float vol, int pitch, int chanflags, FISoundChannel *reuse_chan);

View file

@ -84,7 +84,7 @@ void OPLmusicBlock::Restart()
LastOffset = 0;
}
OPLmusicFile::OPLmusicFile (FileRdr &reader)
OPLmusicFile::OPLmusicFile (FileReader &reader)
: ScoreLen ((int)reader.GetLength())
{
if (io == NULL)

View file

@ -1,7 +1,7 @@
#include "critsec.h"
#include "musicblock.h"
class FileRdr;
class FileReader;
class OPLmusicBlock : public musicBlock
{
@ -34,7 +34,7 @@ protected:
class OPLmusicFile : public OPLmusicBlock
{
public:
OPLmusicFile(FileRdr &reader);
OPLmusicFile(FileReader &reader);
OPLmusicFile(const OPLmusicFile *source, const char *filename);
virtual ~OPLmusicFile();

View file

@ -80,7 +80,7 @@ sf_count_t SndFileDecoder::file_seek(sf_count_t offset, int whence, void *user_d
{
auto &reader = reinterpret_cast<SndFileDecoder*>(user_data)->Reader;
if(reader.Seek((long)offset, (FileRdr::ESeek)whence) != 0)
if(reader.Seek((long)offset, (FileReader::ESeek)whence) != 0)
return -1;
return reader.Tell();
}
@ -110,7 +110,7 @@ SndFileDecoder::~SndFileDecoder()
SndFile = 0;
}
bool SndFileDecoder::open(FileRdr &reader)
bool SndFileDecoder::open(FileReader &reader)
{
if (!IsSndFilePresent()) return false;

View file

@ -26,13 +26,13 @@ struct SndFileDecoder : public SoundDecoder
virtual ~SndFileDecoder();
protected:
virtual bool open(FileRdr &reader);
virtual bool open(FileReader &reader);
private:
SNDFILE *SndFile;
SF_INFO SndInfo;
FileRdr Reader;
FileReader Reader;
static sf_count_t file_get_filelen(void *user_data);
static sf_count_t file_seek(sf_count_t offset, int whence, void *user_data);
static sf_count_t file_read(void *ptr, sf_count_t count, void *user_data);

View file

@ -17,7 +17,7 @@ namespace Timidity
FontFile *Fonts;
extern std::unique_ptr<FSoundFontReader> gus_sfreader;
FontFile *ReadDLS(const char *filename, FileRdr &f)
FontFile *ReadDLS(const char *filename, FileReader &f)
{
return NULL;
}
@ -57,7 +57,7 @@ void font_add(const char *filename, int load_order)
}
else
{
FileRdr fp = gus_sfreader->LookupFile(filename).first;
FileReader fp = gus_sfreader->LookupFile(filename).first;
if (fp.isOpen())
{

View file

@ -28,7 +28,7 @@ class CBadVer {};
struct ListHandler
{
uint32_t ID;
void (*Parser)(SFFile *sf2, FileRdr &f, uint32_t chunkid, uint32_t chunklen);
void (*Parser)(SFFile *sf2, FileReader &f, uint32_t chunkid, uint32_t chunklen);
};
enum
@ -162,15 +162,15 @@ static const SFGenComposite DefaultGenerators =
-1 // overridingRootKey
};
static void ParseIfil(SFFile *sf2, FileRdr &f, uint32_t chunkid, uint32_t chunklen);
static void ParseSmpl(SFFile *sf2, FileRdr &f, uint32_t chunkid, uint32_t chunklen);
static void ParseSm24(SFFile *sf2, FileRdr &f, uint32_t chunkid, uint32_t chunklen);
static void ParsePhdr(SFFile *sf2, FileRdr &f, uint32_t chunkid, uint32_t chunklen);
static void ParseBag(SFFile *sf2, FileRdr &f, uint32_t chunkid, uint32_t chunklen);
static void ParseMod(SFFile *sf2, FileRdr &f, uint32_t chunkid, uint32_t chunklen);
static void ParseGen(SFFile *sf2, FileRdr &f, uint32_t chunkid, uint32_t chunklen);
static void ParseInst(SFFile *sf2, FileRdr &f, uint32_t chunkid, uint32_t chunklen);
static void ParseShdr(SFFile *sf2, FileRdr &f, uint32_t chunkid, uint32_t chunklen);
static void ParseIfil(SFFile *sf2, FileReader &f, uint32_t chunkid, uint32_t chunklen);
static void ParseSmpl(SFFile *sf2, FileReader &f, uint32_t chunkid, uint32_t chunklen);
static void ParseSm24(SFFile *sf2, FileReader &f, uint32_t chunkid, uint32_t chunklen);
static void ParsePhdr(SFFile *sf2, FileReader &f, uint32_t chunkid, uint32_t chunklen);
static void ParseBag(SFFile *sf2, FileReader &f, uint32_t chunkid, uint32_t chunklen);
static void ParseMod(SFFile *sf2, FileReader &f, uint32_t chunkid, uint32_t chunklen);
static void ParseGen(SFFile *sf2, FileReader &f, uint32_t chunkid, uint32_t chunklen);
static void ParseInst(SFFile *sf2, FileReader &f, uint32_t chunkid, uint32_t chunklen);
static void ParseShdr(SFFile *sf2, FileReader &f, uint32_t chunkid, uint32_t chunklen);
ListHandler INFOHandlers[] =
{
@ -225,7 +225,7 @@ static int32_t calc_rate(Renderer *song, int diff, double sec)
}
static inline uint32_t read_id(FileRdr &f)
static inline uint32_t read_id(FileReader &f)
{
uint32_t id;
if (f.Read(&id, 4) != 4)
@ -235,7 +235,7 @@ static inline uint32_t read_id(FileRdr &f)
return id;
}
static inline int read_byte(FileRdr &f)
static inline int read_byte(FileReader &f)
{
uint8_t x;
if (f.Read(&x, 1) != 1)
@ -245,7 +245,7 @@ static inline int read_byte(FileRdr &f)
return x;
}
static inline int read_char(FileRdr &f)
static inline int read_char(FileReader &f)
{
int8_t x;
if (f.Read(&x, 1) != 1)
@ -255,7 +255,7 @@ static inline int read_char(FileRdr &f)
return x;
}
static inline int read_uword(FileRdr &f)
static inline int read_uword(FileReader &f)
{
uint16_t x;
if (f.Read(&x, 2) != 2)
@ -265,7 +265,7 @@ static inline int read_uword(FileRdr &f)
return LittleShort(x);
}
static inline int read_sword(FileRdr &f)
static inline int read_sword(FileReader &f)
{
int16_t x;
if (f.Read(&x, 2) != 2)
@ -275,7 +275,7 @@ static inline int read_sword(FileRdr &f)
return LittleShort(x);
}
static inline uint32_t read_dword(FileRdr &f)
static inline uint32_t read_dword(FileReader &f)
{
uint32_t x;
if (f.Read(&x, 4) != 4)
@ -285,7 +285,7 @@ static inline uint32_t read_dword(FileRdr &f)
return LittleLong(x);
}
static inline void read_name(FileRdr &f, char name[21])
static inline void read_name(FileReader &f, char name[21])
{
if (f.Read(name, 20) != 20)
{
@ -294,18 +294,18 @@ static inline void read_name(FileRdr &f, char name[21])
name[20] = 0;
}
static inline void skip_chunk(FileRdr &f, uint32_t len)
static inline void skip_chunk(FileReader &f, uint32_t len)
{
// RIFF, like IFF, adds an extra pad byte to the end of
// odd-sized chunks so that new chunks are always on even
// byte boundaries.
if (f.Seek(len + (len & 1), FileRdr::SeekCur) != 0)
if (f.Seek(len + (len & 1), FileReader::SeekCur) != 0)
{
throw CIOErr();
}
}
static void check_list(FileRdr &f, uint32_t id, uint32_t filelen, uint32_t &chunklen)
static void check_list(FileReader &f, uint32_t id, uint32_t filelen, uint32_t &chunklen)
{
if (read_id(f) != ID_LIST)
{
@ -322,7 +322,7 @@ static void check_list(FileRdr &f, uint32_t id, uint32_t filelen, uint32_t &chun
}
}
static void ParseIfil(SFFile *sf2, FileRdr &f, uint32_t chunkid, uint32_t chunklen)
static void ParseIfil(SFFile *sf2, FileReader &f, uint32_t chunkid, uint32_t chunklen)
{
uint16_t major, minor;
@ -341,7 +341,7 @@ static void ParseIfil(SFFile *sf2, FileRdr &f, uint32_t chunkid, uint32_t chunkl
sf2->MinorVersion = minor;
}
static void ParseLIST(SFFile *sf2, FileRdr &f, uint32_t chunklen, ListHandler *handlers)
static void ParseLIST(SFFile *sf2, FileReader &f, uint32_t chunklen, ListHandler *handlers)
{
ListHandler *handler;
uint32_t id;
@ -375,7 +375,7 @@ static void ParseLIST(SFFile *sf2, FileRdr &f, uint32_t chunklen, ListHandler *h
}
}
static void ParseINFO(SFFile *sf2, FileRdr &f, uint32_t chunklen)
static void ParseINFO(SFFile *sf2, FileReader &f, uint32_t chunklen)
{
sf2->MinorVersion = -1;
@ -387,7 +387,7 @@ static void ParseINFO(SFFile *sf2, FileRdr &f, uint32_t chunklen)
}
}
static void ParseSdta(SFFile *sf2, FileRdr &f, uint32_t chunklen)
static void ParseSdta(SFFile *sf2, FileReader &f, uint32_t chunklen)
{
ParseLIST(sf2, f, chunklen, SdtaHandlers);
if (sf2->SampleDataOffset == 0)
@ -404,7 +404,7 @@ static void ParseSdta(SFFile *sf2, FileRdr &f, uint32_t chunklen)
}
}
static void ParseSmpl(SFFile *sf2, FileRdr &f, uint32_t chunkid, uint32_t chunklen)
static void ParseSmpl(SFFile *sf2, FileReader &f, uint32_t chunkid, uint32_t chunklen)
{
// Only use the first smpl chunk. (Or should we reject files with more than one?)
if (sf2->SampleDataOffset == 0)
@ -419,7 +419,7 @@ static void ParseSmpl(SFFile *sf2, FileRdr &f, uint32_t chunkid, uint32_t chunkl
skip_chunk(f, chunklen);
}
static void ParseSm24(SFFile *sf2, FileRdr &f, uint32_t chunkid, uint32_t chunklen)
static void ParseSm24(SFFile *sf2, FileReader &f, uint32_t chunkid, uint32_t chunklen)
{
// The sm24 chunk is ignored if the file version is < 2.04
if (sf2->MinorVersion >= 4)
@ -434,12 +434,12 @@ static void ParseSm24(SFFile *sf2, FileRdr &f, uint32_t chunkid, uint32_t chunkl
skip_chunk(f, chunklen);
}
static void ParsePdta(SFFile *sf2, FileRdr &f, uint32_t chunklen)
static void ParsePdta(SFFile *sf2, FileReader &f, uint32_t chunklen)
{
ParseLIST(sf2, f, chunklen, PdtaHandlers);
}
static void ParsePhdr(SFFile *sf2, FileRdr &f, uint32_t chunkid, uint32_t chunklen)
static void ParsePhdr(SFFile *sf2, FileReader &f, uint32_t chunkid, uint32_t chunklen)
{
SFPreset *preset;
@ -477,7 +477,7 @@ static void ParsePhdr(SFFile *sf2, FileRdr &f, uint32_t chunkid, uint32_t chunkl
}
}
static void ParseBag(SFFile *sf2, FileRdr &f, uint32_t chunkid, uint32_t chunklen)
static void ParseBag(SFFile *sf2, FileReader &f, uint32_t chunkid, uint32_t chunklen)
{
SFBag *bags, *bag;
uint16_t prev_mod = 0;
@ -539,7 +539,7 @@ static void ParseBag(SFFile *sf2, FileRdr &f, uint32_t chunkid, uint32_t chunkle
}
}
static void ParseMod(SFFile *sf2, FileRdr &f, uint32_t chunkid, uint32_t chunklen)
static void ParseMod(SFFile *sf2, FileReader &f, uint32_t chunkid, uint32_t chunklen)
{
// Section 7.4, page 23:
// It [the PMOD sub-chunk] is always a multiple of ten bytes in length,
@ -552,7 +552,7 @@ static void ParseMod(SFFile *sf2, FileRdr &f, uint32_t chunkid, uint32_t chunkle
skip_chunk(f, chunklen);
}
static void ParseGen(SFFile *sf2, FileRdr &f, uint32_t chunkid, uint32_t chunklen)
static void ParseGen(SFFile *sf2, FileReader &f, uint32_t chunkid, uint32_t chunklen)
{
SFGenList *gens, *gen;
int numgens;
@ -604,7 +604,7 @@ static void ParseGen(SFFile *sf2, FileRdr &f, uint32_t chunkid, uint32_t chunkle
}
}
static void ParseInst(SFFile *sf2, FileRdr &f, uint32_t chunkid, uint32_t chunklen)
static void ParseInst(SFFile *sf2, FileReader &f, uint32_t chunkid, uint32_t chunklen)
{
int i;
SFInst *inst;
@ -639,7 +639,7 @@ static void ParseInst(SFFile *sf2, FileRdr &f, uint32_t chunkid, uint32_t chunkl
}
}
static void ParseShdr(SFFile *sf2, FileRdr &f, uint32_t chunkid, uint32_t chunklen)
static void ParseShdr(SFFile *sf2, FileReader &f, uint32_t chunkid, uint32_t chunklen)
{
int i;
SFSample *sample;
@ -698,7 +698,7 @@ static void ParseShdr(SFFile *sf2, FileRdr &f, uint32_t chunkid, uint32_t chunkl
}
SFFile *ReadSF2(const char *filename, FileRdr &f)
SFFile *ReadSF2(const char *filename, FileReader &f)
{
SFFile *sf2 = NULL;
uint32_t filelen;
@ -1508,7 +1508,7 @@ void SFFile::ApplyGeneratorsToRegion(SFGenComposite *gen, SFSample *sfsamp, Rend
void SFFile::LoadSample(SFSample *sample)
{
FileRdr fp = gus_sfreader->LookupFile(Filename).first;
FileReader fp = gus_sfreader->LookupFile(Filename).first;
uint32_t i;
if (!fp.isOpen())
@ -1516,7 +1516,7 @@ void SFFile::LoadSample(SFSample *sample)
return;
}
sample->InMemoryData = new float[sample->End - sample->Start + 1];
fp.Seek(SampleDataOffset + sample->Start * 2, FileRdr::SeekSet);
fp.Seek(SampleDataOffset + sample->Start * 2, FileReader::SeekSet);
// Load 16-bit sample data.
for (i = 0; i < sample->End - sample->Start; ++i)
{
@ -1525,7 +1525,7 @@ void SFFile::LoadSample(SFSample *sample)
}
if (SampleDataLSBOffset != 0)
{ // Load lower 8 bits of 24-bit sample data.
fp.Seek(SampleDataLSBOffset + sample->Start, FileRdr::SeekSet);
fp.Seek(SampleDataLSBOffset + sample->Start, FileReader::SeekSet);
for (i = 0; i < sample->End - sample->Start; ++i)
{
uint8_t samp = fp.ReadUInt8();

View file

@ -315,4 +315,4 @@ struct SFFile : public Timidity::FontFile
int NumSamples;
};
SFFile *ReadSF2(const char *filename, FileRdr &f);
SFFile *ReadSF2(const char *filename, FileReader &f);

View file

@ -82,7 +82,7 @@ static bool InitReader(const char *config_file)
static int read_config_file(const char *name, bool ismain)
{
FileRdr fp;
FileReader fp;
char tmp[1024], *cp;
ToneBank *bank = NULL;
int i, j, k, line = 0, words;
@ -596,7 +596,7 @@ int LoadDMXGUS()
int status = -1;
int gusbank = (gus_memsize >= 1 && gus_memsize <= 4) ? gus_memsize : -1;
data.Seek(0, FileRdr::SeekSet);
data.Seek(0, FileReader::SeekSet);
while (data.Gets(readbuffer, 1024) && read < size)
{

View file

@ -361,7 +361,7 @@ void font_order(int order, int bank, int preset, int keynote);
Instrument *load_instrument_font(struct Renderer *song, const char *font, int drum, int bank, int instrument);
Instrument *load_instrument_font_order(struct Renderer *song, int order, int drum, int bank, int instrument);
FontFile *ReadDLS(const char *filename, FileRdr &f);
FontFile *ReadDLS(const char *filename, FileReader &f);
/*
mix.h

View file

@ -130,7 +130,7 @@ double flt_rand()
struct timidity_file *open_file(const char *name, FSoundFontReader *sfreader)
{
FileRdr fr;
FileReader fr;
FString filename;
if (name == nullptr)
{
@ -161,7 +161,7 @@ void tf_close(struct timidity_file *tf)
/* This is meant for skipping a few bytes. */
void skip(struct timidity_file *tf, size_t len)
{
tf->url.Seek((long)len, FileRdr::SeekCur);
tf->url.Seek((long)len, FileReader::SeekCur);
}
char *tf_gets(char *buff, int n, struct timidity_file *tf)
@ -184,7 +184,7 @@ long tf_read(void *buff, int32_t size, int32_t nitems, struct timidity_file *tf)
long tf_seek(struct timidity_file *tf, long offset, int whence)
{
return (long)tf->url.Seek(offset, (FileRdr::ESeek)whence);
return (long)tf->url.Seek(offset, (FileReader::ESeek)whence);
}
long tf_tell(struct timidity_file *tf)

View file

@ -35,7 +35,7 @@ namespace TimidityPlus
struct timidity_file
{
FileRdr url;
FileReader url;
std::string filename;
};

View file

@ -60,7 +60,7 @@ bool _WM_InitReader(const char *config_file)
unsigned char *_WM_BufferFile(const char *filename, unsigned long int *size)
{
FileRdr fp;
FileReader fp;
if (filename == nullptr)
{

View file

@ -676,7 +676,7 @@ static int WM_LoadConfig(const char *config_file, bool main) {
int token_count = 0;
auto config_parm = config_file;
FileRdr fr;
FileReader fr;
if (main)
{
if (!_WM_InitReader(config_file)) return -1; // unable to open this as a config file.

View file

@ -72,7 +72,7 @@ private:
//
//==========================================================================
FTexture *AutomapTexture_TryCreate(FileRdr &data, int lumpnum)
FTexture *AutomapTexture_TryCreate(FileReader &data, int lumpnum)
{
if (data.GetLength() < 320) return NULL;
if (!Wads.CheckLumpName(lumpnum, "AUTOPAGE")) return NULL;

View file

@ -306,7 +306,7 @@ int FTextureManager::CountBuildTiles ()
FString artpath = rffpath;
artpath += artfile;
FileRdr fr;
FileReader fr;
if (!fr.OpenFile(artpath))
{

View file

@ -156,7 +156,7 @@ struct DDSFileHeader
class FDDSTexture : public FTexture
{
public:
FDDSTexture (FileRdr &lump, int lumpnum, void *surfdesc);
FDDSTexture (FileReader &lump, int lumpnum, void *surfdesc);
~FDDSTexture ();
const uint8_t *GetColumn (unsigned int column, const Span **spans_out);
@ -181,10 +181,10 @@ protected:
static void CalcBitShift (uint32_t mask, uint8_t *lshift, uint8_t *rshift);
void MakeTexture ();
void ReadRGB (FileRdr &lump, uint8_t *tcbuf = NULL);
void DecompressDXT1 (FileRdr &lump, uint8_t *tcbuf = NULL);
void DecompressDXT3 (FileRdr &lump, bool premultiplied, uint8_t *tcbuf = NULL);
void DecompressDXT5 (FileRdr &lump, bool premultiplied, uint8_t *tcbuf = NULL);
void ReadRGB (FileReader &lump, uint8_t *tcbuf = NULL);
void DecompressDXT1 (FileReader &lump, uint8_t *tcbuf = NULL);
void DecompressDXT3 (FileReader &lump, bool premultiplied, uint8_t *tcbuf = NULL);
void DecompressDXT5 (FileReader &lump, bool premultiplied, uint8_t *tcbuf = NULL);
int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf = NULL);
bool UseBasePalette();
@ -199,11 +199,11 @@ protected:
//
//==========================================================================
static bool CheckDDS (FileRdr &file)
static bool CheckDDS (FileReader &file)
{
DDSFileHeader Header;
file.Seek(0, FileRdr::SeekSet);
file.Seek(0, FileReader::SeekSet);
if (file.Read (&Header, sizeof(Header)) != sizeof(Header))
{
return false;
@ -222,7 +222,7 @@ static bool CheckDDS (FileRdr &file)
//
//==========================================================================
FTexture *DDSTexture_TryCreate (FileRdr &data, int lumpnum)
FTexture *DDSTexture_TryCreate (FileReader &data, int lumpnum)
{
union
{
@ -232,7 +232,7 @@ FTexture *DDSTexture_TryCreate (FileRdr &data, int lumpnum)
if (!CheckDDS(data)) return NULL;
data.Seek(4, FileRdr::SeekSet);
data.Seek(4, FileReader::SeekSet);
data.Read (&surfdesc, sizeof(surfdesc));
#ifdef __BIG_ENDIAN__
@ -286,7 +286,7 @@ FTexture *DDSTexture_TryCreate (FileRdr &data, int lumpnum)
//
//==========================================================================
FDDSTexture::FDDSTexture (FileRdr &lump, int lumpnum, void *vsurfdesc)
FDDSTexture::FDDSTexture (FileReader &lump, int lumpnum, void *vsurfdesc)
: FTexture(NULL, lumpnum), Pixels(0), Spans(0)
{
DDSURFACEDESC2 *surf = (DDSURFACEDESC2 *)vsurfdesc;
@ -492,7 +492,7 @@ void FDDSTexture::MakeTexture ()
Pixels = new uint8_t[Width*Height];
lump.Seek (sizeof(DDSURFACEDESC2) + 4, FileRdr::SeekSet);
lump.Seek (sizeof(DDSURFACEDESC2) + 4, FileReader::SeekSet);
if (Format >= 1 && Format <= 4) // RGB: Format is # of bytes per pixel
{
@ -518,7 +518,7 @@ void FDDSTexture::MakeTexture ()
//
//==========================================================================
void FDDSTexture::ReadRGB (FileRdr &lump, uint8_t *tcbuf)
void FDDSTexture::ReadRGB (FileReader &lump, uint8_t *tcbuf)
{
uint32_t x, y;
uint32_t amask = AMask == 0 ? 0 : 0x80000000 >> AShiftL;
@ -587,7 +587,7 @@ void FDDSTexture::ReadRGB (FileRdr &lump, uint8_t *tcbuf)
//
//==========================================================================
void FDDSTexture::DecompressDXT1 (FileRdr &lump, uint8_t *tcbuf)
void FDDSTexture::DecompressDXT1 (FileReader &lump, uint8_t *tcbuf)
{
const long blocklinelen = ((Width + 3) >> 2) << 3;
uint8_t *blockbuff = new uint8_t[blocklinelen];
@ -685,7 +685,7 @@ void FDDSTexture::DecompressDXT1 (FileRdr &lump, uint8_t *tcbuf)
//
//==========================================================================
void FDDSTexture::DecompressDXT3 (FileRdr &lump, bool premultiplied, uint8_t *tcbuf)
void FDDSTexture::DecompressDXT3 (FileReader &lump, bool premultiplied, uint8_t *tcbuf)
{
const long blocklinelen = ((Width + 3) >> 2) << 4;
uint8_t *blockbuff = new uint8_t[blocklinelen];
@ -767,7 +767,7 @@ void FDDSTexture::DecompressDXT3 (FileRdr &lump, bool premultiplied, uint8_t *tc
//
//==========================================================================
void FDDSTexture::DecompressDXT5 (FileRdr &lump, bool premultiplied, uint8_t *tcbuf)
void FDDSTexture::DecompressDXT5 (FileReader &lump, bool premultiplied, uint8_t *tcbuf)
{
const long blocklinelen = ((Width + 3) >> 2) << 4;
uint8_t *blockbuff = new uint8_t[blocklinelen];
@ -885,7 +885,7 @@ int FDDSTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
uint8_t *TexBuffer = new uint8_t[4*Width*Height];
lump.Seek (sizeof(DDSURFACEDESC2) + 4, FileRdr::SeekSet);
lump.Seek (sizeof(DDSURFACEDESC2) + 4, FileReader::SeekSet);
if (Format >= 1 && Format <= 4) // RGB: Format is # of bytes per pixel
{

View file

@ -68,11 +68,11 @@ protected:
//
//==========================================================================
FTexture *EmptyTexture_TryCreate(FileRdr & file, int lumpnum)
FTexture *EmptyTexture_TryCreate(FileReader & file, int lumpnum)
{
char check[8];
if (file.GetLength() != 8) return NULL;
file.Seek(0, FileRdr::SeekSet);
file.Seek(0, FileReader::SeekSet);
if (file.Read(check, 8) != 8) return NULL;
if (memcmp(check, "\0\0\0\0\0\0\0\0", 8)) return NULL;

View file

@ -74,7 +74,7 @@ protected:
//
//==========================================================================
FTexture *FlatTexture_TryCreate(FileRdr & file, int lumpnum)
FTexture *FlatTexture_TryCreate(FileReader & file, int lumpnum)
{
return new FFlatTexture(lumpnum);
}

View file

@ -83,13 +83,13 @@ protected:
//
//==========================================================================
FTexture *IMGZTexture_TryCreate(FileRdr & file, int lumpnum)
FTexture *IMGZTexture_TryCreate(FileReader & file, int lumpnum)
{
uint32_t magic = 0;
uint16_t w, h;
int16_t l, t;
file.Seek(0, FileRdr::SeekSet);
file.Seek(0, FileReader::SeekSet);
if (file.Read(&magic, 4) != 4) return NULL;
if (magic != MAKE_ID('I','M','G','Z')) return NULL;
w = file.ReadUInt16();

View file

@ -50,11 +50,11 @@ extern "C"
struct FLumpSourceMgr : public jpeg_source_mgr
{
FileRdr *Lump;
FileReader *Lump;
JOCTET Buffer[4096];
bool StartOfFile;
FLumpSourceMgr (FileRdr *lump, j_decompress_ptr cinfo);
FLumpSourceMgr (FileReader *lump, j_decompress_ptr cinfo);
static void InitSource (j_decompress_ptr cinfo);
static boolean FillInputBuffer (j_decompress_ptr cinfo);
static void SkipInputData (j_decompress_ptr cinfo, long num_bytes);
@ -113,7 +113,7 @@ void FLumpSourceMgr::SkipInputData (j_decompress_ptr cinfo, long num_bytes)
else
{
num_bytes -= (long)me->bytes_in_buffer;
me->Lump->Seek (num_bytes, FileRdr::SeekCur);
me->Lump->Seek (num_bytes, FileReader::SeekCur);
FillInputBuffer (cinfo);
}
}
@ -134,7 +134,7 @@ void FLumpSourceMgr::TermSource (j_decompress_ptr cinfo)
//
//==========================================================================
FLumpSourceMgr::FLumpSourceMgr (FileRdr *lump, j_decompress_ptr cinfo)
FLumpSourceMgr::FLumpSourceMgr (FileReader *lump, j_decompress_ptr cinfo)
: Lump (lump)
{
cinfo->src = this;
@ -208,7 +208,7 @@ protected:
//
//==========================================================================
FTexture *JPEGTexture_TryCreate(FileRdr & data, int lumpnum)
FTexture *JPEGTexture_TryCreate(FileReader & data, int lumpnum)
{
union
{
@ -217,7 +217,7 @@ FTexture *JPEGTexture_TryCreate(FileRdr & data, int lumpnum)
uint8_t b[4];
} first4bytes;
data.Seek(0, FileRdr::SeekSet);
data.Seek(0, FileReader::SeekSet);
if (data.Read(&first4bytes, 4) < 4) return NULL;
if (first4bytes.b[0] != 0xFF || first4bytes.b[1] != 0xD8 || first4bytes.b[2] != 0xFF)
@ -231,7 +231,7 @@ FTexture *JPEGTexture_TryCreate(FileRdr & data, int lumpnum)
{
return NULL;
}
data.Seek (BigShort(first4bytes.w[0]) - 2, FileRdr::SeekCur);
data.Seek (BigShort(first4bytes.w[0]) - 2, FileReader::SeekCur);
if (data.Read (first4bytes.b + 2, 2) != 2 || first4bytes.b[2] != 0xFF)
{
return NULL;

View file

@ -81,12 +81,12 @@ protected:
//
//==========================================================================
static bool CheckIfPatch(FileRdr & file)
static bool CheckIfPatch(FileReader & file)
{
if (file.GetLength() < 13) return false; // minimum length of a valid Doom patch
uint8_t *data = new uint8_t[file.GetLength()];
file.Seek(0, FileRdr::SeekSet);
file.Seek(0, FileReader::SeekSet);
file.Read(data, file.GetLength());
const patch_t *foo = (const patch_t *)data;
@ -129,12 +129,12 @@ static bool CheckIfPatch(FileRdr & file)
//
//==========================================================================
FTexture *PatchTexture_TryCreate(FileRdr & file, int lumpnum)
FTexture *PatchTexture_TryCreate(FileReader & file, int lumpnum)
{
patch_t header;
if (!CheckIfPatch(file)) return NULL;
file.Seek(0, FileRdr::SeekSet);
file.Seek(0, FileReader::SeekSet);
header.width = file.ReadUInt16();
header.height = file.ReadUInt16();
header.leftoffset = file.ReadInt16();

View file

@ -99,10 +99,10 @@ protected:
uint8_t *Pixels;
Span DummySpans[2];
void ReadPCX1bit (uint8_t *dst, FileRdr & lump, PCXHeader *hdr);
void ReadPCX4bits (uint8_t *dst, FileRdr & lump, PCXHeader *hdr);
void ReadPCX8bits (uint8_t *dst, FileRdr & lump, PCXHeader *hdr);
void ReadPCX24bits (uint8_t *dst, FileRdr & lump, PCXHeader *hdr, int planes);
void ReadPCX1bit (uint8_t *dst, FileReader & lump, PCXHeader *hdr);
void ReadPCX4bits (uint8_t *dst, FileReader & lump, PCXHeader *hdr);
void ReadPCX8bits (uint8_t *dst, FileReader & lump, PCXHeader *hdr);
void ReadPCX24bits (uint8_t *dst, FileReader & lump, PCXHeader *hdr, int planes);
virtual void MakeTexture ();
@ -116,11 +116,11 @@ protected:
//
//==========================================================================
FTexture * PCXTexture_TryCreate(FileRdr & file, int lumpnum)
FTexture * PCXTexture_TryCreate(FileReader & file, int lumpnum)
{
PCXHeader hdr;
file.Seek(0, FileRdr::SeekSet);
file.Seek(0, FileReader::SeekSet);
if (file.Read(&hdr, sizeof(hdr)) != sizeof(hdr))
{
return NULL;
@ -141,7 +141,7 @@ FTexture * PCXTexture_TryCreate(FileRdr & file, int lumpnum)
if (hdr.padding[i] != 0) return NULL;
}
file.Seek(0, FileRdr::SeekSet);
file.Seek(0, FileReader::SeekSet);
file.Read(&hdr, sizeof(hdr));
return new FPCXTexture(lumpnum, hdr);
@ -256,7 +256,7 @@ const uint8_t *FPCXTexture::GetPixels ()
//
//==========================================================================
void FPCXTexture::ReadPCX1bit (uint8_t *dst, FileRdr & lump, PCXHeader *hdr)
void FPCXTexture::ReadPCX1bit (uint8_t *dst, FileReader & lump, PCXHeader *hdr)
{
int y, i, bytes;
int rle_count = 0;
@ -304,7 +304,7 @@ void FPCXTexture::ReadPCX1bit (uint8_t *dst, FileRdr & lump, PCXHeader *hdr)
//
//==========================================================================
void FPCXTexture::ReadPCX4bits (uint8_t *dst, FileRdr & lump, PCXHeader *hdr)
void FPCXTexture::ReadPCX4bits (uint8_t *dst, FileReader & lump, PCXHeader *hdr)
{
int rle_count = 0, rle_value = 0;
int x, y, c;
@ -367,7 +367,7 @@ void FPCXTexture::ReadPCX4bits (uint8_t *dst, FileRdr & lump, PCXHeader *hdr)
//
//==========================================================================
void FPCXTexture::ReadPCX8bits (uint8_t *dst, FileRdr & lump, PCXHeader *hdr)
void FPCXTexture::ReadPCX8bits (uint8_t *dst, FileReader & lump, PCXHeader *hdr)
{
int rle_count = 0, rle_value = 0;
int y, bytes;
@ -409,7 +409,7 @@ void FPCXTexture::ReadPCX8bits (uint8_t *dst, FileRdr & lump, PCXHeader *hdr)
//
//==========================================================================
void FPCXTexture::ReadPCX24bits (uint8_t *dst, FileRdr & lump, PCXHeader *hdr, int planes)
void FPCXTexture::ReadPCX24bits (uint8_t *dst, FileReader & lump, PCXHeader *hdr, int planes)
{
int rle_count = 0, rle_value = 0;
int y, c;
@ -493,7 +493,7 @@ void FPCXTexture::MakeTexture()
}
else if (bitcount == 8)
{
lump.Seek(-769, FileRdr::SeekEnd);
lump.Seek(-769, FileReader::SeekEnd);
uint8_t c = lump.ReadUInt8();
//if (c !=0x0c) memcpy(PaletteMap, GrayMap, 256); // Fallback for files without palette
//else
@ -504,7 +504,7 @@ void FPCXTexture::MakeTexture()
uint8_t b = lump.ReadUInt8();
PaletteMap[i] = ColorMatcher.Pick(r,g,b);
}
lump.Seek(sizeof(header), FileRdr::SeekSet);
lump.Seek(sizeof(header), FileReader::SeekSet);
ReadPCX8bits (Pixels, lump, &header);
}
if (Width == Height)
@ -582,7 +582,7 @@ int FPCXTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
}
else if (bitcount == 8)
{
lump.Seek(-769, FileRdr::SeekEnd);
lump.Seek(-769, FileReader::SeekEnd);
uint8_t c = lump.ReadUInt8();
c=0x0c; // Apparently there's many non-compliant PCXs out there...
if (c !=0x0c)
@ -596,7 +596,7 @@ int FPCXTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
uint8_t b = lump.ReadUInt8();
pe[i] = PalEntry(255, r,g,b);
}
lump.Seek(sizeof(header), FileRdr::SeekSet);
lump.Seek(sizeof(header), FileReader::SeekSet);
ReadPCX8bits (Pixels, lump, &header);
}
bmp->CopyPixelData(x, y, Pixels, Width, Height, 1, Width, rotate, pe, inf);

View file

@ -51,7 +51,7 @@
class FPNGTexture : public FTexture
{
public:
FPNGTexture (FileRdr &lump, int lumpnum, const FString &filename, int width, int height, uint8_t bitdepth, uint8_t colortype, uint8_t interlace);
FPNGTexture (FileReader &lump, int lumpnum, const FString &filename, int width, int height, uint8_t bitdepth, uint8_t colortype, uint8_t interlace);
~FPNGTexture ();
const uint8_t *GetColumn (unsigned int column, const Span **spans_out);
@ -66,7 +66,7 @@ protected:
FString SourceFile;
uint8_t *Pixels;
Span **Spans;
FileRdr fr;
FileReader fr;
uint8_t BitDepth;
uint8_t ColorType;
@ -90,7 +90,7 @@ protected:
//
//==========================================================================
FTexture *PNGTexture_TryCreate(FileRdr & data, int lumpnum)
FTexture *PNGTexture_TryCreate(FileReader & data, int lumpnum)
{
union
{
@ -104,7 +104,7 @@ FTexture *PNGTexture_TryCreate(FileRdr & data, int lumpnum)
// first 4 bytes match, but later bytes don't, we assume it's
// a corrupt PNG.)
data.Seek(0, FileRdr::SeekSet);
data.Seek(0, FileReader::SeekSet);
if (data.Read (first4bytes.b, 4) != 4) return NULL;
if (first4bytes.dw != MAKE_ID(137,'P','N','G')) return NULL;
if (data.Read (first4bytes.b, 4) != 4) return NULL;
@ -138,7 +138,7 @@ FTexture *PNGTexture_TryCreate(FileRdr & data, int lumpnum)
}
// Just for completeness, make sure the PNG has something more than an IHDR.
data.Seek (4, FileRdr::SeekSet);
data.Seek (4, FileReader::SeekSet);
data.Read (first4bytes.b, 4);
if (first4bytes.dw == 0)
{
@ -198,7 +198,7 @@ FTexture *PNGTexture_CreateFromFile(PNGHandle *png, const FString &filename)
//
//==========================================================================
FPNGTexture::FPNGTexture (FileRdr &lump, int lumpnum, const FString &filename, int width, int height,
FPNGTexture::FPNGTexture (FileReader &lump, int lumpnum, const FString &filename, int width, int height,
uint8_t depth, uint8_t colortype, uint8_t interlace)
: FTexture(NULL, lumpnum), SourceFile(filename), Pixels(0), Spans(0),
BitDepth(depth), ColorType(colortype), Interlace(interlace), HaveTrans(false),
@ -225,7 +225,7 @@ FPNGTexture::FPNGTexture (FileRdr &lump, int lumpnum, const FString &filename, i
memset(trans, 255, 256);
// Parse pre-IDAT chunks. I skip the CRCs. Is that bad?
lump.Seek(33, FileRdr::SeekSet);
lump.Seek(33, FileReader::SeekSet);
lump.Read(&len, 4);
lump.Read(&id, 4);
@ -235,7 +235,7 @@ FPNGTexture::FPNGTexture (FileRdr &lump, int lumpnum, const FString &filename, i
switch (id)
{
default:
lump.Seek (len, FileRdr::SeekCur);
lump.Seek (len, FileReader::SeekCur);
break;
case MAKE_ID('g','r','A','b'):
@ -268,7 +268,7 @@ FPNGTexture::FPNGTexture (FileRdr &lump, int lumpnum, const FString &filename, i
lump.Read (p.pngpal, PaletteSize * 3);
if (PaletteSize * 3 != (int)len)
{
lump.Seek (len - PaletteSize * 3, FileRdr::SeekCur);
lump.Seek (len - PaletteSize * 3, FileReader::SeekCur);
}
for (i = PaletteSize - 1; i >= 0; --i)
{
@ -290,7 +290,7 @@ FPNGTexture::FPNGTexture (FileRdr &lump, int lumpnum, const FString &filename, i
bMasked = true;
break;
}
lump.Seek(4, FileRdr::SeekCur); // Skip CRC
lump.Seek(4, FileReader::SeekCur); // Skip CRC
lump.Read(&len, 4);
id = MAKE_ID('I','E','N','D');
lump.Read(&id, 4);
@ -459,8 +459,8 @@ const uint8_t *FPNGTexture::GetPixels ()
void FPNGTexture::MakeTexture ()
{
FileRdr *lump;
FileRdr lfr;
FileReader *lump;
FileReader lfr;
if (SourceLump >= 0)
{
@ -480,7 +480,7 @@ void FPNGTexture::MakeTexture ()
else
{
uint32_t len, id;
lump->Seek (StartOfIDAT, FileRdr::SeekSet);
lump->Seek (StartOfIDAT, FileReader::SeekSet);
lump->Read(&len, 4);
lump->Read(&id, 4);
@ -623,8 +623,8 @@ int FPNGTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
int pixwidth = Width * bpp[ColorType];
int transpal = false;
FileRdr *lump;
FileRdr lfr;
FileReader *lump;
FileReader lfr;
if (SourceLump >= 0)
{
@ -636,7 +636,7 @@ int FPNGTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
lump = &fr;
}
lump->Seek(33, FileRdr::SeekSet);
lump->Seek(33, FileReader::SeekSet);
for(int i = 0; i < 256; i++) // default to a gray map
pe[i] = PalEntry(255,i,i,i);
@ -648,7 +648,7 @@ int FPNGTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
switch (id)
{
default:
lump->Seek (len, FileRdr::SeekCur);
lump->Seek (len, FileReader::SeekCur);
break;
case MAKE_ID('P','L','T','E'):
@ -672,11 +672,11 @@ int FPNGTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
}
else
{
lump->Seek(len, FileRdr::SeekCur);
lump->Seek(len, FileReader::SeekCur);
}
break;
}
lump->Seek(4, FileRdr::SeekCur); // Skip CRC
lump->Seek(4, FileReader::SeekCur); // Skip CRC
lump->Read(&len, 4);
id = MAKE_ID('I','E','N','D');
lump->Read(&id, 4);
@ -690,7 +690,7 @@ int FPNGTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
uint8_t * Pixels = new uint8_t[pixwidth * Height];
lump->Seek (StartOfIDAT, FileRdr::SeekSet);
lump->Seek (StartOfIDAT, FileReader::SeekSet);
lump->Read(&len, 4);
lump->Read(&id, 4);
M_ReadIDAT (*lump, Pixels, Width, Height, pixwidth, BitDepth, ColorType, Interlace, BigLong((unsigned int)len));

View file

@ -70,7 +70,7 @@ protected:
//
//==========================================================================
static bool CheckIfRaw(FileRdr & data)
static bool CheckIfRaw(FileReader & data)
{
if (data.GetLength() != 64000) return false;
@ -80,7 +80,7 @@ static bool CheckIfRaw(FileRdr & data)
int width;
foo = (patch_t *)M_Malloc (data.GetLength());
data.Seek (0, FileRdr::SeekSet);
data.Seek (0, FileReader::SeekSet);
data.Read (foo, data.GetLength());
height = LittleShort(foo->height);
@ -148,7 +148,7 @@ static bool CheckIfRaw(FileRdr & data)
//
//==========================================================================
FTexture *RawPageTexture_TryCreate(FileRdr & file, int lumpnum)
FTexture *RawPageTexture_TryCreate(FileReader & file, int lumpnum)
{
if (!CheckIfRaw(file)) return NULL;
return new FRawPageTexture(lumpnum);

View file

@ -47,7 +47,7 @@
#include "textures/textures.h"
#include "v_palette.h"
typedef FTexture * (*CreateFunc)(FileRdr & file, int lumpnum);
typedef FTexture * (*CreateFunc)(FileReader & file, int lumpnum);
struct TexCreateInfo
{
@ -65,17 +65,17 @@ void FTexture::InitGrayMap()
}
}
FTexture *IMGZTexture_TryCreate(FileRdr &, int lumpnum);
FTexture *PNGTexture_TryCreate(FileRdr &, int lumpnum);
FTexture *JPEGTexture_TryCreate(FileRdr &, int lumpnum);
FTexture *DDSTexture_TryCreate(FileRdr &, int lumpnum);
FTexture *PCXTexture_TryCreate(FileRdr &, int lumpnum);
FTexture *TGATexture_TryCreate(FileRdr &, int lumpnum);
FTexture *RawPageTexture_TryCreate(FileRdr &, int lumpnum);
FTexture *FlatTexture_TryCreate(FileRdr &, int lumpnum);
FTexture *PatchTexture_TryCreate(FileRdr &, int lumpnum);
FTexture *EmptyTexture_TryCreate(FileRdr &, int lumpnum);
FTexture *AutomapTexture_TryCreate(FileRdr &, int lumpnum);
FTexture *IMGZTexture_TryCreate(FileReader &, int lumpnum);
FTexture *PNGTexture_TryCreate(FileReader &, int lumpnum);
FTexture *JPEGTexture_TryCreate(FileReader &, int lumpnum);
FTexture *DDSTexture_TryCreate(FileReader &, int lumpnum);
FTexture *PCXTexture_TryCreate(FileReader &, int lumpnum);
FTexture *TGATexture_TryCreate(FileReader &, int lumpnum);
FTexture *RawPageTexture_TryCreate(FileReader &, int lumpnum);
FTexture *FlatTexture_TryCreate(FileReader &, int lumpnum);
FTexture *PatchTexture_TryCreate(FileReader &, int lumpnum);
FTexture *EmptyTexture_TryCreate(FileReader &, int lumpnum);
FTexture *AutomapTexture_TryCreate(FileReader &, int lumpnum);
// Examines the lump contents to decide what type of texture to create,

View file

@ -94,7 +94,7 @@ protected:
uint8_t *Pixels;
Span **Spans;
void ReadCompressed(FileRdr &lump, uint8_t * buffer, int bytesperpixel);
void ReadCompressed(FileReader &lump, uint8_t * buffer, int bytesperpixel);
virtual void MakeTexture ();
@ -107,13 +107,13 @@ protected:
//
//==========================================================================
FTexture *TGATexture_TryCreate(FileRdr & file, int lumpnum)
FTexture *TGATexture_TryCreate(FileReader & file, int lumpnum)
{
TGAHeader hdr;
if (file.GetLength() < (long)sizeof(hdr)) return NULL;
file.Seek(0, FileRdr::SeekSet);
file.Seek(0, FileReader::SeekSet);
file.Read(&hdr, sizeof(hdr));
hdr.width = LittleShort(hdr.width);
hdr.height = LittleShort(hdr.height);
@ -127,7 +127,7 @@ FTexture *TGATexture_TryCreate(FileRdr & file, int lumpnum)
if (hdr.img_type >=4 && hdr.img_type <= 8) return NULL;
if ((hdr.img_desc & 16) != 0) return NULL;
file.Seek(0, FileRdr::SeekSet);
file.Seek(0, FileReader::SeekSet);
file.Read(&hdr, sizeof(hdr));
hdr.width = LittleShort(hdr.width);
hdr.height = LittleShort(hdr.height);
@ -250,7 +250,7 @@ const uint8_t *FTGATexture::GetPixels ()
//
//==========================================================================
void FTGATexture::ReadCompressed(FileRdr &lump, uint8_t * buffer, int bytesperpixel)
void FTGATexture::ReadCompressed(FileReader &lump, uint8_t * buffer, int bytesperpixel)
{
uint8_t data[4];
int Size = Width * Height;
@ -297,7 +297,7 @@ void FTGATexture::MakeTexture ()
Pixels = new uint8_t[Width*Height];
lump.Read(&hdr, sizeof(hdr));
lump.Seek(hdr.id_len, FileRdr::SeekCur);
lump.Seek(hdr.id_len, FileReader::SeekCur);
hdr.width = LittleShort(hdr.width);
hdr.height = LittleShort(hdr.height);
@ -503,7 +503,7 @@ int FTGATexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
int transval = 0;
lump.Read(&hdr, sizeof(hdr));
lump.Seek(hdr.id_len, FileRdr::SeekCur);
lump.Seek(hdr.id_len, FileReader::SeekCur);
hdr.width = LittleShort(hdr.width);
hdr.height = LittleShort(hdr.height);

View file

@ -1868,18 +1868,18 @@ void FFontChar2::MakeTexture ()
{
lump.Read (buff, 7);
max = buff[6];
lump.Seek (SourcePos - 11, FileRdr::SeekCur);
lump.Seek (SourcePos - 11, FileReader::SeekCur);
}
else if (buff[3] == 0x1A)
{
lump.Read(buff, 13);
max = buff[12] - 1;
lump.Seek (SourcePos - 17, FileRdr::SeekCur);
lump.Seek (SourcePos - 17, FileReader::SeekCur);
rle = false;
}
else
{
lump.Seek (SourcePos - 4, FileRdr::SeekCur);
lump.Seek (SourcePos - 4, FileReader::SeekCur);
}
}

View file

@ -225,11 +225,11 @@ int FWadCollection::AddExternalFile(const char *filename)
// [RH] Removed reload hack
//==========================================================================
void FWadCollection::AddFile (const char *filename, FileRdr *wadr)
void FWadCollection::AddFile (const char *filename, FileReader *wadr)
{
int startlump;
bool isdir = false;
FileRdr wadreader;
FileReader wadreader;
if (wadr == nullptr)
{
@ -304,7 +304,7 @@ void FWadCollection::AddFile (const char *filename, FileRdr *wadr)
if (wadreader.isOpen())
{
MD5Context md5;
wadreader.Seek(0, FileRdr::SeekSet);
wadreader.Seek(0, FileReader::SeekSet);
md5.Update(wadreader, (unsigned)wadreader.GetLength());
md5.Final(cksum);
@ -932,7 +932,7 @@ void FWadCollection::RenameNerve ()
// cheaper way to know this is not the file
continue;
}
fr->Seek(0, FileRdr::SeekSet);
fr->Seek(0, FileReader::SeekSet);
MD5Context md5;
md5.Update(*fr, (unsigned)fr->GetLength());
md5.Final(cksum);
@ -982,7 +982,7 @@ void FWadCollection::FixMacHexen()
return;
}
FileRdr *reader = GetFileReader(GetIwadNum());
FileReader *reader = GetFileReader(GetIwadNum());
auto iwadSize = reader->GetLength();
static const long DEMO_SIZE = 13596228;
@ -996,7 +996,7 @@ void FWadCollection::FixMacHexen()
return;
}
reader->Seek(0, FileRdr::SeekSet);
reader->Seek(0, FileReader::SeekSet);
uint8_t checksum[16];
MD5Context md5;
@ -1305,7 +1305,7 @@ DEFINE_ACTION_FUNCTION(_Wads, ReadLump)
//==========================================================================
FileRdr FWadCollection::OpenLumpReader(int lump)
FileReader FWadCollection::OpenLumpReader(int lump)
{
if ((unsigned)lump >= (unsigned)LumpInfo.Size())
{
@ -1317,14 +1317,14 @@ FileRdr FWadCollection::OpenLumpReader(int lump)
if (rl->RefCount == 0 && rd != nullptr && !rd->GetBuffer() && !(rl->Flags & (LUMPF_BLOODCRYPT | LUMPF_COMPRESSED)))
{
FileRdr rdr;
FileReader rdr;
rdr.OpenFilePart(*rd, rl->GetFileOffset(), rl->LumpSize);
return rdr;
}
return rl->NewReader(); // This always gets a reader to the cache
}
FileRdr FWadCollection::ReopenLumpReader(int lump, bool alwayscache)
FileReader FWadCollection::ReopenLumpReader(int lump, bool alwayscache)
{
if ((unsigned)lump >= (unsigned)LumpInfo.Size())
{
@ -1338,7 +1338,7 @@ FileRdr FWadCollection::ReopenLumpReader(int lump, bool alwayscache)
{
int fileno = Wads.GetLumpFile(lump);
const char *filename = Wads.GetWadFullName(fileno);
FileRdr fr;
FileReader fr;
if (fr.OpenFile(filename, rl->GetFileOffset(), rl->LumpSize))
{
return fr;
@ -1356,7 +1356,7 @@ FileRdr FWadCollection::ReopenLumpReader(int lump, bool alwayscache)
//
//==========================================================================
FileRdr *FWadCollection::GetFileReader(int wadnum)
FileReader *FWadCollection::GetFileReader(int wadnum)
{
if ((uint32_t)wadnum >= Files.Size())
{

View file

@ -112,7 +112,7 @@ public:
void SetIwadNum(int x) { IwadIndex = x; }
void InitMultipleFiles (TArray<FString> &filenames);
void AddFile (const char *filename, FileRdr *wadinfo = NULL);
void AddFile (const char *filename, FileReader *wadinfo = NULL);
int CheckIfWadLoaded (const char *name);
const char *GetWadName (int wadnum) const;
@ -151,8 +151,8 @@ public:
FMemLump ReadLump (int lump);
FMemLump ReadLump (const char *name) { return ReadLump (GetNumForName (name)); }
FileRdr OpenLumpReader(int lump); // opens a reader that redirects to the containing file's one.
FileRdr ReopenLumpReader(int lump, bool alwayscache = false); // opens an independent reader.
FileReader OpenLumpReader(int lump); // opens a reader that redirects to the containing file's one.
FileReader ReopenLumpReader(int lump, bool alwayscache = false); // opens an independent reader.
int FindLump (const char *name, int *lastlump, bool anyns=false); // [RH] Find lumps with duplication
int FindLumpMulti (const char **names, int *lastlump, bool anyns = false, int *nameindex = NULL); // same with multiple possible names
@ -206,7 +206,7 @@ private:
void RenameNerve();
void FixMacHexen();
void DeleteAll();
FileRdr * GetFileReader(int wadnum); // Gets a FileRdr object to the entire WAD
FileReader * GetFileReader(int wadnum); // Gets a FileReader object to the entire WAD
};
extern FWadCollection Wads;

View file

@ -967,7 +967,7 @@ FStrifeStartupScreen::FStrifeStartupScreen(int max_progress, HRESULT &hr)
// Fill bitmap with the startup image.
memset (ST_Util_BitsForBitmap(StartupBitmap), 0xF0, 64000);
auto lumpr = Wads.OpenLumpReader (startup_lump);
lumpr.Seek (57 * 320, FileRdr::SeekSet);
lumpr.Seek (57 * 320, FileReader::SeekSet);
lumpr.Read (ST_Util_BitsForBitmap(StartupBitmap) + 41 * 320, 95 * 320);
// Load the animated overlays.