mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-12 03:00:38 +00:00
- moved kopenfilereader into the FileSystem class.
This commit is contained in:
parent
ef87d2d4f9
commit
749eda32c5
39 changed files with 70 additions and 71 deletions
|
@ -166,7 +166,7 @@ int RFS::Open(const char *fileName)
|
||||||
{
|
{
|
||||||
strcpy(_fileName, fileName);
|
strcpy(_fileName, fileName);
|
||||||
|
|
||||||
auto hFile = kopenFileReader(fileName, 0);
|
auto hFile = fileSystem.OpenFileReader(fileName, 0);
|
||||||
if (!hFile.isOpen()) {
|
if (!hFile.isOpen()) {
|
||||||
initprintf("BARF: Error opening file %s", _fileName);
|
initprintf("BARF: Error opening file %s", _fileName);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -160,14 +160,14 @@ FileReader credKOpen4Load(char *&pzFile)
|
||||||
if (pzFile[i] == '\\')
|
if (pzFile[i] == '\\')
|
||||||
pzFile[i] = '/';
|
pzFile[i] = '/';
|
||||||
}
|
}
|
||||||
auto nHandle = kopenFileReader(pzFile, 0);
|
auto nHandle = fileSystem.OpenFileReader(pzFile, 0);
|
||||||
if (!nHandle.isOpen())
|
if (!nHandle.isOpen())
|
||||||
{
|
{
|
||||||
// Hack
|
// Hack
|
||||||
if (nLen >= 3 && isalpha(pzFile[0]) && pzFile[1] == ':' && pzFile[2] == '/')
|
if (nLen >= 3 && isalpha(pzFile[0]) && pzFile[1] == ':' && pzFile[2] == '/')
|
||||||
{
|
{
|
||||||
pzFile += 3;
|
pzFile += 3;
|
||||||
nHandle = kopenFileReader(pzFile, 0);
|
nHandle = fileSystem.OpenFileReader(pzFile, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nHandle;
|
return nHandle;
|
||||||
|
|
|
@ -130,7 +130,7 @@ void IniFile::Load()
|
||||||
|
|
||||||
curNode = &head;
|
curNode = &head;
|
||||||
|
|
||||||
auto fp = kopenFileReader(fileName, 0);
|
auto fp = fileSystem.OpenFileReader(fileName, 0);
|
||||||
if (fp.isOpen())
|
if (fp.isOpen())
|
||||||
{
|
{
|
||||||
int nSize = fp.GetLength();
|
int nSize = fp.GetLength();
|
||||||
|
|
|
@ -216,7 +216,7 @@ void sndStartWavDisk(const char *pzFile, int nVolume, int nChannel)
|
||||||
pChannel = &Channel[nChannel];
|
pChannel = &Channel[nChannel];
|
||||||
if (pChannel->at0 > 0)
|
if (pChannel->at0 > 0)
|
||||||
sndKillSound(pChannel);
|
sndKillSound(pChannel);
|
||||||
auto hFile = kopenFileReader(pzFile, 0);
|
auto hFile = fileSystem.OpenFileReader(pzFile, 0);
|
||||||
if (!hFile.isOpen())
|
if (!hFile.isOpen())
|
||||||
return;
|
return;
|
||||||
int nLength = hFile.GetLength();
|
int nLength = hFile.GetLength();
|
||||||
|
|
|
@ -86,12 +86,12 @@ int tileInit(char a1, const char *a2)
|
||||||
for (int i = 0; i < kMaxTiles; i++)
|
for (int i = 0; i < kMaxTiles; i++)
|
||||||
voxelIndex[i] = 0;
|
voxelIndex[i] = 0;
|
||||||
|
|
||||||
auto hFile = kopenFileReader("SURFACE.DAT", 0);
|
auto hFile = fileSystem.OpenFileReader("SURFACE.DAT", 0);
|
||||||
if (hFile.isOpen())
|
if (hFile.isOpen())
|
||||||
{
|
{
|
||||||
hFile.Read(surfType, sizeof(surfType));
|
hFile.Read(surfType, sizeof(surfType));
|
||||||
}
|
}
|
||||||
hFile = kopenFileReader("VOXEL.DAT", 0);
|
hFile = fileSystem.OpenFileReader("VOXEL.DAT", 0);
|
||||||
if (hFile.isOpen())
|
if (hFile.isOpen())
|
||||||
{
|
{
|
||||||
hFile.Read(voxelIndex, sizeof(voxelIndex));
|
hFile.Read(voxelIndex, sizeof(voxelIndex));
|
||||||
|
@ -100,7 +100,7 @@ int tileInit(char a1, const char *a2)
|
||||||
voxelIndex[i] = B_LITTLE16(voxelIndex[i]);
|
voxelIndex[i] = B_LITTLE16(voxelIndex[i]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
hFile = kopenFileReader("SHADE.DAT", 0);
|
hFile = fileSystem.OpenFileReader("SHADE.DAT", 0);
|
||||||
if (hFile.isOpen())
|
if (hFile.isOpen())
|
||||||
{
|
{
|
||||||
hFile.Read(tileShade, sizeof(tileShade));
|
hFile.Read(tileShade, sizeof(tileShade));
|
||||||
|
|
|
@ -18,15 +18,6 @@ extern int32_t pathsearchmode; // 0 = gamefs mode (default), 1 = localfs mode (e
|
||||||
|
|
||||||
#include "filesystem/filesystem.h"
|
#include "filesystem/filesystem.h"
|
||||||
|
|
||||||
// Wrappers for the handle based API to get rid of the direct calls without any actual changes to the implementation.
|
|
||||||
// These are now getting redirected to the file system so that the implementation here can be gutted without making changes to the calling code.
|
|
||||||
inline FileReader kopenFileReader(const char* name, int where)
|
|
||||||
{
|
|
||||||
auto lump = fileSystem.FindFile(name);
|
|
||||||
if (lump < 0) return FileReader();
|
|
||||||
else return fileSystem.OpenFileReader(lump);
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is only here to mark a file as not being part of the game assets (e.g. savegames)
|
// This is only here to mark a file as not being part of the game assets (e.g. savegames)
|
||||||
// These should be handled differently (e.g read from a userdata directory or similar things.)
|
// These should be handled differently (e.g read from a userdata directory or similar things.)
|
||||||
inline FileReader fopenFileReader(const char* name, int where)
|
inline FileReader fopenFileReader(const char* name, int where)
|
||||||
|
|
|
@ -2596,7 +2596,7 @@ static int32_t defsparser(scriptfile *script)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileReader fil = kopenFileReader(fn, 0);
|
FileReader fil = fileSystem.OpenFileReader(fn, 0);
|
||||||
if (!fil.isOpen())
|
if (!fil.isOpen())
|
||||||
{
|
{
|
||||||
initprintf("Error: basepalette: Failed opening \"%s\" on line %s:%d\n", fn,
|
initprintf("Error: basepalette: Failed opening \"%s\" on line %s:%d\n", fn,
|
||||||
|
@ -2770,7 +2770,7 @@ static int32_t defsparser(scriptfile *script)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileReader fil = kopenFileReader(fn, 0);
|
FileReader fil = fileSystem.OpenFileReader(fn, 0);
|
||||||
if (!fil.isOpen())
|
if (!fil.isOpen())
|
||||||
{
|
{
|
||||||
initprintf("Error: palookup: Failed opening \"%s\" on line %s:%d\n", fn,
|
initprintf("Error: palookup: Failed opening \"%s\" on line %s:%d\n", fn,
|
||||||
|
@ -3063,7 +3063,7 @@ static int32_t defsparser(scriptfile *script)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileReader fil = kopenFileReader(fn, 0);
|
FileReader fil = fileSystem.OpenFileReader(fn, 0);
|
||||||
if (!fil.isOpen())
|
if (!fil.isOpen())
|
||||||
{
|
{
|
||||||
initprintf("Error: blendtable: Failed opening \"%s\" on line %s:%d\n", fn,
|
initprintf("Error: blendtable: Failed opening \"%s\" on line %s:%d\n", fn,
|
||||||
|
|
|
@ -9447,7 +9447,7 @@ int32_t engineLoadBoard(const char *filename, char flags, vec3_t *dapos, int16_t
|
||||||
|
|
||||||
flags &= 3;
|
flags &= 3;
|
||||||
|
|
||||||
FileReader fr = kopenFileReader(filename, 0);
|
FileReader fr = fileSystem.OpenFileReader(filename, 0);
|
||||||
if (!fr.isOpen())
|
if (!fr.isOpen())
|
||||||
{ mapversion = 7; return -1; }
|
{ mapversion = 7; return -1; }
|
||||||
|
|
||||||
|
@ -9639,7 +9639,7 @@ int32_t engineLoadBoardV5V6(const char *filename, char fromwhere, vec3_t *dapos,
|
||||||
struct walltypev6 v6wall;
|
struct walltypev6 v6wall;
|
||||||
struct spritetypev6 v6spr;
|
struct spritetypev6 v6spr;
|
||||||
|
|
||||||
FileReader fr = kopenFileReader(filename, fromwhere);
|
FileReader fr = fileSystem.OpenFileReader(filename, fromwhere);
|
||||||
if (!fr.isOpen())
|
if (!fr.isOpen())
|
||||||
{ mapversion = 5L; return -1; }
|
{ mapversion = 5L; return -1; }
|
||||||
|
|
||||||
|
@ -10109,7 +10109,7 @@ void videoNextPage(void)
|
||||||
|
|
||||||
int32_t qloadkvx(int32_t voxindex, const char *filename)
|
int32_t qloadkvx(int32_t voxindex, const char *filename)
|
||||||
{
|
{
|
||||||
auto fil = kopenFileReader(filename, 0);
|
auto fil = fileSystem.OpenFileReader(filename, 0);
|
||||||
if (!fil.isOpen())
|
if (!fil.isOpen())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
|
@ -1862,7 +1862,7 @@ mdmodel_t *mdload(const char *filnam)
|
||||||
vm = (mdmodel_t *)voxload(filnam);
|
vm = (mdmodel_t *)voxload(filnam);
|
||||||
if (vm) return vm;
|
if (vm) return vm;
|
||||||
|
|
||||||
auto fil = kopenFileReader(filnam,0);
|
auto fil = fileSystem.OpenFileReader(filnam,0);
|
||||||
|
|
||||||
if (!fil.isOpen())
|
if (!fil.isOpen())
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -179,7 +179,7 @@ void paletteLoadFromDisk(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto fil = kopenFileReader("palette.dat", 0);
|
auto fil = fileSystem.OpenFileReader("palette.dat", 0);
|
||||||
if (!fil.isOpen())
|
if (!fil.isOpen())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -299,7 +299,7 @@ void scriptfile_preparse(scriptfile *sf, char *tx, int32_t flen)
|
||||||
|
|
||||||
scriptfile *scriptfile_fromfile(const char *fn)
|
scriptfile *scriptfile_fromfile(const char *fn)
|
||||||
{
|
{
|
||||||
auto fr = kopenFileReader(fn, 0);
|
auto fr = fileSystem.OpenFileReader(fn, 0);
|
||||||
if (!fr.isOpen()) return nullptr;
|
if (!fr.isOpen()) return nullptr;
|
||||||
|
|
||||||
uint32_t flen = fr.GetLength();
|
uint32_t flen = fr.GetLength();
|
||||||
|
|
|
@ -607,7 +607,7 @@ static void read_pal(FileReader &fil, int32_t pal[256])
|
||||||
|
|
||||||
static int32_t loadvox(const char *filnam)
|
static int32_t loadvox(const char *filnam)
|
||||||
{
|
{
|
||||||
auto fil = kopenFileReader(filnam, 0);
|
auto fil = fileSystem.OpenFileReader(filnam, 0);
|
||||||
if (!fil.isOpen())
|
if (!fil.isOpen())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -683,7 +683,7 @@ static int32_t loadkvx(const char *filnam)
|
||||||
{
|
{
|
||||||
int32_t i, mip1leng;
|
int32_t i, mip1leng;
|
||||||
|
|
||||||
auto fil = kopenFileReader(filnam, 0);
|
auto fil = fileSystem.OpenFileReader(filnam, 0);
|
||||||
if (!fil.isOpen())
|
if (!fil.isOpen())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -767,7 +767,7 @@ static int32_t loadkv6(const char *filnam)
|
||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
|
|
||||||
auto fil = kopenFileReader(filnam, 0);
|
auto fil = fileSystem.OpenFileReader(filnam, 0);
|
||||||
if (!fil.isOpen())
|
if (!fil.isOpen())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
|
@ -770,6 +770,13 @@ FileReader FileSystem::ReopenFileReader(int lump, bool alwayscache)
|
||||||
return rl->NewReader(); // This always gets a reader to the cache
|
return rl->NewReader(); // This always gets a reader to the cache
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FileReader FileSystem::OpenFileReader(const char* name, int where)
|
||||||
|
{
|
||||||
|
auto lump = FindFile(name);
|
||||||
|
if (lump < 0) return FileReader();
|
||||||
|
else return OpenFileReader(lump);
|
||||||
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// GetAllFilesOfType
|
// GetAllFilesOfType
|
||||||
|
|
|
@ -127,6 +127,7 @@ public:
|
||||||
|
|
||||||
FileReader OpenFileReader(int file); // opens a reader that redirects to the containing file's one.
|
FileReader OpenFileReader(int file); // opens a reader that redirects to the containing file's one.
|
||||||
FileReader ReopenFileReader(int file, bool alwayscache = false); // opens an independent reader.
|
FileReader ReopenFileReader(int file, bool alwayscache = false); // opens an independent reader.
|
||||||
|
FileReader OpenFileReader(const char* name, int where);
|
||||||
|
|
||||||
int Iterate (const char *name, int *lastfile, ELookupMode lookupmode = ELookupMode::FullName); // [RH] Find files with duplication
|
int Iterate (const char *name, int *lastfile, ELookupMode lookupmode = ELookupMode::FullName); // [RH] Find files with duplication
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ FFont *V_GetFont(const char *name, const char *fontlumpname)
|
||||||
FFont *font = FFont::FindFont (name);
|
FFont *font = FFont::FindFont (name);
|
||||||
if (font == nullptr)
|
if (font == nullptr)
|
||||||
{
|
{
|
||||||
auto lumpy = kopenFileReader(fontlumpname, 0);
|
auto lumpy = fileSystem.OpenFileReader(fontlumpname, 0);
|
||||||
if (!lumpy.isOpen()) return nullptr;
|
if (!lumpy.isOpen()) return nullptr;
|
||||||
uint32_t head;
|
uint32_t head;
|
||||||
lumpy.Read (&head, 4);
|
lumpy.Read (&head, 4);
|
||||||
|
|
|
@ -13,7 +13,7 @@ static FileReader S_TryFormats(char * const testfn, char * const fn_suffix, char
|
||||||
#ifdef HAVE_FLAC
|
#ifdef HAVE_FLAC
|
||||||
{
|
{
|
||||||
Bstrcpy(fn_suffix, ".flac");
|
Bstrcpy(fn_suffix, ".flac");
|
||||||
auto fp = kopenFileReader(testfn, searchfirst);
|
auto fp = fileSystem.OpenFileReader(testfn, searchfirst);
|
||||||
if (fp.isOpen())
|
if (fp.isOpen())
|
||||||
return fp;
|
return fp;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ static FileReader S_TryFormats(char * const testfn, char * const fn_suffix, char
|
||||||
#ifdef HAVE_VORBIS
|
#ifdef HAVE_VORBIS
|
||||||
{
|
{
|
||||||
Bstrcpy(fn_suffix, ".ogg");
|
Bstrcpy(fn_suffix, ".ogg");
|
||||||
auto fp = kopenFileReader(testfn, searchfirst);
|
auto fp = fileSystem.OpenFileReader(testfn, searchfirst);
|
||||||
if (fp.isOpen())
|
if (fp.isOpen())
|
||||||
return fp;
|
return fp;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ static FileReader S_TryExtensionReplacements(char * const testfn, char const sea
|
||||||
|
|
||||||
FileReader S_OpenAudio(const char *fn, char searchfirst, uint8_t const ismusic)
|
FileReader S_OpenAudio(const char *fn, char searchfirst, uint8_t const ismusic)
|
||||||
{
|
{
|
||||||
auto origfp = kopenFileReader(fn, searchfirst);
|
auto origfp = fileSystem.OpenFileReader(fn, searchfirst);
|
||||||
if (!snd_tryformats) return origfp;
|
if (!snd_tryformats) return origfp;
|
||||||
return origfp;
|
return origfp;
|
||||||
#if 0 // this needs to be redone
|
#if 0 // this needs to be redone
|
||||||
|
|
|
@ -80,7 +80,7 @@ bool RTS_IsInitialized()
|
||||||
{
|
{
|
||||||
if (LumpInfo.Size() > 0) return true;
|
if (LumpInfo.Size() > 0) return true;
|
||||||
if (RTSName.IsEmpty()) return false;
|
if (RTSName.IsEmpty()) return false;
|
||||||
auto fr = kopenFileReader(RTSName, 0);
|
auto fr = fileSystem.OpenFileReader(RTSName, 0);
|
||||||
RTSName = ""; // don't try ever again.
|
RTSName = ""; // don't try ever again.
|
||||||
if (!fr.isOpen()) return false;
|
if (!fr.isOpen()) return false;
|
||||||
RTSFile = fr.Read();
|
RTSFile = fr.Read();
|
||||||
|
|
|
@ -287,7 +287,7 @@ int BuildTiles::LoadArtFile(const char *fn, bool mapart, int firsttile)
|
||||||
auto old = FindFile(fn);
|
auto old = FindFile(fn);
|
||||||
if (old >= ArtFiles.Size()) // Do not process if already loaded.
|
if (old >= ArtFiles.Size()) // Do not process if already loaded.
|
||||||
{
|
{
|
||||||
FileReader fr = kopenFileReader(fn, 0);
|
FileReader fr = fileSystem.OpenFileReader(fn, 0);
|
||||||
if (fr.isOpen())
|
if (fr.isOpen())
|
||||||
{
|
{
|
||||||
auto artdata = fr.Read();
|
auto artdata = fr.Read();
|
||||||
|
@ -565,7 +565,7 @@ void artSetupMapArt(const char* filename)
|
||||||
artClearMapArt();
|
artClearMapArt();
|
||||||
|
|
||||||
FStringf firstname("%s_00.art", filename);
|
FStringf firstname("%s_00.art", filename);
|
||||||
auto fr = kopenFileReader(firstname, 0);
|
auto fr = fileSystem.OpenFileReader(firstname, 0);
|
||||||
if (!fr.isOpen()) return;
|
if (!fr.isOpen()) return;
|
||||||
|
|
||||||
for (bssize_t i = 0; i < MAXARTFILES_TOTAL - MAXARTFILES_BASE; i++)
|
for (bssize_t i = 0; i < MAXARTFILES_TOTAL - MAXARTFILES_BASE; i++)
|
||||||
|
|
|
@ -118,7 +118,7 @@ FArtTexture::FArtTexture(int width, int height, int p)
|
||||||
|
|
||||||
void FArtTexture::CreatePalettedPixels(uint8_t* buffer)
|
void FArtTexture::CreatePalettedPixels(uint8_t* buffer)
|
||||||
{
|
{
|
||||||
FileReader fr = kopenFileReader(Name, 0);
|
FileReader fr = fileSystem.OpenFileReader(Name, 0);
|
||||||
if (!fr.isOpen()) return;
|
if (!fr.isOpen()) return;
|
||||||
int numpixels = Width * Height;
|
int numpixels = Width * Height;
|
||||||
fr.Read(buffer, numpixels);
|
fr.Read(buffer, numpixels);
|
||||||
|
@ -139,7 +139,7 @@ int FArtTexture::CopyPixels(FBitmap *bmp, int conversion)
|
||||||
// Both Src and Dst are ordered the same with no padding.
|
// Both Src and Dst are ordered the same with no padding.
|
||||||
int numpixels = Width * Height;
|
int numpixels = Width * Height;
|
||||||
bool hasalpha = false;
|
bool hasalpha = false;
|
||||||
FileReader fr = kopenFileReader(Name, 0);
|
FileReader fr = fileSystem.OpenFileReader(Name, 0);
|
||||||
if (!fr.isOpen()) return 0;
|
if (!fr.isOpen()) return 0;
|
||||||
TArray<uint8_t> source(numpixels, true);
|
TArray<uint8_t> source(numpixels, true);
|
||||||
fr.Read(source.Data(), numpixels);
|
fr.Read(source.Data(), numpixels);
|
||||||
|
|
|
@ -374,7 +374,7 @@ void FDDSTexture::CalcBitShift (uint32_t mask, uint8_t *lshiftp, uint8_t *rshift
|
||||||
|
|
||||||
void FDDSTexture::CreatePalettedPixels(uint8_t *buffer)
|
void FDDSTexture::CreatePalettedPixels(uint8_t *buffer)
|
||||||
{
|
{
|
||||||
auto lump = kopenFileReader(Name, 0);
|
auto lump = fileSystem.OpenFileReader(Name, 0);
|
||||||
if (!lump.isOpen()) return; // Just leave the texture blank.
|
if (!lump.isOpen()) return; // Just leave the texture blank.
|
||||||
|
|
||||||
lump.Seek (sizeof(DDSURFACEDESC2) + 4, FileReader::SeekSet);
|
lump.Seek (sizeof(DDSURFACEDESC2) + 4, FileReader::SeekSet);
|
||||||
|
@ -781,7 +781,7 @@ void FDDSTexture::DecompressDXT5 (FileReader &lump, bool premultiplied, uint8_t
|
||||||
|
|
||||||
int FDDSTexture::CopyPixels(FBitmap *bmp, int conversion)
|
int FDDSTexture::CopyPixels(FBitmap *bmp, int conversion)
|
||||||
{
|
{
|
||||||
auto lump = kopenFileReader(Name, 0);
|
auto lump = fileSystem.OpenFileReader(Name, 0);
|
||||||
if (!lump.isOpen()) return -1; // Just leave the texture blank.
|
if (!lump.isOpen()) return -1; // Just leave the texture blank.
|
||||||
|
|
||||||
uint8_t *TexBuffer = bmp->GetPixels();
|
uint8_t *TexBuffer = bmp->GetPixels();
|
||||||
|
|
|
@ -262,7 +262,7 @@ FJPEGTexture::FJPEGTexture (int width, int height)
|
||||||
|
|
||||||
void FJPEGTexture::CreatePalettedPixels(uint8_t *buffer)
|
void FJPEGTexture::CreatePalettedPixels(uint8_t *buffer)
|
||||||
{
|
{
|
||||||
auto lump = kopenFileReader(Name, 0);
|
auto lump = fileSystem.OpenFileReader(Name, 0);
|
||||||
if (!lump.isOpen()) return; // Just leave the texture blank.
|
if (!lump.isOpen()) return; // Just leave the texture blank.
|
||||||
JSAMPLE *buff = NULL;
|
JSAMPLE *buff = NULL;
|
||||||
|
|
||||||
|
@ -385,7 +385,7 @@ int FJPEGTexture::CopyPixels(FBitmap *bmp, int conversion)
|
||||||
{
|
{
|
||||||
PalEntry pe[256];
|
PalEntry pe[256];
|
||||||
|
|
||||||
auto lump = kopenFileReader(Name, 0);
|
auto lump = fileSystem.OpenFileReader(Name, 0);
|
||||||
if (!lump.isOpen()) return -1; // Just leave the texture blank.
|
if (!lump.isOpen()) return -1; // Just leave the texture blank.
|
||||||
|
|
||||||
jpeg_decompress_struct cinfo;
|
jpeg_decompress_struct cinfo;
|
||||||
|
|
|
@ -350,7 +350,7 @@ void FPCXTexture::CreatePalettedPixels(uint8_t *buffer)
|
||||||
PCXHeader header;
|
PCXHeader header;
|
||||||
int bitcount;
|
int bitcount;
|
||||||
|
|
||||||
auto lump = kopenFileReader(Name, 0);
|
auto lump = fileSystem.OpenFileReader(Name, 0);
|
||||||
if (!lump.isOpen()) return; // Just leave the texture blank.
|
if (!lump.isOpen()) return; // Just leave the texture blank.
|
||||||
|
|
||||||
lump.Read(&header, sizeof(header));
|
lump.Read(&header, sizeof(header));
|
||||||
|
@ -436,7 +436,7 @@ int FPCXTexture::CopyPixels(FBitmap *bmp, int conversion)
|
||||||
int bitcount;
|
int bitcount;
|
||||||
TArray<uint8_t> Pixels;
|
TArray<uint8_t> Pixels;
|
||||||
|
|
||||||
auto lump = kopenFileReader(Name, 0);
|
auto lump = fileSystem.OpenFileReader(Name, 0);
|
||||||
if (!lump.isOpen()) return -1; // Just leave the texture blank.
|
if (!lump.isOpen()) return -1; // Just leave the texture blank.
|
||||||
|
|
||||||
lump.Read(&header, sizeof(header));
|
lump.Read(&header, sizeof(header));
|
||||||
|
|
|
@ -291,7 +291,7 @@ void FPNGTexture::CreatePalettedPixels(uint8_t *buffer)
|
||||||
FileReader *lump;
|
FileReader *lump;
|
||||||
FileReader lfr;
|
FileReader lfr;
|
||||||
|
|
||||||
lfr = kopenFileReader(Name, 0);
|
lfr = fileSystem.OpenFileReader(Name, 0);
|
||||||
if (!lfr.isOpen()) return;
|
if (!lfr.isOpen()) return;
|
||||||
lump = 𝔩
|
lump = 𝔩
|
||||||
|
|
||||||
|
@ -408,7 +408,7 @@ int FPNGTexture::CopyPixels(FBitmap *bmp, int conversion)
|
||||||
FileReader *lump;
|
FileReader *lump;
|
||||||
FileReader lfr;
|
FileReader lfr;
|
||||||
|
|
||||||
lfr = kopenFileReader(Name, 0);
|
lfr = fileSystem.OpenFileReader(Name, 0);
|
||||||
if (!lfr.isOpen()) return -1; // Just leave the texture blank.
|
if (!lfr.isOpen()) return -1; // Just leave the texture blank.
|
||||||
|
|
||||||
lump = 𝔩
|
lump = 𝔩
|
||||||
|
|
|
@ -154,7 +154,7 @@ void FStbTexture::CreatePalettedPixels(uint8_t *buffer)
|
||||||
|
|
||||||
int FStbTexture::CopyPixels(FBitmap *bmp, int conversion)
|
int FStbTexture::CopyPixels(FBitmap *bmp, int conversion)
|
||||||
{
|
{
|
||||||
auto lump = kopenFileReader(Name, 0);
|
auto lump = fileSystem.OpenFileReader(Name, 0);
|
||||||
if (!lump.isOpen()) return -1; // Just leave the texture blank.
|
if (!lump.isOpen()) return -1; // Just leave the texture blank.
|
||||||
int x, y, chan;
|
int x, y, chan;
|
||||||
auto image = stbi_load_from_callbacks(&callbacks, &lump, &x, &y, &chan, STBI_rgb_alpha);
|
auto image = stbi_load_from_callbacks(&callbacks, &lump, &x, &y, &chan, STBI_rgb_alpha);
|
||||||
|
|
|
@ -179,7 +179,7 @@ void FTGATexture::ReadCompressed(FileReader &lump, uint8_t * buffer, int bytespe
|
||||||
void FTGATexture::CreatePalettedPixels(uint8_t *buffer)
|
void FTGATexture::CreatePalettedPixels(uint8_t *buffer)
|
||||||
{
|
{
|
||||||
uint8_t PaletteMap[256];
|
uint8_t PaletteMap[256];
|
||||||
auto lump = kopenFileReader(Name, 0);
|
auto lump = fileSystem.OpenFileReader(Name, 0);
|
||||||
if (!lump.isOpen()) return;
|
if (!lump.isOpen()) return;
|
||||||
TGAHeader hdr;
|
TGAHeader hdr;
|
||||||
uint16_t w;
|
uint16_t w;
|
||||||
|
@ -385,7 +385,7 @@ void FTGATexture::CreatePalettedPixels(uint8_t *buffer)
|
||||||
int FTGATexture::CopyPixels(FBitmap *bmp, int conversion)
|
int FTGATexture::CopyPixels(FBitmap *bmp, int conversion)
|
||||||
{
|
{
|
||||||
PalEntry pe[256];
|
PalEntry pe[256];
|
||||||
auto lump = kopenFileReader(Name, 0);
|
auto lump = fileSystem.OpenFileReader(Name, 0);
|
||||||
if (!lump.isOpen()) return -1;
|
if (!lump.isOpen()) return -1;
|
||||||
TGAHeader hdr;
|
TGAHeader hdr;
|
||||||
uint16_t w;
|
uint16_t w;
|
||||||
|
|
|
@ -79,7 +79,7 @@ FImageSource * FImageSource::GetImage(const char *name)
|
||||||
{ nullptr }
|
{ nullptr }
|
||||||
};
|
};
|
||||||
|
|
||||||
auto data = kopenFileReader(name, 0);
|
auto data = fileSystem.OpenFileReader(name, 0);
|
||||||
if (!data.isOpen()) return nullptr;
|
if (!data.isOpen()) return nullptr;
|
||||||
|
|
||||||
for (size_t i = 0; CreateInfo[i].TryCreate; i++)
|
for (size_t i = 0; CreateInfo[i].TryCreate; i++)
|
||||||
|
|
|
@ -143,7 +143,7 @@ FScanner &FScanner::operator=(const FScanner &other)
|
||||||
|
|
||||||
void FScanner::Open (const char *name)
|
void FScanner::Open (const char *name)
|
||||||
{
|
{
|
||||||
auto fr = kopenFileReader(name, 0);
|
auto fr = fileSystem.OpenFileReader(name, 0);
|
||||||
if (!fr.isOpen())
|
if (!fr.isOpen())
|
||||||
{
|
{
|
||||||
I_Error("Could not find script lump '%s'\n", name);
|
I_Error("Could not find script lump '%s'\n", name);
|
||||||
|
|
|
@ -253,7 +253,7 @@ int32_t Anim_Play(const char *fn)
|
||||||
FileReader handle;
|
FileReader handle;
|
||||||
if (!Bstrcmp(dot, ".ivf"))
|
if (!Bstrcmp(dot, ".ivf"))
|
||||||
{
|
{
|
||||||
handle = kopenFileReader(fn, 0);
|
handle = fileSystem.OpenFileReader(fn, 0);
|
||||||
if (!handle.isOpen())
|
if (!handle.isOpen())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,7 @@ int32_t Anim_Play(const char *fn)
|
||||||
vpxfndot[3] = 'f';
|
vpxfndot[3] = 'f';
|
||||||
vpxfndot[4] = '\0';
|
vpxfndot[4] = '\0';
|
||||||
|
|
||||||
handle = kopenFileReader(vpxfn, 0);
|
handle = fileSystem.OpenFileReader(vpxfn, 0);
|
||||||
if (!handle.isOpen())
|
if (!handle.isOpen())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -420,7 +420,7 @@ int32_t Anim_Play(const char *fn)
|
||||||
int32_t ogltexfiltermode = hw_texfilter;
|
int32_t ogltexfiltermode = hw_texfilter;
|
||||||
#endif
|
#endif
|
||||||
TArray<uint8_t> buffer;
|
TArray<uint8_t> buffer;
|
||||||
auto fr = kopenFileReader(fn, 0);
|
auto fr = fileSystem.OpenFileReader(fn, 0);
|
||||||
|
|
||||||
if (!fr.isOpen())
|
if (!fr.isOpen())
|
||||||
goto end_anim;
|
goto end_anim;
|
||||||
|
|
|
@ -106,7 +106,7 @@ void G_LoadLookups(void)
|
||||||
{
|
{
|
||||||
int32_t j;
|
int32_t j;
|
||||||
|
|
||||||
auto fr = kopenFileReader("lookup.dat", 0);
|
auto fr = fileSystem.OpenFileReader("lookup.dat", 0);
|
||||||
if (!fr.isOpen())
|
if (!fr.isOpen())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -1908,7 +1908,7 @@ static int C_CountCaseStatements()
|
||||||
|
|
||||||
static void C_Include(const char *confile)
|
static void C_Include(const char *confile)
|
||||||
{
|
{
|
||||||
auto fp = kopenFileReader(confile,0);
|
auto fp = fileSystem.OpenFileReader(confile,0);
|
||||||
|
|
||||||
if (!fp.isOpen())
|
if (!fp.isOpen())
|
||||||
{
|
{
|
||||||
|
@ -5922,7 +5922,7 @@ void C_Compile(const char *fileName)
|
||||||
Gv_Init();
|
Gv_Init();
|
||||||
C_InitProjectiles();
|
C_InitProjectiles();
|
||||||
|
|
||||||
auto kFile = kopenFileReader(fileName,0);
|
auto kFile = fileSystem.OpenFileReader(fileName,0);
|
||||||
|
|
||||||
if (!kFile.isOpen())
|
if (!kFile.isOpen())
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,7 +49,7 @@ extern int ydim;
|
||||||
|
|
||||||
FileReader GetResource(const char* fn)
|
FileReader GetResource(const char* fn)
|
||||||
{
|
{
|
||||||
auto fr = kopenFileReader(fn, 0);
|
auto fr = fileSystem.OpenFileReader(fn, 0);
|
||||||
if (!fr.isOpen())
|
if (!fr.isOpen())
|
||||||
{
|
{
|
||||||
I_Error("Fatal: '%s' not found", fn);
|
I_Error("Fatal: '%s' not found", fn);
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace SmackerCommon {
|
||||||
|
|
||||||
bool FileStream::Open(const std::string &fileName)
|
bool FileStream::Open(const std::string &fileName)
|
||||||
{
|
{
|
||||||
file = kopenFileReader(fileName.c_str(), 0);
|
file = fileSystem.OpenFileReader(fileName.c_str(), 0);
|
||||||
if (!file.isOpen())
|
if (!file.isOpen())
|
||||||
{
|
{
|
||||||
// log error
|
// log error
|
||||||
|
|
|
@ -289,7 +289,7 @@ int32_t Anim_Play(const char *fn)
|
||||||
FileReader handle;
|
FileReader handle;
|
||||||
if (!Bstrcmp(dot, ".ivf"))
|
if (!Bstrcmp(dot, ".ivf"))
|
||||||
{
|
{
|
||||||
handle = kopenFileReader(fn, 0);
|
handle = fileSystem.OpenFileReader(fn, 0);
|
||||||
if (!handle.isOpen())
|
if (!handle.isOpen())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -308,7 +308,7 @@ int32_t Anim_Play(const char *fn)
|
||||||
vpxfndot[3] = 'f';
|
vpxfndot[3] = 'f';
|
||||||
vpxfndot[4] = '\0';
|
vpxfndot[4] = '\0';
|
||||||
|
|
||||||
handle = kopenFileReader(vpxfn, 0);
|
handle = fileSystem.OpenFileReader(vpxfn, 0);
|
||||||
if (!handle.isOpen())
|
if (!handle.isOpen())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -451,7 +451,7 @@ int32_t Anim_Play(const char *fn)
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
int32_t ogltexfiltermode = hw_texfilter;
|
int32_t ogltexfiltermode = hw_texfilter;
|
||||||
#endif
|
#endif
|
||||||
auto fr = kopenFileReader(fn, 0);
|
auto fr = fileSystem.OpenFileReader(fn, 0);
|
||||||
|
|
||||||
if (!fr.isOpen())
|
if (!fr.isOpen())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -105,7 +105,7 @@ void G_LoadLookups(void)
|
||||||
{
|
{
|
||||||
int32_t j;
|
int32_t j;
|
||||||
|
|
||||||
auto fr = kopenFileReader("lookup.dat", 0);
|
auto fr = fileSystem.OpenFileReader("lookup.dat", 0);
|
||||||
if (!fr.isOpen())
|
if (!fr.isOpen())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -780,7 +780,7 @@ static int32_t C_CheckEmptyBranch(int32_t tw, intptr_t lastScriptPtr)
|
||||||
|
|
||||||
static void C_Include(const char *confile)
|
static void C_Include(const char *confile)
|
||||||
{
|
{
|
||||||
auto fp = kopenFileReader(confile,0);
|
auto fp = fileSystem.OpenFileReader(confile,0);
|
||||||
|
|
||||||
if (!fp.isOpen())
|
if (!fp.isOpen())
|
||||||
{
|
{
|
||||||
|
@ -2220,7 +2220,7 @@ void C_Compile(const char *fileName)
|
||||||
|
|
||||||
C_InitHashes();
|
C_InitHashes();
|
||||||
|
|
||||||
auto kFile = kopenFileReader(fileName,0);
|
auto kFile = fileSystem.OpenFileReader(fileName,0);
|
||||||
|
|
||||||
if (!kFile.isOpen())
|
if (!kFile.isOpen())
|
||||||
{
|
{
|
||||||
|
|
|
@ -243,7 +243,7 @@ unsigned char *LoadAnm(short anim_num)
|
||||||
|
|
||||||
if (anm_ptr[anim_num] == 0)
|
if (anm_ptr[anim_num] == 0)
|
||||||
{
|
{
|
||||||
auto handle = kopenFileReader(ANIMname[ANIMnum], 0);
|
auto handle = fileSystem.OpenFileReader(ANIMname[ANIMnum], 0);
|
||||||
if (!handle.isOpen())
|
if (!handle.isOpen())
|
||||||
return NULL;
|
return NULL;
|
||||||
length = handle.GetLength();
|
length = handle.GetLength();
|
||||||
|
|
|
@ -55,7 +55,7 @@ extern int DemoRecCnt; // Can only record 1-player game
|
||||||
#if DEMO_FILE_TYPE == DEMO_FILE_GROUP
|
#if DEMO_FILE_TYPE == DEMO_FILE_GROUP
|
||||||
typedef FileReader DFILE;
|
typedef FileReader DFILE;
|
||||||
#define DREAD(ptr, size, num, handle) (handle).Read((ptr),(size)*(num))
|
#define DREAD(ptr, size, num, handle) (handle).Read((ptr),(size)*(num))
|
||||||
#define DOPEN_READ(name) kopenFileReader(name,0)
|
#define DOPEN_READ(name) fileSystem.OpenFileReader(name,0)
|
||||||
#define DCLOSE(handle) ((handle).Close())
|
#define DCLOSE(handle) ((handle).Close())
|
||||||
#define DF_ERR(f) (!(f).isOpen())
|
#define DF_ERR(f) (!(f).isOpen())
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -81,7 +81,7 @@ SWBOOL LoadScriptFile(const char *filename)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!(fp = kopenFileReader(filename, 0)).isOpen())
|
if (!(fp = fileSystem.OpenFileReader(filename, 0)).isOpen())
|
||||||
{
|
{
|
||||||
// If there's no script file, forget it.
|
// If there's no script file, forget it.
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -1055,7 +1055,7 @@ void PlaySoundRTS(int rts_num)
|
||||||
SWBOOL
|
SWBOOL
|
||||||
OpenSound(VOC_INFOp vp, FileReader &handle, int *length)
|
OpenSound(VOC_INFOp vp, FileReader &handle, int *length)
|
||||||
{
|
{
|
||||||
handle = kopenFileReader(vp->name, 0);
|
handle = fileSystem.OpenFileReader(vp->name, 0);
|
||||||
|
|
||||||
if (!handle.isOpen())
|
if (!handle.isOpen())
|
||||||
{
|
{
|
||||||
|
@ -1085,7 +1085,7 @@ ReadSound(FileReader &handle, VOC_INFOp vp, int length)
|
||||||
SWBOOL
|
SWBOOL
|
||||||
LoadSong(const char *filename)
|
LoadSong(const char *filename)
|
||||||
{
|
{
|
||||||
auto fr = kopenFileReader(filename, 0);
|
auto fr = fileSystem.OpenFileReader(filename, 0);
|
||||||
if (!fr.isOpen())
|
if (!fr.isOpen())
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1170,7 +1170,7 @@ SoundShutdown(void)
|
||||||
void MusicStartup(void)
|
void MusicStartup(void)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
auto fil = kopenFileReader("swtimbr.tmb", 0);
|
auto fil = fileSystem.OpenFileReader("swtimbr.tmb", 0);
|
||||||
|
|
||||||
if (fil.isOpen())
|
if (fil.isOpen())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue