Merge branch 'master' of git://github.com/BTAxis/naev into testmission
[naev.git] / src / pack.h
blobaa8c06d3dc099a750653d2a88b3daeb2ee2e056e
1 /*
2 * See Licensing and Copyright notice in naev.h
3 */
7 #ifndef PACK_H
8 # define PACK_H
11 #include "ncompat.h"
13 #include "SDL.h"
16 #include <fcntl.h> /* creat() and friends */
17 #include <stdint.h> /* uint32_t */
18 #if HAS_POSIX
19 #include <sys/types.h> /* ssize_t */
20 #endif /* HAS_POSIX */
23 struct Packfile_s;
24 typedef struct Packfile_s Packfile_t;
26 struct Packcache_s;
27 typedef struct Packcache_s Packcache_t;
30 * packcache manipulation.
32 Packcache_t* pack_openCache( const char* packfile );
33 void pack_closeCache( Packcache_t* cache );
34 Packfile_t* pack_openFromCache( Packcache_t* cache, const char* filename );
37 * packfile manipulation, automatically alloced and freed (with open and close)
39 /* basic */
40 int pack_check( const char* filename );
41 int pack_files( const char* outfile, const char** infiles, const uint32_t nfiles );
42 Packfile_t* pack_open( const char* packfile, const char* filename );
43 ssize_t pack_read( Packfile_t* file, void* buf, const size_t count );
44 off_t pack_seek( Packfile_t* file, off_t offset, int whence);
45 long pack_tell( Packfile_t* file );
46 int pack_close( Packfile_t* file );
47 /* fancy */
48 void* pack_readfile( const char* packfile, const char* filename, uint32_t *filesize );
49 char** pack_listfiles( const char* packfile, uint32_t* nfiles );
50 void* pack_readfileCached( Packcache_t* cache, const char* filename, uint32_t *filesize );
51 const char** pack_listfilesCached( Packcache_t* cache, uint32_t* nfiles );
54 * for rwops.
56 SDL_RWops *pack_rwops( const char* packfile, const char* filename );
57 SDL_RWops *pack_rwopsCached( Packcache_t* cache, const char* filename );
60 #endif /* PACK_H */