summaryrefslogtreecommitdiff
path: root/qstd/pack.h
diff options
context:
space:
mode:
Diffstat (limited to 'qstd/pack.h')
-rw-r--r--qstd/pack.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/qstd/pack.h b/qstd/pack.h
new file mode 100644
index 0000000..447cd5b
--- /dev/null
+++ b/qstd/pack.h
@@ -0,0 +1,40 @@
+#ifndef pack_h
+#define pack_h
+
+#include <stdint.h>
+
+struct Arena;
+struct Pack_File;
+
+typedef struct {
+ char name[56];
+ uint32_t offset;
+ uint32_t size;
+} Pack_Entry;
+
+typedef struct Pack {
+ char* filename;
+ uint32_t file_count;
+} Pack;
+
+Pack_Entry* pack_find_entry(Pack* p, const char* name);
+Pack_Entry* get_pack_table(Pack* p);
+int get_pack_size(int entry_count);
+
+Pack* pack_open(const char* filename, struct Arena* a);
+void pack_close(Pack* p);
+Pack_Entry* pack_get_entry(Pack* p, const char* name);
+
+typedef enum {
+ seek_rel_cur,
+ seek_rel_start,
+ seek_rel_end
+} Seek_Rel;
+
+struct Pack_File* pack_open_file(Pack* p, const char* name);
+void pack_close_file(struct Pack_File* h);
+int pack_read(struct Pack_File* f, void* buf, int size);
+void pack_seek(struct Pack_File* f, int offset, Seek_Rel rel);
+int pack_tell(struct Pack_File* f);
+
+#endif