Fix regression in zip texture packs

Can't seek in compressed zips. Let's add a comment too to not do this
again.

Thanks Nukem for debugging.
This commit is contained in:
Henrik Rydgård 2025-01-11 09:37:07 +01:00
parent 2e297426e9
commit e67b673e4e

View file

@ -290,8 +290,11 @@ VFSOpenFile *ZipFileReader::OpenFileForRead(VFSFileReference *vfsReference, size
void ZipFileReader::Rewind(VFSOpenFile *vfsOpenFile) {
ZipFileReaderOpenFile *file = (ZipFileReaderOpenFile *)vfsOpenFile;
_assert_(file);
// Unless the zip file is compressed, can't seek directly, so we re-open.
// This version of libzip doesn't even have zip_file_is_seekable(), should probably upgrade.
zip_fclose(file->zf);
file->zf = zip_fopen_index(zip_file_, file->reference->zi, 0);
_dbg_assert_(file->zf != nullptr);
zip_fseek(file->zf, 0, SEEK_SET);
}
size_t ZipFileReader::Read(VFSOpenFile *vfsOpenFile, void *buffer, size_t length) {