Open Source Tomb Raider Engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UTPackage.h 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: t; c-basic-offset: 3 -*- */
  2. /*================================================================
  3. *
  4. * Project : OpenRaider, PSKModel viewer, libhel_modelloader
  5. * Author : Terry 'Mongoose' Hendrix II
  6. * Website : http://www.westga.edu/~stu7440/
  7. * Email : stu7440@westga.edu
  8. * Object : UTPackage
  9. * License : No use w/o permission (C) 2003 Mongoose
  10. * Comments: This class handles UT packages
  11. *
  12. *
  13. * This file was generated using Mongoose's C++
  14. * template generator script. <stu7440@westga.edu>
  15. *
  16. *-- Test Defines -----------------------------------------------
  17. *
  18. * UNIT_TEST_UTPACKAGE - Builds UTPackage class as a console unit test
  19. *
  20. *-- History ------------------------------------------------
  21. *
  22. * 2003.07.11:
  23. * Mongoose - Created, form old PSKModel prototype
  24. ================================================================*/
  25. #ifndef GUARD__OPENRAIDER_MONGOOSE_UTPACKAGE_H_
  26. #define GUARD__OPENRAIDER_MONGOOSE_UTPACKAGE_H_
  27. typedef struct {
  28. unsigned int exportCount;
  29. unsigned int nameCount;
  30. } utx_generation_t;
  31. typedef struct {
  32. char *objName;;
  33. unsigned int objFlags;
  34. } utx_name_table_t;
  35. typedef struct {
  36. int objClass;
  37. int objSuper;
  38. unsigned int package;
  39. int objName;
  40. unsigned int objFlags;
  41. int serialSize;
  42. int serialOffset;
  43. } utx_export_table_t;
  44. typedef struct {
  45. int objClass;
  46. int objSuper;
  47. unsigned int package;
  48. int objName;
  49. } utx_import_table_t;
  50. typedef struct {
  51. unsigned int signature;
  52. unsigned short version;
  53. unsigned short version2; // aka mod
  54. unsigned int flags;
  55. unsigned int nameCount;
  56. unsigned int nameOffset;
  57. unsigned int exportCount;
  58. unsigned int exportOffset;
  59. unsigned int importCount;
  60. unsigned int importOffset;
  61. unsigned int heritageCount; // if version < 68
  62. unsigned int heritageOffset; // if version < 68
  63. unsigned int guid[4]; // else if version > 67
  64. unsigned int generationCount; // else if version > 67
  65. utx_generation_t *generations; // else if version > 67
  66. utx_name_table_t *nameTable;
  67. utx_export_table_t *exportTable;
  68. utx_import_table_t *importTable;
  69. unsigned int *heritageTable; // 16byte IDs stored as 4 u32s
  70. } utx_header_t;
  71. /* Index parser algorithm and defines from 'Unreal file reader' source */
  72. #define INDEX_SIGN_BIT 0x80 // Sign bit on first byte
  73. #define INDEX_CONT1_BIT 0x40 // Continuation bit on first byte
  74. #define INDEX_BYT1_MASK 0x3f // Data mast on first byte
  75. #define INDEX_CONT_BIT 0x80 // Continuation bit on other bytes
  76. #define INDEX_BYTE_MASK 0x7f // Data mask on other bytes
  77. #define UNP_ByteProperty 1
  78. #define UNP_IntProperty 2
  79. #define UNP_BoolProperty 3
  80. #define UNP_FloatProperty 4
  81. #define UNP_ObjectProperty 5
  82. #define UNP_NameProperty 6
  83. #define UNP_StringProperty 7
  84. #define UNP_ClassProperty 8
  85. #define UNP_ArrayProperty 9
  86. #define UNP_StructProperty 10
  87. #define UNP_VectorProperty 11
  88. #define UNP_RotatorProperty 12
  89. #define UNP_StrProperty 13
  90. #define UNP_MapProperty 14
  91. #define UNP_FixedArrayProperty 15
  92. #define PROPERTY_TYPE_MASK 0x0f
  93. #define PROPERTY_SIZE_MASK 0x70
  94. #define PROPERTY_ARRAY_MASK 0x80
  95. //////////////////////////////////////////////////////////////////////
  96. // UTPackageProperty Class
  97. //////////////////////////////////////////////////////////////////////
  98. class UTPackageProperty
  99. {
  100. public:
  101. UTPackageProperty();
  102. ~UTPackageProperty();
  103. void clear();
  104. int load(utx_header_t *header, FILE *f);
  105. int index;
  106. unsigned int nameIndex;
  107. unsigned int size;
  108. unsigned int type;
  109. unsigned int flags;
  110. unsigned char *data;
  111. };
  112. //////////////////////////////////////////////////////////////////////
  113. // UTPackage Class
  114. //////////////////////////////////////////////////////////////////////
  115. class UTPackage
  116. {
  117. public:
  118. enum
  119. {
  120. UT_NULL,
  121. UT_IMPORT,
  122. UT_EXPORT
  123. } UT_INDEX;
  124. ////////////////////////////////////////////////////////////
  125. // Constructors
  126. ////////////////////////////////////////////////////////////
  127. UTPackage();
  128. /*------------------------------------------------------
  129. * Pre :
  130. * Post : Constructs an object of UTPackage
  131. *
  132. *-- History ------------------------------------------
  133. *
  134. * 2003.07.11:
  135. * Mongoose - Created
  136. ------------------------------------------------------*/
  137. ~UTPackage();
  138. /*------------------------------------------------------
  139. * Pre : UTPackage object is allocated
  140. * Post : Deconstructs an object of UTPackage
  141. *
  142. *-- History ------------------------------------------
  143. *
  144. * 2003.07.11:
  145. * Mongoose - Created
  146. ------------------------------------------------------*/
  147. ////////////////////////////////////////////////////////////
  148. // Public Accessors
  149. ////////////////////////////////////////////////////////////
  150. ////////////////////////////////////////////////////////////
  151. // Public Mutators
  152. ////////////////////////////////////////////////////////////
  153. private:
  154. ////////////////////////////////////////////////////////////
  155. // Private Accessors
  156. ////////////////////////////////////////////////////////////
  157. ////////////////////////////////////////////////////////////
  158. // Private Mutators
  159. ////////////////////////////////////////////////////////////
  160. /* */
  161. };
  162. int load_utx(char *filename, bool hexDump, bool diskDump);
  163. #endif