1 /* 2 This file is Copyright © 1994-1995 Olivier Montanuy, 3 Copyright © 1999-2005 André Majorel, 4 Copyright © 2006-2019 contributors to the DeuTex project. 5 6 DeuTex incorporates code derived from DEU 5.21 that was put in the 7 public domain in 1994 by Raphaël Quinet and Brendon Wyber. 8 9 SPDX-License-Identifier: GPL-2.0-or-later 10 */ 11 12 /*for merging directories*/ 13 void WADRopenPipo(struct WADINFO *info, int32_t ntry); 14 struct WADDIR *WADRclosePipo(struct WADINFO *info, int32_t * ntry); 15 int32_t WADRdirAddPipo(struct WADINFO *info, int32_t start, int32_t size, const char 16 *entry); 17 18 /*Open a WAD file for read*/ 19 void WADRopenR(struct WADINFO *info, const char *wadin); 20 /*Open a WAD file for write*/ 21 void WADRopenW(struct WADINFO *info, const char *wadout, WADTYPE type, 22 int verbose); 23 /*Open a WAD file for append*/ 24 void WADRopenA(struct WADINFO *info, const char *wadinout); 25 /*Close a WAD file*/ 26 void WADRclose(struct WADINFO *info); 27 28 /*WAD file structure*/ 29 /*set position of internal WAD directory*/ 30 void WADRsetDirRef(struct WADINFO *info, int32_t ntry, int32_t dirpos); 31 /*change size of a WAD*/ 32 void WADRchsize(struct WADINFO *info, int32_t fsize); 33 /*increase size of WAD, do not update position*/ 34 bool WADRchsize2(struct WADINFO *info, int32_t fsize); 35 36 /*composition of internal WAD directory*/ 37 /*add an entry to the directory*/ 38 int32_t WADRdirAddEntry(struct WADINFO *info, int32_t start, int32_t size, const char 39 *name); 40 /*write the directory (and set it's position)*/ 41 void WADRwriteDir(struct WADINFO *info, int verbose); 42 /*find an entry in the directory*/ 43 int16_t WADRfindEntry(struct WADINFO *info, const char *entry); /*-1 or index of entry in directory*/ 44 45 /*set data in a WAD (write position doesn't change)*/ 46 void WADRsetLong(struct WADINFO *info, int32_t pos, int32_t val); 47 void WADRsetShort(struct WADINFO *info, int32_t pos, int16_t val); 48 /*align on long*/ 49 void WADRalign4(struct WADINFO *info); /*align on long word, for next entry */ 50 /*tell position of pointer*/ 51 int32_t WADRposition(struct WADINFO *info); /*current position */ 52 /*write date (write position increase)*/ 53 int32_t WADRwriteLong(struct WADINFO *info, int32_t val); 54 int32_t WADRwriteShort(struct WADINFO *info, int16_t val); 55 int32_t WADRwriteBytes(struct WADINFO *info, char *data, int32_t size); 56 int32_t WADRwriteBytes2(struct WADINFO *info, char *data, int32_t size); 57 int32_t WADRwriteLump(struct WADINFO *info, const char *file); 58 int32_t WADRwriteWADbytes(struct WADINFO *info, struct WADINFO *src, 59 int32_t start, int32_t size); 60 int32_t WADRwriteWADentry(struct WADINFO *info, struct WADINFO *src, 61 int16_t n); 62 void WADRwriteWADlevelParts(struct WADINFO *info, struct WADINFO *src, 63 int16_t n, size_t nlumps); 64 void WADRwriteWADlevel(struct WADINFO *info, const char *file, const char 65 *level); 66 67 /*read data*/ 68 void WADRseek(struct WADINFO *info, int32_t position); 69 iolen_t WADRreadBytes(struct WADINFO *info, char *buffer, iolen_t nbytes); 70 iolen_t WADRreadBytes(struct WADINFO *info, char *buffer, iolen_t nbytes); 71 int16_t WADRreadShort(struct WADINFO *info); 72 int32_t WADRreadLong(struct WADINFO *info); 73 char *WADRreadEntry(struct WADINFO *info, int16_t N, int32_t * psize); 74 char *WADRreadEntry2(struct WADINFO *info, int16_t n, int32_t * psize); 75 void WADRsaveEntry(struct WADINFO *info, int16_t N, const char *file); 76 77 /*make some preparations before appending data to an existing WAD*/ 78 /*so that it can be restored later*/ 79 int32_t WADRprepareAppend(const char *wadres, struct WADINFO *rwad, struct WADDIR 80 *NewDir, int32_t NewNtry, int32_t * dirpos, 81 int32_t * ntry, int32_t * size); 82