| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/Main/Lib/hogfile.h $ |
| 21 | * $Revision: 10 $ |
| 22 | * $Date: 8/06/99 4:29p $ |
| 23 | * $Author: Samir $ |
| 24 | * |
| 25 | * HOG file constants. |
| 26 | * |
| 27 | * $Log: /DescentIII/Main/Lib/hogfile.h $ |
| 28 | * |
| 29 | * 10 8/06/99 4:29p Samir |
| 30 | * added function to read record information for a hog file entry. needed |
| 31 | * from mn3edit. |
| 32 | * |
| 33 | * 9 2/16/99 2:08p Nate |
| 34 | * Made CreateNewHogFile() a bit friendlier |
| 35 | * |
| 36 | * 8 10/30/98 11:16a Nate |
| 37 | * Added function prototype for writing out hog file entries |
| 38 | * |
| 39 | * 7 8/16/98 4:23p Nate |
| 40 | * Added CreateNewHogFile() |
| 41 | * |
| 42 | * 6 8/14/98 4:38p Nate |
| 43 | * Fixed a few minor bugs and added better error reporting |
| 44 | * |
| 45 | * 5 8/14/98 1:01p Nate |
| 46 | * Added better error reporting for the HogEditor |
| 47 | * |
| 48 | * 4 7/20/98 3:34p Nate |
| 49 | * Added FileCopy() prototype |
| 50 | * |
| 51 | * 3 4/01/98 7:03p Samir |
| 52 | * modified some cfile stuff. |
| 53 | * |
| 54 | * 2 3/31/98 6:13p Samir |
| 55 | * new hogfile format. |
| 56 | * |
| 57 | * $NoKeywords: $ |
| 58 | */ |
| 59 | |
| 60 | #ifndef HOGFILE_H |
| 61 | #define HOGFILE_H |
| 62 | |
| 63 | #include <cstdint> |
| 64 | #include <cstdio> |
| 65 | |
| 66 | #define HOG_HDR_SIZE (68) |
| 67 | #define HOG_TAG_STR "HOG2" |
| 68 | #define HOG_TAG_LEN (4) |
| 69 | #define HOG_FILENAME_LEN (36) |
| 70 | |
| 71 | struct tHogHeader { |
| 72 | char magic[HOG_TAG_LEN]; // magic "HOG2" |
| 73 | uint32_t nfiles; // number of files in header |
| 74 | uint32_t file_data_offset; // offset in file to filedata. |
| 75 | }; |
| 76 | |
| 77 | struct tHogFileEntry { |
| 78 | char name[HOG_FILENAME_LEN]; // file name |
| 79 | uint32_t flags; // extra info |
| 80 | uint32_t len; // length of file |
| 81 | uint32_t timestamp; // time of file. |
| 82 | }; |
| 83 | |
| 84 | bool ReadHogHeader(FILE *fp, tHogHeader *header); |
| 85 | bool ReadHogEntry(FILE *fp, tHogFileEntry *entry); |
| 86 | |
| 87 | #endif |