Mercurial > hg > dmlib
view src/dmpack.h @ 1033:c353e6bcb733
Change handling of filename field in PACKs.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 01 Mar 2015 16:39:46 +0200 |
parents | 1684bf6aa1f8 |
children | 2e9ba01294b3 |
line wrap: on
line source
/* * DMLib * -- PACK-file routines * Programmed and designed by Matti 'ccr' Hamalainen * (C) Copyright 2011-2015 Tecnic Software productions (TNSP) */ #ifndef DMPACK_H #define DMPACK_H #include "dmlib.h" #define DPACK_IDENT "TNSPDPCK" // Magic ident #define DPACK_VERSION (0x0120) // Version typedef struct _DMPackEntry { Uint32 size; // Size (UNCOMPRESSED) Uint32 offset; // Offset in pack file Uint32 length; // (Compressed) data length char filename[DMRES_NAME_LEN + 1]; // +1 for NUL byte Uint32 flags, privFlags; struct _DMPackEntry *next, *prev; } DMPackEntry; typedef struct { DMPackEntry *entries; char * filename; // Filename & path FILE * file; // File } DMPackFile; typedef struct __attribute__((__packed__)) { char ident[8]; // Magic identifier Uint16 version; // Version Uint32 dirEntries; // Number of entries Uint32 dirOffset; // Offset of the directory } DMPackFileHeader; DMPackEntry * dmPackEntryNew(); void dmPackEntryFree(DMPackEntry *); void dmPackEntryInsert(DMPackEntry **, DMPackEntry *); void dmPackEntryDelete(DMPackEntry **, DMPackEntry *); DMPackEntry * dmPackFind(DMPackEntry *list, const char *filename); int dmPackOpen(const char *, DMPackFile **, BOOL); int dmPackClose(DMPackFile *); int dmPackRead(DMPackFile *, const char *, Uint8 **, size_t *); #endif // DMPACK_H