mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-10-03 21:01:14 +00:00
Update inlcuded ttvfs
This commit is contained in:
parent
fe0a91129f
commit
ffa26e4105
22 changed files with 327 additions and 153 deletions
|
@ -10,8 +10,16 @@ set(ttvfs_zip_SRC
|
|||
VFSZipArchiveRef.h
|
||||
miniz.c
|
||||
miniz.h
|
||||
ttvfs_zip.h
|
||||
)
|
||||
|
||||
include_directories(${TTVFS_INCLUDE_DIRS})
|
||||
|
||||
add_library(ttvfs_zip ${ttvfs_zip_SRC})
|
||||
|
||||
install(TARGETS ttvfs_zip DESTINATION lib)
|
||||
|
||||
install(FILES miniz.c DESTINATION include/ttvfs)
|
||||
|
||||
install(DIRECTORY ./ DESTINATION include/ttvfs
|
||||
FILES_MATCHING PATTERN "*.h")
|
||||
|
|
|
@ -65,7 +65,7 @@ void ZipDir::load()
|
|||
continue;
|
||||
|
||||
ZipFile *vf = new ZipFile(fs.m_filename, _archiveHandle, fs.m_file_index);
|
||||
addRecursive(vf, len);
|
||||
_addRecursiveSkip(vf, len);
|
||||
}
|
||||
|
||||
_canLoad = false;
|
||||
|
|
|
@ -30,6 +30,8 @@ bool ZipFile::open(const char *mode /* = NULL */)
|
|||
_pos = 0;
|
||||
if(!mode)
|
||||
mode = "rb";
|
||||
else if(strchr(mode, 'w') || strchr(mode, 'a'))
|
||||
return false; // writing not yet supported
|
||||
if(_mode != mode)
|
||||
{
|
||||
delete [] _buf;
|
||||
|
@ -53,7 +55,7 @@ void ZipFile::close()
|
|||
{
|
||||
//flush(); // TODO: write to zip file on close
|
||||
|
||||
delete []_buf;
|
||||
delete [] _buf;
|
||||
_buf = NULL;
|
||||
_bufSize = 0;
|
||||
}
|
||||
|
@ -143,16 +145,15 @@ bool ZipFile::unpack()
|
|||
close(); // delete the buffer
|
||||
|
||||
const vfspos sz = size(); // will reopen the file
|
||||
if(sz < 0)
|
||||
if(sz == npos)
|
||||
return false;
|
||||
|
||||
_buf = new char[sz + 1];
|
||||
_buf = new char[size_t(sz) + 1];
|
||||
if(!_buf)
|
||||
return false;
|
||||
|
||||
if(!mz_zip_reader_extract_to_mem(MZ, _fileIdx, _buf, sz, 0))
|
||||
if(!mz_zip_reader_extract_to_mem(MZ, _fileIdx, _buf, (size_t)sz, 0))
|
||||
{
|
||||
//assert(0 && "ZipFile unpack: Failed mz_zip_reader_extract_to_mem");
|
||||
delete [] _buf;
|
||||
_buf = NULL;
|
||||
return false; // this should not happen
|
||||
|
|
|
@ -144,7 +144,7 @@
|
|||
// If all macros here are defined the only functionality remaining will be CRC-32, adler-32, tinfl, and tdefl.
|
||||
|
||||
// Define MINIZ_NO_STDIO to disable all usage and any functions which rely on stdio for file I/O.
|
||||
#define MINIZ_NO_STDIO
|
||||
//#define MINIZ_NO_STDIO
|
||||
|
||||
// If MINIZ_NO_TIME is specified then the ZIP archive functions will not be able to get the current time, or
|
||||
// get/set file times.
|
||||
|
|
6
ExternalLibs/ttvfs_zip/ttvfs_zip.h
Normal file
6
ExternalLibs/ttvfs_zip/ttvfs_zip.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
#ifndef TTVFS_ZIP_INC_H
|
||||
#define TTVFS_ZIP_INC_H
|
||||
|
||||
#include "VFSZipArchiveLoader.h"
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue