il2cpp-runtime-metadata.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. 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. };
  17. struct Il2CppGenericInst
  18. {
  19. uint32_t type_argc;
  20. const Il2CppType **type_argv;
  21. };
  22. 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. };
  29. 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. };
  38. 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. };
  48. 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. };
  54. struct Il2CppGenericMethod
  55. {
  56. const MethodInfo* methodDefinition;
  57. Il2CppGenericContext context;
  58. };
  59. 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. };
  79. typedef enum
  80. {
  81. IL2CPP_CALL_DEFAULT,
  82. IL2CPP_CALL_C,
  83. IL2CPP_CALL_STDCALL,
  84. IL2CPP_CALL_THISCALL,
  85. IL2CPP_CALL_FASTCALL,
  86. IL2CPP_CALL_VARARG
  87. } Il2CppCallConvention;
  88. enum Il2CppCharSet
  89. {
  90. CHARSET_ANSI,
  91. CHARSET_UNICODE
  92. };