il2cpp-runtime-metadata.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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 Il2CppGenericMethodKey
  41. {
  42. Il2CppMetadataMethodDefinitionHandle methodDefinitionHandle;
  43. Il2CppGenericContext context;
  44. } Il2CppGenericMethodKey;
  45. typedef struct Il2CppType
  46. {
  47. union
  48. {
  49. // We have this dummy field first because pre C99 compilers (MSVC) can only initializer the first value in a union.
  50. void* dummy;
  51. TypeDefinitionIndex __klassIndex; /* for VALUETYPE and CLASS at startup */
  52. Il2CppMetadataTypeHandle typeHandle; /* for VALUETYPE and CLASS at runtime */
  53. const Il2CppType *type; /* for PTR and SZARRAY */
  54. Il2CppArrayType *array; /* for ARRAY */
  55. //MonoMethodSignature *method;
  56. GenericParameterIndex __genericParameterIndex; /* for VAR and MVAR at startup */
  57. Il2CppMetadataGenericParameterHandle genericParameterHandle; /* for VAR and MVAR at runtime */
  58. Il2CppGenericClass *generic_class; /* for GENERICINST */
  59. } data;
  60. unsigned int attrs : 16; /* param attributes or field flags */
  61. Il2CppTypeEnum type : 8;
  62. unsigned int num_mods : 5; /* max 64 modifiers follow at the end */
  63. unsigned int byref : 1;
  64. unsigned int pinned : 1; /* valid when included in a local var signature */
  65. unsigned int valuetype : 1;
  66. //MonoCustomMod modifiers [MONO_ZERO_LEN_ARRAY]; /* this may grow */
  67. } Il2CppType;
  68. typedef struct Il2CppMetadataFieldInfo
  69. {
  70. const Il2CppType* type;
  71. const char* name;
  72. uint32_t token;
  73. } Il2CppMetadataFieldInfo;
  74. typedef struct Il2CppMetadataMethodInfo
  75. {
  76. Il2CppMetadataMethodDefinitionHandle handle;
  77. const char* name;
  78. const Il2CppType* return_type;
  79. uint32_t token;
  80. uint16_t flags;
  81. uint16_t iflags;
  82. uint16_t slot;
  83. uint16_t parameterCount;
  84. bool isUnmangedCallersOnly;
  85. } Il2CppMetadataMethodInfo;
  86. typedef struct Il2CppMetadataParameterInfo
  87. {
  88. const char* name;
  89. uint32_t token;
  90. const Il2CppType* type;
  91. } Il2CppMetadataParameterInfo;
  92. typedef struct Il2CppMetadataPropertyInfo
  93. {
  94. const char* name;
  95. const MethodInfo* get;
  96. const MethodInfo* set;
  97. uint32_t attrs;
  98. uint32_t token;
  99. } Il2CppMetadataPropertyInfo;
  100. typedef struct Il2CppMetadataEventInfo
  101. {
  102. const char* name;
  103. const Il2CppType* type;
  104. const MethodInfo* add;
  105. const MethodInfo* remove;
  106. const MethodInfo* raise;
  107. uint32_t token;
  108. } Il2CppMetadataEventInfo;
  109. typedef struct Il2CppInterfaceOffsetInfo
  110. {
  111. const Il2CppType* interfaceType;
  112. int32_t offset;
  113. } Il2CppInterfaceOffsetInfo;
  114. typedef struct Il2CppGenericParameterInfo
  115. {
  116. Il2CppMetadataGenericContainerHandle containerHandle;
  117. const char* name;
  118. uint16_t num;
  119. uint16_t flags;
  120. } Il2CppGenericParameterInfo;