btreeabout.cpp 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. ** Command & Conquer Generals(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. // Copyright (C) Electronic Arts Canada Inc. 1995-2002. All rights reserved.
  19. /* ABSTRACT */
  20. /*------------------------------------------------------------------*/
  21. /* */
  22. /* BTree - Binary Tree Codex */
  23. /* */
  24. /* by FrANK G. Barchard, EAC */
  25. /* */
  26. /*------------------------------------------------------------------*/
  27. /* */
  28. /* Version Date SE History: */
  29. /* ------- ---- -- -------- */
  30. /* 1.00 950108 FB BTree codex based on hufftree and ref codex */
  31. /* 1.01 970117 FB encode check index before going off array */
  32. /* 1.02 020716 FB allocate percentage more buffer for large files*/
  33. /* */
  34. /*------------------------------------------------------------------*/
  35. /* */
  36. /* Module Notes: */
  37. /* ------------- */
  38. /* Reentrant */
  39. /* Files: btrread.c btrwrite.c btrcodex.h */
  40. /* */
  41. /*------------------------------------------------------------------*/
  42. /* */
  43. /* Format Notes: */
  44. /* ------------- */
  45. /* BTree is an EA proprietary compression scheme by Frank Barchard. */
  46. /* Each byte is either a raw byte (leaf) or node that points to */
  47. /* 2 other nodes. Each node is either a simple byte or 2 nodes. */
  48. /* The stream is simple bytes and uses bytes for nodes that werent */
  49. /* used in the original file. */
  50. /* */
  51. /* BTREE (fb6) header format: */
  52. /* -------------------------- */
  53. /* */
  54. /* offset bytes notes */
  55. /* id 0 2 id is 46fb */
  56. /* ulen 2 3 total unpacked len */
  57. /* ilen* 2/5 3 unpacked len for this file */
  58. /* clue 5/8 1 */
  59. /* nodes 6/9 1 number of nodes */
  60. /* { */
  61. /* node 7/10+3n 1 */
  62. /* left 8/11+3n 1 */
  63. /* right 9/12+3n 1 */
  64. /* } */
  65. /* */
  66. /* [packed data] */
  67. /* [explicitely packed last byte] */
  68. /* */
  69. /* * present if composite packed */
  70. /* */
  71. /*------------------------------------------------------------------*/
  72. /* END ABSTRACT */
  73. #include <string.h>
  74. #include "codex.h"
  75. #include "btreecodex.h"
  76. /****************************************************************/
  77. /* Information Functions */
  78. /****************************************************************/
  79. CODEXABOUT *GCALL BTREE_about(void)
  80. {
  81. CODEXABOUT* info;
  82. info = (CODEXABOUT*) galloc(sizeof(CODEXABOUT));
  83. if (info)
  84. {
  85. memset(info, 0, sizeof(CODEXABOUT));
  86. info->signature = QMAKEID('B','T','R','E');
  87. info->size = sizeof(CODEXABOUT);
  88. info->version = 200; /* codex version number (200) */
  89. info->decode = 1; /* supports decoding */
  90. info->encode = 1; /* supports encoding */
  91. info->size32 = 0; /* supports 32 bit size field */
  92. strcpy(info->versionstr, "1.02"); /* version # */
  93. strcpy(info->shorttypestr, "btr"); /* type */
  94. strcpy(info->longtypestr, "BTree"); /* longtype */
  95. }
  96. return(info);
  97. }