simplification of MemoryArrayReader interface.

This commit is contained in:
Christoph Oelckers 2023-12-13 17:49:20 +01:00
commit 235d36fe69
3 changed files with 3 additions and 33 deletions

View file

@ -317,14 +317,9 @@ unsigned FSavegameManagerBase::ExtractSaveData(int index)
if (pic >= 0)
{
FileReader picreader;
picreader.OpenMemoryArray([=](std::vector<uint8_t>& array)
{
auto rd = resf->GetEntryReader(pic, false);
array.resize(resf->Length(pic));
rd.Read(array.data(), array.size());
return true;
});
// we must create a memory reader copy of the PNG if we want to close the savegame file here.
auto rd = resf->Read(pic);
picreader.OpenMemoryArray(rd);
PNGHandle *png = M_VerifyPNG(picreader);
if (png != nullptr)
{