mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-19 08:01:50 +00:00
merge FileData and ResourceData.
This commit is contained in:
parent
d2cb44b1bf
commit
fe106d9bfe
38 changed files with 77 additions and 118 deletions
|
@ -182,8 +182,8 @@ static void SetupGenMidi()
|
|||
}
|
||||
auto genmidi = fileSystem.ReadFile(lump);
|
||||
|
||||
if (genmidi.GetSize() < 8 + 175 * 36 || memcmp(genmidi.GetMem(), "#OPL_II#", 8)) return;
|
||||
ZMusic_SetGenMidi(genmidi.GetBytes() + 8);
|
||||
if (genmidi.size() < 8 + 175 * 36 || memcmp(genmidi.data(), "#OPL_II#", 8)) return;
|
||||
ZMusic_SetGenMidi(genmidi.bytes() + 8);
|
||||
}
|
||||
|
||||
static void SetupWgOpn()
|
||||
|
@ -194,7 +194,7 @@ static void SetupWgOpn()
|
|||
return;
|
||||
}
|
||||
auto data = fileSystem.ReadFile(lump);
|
||||
ZMusic_SetWgOpn(data.GetMem(), (uint32_t)data.GetSize());
|
||||
ZMusic_SetWgOpn(data.data(), (uint32_t)data.size());
|
||||
}
|
||||
|
||||
static void SetupDMXGUS()
|
||||
|
@ -206,7 +206,7 @@ static void SetupDMXGUS()
|
|||
return;
|
||||
}
|
||||
auto data = fileSystem.ReadFile(lump);
|
||||
ZMusic_SetDmxGus(data.GetMem(), (uint32_t)data.GetSize());
|
||||
ZMusic_SetDmxGus(data.data(), (uint32_t)data.size());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -153,7 +153,7 @@ class AnmPlayer : public MoviePlayer
|
|||
{
|
||||
// This doesn't need its own class type
|
||||
anim_t anim;
|
||||
FileSys::ResourceData buffer;
|
||||
FileSys::FileData buffer;
|
||||
int numframes = 0;
|
||||
int curframe = 1;
|
||||
int frametime = 0;
|
||||
|
|
|
@ -63,8 +63,8 @@ void FStringTable::LoadStrings (const char *language)
|
|||
{
|
||||
auto lumpdata = fileSystem.ReadFile(lump);
|
||||
|
||||
if (!ParseLanguageCSV(lump, lumpdata.GetString(), lumpdata.GetSize()))
|
||||
LoadLanguage (lump, lumpdata.GetString(), lumpdata.GetSize());
|
||||
if (!ParseLanguageCSV(lump, lumpdata.string(), lumpdata.size()))
|
||||
LoadLanguage (lump, lumpdata.string(), lumpdata.size());
|
||||
}
|
||||
UpdateLanguage(language);
|
||||
allMacros.Clear();
|
||||
|
@ -160,7 +160,7 @@ TArray<TArray<FString>> FStringTable::parseCSV(const char* buffer, size_t size)
|
|||
bool FStringTable::readMacros(int lumpnum)
|
||||
{
|
||||
auto lumpdata = fileSystem.ReadFile(lumpnum);
|
||||
auto data = parseCSV(lumpdata.GetString(), lumpdata.GetSize());
|
||||
auto data = parseCSV(lumpdata.string(), lumpdata.size());
|
||||
|
||||
for (unsigned i = 1; i < data.Size(); i++)
|
||||
{
|
||||
|
|
|
@ -91,7 +91,7 @@ enum
|
|||
class FileReader;
|
||||
|
||||
// an opaque memory buffer to the file's content. Can either own the memory or just point to an external buffer.
|
||||
class ResourceData
|
||||
class FileData
|
||||
{
|
||||
void* memory;
|
||||
size_t length;
|
||||
|
@ -99,13 +99,13 @@ class ResourceData
|
|||
|
||||
public:
|
||||
using value_type = uint8_t;
|
||||
ResourceData() { memory = nullptr; length = 0; owned = true; }
|
||||
FileData() { memory = nullptr; length = 0; owned = true; }
|
||||
const void* data() const { return memory; }
|
||||
size_t size() const { return length; }
|
||||
const char* string() const { return (const char*)memory; }
|
||||
const uint8_t* bytes() const { return (const uint8_t*)memory; }
|
||||
|
||||
ResourceData& operator = (const ResourceData& copy)
|
||||
FileData& operator = (const FileData& copy)
|
||||
{
|
||||
if (owned && memory) free(memory);
|
||||
length = copy.length;
|
||||
|
@ -119,7 +119,7 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
ResourceData& operator = (ResourceData&& copy) noexcept
|
||||
FileData& operator = (FileData&& copy) noexcept
|
||||
{
|
||||
if (owned && memory) free(memory);
|
||||
length = copy.length;
|
||||
|
@ -131,13 +131,13 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
ResourceData(const ResourceData& copy)
|
||||
FileData(const FileData& copy)
|
||||
{
|
||||
memory = nullptr;
|
||||
*this = copy;
|
||||
}
|
||||
|
||||
~ResourceData()
|
||||
~FileData()
|
||||
{
|
||||
if (owned && memory) free(memory);
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ public:
|
|||
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::vector<uint8_t>& data); // take the given array
|
||||
bool OpenMemoryArray(ResourceData& data); // take the given array
|
||||
bool OpenMemoryArray(FileData& data); // take the given array
|
||||
bool OpenMemoryArray(std::function<bool(std::vector<uint8_t>&)> getter); // read contents to a buffer and return a reader to it
|
||||
bool OpenDecompressor(FileReader &parent, Size length, int method, bool seekable, bool exceptions = false); // creates a decompressor stream. 'seekable' uses a buffered version so that the Seek and Tell methods can be used.
|
||||
|
||||
|
@ -273,9 +273,9 @@ public:
|
|||
return mReader->Read(buffer, len);
|
||||
}
|
||||
|
||||
ResourceData Read(size_t len)
|
||||
FileData Read(size_t len)
|
||||
{
|
||||
ResourceData buffer;
|
||||
FileData buffer;
|
||||
if (len > 0)
|
||||
{
|
||||
Size length = mReader->Read(buffer.allocate(len), len);
|
||||
|
@ -284,15 +284,15 @@ public:
|
|||
return buffer;
|
||||
}
|
||||
|
||||
ResourceData Read()
|
||||
FileData Read()
|
||||
{
|
||||
return Read(GetLength());
|
||||
}
|
||||
|
||||
ResourceData ReadPadded(size_t padding)
|
||||
FileData ReadPadded(size_t padding)
|
||||
{
|
||||
auto len = GetLength();
|
||||
ResourceData buffer;
|
||||
FileData buffer;
|
||||
|
||||
if (len > 0)
|
||||
{
|
||||
|
|
|
@ -22,42 +22,6 @@ union LumpShortName
|
|||
};
|
||||
|
||||
|
||||
// A lump in memory.
|
||||
class FileData
|
||||
{
|
||||
public:
|
||||
FileData() { lump = nullptr; }
|
||||
const void *GetMem () { return lump->Cache; }
|
||||
size_t GetSize () { return lump->LumpSize; }
|
||||
const char* GetString () const { return (const char*)lump->Cache; }
|
||||
const uint8_t* GetBytes() const { return (const uint8_t*)lump->Cache; }
|
||||
|
||||
FileData& operator = (const FileData& copy) = delete;
|
||||
|
||||
FileData(const FileData& copy)
|
||||
{
|
||||
lump = copy.lump;
|
||||
lump->Lock();
|
||||
}
|
||||
|
||||
~FileData()
|
||||
{
|
||||
if (lump) lump->Unlock();
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
FileData(FResourceLump* nlump)
|
||||
{
|
||||
lump = nlump;
|
||||
if (lump) lump->Lock();
|
||||
}
|
||||
|
||||
FResourceLump* lump;
|
||||
|
||||
friend class FileSystem;
|
||||
};
|
||||
|
||||
struct FolderEntry
|
||||
{
|
||||
const char *name;
|
||||
|
|
|
@ -249,7 +249,7 @@ public:
|
|||
return l ? l->GetIndexNum() : 0;
|
||||
}
|
||||
|
||||
ResourceData Read(int entry)
|
||||
FileData Read(int entry)
|
||||
{
|
||||
auto fr = GetEntryReader(entry, false);
|
||||
return fr.Read();
|
||||
|
|
|
@ -406,10 +406,10 @@ bool FileReader::OpenMemoryArray(std::vector<uint8_t>& data)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool FileReader::OpenMemoryArray(ResourceData& data)
|
||||
bool FileReader::OpenMemoryArray(FileData& data)
|
||||
{
|
||||
Close();
|
||||
if (data.size() > 0) mReader = new MemoryArrayReader<ResourceData>(data);
|
||||
if (data.size() > 0) mReader = new MemoryArrayReader<FileData>(data);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -306,7 +306,6 @@ int FileSystem::AddFromBuffer(const char* name, char* data, int size, int id, in
|
|||
if (rf)
|
||||
{
|
||||
Files.push_back(rf);
|
||||
FResourceLump* lump = rf->GetLump(0);
|
||||
FileInfo.resize(FileInfo.size() + 1);
|
||||
FileSystem::LumpRecord* lump_p = &FileInfo.back();
|
||||
lump_p->SetFromLump(rf, 0, (int)Files.size() - 1, stringpool);
|
||||
|
@ -379,7 +378,6 @@ void FileSystem::AddFile (const char *filename, FileReader *filer, LumpFilterInf
|
|||
Files.push_back(resfile);
|
||||
for (int i = 0; i < resfile->EntryCount(); i++)
|
||||
{
|
||||
FResourceLump* lump = resfile->GetLump(i);
|
||||
FileInfo.resize(FileInfo.size() + 1);
|
||||
FileSystem::LumpRecord* lump_p = &FileInfo.back();
|
||||
lump_p->SetFromLump(resfile, i, (int)Files.size() - 1, stringpool);
|
||||
|
@ -1312,10 +1310,7 @@ FileData FileSystem::ReadFile (int lump)
|
|||
{
|
||||
throw FileSystemException("ReadFile: %u >= NumEntries", lump);
|
||||
}
|
||||
|
||||
auto file = FileInfo[lump].resfile;
|
||||
auto lumpp = file->GetLump(FileInfo[lump].resindex);
|
||||
return FileData(lumpp);
|
||||
return FileInfo[lump].resfile->Read(FileInfo[lump].resindex);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -125,7 +125,7 @@ FSingleLumpFont::FSingleLumpFont (const char *name, int lump) : FFont(lump)
|
|||
FontName = name;
|
||||
|
||||
auto data1 = fileSystem.ReadFile (lump);
|
||||
auto data = data1.GetBytes();
|
||||
auto data = data1.bytes();
|
||||
|
||||
if (data[0] == 0xE1 && data[1] == 0xE6 && data[2] == 0xD5 && data[3] == 0x1A)
|
||||
{
|
||||
|
@ -475,7 +475,7 @@ void FSingleLumpFont::LoadBMF(int lump, const uint8_t *data)
|
|||
void FSingleLumpFont::CheckFON1Chars()
|
||||
{
|
||||
auto memLump = fileSystem.ReadFile(Lump);
|
||||
auto data = memLump.GetBytes();
|
||||
auto data = memLump.bytes();
|
||||
const uint8_t* data_p;
|
||||
|
||||
data_p = data + 8;
|
||||
|
|
|
@ -165,7 +165,7 @@ unsigned FindModel(const char * path, const char * modelfile, bool silent)
|
|||
|
||||
int len = fileSystem.FileLength(lump);
|
||||
auto lumpd = fileSystem.ReadFile(lump);
|
||||
const char * buffer = lumpd.GetString();
|
||||
const char * buffer = lumpd.string();
|
||||
|
||||
if ( (size_t)fullname.LastIndexOf("_d.3d") == fullname.Len()-5 )
|
||||
{
|
||||
|
|
|
@ -274,7 +274,7 @@ void IQMModel::LoadGeometry()
|
|||
try
|
||||
{
|
||||
auto lumpdata = fileSystem.ReadFile(mLumpNum);
|
||||
IQMFileReader reader(lumpdata.GetMem(), (int)lumpdata.GetSize());
|
||||
IQMFileReader reader(lumpdata.data(), (int)lumpdata.size());
|
||||
|
||||
Vertices.Resize(NumVertices);
|
||||
for (IQMVertexArray& vertexArray : VertexArrays)
|
||||
|
|
|
@ -178,7 +178,7 @@ void FDMDModel::LoadGeometry()
|
|||
{
|
||||
static int axis[3] = { VX, VY, VZ };
|
||||
auto lumpdata = fileSystem.ReadFile(mLumpNum);
|
||||
auto buffer = lumpdata.GetString();
|
||||
auto buffer = lumpdata.string();
|
||||
texCoords = new FTexCoord[info.numTexCoords];
|
||||
memcpy(texCoords, buffer + info.offsetTexCoords, info.numTexCoords * sizeof(FTexCoord));
|
||||
|
||||
|
@ -502,7 +502,7 @@ void FMD2Model::LoadGeometry()
|
|||
static int axis[3] = { VX, VY, VZ };
|
||||
uint8_t *md2_frames;
|
||||
auto lumpdata = fileSystem.ReadFile(mLumpNum);
|
||||
auto buffer = lumpdata.GetString();
|
||||
auto buffer = lumpdata.string();
|
||||
|
||||
texCoords = new FTexCoord[info.numTexCoords];
|
||||
memcpy(texCoords, (uint8_t*)buffer + info.offsetTexCoords, info.numTexCoords * sizeof(FTexCoord));
|
||||
|
|
|
@ -190,7 +190,7 @@ bool FMD3Model::Load(const char * path, int lumpnum, const char * buffer, int le
|
|||
void FMD3Model::LoadGeometry()
|
||||
{
|
||||
auto lumpdata = fileSystem.ReadFile(mLumpNum);
|
||||
auto buffer = lumpdata.GetString();
|
||||
auto buffer = lumpdata.string();
|
||||
md3_header_t * hdr = (md3_header_t *)buffer;
|
||||
md3_surface_t * surf = (md3_surface_t*)(buffer + LittleLong(hdr->Ofs_Surfaces));
|
||||
|
||||
|
|
|
@ -71,9 +71,9 @@ void FUE1Model::LoadGeometry()
|
|||
{
|
||||
const char *buffer, *buffer2;
|
||||
auto lump = fileSystem.ReadFile(mDataLump);
|
||||
buffer = lump.GetString();
|
||||
buffer = lump.string();
|
||||
auto lump2 = fileSystem.ReadFile(mAnivLump);
|
||||
buffer2 = lump2.GetString();
|
||||
buffer2 = lump2.string();
|
||||
// map structures
|
||||
dhead = (const d3dhead*)(buffer);
|
||||
dpolys = (const d3dpoly*)(buffer+sizeof(d3dhead));
|
||||
|
|
|
@ -162,8 +162,8 @@ FVoxel *R_LoadKVX(int lumpnum)
|
|||
int i, j, n;
|
||||
|
||||
auto lump = fileSystem.ReadFile(lumpnum); // FileData adds an extra 0 byte to the end.
|
||||
auto rawvoxel = lump.GetBytes();
|
||||
int voxelsize = (int)(lump.GetSize());
|
||||
auto rawvoxel = lump.bytes();
|
||||
int voxelsize = (int)(lump.size());
|
||||
|
||||
// Oh, KVX, why couldn't you have a proper header? We'll just go through
|
||||
// and collect each MIP level, doing lots of range checking, and if the
|
||||
|
|
|
@ -106,10 +106,10 @@ FAnmTexture::FAnmTexture (int lumpnum, int w, int h)
|
|||
void FAnmTexture::ReadFrame(uint8_t *pixels, uint8_t *palette)
|
||||
{
|
||||
auto lump = fileSystem.ReadFile (SourceLump);
|
||||
auto source = lump.GetBytes();
|
||||
auto source = lump.bytes();
|
||||
|
||||
std::unique_ptr<anim_t> anim = std::make_unique<anim_t>(); // note that this struct is very large and should not go onto the stack!
|
||||
if (ANIM_LoadAnim(anim.get(), source, (int)lump.GetSize()) >= 0)
|
||||
if (ANIM_LoadAnim(anim.get(), source, (int)lump.size()) >= 0)
|
||||
{
|
||||
int numframes = ANIM_NumFrames(anim.get());
|
||||
if (numframes >= 1)
|
||||
|
|
|
@ -93,7 +93,7 @@ PalettedPixels FAutomapTexture::CreatePalettedPixels(int conversion, int frame)
|
|||
{
|
||||
int x, y;
|
||||
auto data = fileSystem.ReadFile (SourceLump);
|
||||
auto indata = data.GetBytes();
|
||||
auto indata = data.bytes();
|
||||
|
||||
PalettedPixels Pixels(Width * Height);
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ FIMGZTexture::FIMGZTexture (int lumpnum, uint16_t w, uint16_t h, int16_t l, int1
|
|||
PalettedPixels FIMGZTexture::CreatePalettedPixels(int conversion, int frame)
|
||||
{
|
||||
auto lump = fileSystem.ReadFile (SourceLump);
|
||||
auto imgz = (const ImageHeader *)lump.GetMem();
|
||||
auto imgz = (const ImageHeader *)lump.data();
|
||||
const uint8_t *data = (const uint8_t *)&imgz[1];
|
||||
|
||||
uint8_t *dest_p;
|
||||
|
|
|
@ -186,7 +186,7 @@ PalettedPixels FPatchTexture::CreatePalettedPixels(int conversion, int frame)
|
|||
int x;
|
||||
|
||||
auto lump = fileSystem.ReadFile (SourceLump);
|
||||
const patch_t *patch = (const patch_t *)lump.GetMem();
|
||||
const patch_t *patch = (const patch_t *)lump.data();
|
||||
|
||||
maxcol = (const column_t *)((const uint8_t *)patch + fileSystem.FileLength (SourceLump) - 3);
|
||||
|
||||
|
@ -296,7 +296,7 @@ void FPatchTexture::DetectBadPatches ()
|
|||
// It must be 256 pixels tall, and all its columns must have exactly
|
||||
// one post, where each post has a supposed length of 0.
|
||||
auto lump = fileSystem.ReadFile (SourceLump);
|
||||
const patch_t *realpatch = (patch_t *)lump.GetMem();
|
||||
const patch_t *realpatch = (patch_t *)lump.data();
|
||||
const uint32_t *cofs = realpatch->columnofs;
|
||||
int x, x2 = LittleShort(realpatch->width);
|
||||
|
||||
|
|
|
@ -141,14 +141,14 @@ int FQOITexture::CopyPixels(FBitmap *bmp, int conversion, int frame)
|
|||
constexpr auto QOI_COLOR_HASH = [](PalEntry C) { return (C.r * 3 + C.g * 5 + C.b * 7 + C.a * 11); };
|
||||
|
||||
auto lump = fileSystem.ReadFile(SourceLump);
|
||||
if (lump.GetSize() < 22) return 0; // error
|
||||
if (lump.size() < 22) return 0; // error
|
||||
PalEntry index[64] = {};
|
||||
PalEntry pe = 0xff000000;
|
||||
|
||||
size_t p = 14, run = 0;
|
||||
|
||||
size_t chunks_len = lump.GetSize() - 8;
|
||||
auto bytes = lump.GetBytes();
|
||||
size_t chunks_len = lump.size() - 8;
|
||||
auto bytes = lump.bytes();
|
||||
|
||||
for (int h = 0; h < Height; h++)
|
||||
{
|
||||
|
|
|
@ -183,7 +183,7 @@ FRawPageTexture::FRawPageTexture (int lumpnum)
|
|||
PalettedPixels FRawPageTexture::CreatePalettedPixels(int conversion, int frame)
|
||||
{
|
||||
auto lump = fileSystem.ReadFile (SourceLump);
|
||||
auto source = lump.GetBytes();
|
||||
auto source = lump.bytes();
|
||||
const uint8_t *source_p = source;
|
||||
uint8_t *dest_p;
|
||||
|
||||
|
@ -216,8 +216,8 @@ int FRawPageTexture::CopyPixels(FBitmap *bmp, int conversion, int frame)
|
|||
{
|
||||
auto lump = fileSystem.ReadFile(SourceLump);
|
||||
auto plump = fileSystem.ReadFile(mPaletteLump);
|
||||
auto source = lump.GetBytes();
|
||||
auto psource = plump.GetBytes();
|
||||
auto source = lump.bytes();
|
||||
auto psource = plump.bytes();
|
||||
PalEntry paldata[256];
|
||||
for (auto & pe : paldata)
|
||||
{
|
||||
|
|
|
@ -165,7 +165,7 @@ FStartupTexture::FStartupTexture (int lumpnum)
|
|||
bUseGamePalette = false;
|
||||
|
||||
auto lump = fileSystem.ReadFile (SourceLump);
|
||||
auto source = lump.GetBytes();
|
||||
auto source = lump.bytes();
|
||||
|
||||
// Initialize the bitmap palette.
|
||||
// the palette is static so that the notches can share it.
|
||||
|
@ -234,7 +234,7 @@ void PlanarToChunky(T* dest, const uint8_t* src, const T* remap, int width, int
|
|||
PalettedPixels FStartupTexture::CreatePalettedPixels(int conversion, int frame)
|
||||
{
|
||||
auto lump = fileSystem.ReadFile (SourceLump);
|
||||
auto source = lump.GetBytes();
|
||||
auto source = lump.bytes();
|
||||
const uint8_t *remap = ImageHelpers::GetRemap(conversion == luminance);
|
||||
|
||||
|
||||
|
@ -254,7 +254,7 @@ PalettedPixels FStartupTexture::CreatePalettedPixels(int conversion, int frame)
|
|||
int FStartupTexture::CopyPixels(FBitmap *bmp, int conversion, int frame)
|
||||
{
|
||||
auto lump = fileSystem.ReadFile (SourceLump);
|
||||
auto source = lump.GetBytes();
|
||||
auto source = lump.bytes();
|
||||
PlanarToChunky((uint32_t*)bmp->GetPixels(), source + 48, startuppalette32, Width, Height);
|
||||
return 0;
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ FNotchTexture::FNotchTexture (int lumpnum, int width, int height)
|
|||
PalettedPixels FNotchTexture::CreatePalettedPixels(int conversion, int frame)
|
||||
{
|
||||
auto lump = fileSystem.ReadFile (SourceLump);
|
||||
auto source = lump.GetBytes();
|
||||
auto source = lump.bytes();
|
||||
const uint8_t *remap = ImageHelpers::GetRemap(conversion == luminance);
|
||||
|
||||
TArray<uint8_t> Work(Width*Height, true);
|
||||
|
@ -305,7 +305,7 @@ PalettedPixels FNotchTexture::CreatePalettedPixels(int conversion, int frame)
|
|||
int FNotchTexture::CopyPixels(FBitmap *bmp, int conversion, int frame)
|
||||
{
|
||||
auto lump = fileSystem.ReadFile (SourceLump);
|
||||
auto source = lump.GetBytes();
|
||||
auto source = lump.bytes();
|
||||
|
||||
auto Work = (uint32_t*)bmp->GetPixels();
|
||||
for(int i = 0; i < Width * Height / 2; i++)
|
||||
|
@ -339,7 +339,7 @@ FStrifeStartupTexture::FStrifeStartupTexture (int lumpnum, int w, int h)
|
|||
PalettedPixels FStrifeStartupTexture::CreatePalettedPixels(int conversion, int frame)
|
||||
{
|
||||
auto lump = fileSystem.ReadFile (SourceLump);
|
||||
auto source = lump.GetBytes();
|
||||
auto source = lump.bytes();
|
||||
PalettedPixels Pixels(Width*Height);
|
||||
const uint8_t *remap = ImageHelpers::GetRemap(conversion == luminance);
|
||||
ImageHelpers::FlipNonSquareBlockRemap(Pixels.Data(), source, Width, Height, Width, remap);
|
||||
|
|
|
@ -142,7 +142,7 @@ int FWebPTexture::CopyPixels(FBitmap *bmp, int conversion, int frame)
|
|||
config.output.u.RGBA.stride = bmp->GetPitch();
|
||||
config.output.is_external_memory = 1;
|
||||
|
||||
(void)WebPDecode(bytes.GetBytes(), bytes.GetSize(), &config);
|
||||
(void)WebPDecode(bytes.bytes(), bytes.size(), &config);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -398,12 +398,12 @@ void FMultipatchTextureBuilder::AddTexturesLumps(int lump1, int lump2, int patch
|
|||
if (lump1 >= 0)
|
||||
{
|
||||
auto texdir = fileSystem.ReadFile(lump1);
|
||||
AddTexturesLump(texdir.GetMem(), fileSystem.FileLength(lump1), lump1, patcheslump, firstdup, true);
|
||||
AddTexturesLump(texdir.data(), fileSystem.FileLength(lump1), lump1, patcheslump, firstdup, true);
|
||||
}
|
||||
if (lump2 >= 0)
|
||||
{
|
||||
auto texdir = fileSystem.ReadFile(lump2);
|
||||
AddTexturesLump(texdir.GetMem(), fileSystem.FileLength(lump2), lump2, patcheslump, firstdup, false);
|
||||
AddTexturesLump(texdir.data(), fileSystem.FileLength(lump2), lump2, patcheslump, firstdup, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1045,7 +1045,7 @@ void uppercopy(char* to, const char* from)
|
|||
FString GetStringFromLump(int lump, bool zerotruncate)
|
||||
{
|
||||
auto fd = fileSystem.ReadFile(lump);
|
||||
FString ScriptBuffer(fd.GetString(), fd.GetSize());
|
||||
FString ScriptBuffer(fd.string(), fd.size());
|
||||
if (zerotruncate) ScriptBuffer.Truncate(strlen(ScriptBuffer.GetChars())); // this is necessary to properly truncate the generated string to not contain 0 bytes.
|
||||
return ScriptBuffer;
|
||||
}
|
||||
|
|
|
@ -681,8 +681,8 @@ FString V_GetColorStringByName(const char* name, FScriptPosition* sc)
|
|||
}
|
||||
|
||||
auto rgbNames = fileSystem.ReadFile(rgblump);
|
||||
rgb = rgbNames.GetString();
|
||||
rgbEnd = rgb + rgbNames.GetSize();
|
||||
rgb = rgbNames.string();
|
||||
rgbEnd = rgb + rgbNames.size();
|
||||
step = 0;
|
||||
namelen = strlen(name);
|
||||
|
||||
|
@ -930,11 +930,11 @@ int ReadPalette(int lumpnum, uint8_t* buffer)
|
|||
return 0;
|
||||
}
|
||||
auto lump = fileSystem.ReadFile(lumpnum);
|
||||
auto lumpmem = lump.GetBytes();
|
||||
auto lumpmem = lump.bytes();
|
||||
memset(buffer, 0, 768);
|
||||
|
||||
FileReader fr;
|
||||
fr.OpenMemory(lumpmem, lump.GetSize());
|
||||
fr.OpenMemory(lumpmem, lump.size());
|
||||
auto png = M_VerifyPNG(fr);
|
||||
if (png)
|
||||
{
|
||||
|
@ -964,7 +964,7 @@ int ReadPalette(int lumpnum, uint8_t* buffer)
|
|||
{
|
||||
FScanner sc;
|
||||
|
||||
sc.OpenMem(fileSystem.GetFileFullName(lumpnum), (char*)lumpmem, int(lump.GetSize()));
|
||||
sc.OpenMem(fileSystem.GetFileFullName(lumpnum), (char*)lumpmem, int(lump.size()));
|
||||
sc.MustGetString();
|
||||
sc.MustGetNumber(); // version - ignore
|
||||
sc.MustGetNumber();
|
||||
|
@ -982,7 +982,7 @@ int ReadPalette(int lumpnum, uint8_t* buffer)
|
|||
}
|
||||
else
|
||||
{
|
||||
memcpy(buffer, lumpmem, min<size_t>(768, lump.GetSize()));
|
||||
memcpy(buffer, lumpmem, min<size_t>(768, lump.size()));
|
||||
return 256;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -315,7 +315,7 @@ FIWadManager::FIWadManager(const char *firstfn, const char *optfn)
|
|||
if (num >= 0)
|
||||
{
|
||||
auto data = check.ReadFile(num);
|
||||
ParseIWadInfo("IWADINFO", data.GetString(), (int)data.GetSize());
|
||||
ParseIWadInfo("IWADINFO", data.string(), (int)data.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ int FIWadManager::CheckIWADInfo(const char* fn)
|
|||
|
||||
FIWADInfo result;
|
||||
auto data = check.ReadFile(num);
|
||||
ParseIWadInfo(fn, data.GetString(), (int)data.GetSize(), &result);
|
||||
ParseIWadInfo(fn, data.string(), (int)data.size(), &result);
|
||||
|
||||
for (unsigned i = 0, count = mIWadInfos.Size(); i < count; ++i)
|
||||
{
|
||||
|
|
|
@ -1940,7 +1940,7 @@ static FString CheckGameInfo(std::vector<std::string> & pwads)
|
|||
// Found one!
|
||||
auto data = check.ReadFile(num);
|
||||
auto wadname = check.GetResourceFileName(check.GetFileContainer(num));
|
||||
return ParseGameInfo(pwads, wadname, data.GetString(), (int)data.GetSize());
|
||||
return ParseGameInfo(pwads, wadname, data.string(), (int)data.size());
|
||||
}
|
||||
}
|
||||
return "";
|
||||
|
|
|
@ -2599,7 +2599,7 @@ void G_ParseMapInfo (FString basemapinfo)
|
|||
if (comp >= 0)
|
||||
{
|
||||
auto complvl = fileSystem.ReadFile(comp);
|
||||
auto data = complvl.GetString();
|
||||
auto data = complvl.string();
|
||||
int length = fileSystem.FileLength(comp);
|
||||
if (length == 7 && !strnicmp("vanilla", data, 7))
|
||||
{
|
||||
|
|
|
@ -166,8 +166,8 @@ void D_LoadWadSettings ()
|
|||
while ((lump = fileSystem.FindLump ("KEYCONF", &lastlump)) != -1)
|
||||
{
|
||||
auto data = fileSystem.ReadFile (lump);
|
||||
const char* conf = data.GetString();
|
||||
const char *eof = conf + data.GetSize();
|
||||
const char* conf = data.string();
|
||||
const char *eof = conf + data.size();
|
||||
|
||||
while (conf < eof)
|
||||
{
|
||||
|
|
|
@ -67,7 +67,7 @@ void FTextureAnimator::InitSwitchList ()
|
|||
if (lump != -1)
|
||||
{
|
||||
auto lumpdata = fileSystem.ReadFile (lump);
|
||||
auto alphSwitchList = lumpdata.GetString();
|
||||
auto alphSwitchList = lumpdata.string();
|
||||
const char *list_p;
|
||||
FSwitchDef *def1, *def2;
|
||||
|
||||
|
|
|
@ -205,7 +205,7 @@ void FTextureAnimator::InitAnimated (void)
|
|||
{
|
||||
auto animatedlump = fileSystem.ReadFile (lumpnum);
|
||||
int animatedlen = fileSystem.FileLength(lumpnum);
|
||||
auto animdefs = animatedlump.GetBytes();
|
||||
auto animdefs = animatedlump.bytes();
|
||||
const uint8_t *anim_p;
|
||||
FTextureID pic1, pic2;
|
||||
int animtype;
|
||||
|
|
|
@ -85,7 +85,7 @@ static int BuildPaletteTranslation(int lump)
|
|||
}
|
||||
|
||||
auto data = fileSystem.ReadFile(lump);
|
||||
auto ipal = data.GetBytes();
|
||||
auto ipal = data.bytes();
|
||||
FRemapTable opal;
|
||||
|
||||
bool blood = false;
|
||||
|
|
|
@ -98,7 +98,7 @@ void M_FindResponseFile (void)
|
|||
else
|
||||
{
|
||||
char **argv;
|
||||
FileSys::ResourceData file;
|
||||
FileSys::FileData file;
|
||||
int argc = 0;
|
||||
size_t argsize = 0;
|
||||
int index;
|
||||
|
|
|
@ -403,7 +403,7 @@ void player_t::SetLogNumber (int num)
|
|||
}
|
||||
|
||||
auto lump = fileSystem.ReadFile(lumpnum);
|
||||
SetLogText (lump.GetString());
|
||||
SetLogText (lump.string());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -494,7 +494,7 @@ static void R_CreatePlayerTranslation (float h, float s, float v, const FPlayerC
|
|||
else
|
||||
{
|
||||
auto translump = fileSystem.ReadFile(colorset->Lump);
|
||||
auto trans = translump.GetBytes();
|
||||
auto trans = translump.bytes();
|
||||
for (i = start; i <= end; ++i)
|
||||
{
|
||||
table->Remap[i] = GPalette.Remap[trans[i]];
|
||||
|
|
|
@ -947,7 +947,7 @@ CCMD (skins)
|
|||
static void R_CreateSkinTranslation (const char *palname)
|
||||
{
|
||||
auto lump = fileSystem.ReadFile (palname);
|
||||
auto otherPal = lump.GetBytes();
|
||||
auto otherPal = lump.bytes();
|
||||
|
||||
for (int i = 0; i < 256; ++i)
|
||||
{
|
||||
|
|
|
@ -65,7 +65,7 @@ void InitPalette ()
|
|||
if (lump != -1)
|
||||
{
|
||||
FileData cmap = fileSystem.ReadFile(lump);
|
||||
auto cmapdata = cmap.GetBytes();
|
||||
auto cmapdata = cmap.bytes();
|
||||
GPalette.GenerateGlobalBrightmapFromColormap(cmapdata, 32);
|
||||
MakeGoodRemap((uint32_t*)GPalette.BaseColors, GPalette.Remap, cmapdata + 7936); // last entry in colormap
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue