Image.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #pragma once
  2. #include <stdint.h>
  3. #include <string>
  4. #include <vector>
  5. #include "il2cpp-config.h"
  6. struct Il2CppClass;
  7. struct MethodInfo;
  8. struct Il2CppAssembly;
  9. struct Il2CppDelegate;
  10. struct Il2CppImage;
  11. struct Il2CppType;
  12. struct Il2CppGenericContext;
  13. struct Il2CppGenericContainer;
  14. struct Il2CppReflectionAssembly;
  15. struct Il2CppArray;
  16. class AssemblyVector;
  17. namespace il2cpp
  18. {
  19. namespace vm
  20. {
  21. typedef std::vector<const Il2CppClass*> TypeVector;
  22. class TypeNameParseInfo;
  23. struct EmbeddedResourceRecord
  24. {
  25. EmbeddedResourceRecord(const Il2CppImage* image, const std::string& name, uint32_t offset, uint32_t size)
  26. : image(image), name(name), offset(offset), size(size)
  27. {}
  28. const Il2CppImage* image;
  29. std::string name;
  30. uint32_t offset;
  31. uint32_t size;
  32. };
  33. class LIBIL2CPP_CODEGEN_API Image
  34. {
  35. // exported
  36. public:
  37. static Il2CppImage* GetCorlib();
  38. public:
  39. static const char * GetName(const Il2CppImage* image);
  40. static const char * GetFileName(const Il2CppImage* image);
  41. static const Il2CppAssembly* GetAssembly(const Il2CppImage* image);
  42. static const MethodInfo* GetEntryPoint(const Il2CppImage* image);
  43. static const Il2CppImage* GetExecutingImage();
  44. static const Il2CppImage* GetCallingImage();
  45. static uint32_t GetNumTypes(const Il2CppImage* image);
  46. static const Il2CppClass* GetType(const Il2CppImage* image, AssemblyTypeIndex index);
  47. static Il2CppClass* FromTypeNameParseInfo(const Il2CppImage* image, const TypeNameParseInfo &info, bool ignoreCase);
  48. static Il2CppClass* ClassFromName(const Il2CppImage* image, const char* namespaze, const char *name);
  49. static void GetTypes(const Il2CppImage* image, bool exportedOnly, TypeVector* target);
  50. static Il2CppArray* GetTypes(const Il2CppImage* image, bool exportedOnly);
  51. struct EmbeddedResourceData
  52. {
  53. EmbeddedResourceData(EmbeddedResourceRecord record, void* data)
  54. : record(record), data(data)
  55. {}
  56. EmbeddedResourceRecord record;
  57. void* data;
  58. };
  59. static void CacheMemoryMappedResourceFile(Il2CppReflectionAssembly* assembly, void* memoryMappedFile);
  60. static void* GetCachedMemoryMappedResourceFile(Il2CppReflectionAssembly* assembly);
  61. static void CacheResourceData(EmbeddedResourceRecord record, void* data);
  62. static void* GetCachedResourceData(const Il2CppImage* image, const std::string& name);
  63. static void ClearCachedResourceData();
  64. static void InitNestedTypes(const Il2CppImage *image);
  65. };
  66. } /* namespace vm */
  67. } /* namespace il2cpp */