Exemplo n.º 1
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");
        }
Exemplo n.º 2
0
        unsafe static Graphics()
        {
            InternalClassPointerStore <Graphics> .NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Graphics");
            fd_Internal_DrawTexture = UnityInternals.ResolveICall <Internal_DrawTextureDelegate>("UnityEngine.Graphics::Internal_DrawTexture");

            if (NativeSignatureResolver.IsUnityVersionOverOrEqual(MelonLoader.InternalUtils.UnityInformationHandler.EngineVersion.ToStringWithoutType(), new string[] { "2018.2.0", "2019.1.0" }))
            {
                fd_Internal_DrawMeshNow1_Injected = UnityInternals.ResolveICall <Internal_DrawMeshNow1_InjectedDelegate>("UnityEngine.Graphics::Internal_DrawMeshNow1_Injected");
            }
            else
            {
                fd_Internal_DrawMeshNow1_Injected = UnityInternals.ResolveICall <Internal_DrawMeshNow1_InjectedDelegate>("UnityEngine.Graphics::INTERNAL_CALL_Internal_DrawMeshNow1");
            }

            if (NativeSignatureResolver.IsUnityVersionOverOrEqual(MelonLoader.InternalUtils.UnityInformationHandler.EngineVersion.ToStringWithoutType(), new string[] { "2019.3.0", "2020.1.0" }))
            {
                m_DrawTexture_Internal_struct = 3;
            }
            else if (NativeSignatureResolver.IsUnityVersionOverOrEqual(MelonLoader.InternalUtils.UnityInformationHandler.EngineVersion.ToStringWithoutType(), new string[] { "2018.2.0", "2019.1.0" }))
            {
                m_DrawTexture_Internal_struct = 2;
            }
            else if (NativeSignatureResolver.IsUnityVersionOverOrEqual(MelonLoader.InternalUtils.UnityInformationHandler.EngineVersion.ToStringWithoutType(), new string[] { "2017.3.0", "2018.1.0" }))
            {
                m_DrawTexture_Internal_struct = 1;
            }
            else if (NativeSignatureResolver.IsUnityVersionOverOrEqual(MelonLoader.InternalUtils.UnityInformationHandler.EngineVersion.ToStringWithoutType(), new string[] { "2017.2.0" }))
            {
                m_DrawTexture_Internal_struct = 0;
            }
        }
Exemplo n.º 3
0
        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;
            }
        }
Exemplo n.º 4
0
        //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");
        }
Exemplo n.º 5
0
        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");
        }
Exemplo n.º 6
0
        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)");
        }
Exemplo n.º 7
0
        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");
        }
Exemplo n.º 8
0
        static Texture()
        {
            InternalClassPointerStore <Texture> .NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Texture");

            if (NativeSignatureResolver.IsUnityVersionOverOrEqual(MelonLoader.InternalUtils.UnityInformationHandler.EngineVersion.ToStringWithoutType(), new string[] { "2018.1.0" }))
            {
                getDataWidth  = UnityInternals.ResolveICall <GetDataWidthDelegate>("UnityEngine.Texture::GetDataWidth");
                getDataHeight = UnityInternals.ResolveICall <GetDataHeightDelegate>("UnityEngine.Texture::GetDataHeight");
            }
            else if (NativeSignatureResolver.IsUnityVersionOverOrEqual(MelonLoader.InternalUtils.UnityInformationHandler.EngineVersion.ToStringWithoutType(), new string[] { "2017.1.0" }))
            {
                getDataWidth  = UnityInternals.ResolveICall <GetDataWidthDelegate>("UnityEngine.Texture::Internal_GetWidth");
                getDataHeight = UnityInternals.ResolveICall <GetDataHeightDelegate>("UnityEngine.Texture::Internal_GetHeight");
            }
            set_filterMode_ = UnityInternals.ResolveICall <set_filterModeDelegate>("UnityEngine.Texture::set_filterMode");
        }
Exemplo n.º 9
0
        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");
        }
Exemplo n.º 10
0
        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");
        }
Exemplo n.º 11
0
 static UnityTls()
 {
     InternalClassPointerStore <UnityTls> .NativeClassPtr = UnityInternals.GetClass("System.dll", "Mono.Unity", "UnityTls");
     m_GetUnityTlsInterface = UnityInternals.GetMethod(InternalClassPointerStore <UnityTls> .NativeClassPtr, "GetUnityTlsInterface", "System.IntPtr");
 }
Exemplo n.º 12
0
 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");
 }
Exemplo n.º 13
0
 static Color32()
 {
     InternalClassPointerStore <Color32> .NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Color32");
     UnityInternals.runtime_class_init(InternalClassPointerStore <Color32> .NativeClassPtr);
 }
Exemplo n.º 14
0
 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");
 }
Exemplo n.º 15
0
 static Vector3()
 {
     InternalClassPointerStore <Vector3> .NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Vector3");
 }
Exemplo n.º 16
0
 static Byte()
 {
     InternalClassPointerStore <byte> .NativeClassPtr = UnityInternals.GetClass("mscorlib.dll", "System", "Byte");
     UnityInternals.runtime_class_init(InternalClassPointerStore <byte> .NativeClassPtr);
 }
Exemplo n.º 17
0
 static Quaternion()
 {
     InternalClassPointerStore <Quaternion> .NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Quaternion");
 }
Exemplo n.º 18
0
 static Vector2()
 {
     InternalClassPointerStore <Vector2> .NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Vector2");
     //UnityInternals.runtime_class_init(InternalClassPointerStore<Vector2>.NativeClassPtr);
 }
Exemplo n.º 19
0
        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");
        }
Exemplo n.º 20
0
 static Rect()
 {
     InternalClassPointerStore <Rect> .NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Rect");
     UnityInternals.runtime_class_init(InternalClassPointerStore <Rect> .NativeClassPtr);
 }
Exemplo n.º 21
0
 static Int32()
 {
     InternalClassPointerStore <int> .NativeClassPtr = UnityInternals.GetClass("mscorlib.dll", "System", "Int32");
     UnityInternals.runtime_class_init(InternalClassPointerStore <int> .NativeClassPtr);
 }