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"); }
//private static readonly IntPtr f_generateOutOfBounds; static TextGenerationSettings() { InternalClassPointerStore <TextGenerationSettings> .NativeClassPtr = UnityInternals.GetClass("UnityEngine.TextRenderingModule.dll", "UnityEngine", "TextGenerationSettings"); UnityInternals.runtime_class_init(InternalClassPointerStore <TextGenerationSettings> .NativeClassPtr); uint align = 0; classsize = UnityInternals.class_value_size(InternalClassPointerStore <TextGenerationSettings> .NativeClassPtr, ref align); f_font = UnityInternals.GetField(InternalClassPointerStore <TextGenerationSettings> .NativeClassPtr, "font"); f_color = UnityInternals.GetField(InternalClassPointerStore <TextGenerationSettings> .NativeClassPtr, "color"); f_fontSize = UnityInternals.GetField(InternalClassPointerStore <TextGenerationSettings> .NativeClassPtr, "fontSize"); f_lineSpacing = UnityInternals.GetField(InternalClassPointerStore <TextGenerationSettings> .NativeClassPtr, "lineSpacing"); f_richText = UnityInternals.GetField(InternalClassPointerStore <TextGenerationSettings> .NativeClassPtr, "richText"); f_scaleFactor = UnityInternals.GetField(InternalClassPointerStore <TextGenerationSettings> .NativeClassPtr, "scaleFactor"); f_fontStyle = UnityInternals.GetField(InternalClassPointerStore <TextGenerationSettings> .NativeClassPtr, "fontStyle"); f_textAnchor = UnityInternals.GetField(InternalClassPointerStore <TextGenerationSettings> .NativeClassPtr, "textAnchor"); //f_alignByGeometry = UnityInternals.GetField(InternalClassPointerStore<TextGenerationSettings>.NativeClassPtr, "alignByGeometry"); //f_resizeTextForBestFit = UnityInternals.GetField(InternalClassPointerStore<TextGenerationSettings>.NativeClassPtr, "resizeTextForBestFit"); //f_resizeTextMinSize = UnityInternals.GetField(InternalClassPointerStore<TextGenerationSettings>.NativeClassPtr, "resizeTextMinSize"); //f_resizeTextMaxSize = UnityInternals.GetField(InternalClassPointerStore<TextGenerationSettings>.NativeClassPtr, "resizeTextMaxSize"); //f_updateBounds = UnityInternals.GetField(InternalClassPointerStore<TextGenerationSettings>.NativeClassPtr, "updateBounds"); f_verticalOverflow = UnityInternals.GetField(InternalClassPointerStore <TextGenerationSettings> .NativeClassPtr, "verticalOverflow"); //f_horizontalOverflow = UnityInternals.GetField(InternalClassPointerStore<TextGenerationSettings>.NativeClassPtr, "horizontalOverflow"); f_generationExtents = UnityInternals.GetField(InternalClassPointerStore <TextGenerationSettings> .NativeClassPtr, "generationExtents"); f_pivot = UnityInternals.GetField(InternalClassPointerStore <TextGenerationSettings> .NativeClassPtr, "pivot"); //f_generateOutOfBounds = UnityInternals.GetField(InternalClassPointerStore<TextGenerationSettings>.NativeClassPtr, "generateOutOfBounds"); }
unsafe static Material() { InternalClassPointerStore <Material> .NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Material"); UnityInternals.runtime_class_init(InternalClassPointerStore <Material> .NativeClassPtr); //m_SetPass = UnityInternals.GetMethod(InternalClassPointerStore<Material>.NativeClassPtr, "SetPass", "System.Boolean", "System.Int32"); m_SetPass = UnityInternals.ResolveICall <d_SetPass>("UnityEngine.Material::SetPass"); }
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 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 Color32() { InternalClassPointerStore <Color32> .NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Color32"); UnityInternals.runtime_class_init(InternalClassPointerStore <Color32> .NativeClassPtr); }
static Rect() { InternalClassPointerStore <Rect> .NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Rect"); UnityInternals.runtime_class_init(InternalClassPointerStore <Rect> .NativeClassPtr); }
static Byte() { InternalClassPointerStore <byte> .NativeClassPtr = UnityInternals.GetClass("mscorlib.dll", "System", "Byte"); UnityInternals.runtime_class_init(InternalClassPointerStore <byte> .NativeClassPtr); }
static Int32() { InternalClassPointerStore <int> .NativeClassPtr = UnityInternals.GetClass("mscorlib.dll", "System", "Int32"); UnityInternals.runtime_class_init(InternalClassPointerStore <int> .NativeClassPtr); }