static Mesh() { InternalClassPointerStore <Mesh> .NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Mesh"); UnityInternals.runtime_class_init(InternalClassPointerStore <Mesh> .NativeClassPtr); m_ctor = UnityInternals.GetMethod(InternalClassPointerStore <Mesh> .NativeClassPtr, ".ctor", "System.Void"); m_set_triangles = UnityInternals.GetMethod(InternalClassPointerStore <Mesh> .NativeClassPtr, "set_triangles", "System.Void", "System.Int32[]"); m_RecalculateBounds = UnityInternals.GetMethod(InternalClassPointerStore <Mesh> .NativeClassPtr, "RecalculateBounds", "System.Void"); if (NativeSignatureResolver.IsUnityVersionOverOrEqual(MelonLoader.InternalUtils.UnityInformationHandler.EngineVersion.ToStringWithoutType(), new string[] { "2020.1.0" })) { m_SetArrayForChannelImpl_2020 = UnityInternals.ResolveICall <SetArrayForChannelImpl_2020>("UnityEngine.Mesh::SetArrayForChannelImpl"); type_SetArrayForChannelImpl = 2; } else if (NativeSignatureResolver.IsUnityVersionOverOrEqual(MelonLoader.InternalUtils.UnityInformationHandler.EngineVersion.ToStringWithoutType(), new string[] { "2019.3.0" })) { m_SetArrayForChannelImpl_2019 = UnityInternals.ResolveICall <SetArrayForChannelImpl_2019>("UnityEngine.Mesh::SetArrayForChannelImpl"); type_SetArrayForChannelImpl = 1; } else if (NativeSignatureResolver.IsUnityVersionOverOrEqual(MelonLoader.InternalUtils.UnityInformationHandler.EngineVersion.ToStringWithoutType(), new string[] { "2017.1.0" })) { m_SetArrayForChannelImpl_2017 = UnityInternals.ResolveICall <SetArrayForChannelImpl_2017>("UnityEngine.Mesh::SetArrayForChannelImpl"); type_SetArrayForChannelImpl = 0; } }
static Font() { InternalClassPointerStore <Font> .NativeClassPtr = UnityInternals.GetClass("UnityEngine.TextRenderingModule.dll", "UnityEngine", "Font"); UnityInternals.runtime_class_init(InternalClassPointerStore <Font> .NativeClassPtr); m_get_material = UnityInternals.GetMethod(InternalClassPointerStore <Font> .NativeClassPtr, "get_material", "UnityEngine.Material"); }
unsafe static UnityObject() { InternalClassPointerStore <UnityObject> .NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Object"); //UnityInternals.runtime_class_init(InternalClassPointerStore<UnityObject>.NativeClassPtr); m_DestroyImmediate = UnityInternals.GetMethod(InternalClassPointerStore <UnityObject> .NativeClassPtr, "DestroyImmediate", "System.Void", "UnityEngine.Object"); m_DontDestroyOnLoad = UnityInternals.GetMethod(InternalClassPointerStore <UnityObject> .NativeClassPtr, "DontDestroyOnLoad", "System.Void", "UnityEngine.Object"); m_get_hideFlags = UnityInternals.ResolveICall <get_hideFlags_Delegate>("UnityEngine.Object::get_hideFlags(UnityEngine.Object)"); m_set_hideFlags = UnityInternals.ResolveICall <set_hideFlags_Delegate>("UnityEngine.Object::set_hideFlags(UnityEngine.Object)"); }
static TextGenerator() { InternalClassPointerStore <TextGenerator> .NativeClassPtr = UnityInternals.GetClass("UnityEngine.TextRenderingModule.dll", "UnityEngine", "TextGenerator"); UnityInternals.runtime_class_init(InternalClassPointerStore <TextGenerator> .NativeClassPtr); m_ctor = UnityInternals.GetMethod(InternalClassPointerStore <TextGenerator> .NativeClassPtr, ".ctor", "System.Void"); m_Populate = UnityInternals.GetMethod(InternalClassPointerStore <TextGenerator> .NativeClassPtr, "Populate", "System.Boolean", "System.String", "UnityEngine.TextGenerationSettings"); fd_get_vertexCount = UnityInternals.ResolveICall <get_vertexCountDelegate>("UnityEngine.TextGenerator::get_vertexCount"); fd_GetVerticesArray = UnityInternals.ResolveICall <GetVerticesArrayDelegate>("UnityEngine.TextGenerator::GetVerticesArray"); }
static Resources() { InternalClassPointerStore <Resources> .NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Resources"); UnityInternals.runtime_class_init(InternalClassPointerStore <Resources> .NativeClassPtr); /* * IntPtr mptr = IntPtr.Zero; * IntPtr iter = IntPtr.Zero; * while ((mptr = UnityInternals.class_get_methods(InternalClassPointerStore<Resources>.NativeClassPtr, ref iter)) != IntPtr.Zero) * { * uint paramCount = UnityInternals.method_get_param_count(mptr); * string[] paramTypes = new string[paramCount]; * for (uint i = 0; i < paramCount; ++i) * paramTypes[i] = Marshal.PtrToStringAnsi(UnityInternals.type_get_name(UnityInternals.method_get_param(mptr, i))); * MelonLoader.MelonLogger.Msg($" {Marshal.PtrToStringAnsi(UnityInternals.type_get_name(UnityInternals.method_get_return_type(mptr)))} {Marshal.PtrToStringAnsi(UnityInternals.method_get_name(mptr))}({string.Join(", ", paramTypes)})"); * } */ // T GetBuiltinResource(System.String) m_GetBuiltinResource = UnityInternals.GetMethod(InternalClassPointerStore <Resources> .NativeClassPtr, "GetBuiltinResource", "UnityEngine.Object", "System.Type", "System.String"); }
static Texture2D() { InternalClassPointerStore <Texture2D> .NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Texture2D"); UnityInternals.runtime_class_init(InternalClassPointerStore <Texture2D> .NativeClassPtr); m_ctor = UnityInternals.GetMethod(InternalClassPointerStore <Texture2D> .NativeClassPtr, ".ctor", "System.Void", "System.Int32", "System.Int32"); m_get_whiteTexture = UnityInternals.GetMethod(InternalClassPointerStore <Texture2D> .NativeClassPtr, "get_whiteTexture", "UnityEngine.Texture2D"); if (NativeSignatureResolver.IsUnityVersionOverOrEqual(MelonLoader.InternalUtils.UnityInformationHandler.EngineVersion.ToStringWithoutType(), new string[] { "2018.1.0" })) { type_SetPixelsImpl = 1; m_SetPixelsImpl_2018 = UnityInternals.ResolveICall <SetPixelsImplDelegate_2018>("UnityEngine.Texture2D::SetPixelsImpl"); } else if (NativeSignatureResolver.IsUnityVersionOverOrEqual(MelonLoader.InternalUtils.UnityInformationHandler.EngineVersion.ToStringWithoutType(), new string[] { "2017.1.0" })) { type_SetPixelsImpl = 0; m_SetPixelsImpl_2017 = UnityInternals.ResolveICall <SetPixelsImplDelegate_2017>("UnityEngine.Texture2D::SetPixels"); } m_Apply = UnityInternals.GetMethod(InternalClassPointerStore <Texture2D> .NativeClassPtr, "Apply", "System.Void"); }
static Screen() { InternalClassPointerStore <Screen> .NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Screen"); m_get_width = UnityInternals.GetMethod(InternalClassPointerStore <Screen> .NativeClassPtr, "get_width", "System.Int32"); m_get_height = UnityInternals.GetMethod(InternalClassPointerStore <Screen> .NativeClassPtr, "get_height", "System.Int32"); }
static Color() { InternalClassPointerStore <Color> .NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Color"); UnityInternals.runtime_class_init(InternalClassPointerStore <Color> .NativeClassPtr); m_ToString = UnityInternals.GetMethod(InternalClassPointerStore <Color> .NativeClassPtr, "ToString", "System.String"); }
static UnityTls() { InternalClassPointerStore <UnityTls> .NativeClassPtr = UnityInternals.GetClass("System.dll", "Mono.Unity", "UnityTls"); m_GetUnityTlsInterface = UnityInternals.GetMethod(InternalClassPointerStore <UnityTls> .NativeClassPtr, "GetUnityTlsInterface", "System.IntPtr"); }
static Type() { InternalClassPointerStore <Type> .NativeClassPtr = UnityInternals.GetClass("mscorlib.dll", "System", "Type"); m_internal_from_handle = UnityInternals.GetMethod(InternalClassPointerStore <Type> .NativeClassPtr, "internal_from_handle", "System.Type", "System.IntPtr"); }