IFF.H 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. /*
  2. ** Command & Conquer Red Alert(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  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. /***************************************************************************
  19. ** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S **
  20. ***************************************************************************
  21. * *
  22. * Project Name : Part of the FILEIO Library *
  23. * *
  24. * File Name : IFF.H *
  25. * *
  26. * Programmer : Scott K. Bowen *
  27. * *
  28. * Start Date : April 20, 1994 *
  29. * *
  30. * Last Update : April 20, 1994 [SKB] *
  31. * *
  32. *-------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #ifndef IFF_H
  36. #define IFF_H
  37. #ifndef GBUFFER_H
  38. #include <gbuffer.h>
  39. #endif
  40. #ifndef MISC_H
  41. #include <misc.h> // This is needed fro Reverse_WORD and _LONG
  42. #endif
  43. #ifndef MEMFLAGS_H
  44. #include <memflag.h> // This is needed for MemoryFlagType.
  45. #endif
  46. #define LZW_SUPPORTED FALSE
  47. /*=========================================================================*/
  48. /* Iff and Load Picture system defines and enumerations */
  49. /*=========================================================================*/
  50. #define MAKE_ID(a,b,c,d) ((long) ((long) d << 24) | ((long) c << 16) | ((long) b << 8) | (long)(a))
  51. #define IFFize_WORD(a) Reverse_Word(a)
  52. #define IFFize_LONG(a) Reverse_Long(a)
  53. //lint -strong(AJX,PicturePlaneType)
  54. typedef enum {
  55. BM_AMIGA, // Bit plane format (8K per bitplane).
  56. BM_MCGA, // Byte per pixel format (64K).
  57. BM_DEFAULT=BM_MCGA // Default picture format.
  58. } PicturePlaneType;
  59. /*
  60. ** This is the compression type code. This value is used in the compressed
  61. ** file header to indicate the method of compression used. Note that the
  62. ** LZW method may not be supported.
  63. */
  64. //lint -strong(AJX,CompressionType)
  65. typedef enum {
  66. NOCOMPRESS, // No compression (raw data).
  67. LZW12, // LZW 12 bit codes.
  68. LZW14, // LZW 14 bit codes.
  69. HORIZONTAL, // Run length encoding (RLE).
  70. LCW // Westwood proprietary compression.
  71. } CompressionType;
  72. /*
  73. ** Compressed blocks of data must start with this header structure.
  74. ** Note that disk based compressed files have an additional two
  75. ** leading bytes that indicate the size of the entire file.
  76. */
  77. //lint -strong(AJX,CompHeaderType)
  78. typedef struct {
  79. char Method; // Compression method (CompressionType).
  80. char pad; // Reserved pad byte (always 0).
  81. long Size; // Size of the uncompressed data.
  82. short Skip; // Number of bytes to skip before data.
  83. } CompHeaderType;
  84. /*=========================================================================*/
  85. /* The following prototypes are for the file: IFF.CPP */
  86. /*=========================================================================*/
  87. int __cdecl Open_Iff_File(char const *filename);
  88. void __cdecl Close_Iff_File(int fh);
  89. unsigned long __cdecl Get_Iff_Chunk_Size(int fh, long id);
  90. unsigned long __cdecl Read_Iff_Chunk(int fh, long id, void *buffer, unsigned long maxsize);
  91. void __cdecl Write_Iff_Chunk(int file, long id, void *buffer, long length);
  92. /*=========================================================================*/
  93. /* The following prototypes are for the file: LOADPICT.CPP */
  94. /*=========================================================================*/
  95. int __cdecl Load_Picture(char const *filename, BufferClass& scratchbuf, BufferClass& destbuf, unsigned char *palette=NULL, PicturePlaneType format=BM_DEFAULT);
  96. /*=========================================================================*/
  97. /* The following prototypes are for the file: LOAD.CPP */
  98. /*=========================================================================*/
  99. unsigned long __cdecl Load_Data(char const *name, void *ptr, unsigned long size);
  100. unsigned long __cdecl Write_Data(char const *name, void *ptr, unsigned long size);
  101. void * __cdecl Load_Alloc_Data(char const *name, MemoryFlagType flags);
  102. unsigned long __cdecl Load_Uncompress(char const *file, BufferClass& uncomp_buff, BufferClass& dest_buff, void *reserved_data=NULL);
  103. unsigned long __cdecl Uncompress_Data(void const *src, void *dst);
  104. void __cdecl Set_Uncomp_Buffer(int buffer_segment, int size_of_buffer);
  105. /*=========================================================================*/
  106. /* The following prototypes are for the file: WRITELBM.CPP */
  107. /*=========================================================================*/
  108. PUBLIC BOOL Write_LBM_File(int lbmhandle, BufferClass& buff, int bitplanes, unsigned char *palette);
  109. /*========================= Assembly Functions ============================*/
  110. #ifdef __cplusplus
  111. extern "C" {
  112. #endif
  113. /*=========================================================================*/
  114. /* The following prototypes are for the file: PACK2PLN.ASM */
  115. /*=========================================================================*/
  116. extern void __cdecl Pack_2_Plane(void *buffer, void * pageptr, int planebit);
  117. /*=========================================================================*/
  118. /* The following prototypes are for the file: LCWCOMP.ASM */
  119. /*=========================================================================*/
  120. extern unsigned long __cdecl LCW_Compress(void *source, void *dest, unsigned long length);
  121. /*=========================================================================*/
  122. /* The following prototypes are for the file: LCWUNCMP.ASM */
  123. /*=========================================================================*/
  124. extern unsigned long __cdecl LCW_Uncompress(void *source, void *dest, unsigned long length);
  125. #ifdef __cplusplus
  126. }
  127. #endif
  128. /*=========================================================================*/
  129. #endif //IFF_H