forked from keendreams/keen
-
Notifications
You must be signed in to change notification settings - Fork 1
/
sl_file.h
111 lines (81 loc) · 3.02 KB
/
sl_file.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/* Keen Dreams (SDL2/Steam Port) Source Code
* Copyright (C) 2014 Javier M. Chavez
* Copyright (C) 2015 David Gow <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef _SL_FILE_H
#define _SL_FILE_H
//==========================================================================
//
// DEFINES
//
//==========================================================================
#ifndef MakeID
#define MakeID(a,b,c,d) (((long)(d)<<24L)|((long)(c)<<16L)|((long)(b)<<8L)|(long)(a))
#endif
#define ID_SLIB MakeID('S','L','I','B')
#define SLIB ("SLIB")
#define SOFTLIB_VER 2
#define ID_CHUNK MakeID('C','U','N','K')
//==========================================================================
//
// TYPES
//
//==========================================================================
#include <stdint.h>
//--------------------------------------------------------------------------
// SOFTLIB File Entry Types
//--------------------------------------------------------------------------
typedef enum LibFileTypes
{
lib_DATA =0, // Just streight raw data
// lib_AUDIO, // Multi chunk audio file
} LibFileTypes;
//--------------------------------------------------------------------------
// SOFTLIB Library File header..
//
// * This header will NEVER change! *
//--------------------------------------------------------------------------
PACKED(SoftLibHdr)
{
uint16_t Version; // Library Version Num
uint16_t FileCount;
} SoftlibHdr;
//--------------------------------------------------------------------------
// SOFTLIB Directory Entry Hdr
//
// This can change according to Version of SoftLib (Make sure we are
// always downward compatable!
//--------------------------------------------------------------------------
#define SL_FILENAMESIZE 16
PACKED(FileEntryHdr)
{
char FileName[SL_FILENAMESIZE]; // NOTE : May not be null terminated!
uint32_t Offset;
uint32_t ChunkLen;
uint32_t OrginalLength;
int16_t Compression; // ct_TYPES
} FileEntryHdr;
//--------------------------------------------------------------------------
// SOFTLIB Entry Chunk Header
//--------------------------------------------------------------------------
PACKED(ChunkHeader)
{
uint32_t HeaderID;
uint32_t OrginalLength;
int16_t Compression; // ct_TYPES
} ChunkHeader;
#endif