Mercurial > hg > dmlib
annotate src/dmpack.h @ 2281:167ec99e57a5
Initialize JSSPattern::used[] values to TRUE.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 18 Jun 2019 12:31:17 +0300 |
parents | d674ddc0fc82 |
children | 0115b3dd9064 |
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 | |
1037
d674ddc0fc82
Change PACK file format to use 64 bit fileoffsets. Also switch some
Matti Hamalainen <ccr@tnsp.org>
parents:
1034
diff
changeset
|
13 #define DPACK_VERSION (0x0200) // Version |
0 | 14 |
15 | |
16 typedef struct _DMPackEntry | |
17 { | |
1033
c353e6bcb733
Change handling of filename field in PACKs.
Matti Hamalainen <ccr@tnsp.org>
parents:
1013
diff
changeset
|
18 char filename[DMRES_NAME_LEN + 1]; // +1 for NUL byte |
1037
d674ddc0fc82
Change PACK file format to use 64 bit fileoffsets. Also switch some
Matti Hamalainen <ccr@tnsp.org>
parents:
1034
diff
changeset
|
19 Uint64 offset; // Offset in pack file |
d674ddc0fc82
Change PACK file format to use 64 bit fileoffsets. Also switch some
Matti Hamalainen <ccr@tnsp.org>
parents:
1034
diff
changeset
|
20 Uint32 length; // Compressed data length |
d674ddc0fc82
Change PACK file format to use 64 bit fileoffsets. Also switch some
Matti Hamalainen <ccr@tnsp.org>
parents:
1034
diff
changeset
|
21 Uint32 size; // Size of UNCOMPRESSED data |
d674ddc0fc82
Change PACK file format to use 64 bit fileoffsets. Also switch some
Matti Hamalainen <ccr@tnsp.org>
parents:
1034
diff
changeset
|
22 Uint32 flags; // Stored flags, see DMF_* in dmres.h |
721
bb14d7907eb2
Rename many pack & resource handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
23 |
1037
d674ddc0fc82
Change PACK file format to use 64 bit fileoffsets. Also switch some
Matti Hamalainen <ccr@tnsp.org>
parents:
1034
diff
changeset
|
24 Uint32 privFlags; // PrivFlags are not stored |
0 | 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 | |
1037
d674ddc0fc82
Change PACK file format to use 64 bit fileoffsets. Also switch some
Matti Hamalainen <ccr@tnsp.org>
parents:
1034
diff
changeset
|
42 Uint64 dirOffset; // Offset of the directory |
0 | 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 |