comparison src/dmpack.h @ 1037:d674ddc0fc82

Change PACK file format to use 64 bit fileoffsets. Also switch some fields around for nicety. This breaks compatibility, so bump version.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 01 Mar 2015 16:59:00 +0200
parents 2e9ba01294b3
children 0115b3dd9064
comparison
equal deleted inserted replaced
1036:1a0a327d8fed 1037:d674ddc0fc82
8 #define DMPACK_H 8 #define DMPACK_H
9 #include "dmlib.h" 9 #include "dmlib.h"
10 10
11 11
12 #define DPACK_IDENT "TNSPDPCK" // Magic ident 12 #define DPACK_IDENT "TNSPDPCK" // Magic ident
13 #define DPACK_VERSION (0x0120) // Version 13 #define DPACK_VERSION (0x0200) // Version
14 14
15 15
16 typedef struct _DMPackEntry 16 typedef struct _DMPackEntry
17 { 17 {
18 Uint32 size; // Size (UNCOMPRESSED)
19 Uint32 offset; // Offset in pack file
20 Uint32 length; // (Compressed) data length
21 char filename[DMRES_NAME_LEN + 1]; // +1 for NUL byte 18 char filename[DMRES_NAME_LEN + 1]; // +1 for NUL byte
19 Uint64 offset; // Offset in pack file
20 Uint32 length; // Compressed data length
21 Uint32 size; // Size of UNCOMPRESSED data
22 Uint32 flags; // Stored flags, see DMF_* in dmres.h
22 23
23 Uint32 flags, privFlags; 24 Uint32 privFlags; // PrivFlags are not stored
24 struct _DMPackEntry *next, *prev; 25 struct _DMPackEntry *next, *prev;
25 } DMPackEntry; 26 } DMPackEntry;
26 27
27 28
28 typedef struct 29 typedef struct
36 typedef struct __attribute__((__packed__)) 37 typedef struct __attribute__((__packed__))
37 { 38 {
38 char ident[8]; // Magic identifier 39 char ident[8]; // Magic identifier
39 Uint16 version; // Version 40 Uint16 version; // Version
40 Uint32 dirEntries; // Number of entries 41 Uint32 dirEntries; // Number of entries
41 Uint32 dirOffset; // Offset of the directory 42 Uint64 dirOffset; // Offset of the directory
42 } DMPackFileHeader; 43 } DMPackFileHeader;
43 44
44 45
45 DMPackEntry * dmPackEntryNew(); 46 DMPackEntry * dmPackEntryNew();
46 void dmPackEntryFree(DMPackEntry *); 47 void dmPackEntryFree(DMPackEntry *);