Subversion Repositories ipe_artfile_utils

Rev

Blame | Last modification | View Log | RSS feed

  1. /**
  2.  * LZW Decoder for Imagination Pilots Entertainment 32-bit games (IPE32)
  3.  * - Where's Waldo? Exploring Geography
  4.  * - Eraser Turnabout by Imagination Pilots
  5.  * - Virtual K'Nex by Imagination Pilots
  6.  * ART file packer and unpacker by Daniel Marschall, ViaThinkSoft (C) 2018
  7.  * Revision: 2018-02-15
  8.  **/
  9.  
  10. #ifndef __inc__ipe32_lzw_decoder
  11. #define __inc__ipe32_lzw_decoder
  12.  
  13. #include <stdio.h>
  14. #include <stdlib.h>
  15. #include <stdint.h>
  16. #include <stdbool.h>
  17.  
  18. typedef struct tagIpe32LZWDecoder {
  19.         unsigned int *prefix_code;            /* This array holds the prefix codes */
  20.         unsigned char *append_character;      /* This array holds the appended chars */
  21.         unsigned char decode_stack[4000];     /* This array holds the decoded string */
  22.  
  23.         int num_bits;                         /* Starting with 9 bit codes */
  24.         int max_code;                         /* old MAX_CODE */
  25.  
  26.         int input_bit_count;
  27.         uint32_t input_bit_buffer;
  28. } Ipe32LZWDecoder;
  29.  
  30. // Returns: Bytes written or -1 when an error occurs
  31. int ipe32lzw_decode(Ipe32LZWDecoder *decoder, unsigned char* outputBuffer, const size_t outpufBufferSize, unsigned char* lzwInputBuffer, const size_t maxReadBytes);
  32.  
  33. Ipe32LZWDecoder* new_ipe32lzw_decoder(void);
  34. void ipe32lzw_init_decoder(Ipe32LZWDecoder *decoder);
  35. void ipe32lzw_free_decoder(Ipe32LZWDecoder *decoder);
  36.  
  37. #endif // #ifndef __inc__ipe32_lzw_decoder
  38.  
  39.