ScummVM API documentation
px_clu_api.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * Additional copyright for this file:
8  * Copyright (C) 1999-2000 Revolution Software Ltd.
9  * This code is based on source code created by Revolution Software,
10  * used with permission.
11  *
12  * This program is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation, either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program. If not, see <http://www.gnu.org/licenses/>.
24  *
25  */
26 
27 #ifndef ICB_CLU_API_H
28 #define ICB_CLU_API_H
29 
30 namespace ICB {
31 
32 #define MAX_DESCRIPTION_SIZE 60
33 #define MAX_FILENAME_SIZE 128
34 #define NON_KOSHA_FILE "ZZT_666_BUGGERED_666_ZZT"
35 #define NON_KOSHA_HASH 0xFFFFFFFF
36 
37 #define CLUSTER_API_SCHEMA 2
38 #define CLUSTER_API_ID "CLU"
39 
40 #define NULL_HASH 0x0
41 
42 #define FOLDER_FILE_ID "ZZT"
43 
44 // moved actual function to clu_api.cpp to save some memory maybe (testing)
45 uint32 EngineHashString(const char *fn);
46 uint32 EngineHashFile(const char *fn, char *output);
47 uint32 EngineHashToFile(uint32 hash, char *output); // Take a hash convert that hash value to 7 character filename
48 
49 // To let the engine use the old version of HashString & HashFile
50 #define HashString EngineHashString
51 #define HashFile EngineHashFile
52 
53 // File Layout is:
54 // HEADER_OPEN
55 // HEADER_NORMAL[n]
56 // filename1
57 // filename2
58 // ...
59 // filenamen
60 // file1
61 // file2
62 // ...
63 // filen
64 //
65 // The filenames are padded to multiple of 4 bytes
66 // The files are padded to multiple of 8 bytes
67 
68 typedef struct HEADER_OPEN {
69  uint32 header_size;
70  uint32 noFiles;
71  uint32 cluster_hash;
72  int32 cdpos;
73  char description[MAX_DESCRIPTION_SIZE];
74 } HEADER_OPEN;
75 
76 typedef struct HEADER_NORMAL {
77  uint32 fnOffset; // WAS: char* fn;
78  uint32 size;
79  uint32 offset;
80  uint32 hash;
82 
83 typedef struct Cluster_API {
84  char ID[4];
85  uint32 schema;
86  HEADER_OPEN ho;
87  HEADER_NORMAL hn[1]; // hn[n]
88  // string data
89  // file data
90 } Cluster_API;
91 
92 #define FILE_NAME(a) (sizeof(uint) + sizeof(uint32) + sizeof(HEADER_OPEN) + (sizeof(HEADER_NORMAL) * (a)))
93 #define FILE_SIZE(a) (FILE_NAME(a) + sizeof(uint32))
94 #define FILE_OFFSET(a) (FILE_SIZE(a) + sizeof(uint32))
95 #define FILE_HASH(a) (FILE_OFFSET(a) + sizeof(uint32))
96 
97 } // End of namespace ICB
98 
99 #endif // #ifndef CLU_API_H
Definition: px_clu_api.h:68
Definition: actor.h:32
Definition: px_clu_api.h:83
Definition: px_clu_api.h:76