packhead.h 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /******************************************************************************
  2. *
  3. * project name: TI-68k Developer Utilities
  4. * file name: packhead.h
  5. * initial date: 14/08/2000
  6. * author: thomas.nussbaumer@gmx.net
  7. * description: header definition of compressed data
  8. *
  9. ******************************************************************************/
  10. /*
  11. This file is part of TI-68k Developer Utilities.
  12. This file is free software; you can redistribute it and/or
  13. modify it under the terms of the GNU Lesser General Public
  14. License as published by the Free Software Foundation; either
  15. version 2.1 of the License, or (at your option) any later version.
  16. As a special exception, UNMODIFIED copies of ttbin2oth may also be
  17. redistributed or sold without source code, for any purpose. (The Lesser
  18. General Public License restrictions do apply in other respects; for example,
  19. they cover modification of the program.) This exception notice must be
  20. removed on modified copies of this file.
  21. This program is distributed in the hope that it will be useful,
  22. but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  24. Lesser General Public License for more details.
  25. You should have received a copy of the GNU Lesser General Public
  26. License along with this library; if not, write to the Free Software
  27. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  28. */
  29. #ifndef __PACKHEAD_H__
  30. #define __PACKHEAD_H__
  31. #define MAGIC_CHAR1 'T'
  32. #define MAGIC_CHAR2 'P'
  33. #define MAX_RLE_ENTRIES 31
  34. // size = 16 bytes
  35. typedef struct {
  36. unsigned char origsize_lo; // original size lowbyte
  37. unsigned char origsize_hi; // original size highbyte
  38. unsigned char magic1; // must be equal to MAGIC_CHAR1
  39. unsigned char magic2; // must be equal to MAGIC_CHAR2
  40. unsigned char compsize_lo; // compressed size lowbyte
  41. unsigned char compsize_hi; // compressed size lowbyte
  42. unsigned char esc1; // escape >> (8-escBits)
  43. unsigned char notused3;
  44. unsigned char notused4;
  45. unsigned char esc2; // escBits
  46. unsigned char gamma1; // maxGamma + 1
  47. unsigned char gamma2; // (1<<maxGamma)
  48. unsigned char extralz; // extraLZPosBits
  49. unsigned char notused1;
  50. unsigned char notused2;
  51. unsigned char rleentries; // rleUsed
  52. } PackedHeader;
  53. #define GetUnPackedSize(p) (unsigned int)((p)->origsize_lo | ((p)->origsize_hi << 8))
  54. #define IsPacked(p) ((p)->magic1 == MAGIC_CHAR1 && (p)->magic2 == MAGIC_CHAR2)
  55. typedef struct {
  56. unsigned char value[MAX_RLE_ENTRIES];
  57. } RLEEntries;
  58. #endif
  59. //#############################################################################
  60. //###################### NO MORE FAKES BEYOND THIS LINE #######################
  61. //#############################################################################
  62. //
  63. //=============================================================================
  64. // Revision History
  65. //=============================================================================
  66. //
  67. // Revision 1.3 2000/08/20 15:24:28 Thomas Nussbaumer
  68. // macros to get unpacked size and to check if packed added
  69. //
  70. // Revision 1.2 2000/08/16 23:08:55 Thomas Nussbaumer
  71. // magic characters changed to TP ... t(igcc tools) p(acked file)
  72. //
  73. // Revision 1.1 2000/08/14 22:49:57 Thomas Nussbaumer
  74. // initial version
  75. //
  76. //