2
0

iff.h 7.1 KB

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