1 /* ResidualVM - A 3D game interpreter 2 * 3 * ResidualVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the AUTHORS 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 13 * modify it under the terms of the GNU General Public License 14 * as published by the Free Software Foundation; either version 2 15 * of the License, or (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, write to the Free Software 24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 25 * 26 */ 27 28 #ifndef ICB_CLU_API_H 29 #define ICB_CLU_API_H 30 31 namespace ICB { 32 33 #define MAX_DESCRIPTION_SIZE 60 34 #define MAX_FILENAME_SIZE 128 35 #define NON_KOSHA_FILE "ZZT_666_BUGGERED_666_ZZT" 36 #define NON_KOSHA_HASH 0xFFFFFFFF 37 38 #define CLUSTER_API_SCHEMA 2 39 #define CLUSTER_API_ID "CLU" 40 41 #define NULL_HASH 0x0 42 43 #define FOLDER_FILE_ID "ZZT" 44 45 // moved actual function to clu_api.cpp to save some memory maybe (testing) 46 uint32 EngineHashString(const char *fn); 47 uint32 EngineHashFile(const char *fn, char *output); 48 uint32 EngineHashToFile(uint32 hash, char *output); // Take a hash convert that hash value to 7 character filename 49 50 // To let the engine use the old version of HashString & HashFile 51 #define HashString EngineHashString 52 #define HashFile EngineHashFile 53 54 // File Layout is: 55 // HEADER_OPEN 56 // HEADER_NORMAL[n] 57 // filename1 58 // filename2 59 // ... 60 // filenamen 61 // file1 62 // file2 63 // ... 64 // filen 65 // 66 // The filenames are padded to multiple of 4 bytes 67 // The files are padded to multiple of 8 bytes 68 69 typedef struct HEADER_OPEN { 70 uint32 header_size; 71 uint32 noFiles; 72 uint32 cluster_hash; 73 int32 cdpos; 74 char description[MAX_DESCRIPTION_SIZE]; 75 } HEADER_OPEN; 76 77 typedef struct HEADER_NORMAL { 78 uint32 fnOffset; // WAS: char* fn; 79 uint32 size; 80 uint32 offset; 81 uint32 hash; 82 } HEADER_NORMAL; 83 84 typedef struct Cluster_API { 85 char ID[4]; 86 uint32 schema; 87 HEADER_OPEN ho; 88 HEADER_NORMAL hn[1]; // hn[n] 89 // string data 90 // file data 91 } Cluster_API; 92 93 #define FILE_NAME(a) (sizeof(uint) + sizeof(uint32) + sizeof(HEADER_OPEN) + (sizeof(HEADER_NORMAL) * (a))) 94 #define FILE_SIZE(a) (FILE_NAME(a) + sizeof(uint32)) 95 #define FILE_OFFSET(a) (FILE_SIZE(a) + sizeof(uint32)) 96 #define FILE_HASH(a) (FILE_OFFSET(a) + sizeof(uint32)) 97 98 } // End of namespace ICB 99 100 #endif // #ifndef CLU_API_H 101