il2cpp-runtime-metadata.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 Il2CppGenericParameter
  30. {
  31. GenericContainerIndex ownerIndex; /* Type or method this parameter was defined in. */
  32. StringIndex nameIndex;
  33. GenericParameterConstraintIndex constraintsStart;
  34. int16_t constraintsCount;
  35. uint16_t num;
  36. uint16_t flags;
  37. } Il2CppGenericParameter;
  38. typedef struct Il2CppGenericContainer
  39. {
  40. /* index of the generic type definition or the generic method definition corresponding to this container */
  41. int32_t ownerIndex; // either index into Il2CppClass metadata array or Il2CppMethodDefinition array
  42. int32_t type_argc;
  43. /* If true, we're a generic method, otherwise a generic type definition. */
  44. int32_t is_method;
  45. /* Our type parameters. */
  46. GenericParameterIndex genericParameterStart;
  47. } Il2CppGenericContainer;
  48. typedef struct Il2CppGenericClass
  49. {
  50. TypeDefinitionIndex typeDefinitionIndex; /* the generic type definition */
  51. Il2CppGenericContext context; /* a context that contains the type instantiation doesn't contain any method instantiation */
  52. Il2CppClass *cached_class; /* if present, the Il2CppClass corresponding to the instantiation. */
  53. } Il2CppGenericClass;
  54. typedef struct Il2CppGenericMethod
  55. {
  56. const MethodInfo* methodDefinition;
  57. Il2CppGenericContext context;
  58. } Il2CppGenericMethod;
  59. typedef struct Il2CppType
  60. {
  61. union
  62. {
  63. // We have this dummy field first because pre C99 compilers (MSVC) can only initializer the first value in a union.
  64. void* dummy;
  65. TypeDefinitionIndex klassIndex; /* for VALUETYPE and CLASS */
  66. const Il2CppType *type; /* for PTR and SZARRAY */
  67. Il2CppArrayType *array; /* for ARRAY */
  68. //MonoMethodSignature *method;
  69. GenericParameterIndex genericParameterIndex; /* for VAR and MVAR */
  70. Il2CppGenericClass *generic_class; /* for GENERICINST */
  71. } data;
  72. unsigned int attrs : 16; /* param attributes or field flags */
  73. Il2CppTypeEnum type : 8;
  74. unsigned int num_mods : 6; /* max 64 modifiers follow at the end */
  75. unsigned int byref : 1;
  76. unsigned int pinned : 1; /* valid when included in a local var signature */
  77. //MonoCustomMod modifiers [MONO_ZERO_LEN_ARRAY]; /* this may grow */
  78. } Il2CppType;