Mercurial > hg > dmlib
annotate src/dmpack.h @ 1034:2e9ba01294b3
Cosmetics.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 01 Mar 2015 16:39:59 +0200 |
parents | c353e6bcb733 |
children | d674ddc0fc82 |
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 Uint32 size; // Size (UNCOMPRESSED) | |
19 Uint32 offset; // Offset in pack file | |
20 Uint32 length; // (Compressed) data length | |
1033
c353e6bcb733
Change handling of filename field in PACKs.
Matti Hamalainen <ccr@tnsp.org>
parents:
1013
diff
changeset
|
21 char filename[DMRES_NAME_LEN + 1]; // +1 for NUL byte |
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 struct _DMPackEntry *next, *prev; |
25 } DMPackEntry; | |
26 | |
27 | |
28 typedef struct | |
29 { | |
30 DMPackEntry *entries; | |
31 char * filename; // Filename & path | |
32 FILE * file; // File | |
33 } DMPackFile; | |
34 | |
35 | |
1006 | 36 typedef struct __attribute__((__packed__)) |
0 | 37 { |
38 char ident[8]; // Magic identifier | |
39 Uint16 version; // Version | |
40 Uint32 dirEntries; // Number of entries | |
41 Uint32 dirOffset; // Offset of the directory | |
42 } DMPackFileHeader; | |
43 | |
44 | |
721
bb14d7907eb2
Rename many pack & resource handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
45 DMPackEntry * dmPackEntryNew(); |
bb14d7907eb2
Rename many pack & resource handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
46 void dmPackEntryFree(DMPackEntry *); |
bb14d7907eb2
Rename many pack & resource handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
47 void dmPackEntryInsert(DMPackEntry **, DMPackEntry *); |
bb14d7907eb2
Rename many pack & resource handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
48 void dmPackEntryDelete(DMPackEntry **, DMPackEntry *); |
0 | 49 |
721
bb14d7907eb2
Rename many pack & resource handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
50 DMPackEntry * dmPackFind(DMPackEntry *list, const char *filename); |
0 | 51 |
721
bb14d7907eb2
Rename many pack & resource handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
52 int dmPackOpen(const char *, DMPackFile **, BOOL); |
bb14d7907eb2
Rename many pack & resource handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
53 int dmPackClose(DMPackFile *); |
bb14d7907eb2
Rename many pack & resource handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
54 int dmPackRead(DMPackFile *, const char *, Uint8 **, size_t *); |
0 | 55 |
56 | |
57 #endif // DMPACK_H |