il2cpp-metadata.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. #pragma once
  2. #include "il2cpp-config.h"
  3. #include <stdint.h>
  4. #include "il2cpp-tokentype.h"
  5. typedef int32_t TypeIndex;
  6. typedef int32_t TypeDefinitionIndex;
  7. typedef int32_t FieldIndex;
  8. typedef int32_t DefaultValueIndex;
  9. typedef int32_t DefaultValueDataIndex;
  10. typedef int32_t CustomAttributeIndex;
  11. typedef int32_t ParameterIndex;
  12. typedef int32_t MethodIndex;
  13. typedef int32_t GenericMethodIndex;
  14. typedef int32_t PropertyIndex;
  15. typedef int32_t EventIndex;
  16. typedef int32_t GenericContainerIndex;
  17. typedef int32_t GenericParameterIndex;
  18. typedef int16_t GenericParameterConstraintIndex;
  19. typedef int32_t NestedTypeIndex;
  20. typedef int32_t InterfacesIndex;
  21. typedef int32_t VTableIndex;
  22. typedef int32_t RGCTXIndex;
  23. typedef int32_t StringIndex;
  24. typedef int32_t StringLiteralIndex;
  25. typedef int32_t GenericInstIndex;
  26. typedef int32_t ImageIndex;
  27. typedef int32_t AssemblyIndex;
  28. typedef int32_t InteropDataIndex;
  29. // "Relative" indexes - based on their parent
  30. typedef int32_t TypeFieldIndex;
  31. typedef int32_t TypeMethodIndex;
  32. typedef int32_t MethodParameterIndex;
  33. typedef int32_t TypePropertyIndex;
  34. typedef int32_t TypeEventIndex;
  35. typedef int32_t TypeInterfaceIndex;
  36. typedef int32_t TypeNestedTypeIndex;
  37. typedef int32_t TypeInterfaceOffsetIndex;
  38. typedef int32_t GenericContainerParameterIndex;
  39. typedef int32_t AssemblyTypeIndex;
  40. typedef int32_t AssemblyExportedTypeIndex;
  41. static const TypeIndex kTypeIndexInvalid = -1;
  42. static const TypeDefinitionIndex kTypeDefinitionIndexInvalid = -1;
  43. static const DefaultValueDataIndex kDefaultValueIndexNull = -1;
  44. static const CustomAttributeIndex kCustomAttributeIndexInvalid = -1;
  45. static const EventIndex kEventIndexInvalid = -1;
  46. static const FieldIndex kFieldIndexInvalid = -1;
  47. static const MethodIndex kMethodIndexInvalid = -1;
  48. static const PropertyIndex kPropertyIndexInvalid = -1;
  49. static const GenericContainerIndex kGenericContainerIndexInvalid = -1;
  50. static const GenericParameterIndex kGenericParameterIndexInvalid = -1;
  51. static const RGCTXIndex kRGCTXIndexInvalid = -1;
  52. static const StringLiteralIndex kStringLiteralIndexInvalid = -1;
  53. static const InteropDataIndex kInteropDataIndexInvalid = -1;
  54. #define PUBLIC_KEY_BYTE_LENGTH 8
  55. static const int kPublicKeyByteLength = PUBLIC_KEY_BYTE_LENGTH;
  56. typedef struct Il2CppMethodSpec
  57. {
  58. MethodIndex methodDefinitionIndex;
  59. GenericInstIndex classIndexIndex;
  60. GenericInstIndex methodIndexIndex;
  61. } Il2CppMethodSpec;
  62. typedef enum Il2CppRGCTXDataType
  63. {
  64. IL2CPP_RGCTX_DATA_INVALID,
  65. IL2CPP_RGCTX_DATA_TYPE,
  66. IL2CPP_RGCTX_DATA_CLASS,
  67. IL2CPP_RGCTX_DATA_METHOD,
  68. IL2CPP_RGCTX_DATA_ARRAY,
  69. IL2CPP_RGCTX_DATA_CONSTRAINED,
  70. } Il2CppRGCTXDataType;
  71. typedef union Il2CppRGCTXDefinitionData
  72. {
  73. int32_t rgctxDataDummy;
  74. MethodIndex __methodIndex;
  75. TypeIndex __typeIndex;
  76. } Il2CppRGCTXDefinitionData;
  77. typedef struct Il2CppRGCTXConstrainedData
  78. {
  79. TypeIndex __typeIndex;
  80. uint32_t __encodedMethodIndex;
  81. } Il2CppRGCTXConstrainedData;
  82. typedef struct Il2CppRGCTXDefinition
  83. {
  84. Il2CppRGCTXDataType type;
  85. const void* data;
  86. } Il2CppRGCTXDefinition;
  87. typedef struct
  88. {
  89. MethodIndex methodIndex;
  90. MethodIndex invokerIndex;
  91. MethodIndex adjustorThunkIndex;
  92. } Il2CppGenericMethodIndices;
  93. typedef struct Il2CppGenericMethodFunctionsDefinitions
  94. {
  95. GenericMethodIndex genericMethodIndex;
  96. Il2CppGenericMethodIndices indices;
  97. } Il2CppGenericMethodFunctionsDefinitions;
  98. static inline uint32_t GetTokenType(uint32_t token)
  99. {
  100. return token & 0xFF000000;
  101. }
  102. static inline uint32_t GetTokenRowId(uint32_t token)
  103. {
  104. return token & 0x00FFFFFF;
  105. }
  106. /* Runtime metadata tokens */
  107. typedef const struct ___Il2CppMetadataImageHandle* Il2CppMetadataImageHandle;
  108. typedef const struct ___Il2CppMetadataCustomAttributeHandle* Il2CppMetadataCustomAttributeHandle;
  109. typedef const struct ___Il2CppMetadataTypeHandle* Il2CppMetadataTypeHandle;
  110. typedef const struct ___Il2CppMetadataMethodHandle* Il2CppMetadataMethodDefinitionHandle;
  111. typedef const struct ___Il2CppMetadataGenericContainerHandle* Il2CppMetadataGenericContainerHandle;
  112. typedef const struct ___Il2CppMetadataGenericParameterHandle* Il2CppMetadataGenericParameterHandle;