41 lines
1.2 KiB
C
41 lines
1.2 KiB
C
#pragma once
|
|
|
|
#include "lcompat.h"
|
|
|
|
#include <fcntl.h>
|
|
#include <stdint.h>
|
|
#if HAS_POSIX
|
|
#include <sys/types.h>
|
|
#endif /* HAS_POSIX */
|
|
|
|
struct Packfile_s;
|
|
typedef struct Packfile_s Packfile_t;
|
|
|
|
struct Packcache_s;
|
|
typedef struct Packcache_s Packcache_t;
|
|
|
|
/*
|
|
* Packcache manipulation.
|
|
*/
|
|
Packcache_t* pack_openCache(const char* packfile);
|
|
void pack_closeCache(Packcache_t* cache);
|
|
Packfile_t* pack_openFromCache(Packcache_t* cache, const char* filename);
|
|
|
|
/* Packfile manipulation. Automatically allocated and freed (with open and close). */
|
|
|
|
/* Basic. */
|
|
int pack_check(const char* filename);
|
|
int pack_files(const char* outfile, const char** infiles, const uint32_t nfiles);
|
|
Packfile_t* pack_open(const char* packfile, const char* filename);
|
|
ssize_t pack_read(Packfile_t* file, void* buf, const size_t count);
|
|
off_t pack_seek(Packfile_t* file, off_t offset, int whence);
|
|
long pack_tell(Packfile_t* file);
|
|
int pack_close(Packfile_t* file);
|
|
|
|
/* Fancy stuff. */
|
|
void* pack_readfile(const char* packfile, const char* filename, uint32_t* filesize);
|
|
char** pack_listfiles(const char* packfile, uint32_t* nfiles);
|
|
void* pack_readfileCached(Packcache_t* cache, const char* filename, uint32_t* filesize);
|
|
const char** pack_listfilesCached(Packcache_t* cache, uint32_t* nfiles);
|
|
|