il2cpp-runtime-metadata.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #pragma once
  2. #include <stdint.h>
  3. #include "il2cpp-blob.h"
  4. #include "il2cpp-metadata.h"
  5. struct Il2CppClass;
  6. struct MethodInfo;
  7. struct Il2CppType;
  8. typedef struct Il2CppArrayType
  9. {
  10. const Il2CppType* etype;
  11. uint8_t rank;
  12. uint8_t numsizes;
  13. uint8_t numlobounds;
  14. int *sizes;
  15. int *lobounds;
  16. } Il2CppArrayType;
  17. typedef struct Il2CppGenericInst
  18. {
  19. uint32_t type_argc;
  20. const Il2CppType **type_argv;
  21. } Il2CppGenericInst;
  22. typedef struct Il2CppGenericContext
  23. {
  24. /* The instantiation corresponding to the class generic parameters */
  25. const Il2CppGenericInst *class_inst;
  26. /* The instantiation corresponding to the method generic parameters */
  27. const Il2CppGenericInst *method_inst;
  28. } Il2CppGenericContext;
  29. typedef struct Il2CppGenericClass
  30. {
  31. const Il2CppType* type; /* the generic type definition */
  32. Il2CppGenericContext context; /* a context that contains the type instantiation doesn't contain any method instantiation */
  33. Il2CppClass *cached_class; /* if present, the Il2CppClass corresponding to the instantiation. */
  34. } Il2CppGenericClass;
  35. typedef struct Il2CppGenericMethod
  36. {
  37. const MethodInfo* methodDefinition;
  38. Il2CppGenericContext context;
  39. } Il2CppGenericMethod;
  40. typedef struct Il2CppType
  41. {
  42. union
  43. {
  44. // We have this dummy field first because pre C99 compilers (MSVC) can only initializer the first value in a union.
  45. void* dummy;
  46. TypeDefinitionIndex __klassIndex; /* for VALUETYPE and CLASS at startup */
  47. Il2CppMetadataTypeHandle typeHandle; /* for VALUETYPE and CLASS at runtime */
  48. const Il2CppType *type; /* for PTR and SZARRAY */
  49. Il2CppArrayType *array; /* for ARRAY */
  50. //MonoMethodSignature *method;
  51. GenericParameterIndex __genericParameterIndex; /* for VAR and MVAR at startup */
  52. Il2CppMetadataGenericParameterHandle genericParameterHandle; /* for VAR and MVAR at runtime */
  53. Il2CppGenericClass *generic_class; /* for GENERICINST */
  54. } data;
  55. unsigned int attrs : 16; /* param attributes or field flags */
  56. Il2CppTypeEnum type : 8;
  57. unsigned int num_mods : 5; /* max 64 modifiers follow at the end */
  58. unsigned int byref : 1;
  59. unsigned int pinned : 1; /* valid when included in a local var signature */
  60. unsigned int valuetype : 1;
  61. //MonoCustomMod modifiers [MONO_ZERO_LEN_ARRAY]; /* this may grow */
  62. } Il2CppType;
  63. typedef struct Il2CppMetadataFieldInfo
  64. {
  65. const Il2CppType* type;
  66. const char* name;
  67. uint32_t token;
  68. } Il2CppMetadataFieldInfo;
  69. typedef struct Il2CppMetadataMethodInfo
  70. {
  71. Il2CppMetadataMethodDefinitionHandle handle;
  72. const char* name;
  73. const Il2CppType* return_type;
  74. uint32_t token;
  75. uint16_t flags;
  76. uint16_t iflags;
  77. uint16_t slot;
  78. uint16_t parameterCount;
  79. } Il2CppMetadataMethodInfo;
  80. typedef struct Il2CppMetadataParameterInfo
  81. {
  82. const char* name;
  83. uint32_t token;
  84. const Il2CppType* type;
  85. } Il2CppMetadataParameterInfo;
  86. typedef struct Il2CppMetadataPropertyInfo
  87. {
  88. const char* name;
  89. const MethodInfo* get;
  90. const MethodInfo* set;
  91. uint32_t attrs;
  92. uint32_t token;
  93. } Il2CppMetadataPropertyInfo;
  94. typedef struct Il2CppMetadataEventInfo
  95. {
  96. const char* name;
  97. const Il2CppType* type;
  98. const MethodInfo* add;
  99. const MethodInfo* remove;
  100. const MethodInfo* raise;
  101. uint32_t token;
  102. } Il2CppMetadataEventInfo;
  103. typedef struct Il2CppInterfaceOffsetInfo
  104. {
  105. const Il2CppType* interfaceType;
  106. int32_t offset;
  107. } Il2CppInterfaceOffsetInfo;
  108. typedef struct Il2CppGenericParameterInfo
  109. {
  110. Il2CppMetadataGenericContainerHandle containerHandle;
  111. const char* name;
  112. uint16_t num;
  113. uint16_t flags;
  114. } Il2CppGenericParameterInfo;