Mercurial > hg > dmlib
annotate src/dmpack.h @ 1013:1684bf6aa1f8
Bump copyright.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 01 Mar 2015 04:43:10 +0200 |
parents | 7a781c1285d9 |
children | c353e6bcb733 |
rev | line source |
---|---|
0 | 1 /* |
2 * DMLib | |
3 * -- PACK-file routines | |
4 * Programmed and designed by Matti 'ccr' Hamalainen | |
1013 | 5 * (C) Copyright 2011-2015 Tecnic Software productions (TNSP) |
0 | 6 */ |
7 #ifndef DMPACK_H | |
8 #define DMPACK_H | |
9 #include "dmlib.h" | |
10 | |
11 | |
12 #define DPACK_IDENT "TNSPDPCK" // Magic ident | |
13 #define DPACK_VERSION (0x0120) // Version | |
14 | |
15 | |
16 typedef struct _DMPackEntry | |
17 { | |
18 char filename[DMRES_NAME_LEN]; | |
19 Uint32 size; // Size (UNCOMPRESSED) | |
20 Uint32 offset; // Offset in pack file | |
21 Uint32 length; // (Compressed) data length | |
721
bb14d7907eb2
Rename many pack & resource handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
22 |
bb14d7907eb2
Rename many pack & resource handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
23 Uint32 flags, privFlags; |
0 | 24 |
25 struct _DMPackEntry *next, *prev; | |
26 } DMPackEntry; | |
27 | |
28 | |
29 typedef struct | |
30 { | |
31 DMPackEntry *entries; | |
32 char * filename; // Filename & path | |
33 FILE * file; // File | |
34 } DMPackFile; | |
35 | |
36 | |
1006 | 37 typedef struct __attribute__((__packed__)) |
0 | 38 { |
39 char ident[8]; // Magic identifier | |
40 Uint16 version; // Version | |
41 Uint32 dirEntries; // Number of entries | |
42 Uint32 dirOffset; // Offset of the directory | |
43 } DMPackFileHeader; | |
44 | |
45 | |
721
bb14d7907eb2
Rename many pack & resource handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
46 DMPackEntry * dmPackEntryNew(); |
bb14d7907eb2
Rename many pack & resource handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
47 void dmPackEntryFree(DMPackEntry *); |
bb14d7907eb2
Rename many pack & resource handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
48 void dmPackEntryInsert(DMPackEntry **, DMPackEntry *); |
bb14d7907eb2
Rename many pack & resource handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
49 void dmPackEntryDelete(DMPackEntry **, DMPackEntry *); |
0 | 50 |
721
bb14d7907eb2
Rename many pack & resource handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
51 DMPackEntry * dmPackFind(DMPackEntry *list, const char *filename); |
0 | 52 |
721
bb14d7907eb2
Rename many pack & resource handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
53 int dmPackOpen(const char *, DMPackFile **, BOOL); |
bb14d7907eb2
Rename many pack & resource handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
54 int dmPackClose(DMPackFile *); |
bb14d7907eb2
Rename many pack & resource handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
55 int dmPackRead(DMPackFile *, const char *, Uint8 **, size_t *); |
0 | 56 |
57 | |
58 #endif // DMPACK_H |