Descent3/cfile/hogfile.h

89 lines
2.4 KiB
C
Raw Normal View History

/*
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
--- HISTORICAL COMMENTS FOLLOW ---
2024-04-16 03:43:29 +00:00
* $Logfile: /DescentIII/Main/Lib/hogfile.h $
* $Revision: 10 $
* $Date: 8/06/99 4:29p $
* $Author: Samir $
*
* HOG file constants.
*
* $Log: /DescentIII/Main/Lib/hogfile.h $
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 10 8/06/99 4:29p Samir
* added function to read record information for a hog file entry. needed
* from mn3edit.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 9 2/16/99 2:08p Nate
* Made CreateNewHogFile() a bit friendlier
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 8 10/30/98 11:16a Nate
* Added function prototype for writing out hog file entries
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 7 8/16/98 4:23p Nate
* Added CreateNewHogFile()
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 6 8/14/98 4:38p Nate
* Fixed a few minor bugs and added better error reporting
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 5 8/14/98 1:01p Nate
* Added better error reporting for the HogEditor
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 4 7/20/98 3:34p Nate
* Added FileCopy() prototype
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 3 4/01/98 7:03p Samir
* modified some cfile stuff.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 2 3/31/98 6:13p Samir
* new hogfile format.
*
* $NoKeywords: $
*/
#ifndef HOGFILE_H
#define HOGFILE_H
#include <cstdint>
#include <cstdio>
2024-04-16 03:43:29 +00:00
#define HOG_HDR_SIZE (64)
2024-04-16 18:56:40 +00:00
#define HOG_TAG_STR "HOG2"
#define HOG_FILENAME_LEN (36)
2024-04-16 18:56:40 +00:00
typedef struct tHogHeader {
uint32_t nfiles; // number of files in header
uint32_t file_data_offset; // offset in file to filedata.
2024-04-16 18:56:40 +00:00
} tHogHeader;
typedef struct tHogFileEntry {
char name[HOG_FILENAME_LEN]; // file name
uint32_t flags; // extra info
uint32_t len; // length of file
uint32_t timestamp; // time of file.
2024-04-16 18:56:40 +00:00
} tHogFileEntry;
2024-04-16 03:43:29 +00:00
bool ReadHogHeader(FILE *fp, tHogHeader *header);
bool ReadHogEntry(FILE *fp, tHogFileEntry *entry);
// returns hog cfile info, using a library handle opened via cf_OpenLibrary.
bool cf_ReadHogFileEntry(int library, const char *filename, tHogFileEntry *entry, int *fileoffset);
#endif