IFF.H 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. //
  2. // Copyright 2020 Electronic Arts Inc.
  3. //
  4. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free
  5. // software: you can redistribute it and/or modify it under the terms of
  6. // the GNU General Public License as published by the Free Software Foundation,
  7. // either version 3 of the License, or (at your option) any later version.
  8. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed
  9. // in the hope that it will be useful, but with permitted additional restrictions
  10. // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
  11. // distributed with this program. You should have received a copy of the
  12. // GNU General Public License along with permitted additional restrictions
  13. // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
  14. /***************************************************************************
  15. ** 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 **
  16. ***************************************************************************
  17. * *
  18. * Project Name : Part of the FILEIO Library *
  19. * *
  20. * File Name : IFF.H *
  21. * *
  22. * Programmer : Scott K. Bowen *
  23. * *
  24. * Start Date : April 20, 1994 *
  25. * *
  26. * Last Update : April 20, 1994 [SKB] *
  27. * *
  28. *-------------------------------------------------------------------------*
  29. * Functions: *
  30. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  31. #ifndef IFF_H
  32. #define IFF_H
  33. #ifndef GBUFFER_H
  34. #include <gbuffer.h>
  35. #endif
  36. #ifndef MISC_H
  37. #include <misc.h> // This is needed fro Reverse_WORD and _LONG
  38. #endif
  39. #ifndef MEMFLAGS_H
  40. #include <memflag.h> // This is needed for MemoryFlagType.
  41. #endif
  42. #define LZW_SUPPORTED FALSE
  43. /*=========================================================================*/
  44. /* Iff and Load Picture system defines and enumerations */
  45. /*=========================================================================*/
  46. #define MAKE_ID(a,b,c,d) ((long) ((long) d << 24) | ((long) c << 16) | ((long) b << 8) | (long)(a))
  47. #define IFFize_WORD(a) Reverse_Word(a)
  48. #define IFFize_LONG(a) Reverse_Long(a)
  49. //lint -strong(AJX,PicturePlaneType)
  50. typedef enum {
  51. BM_AMIGA, // Bit plane format (8K per bitplane).
  52. BM_MCGA, // Byte per pixel format (64K).
  53. BM_DEFAULT=BM_MCGA // Default picture format.
  54. } PicturePlaneType;
  55. /*
  56. ** This is the compression type code. This value is used in the compressed
  57. ** file header to indicate the method of compression used. Note that the
  58. ** LZW method may not be supported.
  59. */
  60. //lint -strong(AJX,CompressionType)
  61. typedef enum {
  62. NOCOMPRESS, // No compression (raw data).
  63. LZW12, // LZW 12 bit codes.
  64. LZW14, // LZW 14 bit codes.
  65. HORIZONTAL, // Run length encoding (RLE).
  66. LCW // Westwood proprietary compression.
  67. } CompressionType;
  68. /*
  69. ** Compressed blocks of data must start with this header structure.
  70. ** Note that disk based compressed files have an additional two
  71. ** leading bytes that indicate the size of the entire file.
  72. */
  73. //lint -strong(AJX,CompHeaderType)
  74. typedef struct {
  75. char Method; // Compression method (CompressionType).
  76. char pad; // Reserved pad byte (always 0).
  77. long Size; // Size of the uncompressed data.
  78. short Skip; // Number of bytes to skip before data.
  79. } CompHeaderType;
  80. /*=========================================================================*/
  81. /* The following prototypes are for the file: IFF.CPP */
  82. /*=========================================================================*/
  83. int __cdecl Open_Iff_File(char const *filename);
  84. void __cdecl Close_Iff_File(int fh);
  85. unsigned long __cdecl Get_Iff_Chunk_Size(int fh, long id);
  86. unsigned long __cdecl Read_Iff_Chunk(int fh, long id, void *buffer, unsigned long maxsize);
  87. void __cdecl Write_Iff_Chunk(int file, long id, void *buffer, long length);
  88. /*=========================================================================*/
  89. /* The following prototypes are for the file: LOADPICT.CPP */
  90. /*=========================================================================*/
  91. int __cdecl Load_Picture(char const *filename, BufferClass& scratchbuf, BufferClass& destbuf, unsigned char *palette=NULL, PicturePlaneType format=BM_DEFAULT);
  92. /*=========================================================================*/
  93. /* The following prototypes are for the file: LOAD.CPP */
  94. /*=========================================================================*/
  95. unsigned long __cdecl Load_Data(char const *name, void *ptr, unsigned long size);
  96. unsigned long __cdecl Write_Data(char const *name, void *ptr, unsigned long size);
  97. void * __cdecl Load_Alloc_Data(char const *name, MemoryFlagType flags);
  98. unsigned long __cdecl Load_Uncompress(char const *file, BufferClass& uncomp_buff, BufferClass& dest_buff, void *reserved_data=NULL);
  99. unsigned long __cdecl Uncompress_Data(void const *src, void *dst);
  100. void __cdecl Set_Uncomp_Buffer(int buffer_segment, int size_of_buffer);
  101. /*=========================================================================*/
  102. /* The following prototypes are for the file: WRITELBM.CPP */
  103. /*=========================================================================*/
  104. PUBLIC BOOL Write_LBM_File(int lbmhandle, BufferClass& buff, int bitplanes, unsigned char *palette);
  105. /*========================= Assembly Functions ============================*/
  106. #ifdef __cplusplus
  107. extern "C" {
  108. #endif
  109. /*=========================================================================*/
  110. /* The following prototypes are for the file: PACK2PLN.ASM */
  111. /*=========================================================================*/
  112. extern void __cdecl Pack_2_Plane(void *buffer, void * pageptr, int planebit);
  113. /*=========================================================================*/
  114. /* The following prototypes are for the file: LCWCOMP.ASM */
  115. /*=========================================================================*/
  116. extern unsigned long __cdecl LCW_Compress(void *source, void *dest, unsigned long length);
  117. /*=========================================================================*/
  118. /* The following prototypes are for the file: LCWUNCMP.ASM */
  119. /*=========================================================================*/
  120. extern unsigned long __cdecl LCW_Uncompress(void *source, void *dest, unsigned long length);
  121. #ifdef __cplusplus
  122. }
  123. #endif
  124. /*=========================================================================*/
  125. #endif //IFF_H