public unsafe TextGenerationSettings() { byte **data = stackalloc byte *[classsize]; IntPtr pointer = UnityInternals.value_box(InternalClassPointerStore <TextGenerationSettings> .NativeClassPtr, (IntPtr)data); myGcHandle = UnityInternals.gchandle_new(pointer, false); }
public unsafe static bool LoadImage(Texture2D tex, byte[] data, bool markNonReadable) { if (method_LoadImage_ptr == IntPtr.Zero) { method_LoadImage_ptr = UnityInternals.ResolveICall("UnityEngine.ImageConversion::LoadImage(UnityEngine.Texture2D,System.Byte[],System.Boolean)"); if (method_LoadImage_ptr == IntPtr.Zero) { MelonLogger.Error("Failed to resolve icall UnityEngine.ImageConversion::LoadImage(UnityEngine.Texture2D,System.Byte[],System.Boolean)"); return(false); } if (method_LoadImage_ptr != IntPtr.Zero) { ImageConversion_LoadImage = (ImageConversion_LoadImage_Delegate)Marshal.GetDelegateForFunctionPointer(method_LoadImage_ptr, typeof(ImageConversion_LoadImage_Delegate)); } } if (ImageConversion_LoadImage != null) { IntPtr dataPtr = UnityInternals.array_new(InternalClassPointerStore <byte> .NativeClassPtr, (uint)data.Length); for (var i = 0; i < data.Length; i++) { IntPtr arrayStartPointer = (IntPtr)((long)dataPtr + 4 * IntPtr.Size); ((byte *)arrayStartPointer.ToPointer())[i] = data[i]; } return(ImageConversion_LoadImage(tex.Pointer, dataPtr, markNonReadable)); } MelonLogger.Error("Failed to run UnityEngine.ImageConversion::LoadImage(UnityEngine.Texture2D,System.Byte[],System.Boolean)"); return(false); }
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; } }
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"); }
public unsafe void Apply() { IntPtr returnedException = default; UnityInternals.runtime_invoke(m_Apply, UnityInternals.ObjectBaseToPtrNotNull(this), (void **)0, ref returnedException); Il2CppException.RaiseExceptionIfNecessary(returnedException); }
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; } }
public unsafe Mesh() : base(UnityInternals.object_new(InternalClassPointerStore <Mesh> .NativeClassPtr)) { IntPtr returnedException = default; UnityInternals.runtime_invoke(m_ctor, UnityInternals.ObjectBaseToPtrNotNull(this), (void **)0, ref returnedException); Il2CppException.RaiseExceptionIfNecessary(returnedException); }
//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"); }
private static void Internal_DrawMeshNow1_Injected(Mesh mesh, int subsetIndex, ref Vector3 position, ref Quaternion rotation) { if ((mesh == null) || (mesh.Pointer == IntPtr.Zero)) { return; } fd_Internal_DrawMeshNow1_Injected(UnityInternals.ObjectBaseToPtr(mesh), subsetIndex, ref position, ref rotation); }
public unsafe void RecalculateBounds() { UnityInternals.ObjectBaseToPtrNotNull(this); IntPtr returnedException = default; UnityInternals.runtime_invoke(m_RecalculateBounds, UnityInternals.ObjectBaseToPtrNotNull(this), (void **)0, ref returnedException); Il2CppException.RaiseExceptionIfNecessary(returnedException); }
unsafe static SystemInfo() { if (NativeSignatureResolver.IsUnityVersionOverOrEqual(MelonLoader.InternalUtils.UnityInformationHandler.EngineVersion.ToStringWithoutType(), new string[] { "2018.1.0" })) { m_GetGraphicsDeviceType = UnityInternals.ResolveICall <d_GetGraphicsDeviceType>("UnityEngine.SystemInfo::GetGraphicsDeviceType"); } else { m_GetGraphicsDeviceType = UnityInternals.ResolveICall <d_GetGraphicsDeviceType>("UnityEngine.SystemInfo::get_graphicsDeviceType"); } }
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)"); }
public unsafe Texture2D(int width, int height) : base(UnityInternals.object_new(InternalClassPointerStore <Texture2D> .NativeClassPtr)) { void **args = stackalloc void *[2]; args[0] = &width; args[1] = &height; IntPtr returnedException = default; UnityInternals.runtime_invoke(m_ctor, UnityInternals.ObjectBaseToPtrNotNull(this), args, ref returnedException); Il2CppException.RaiseExceptionIfNecessary(returnedException); }
static GfxDevice() { if (NativeSignatureResolver.IsUnityVersionOverOrEqual(MelonUtils.GetUnityVersion(), new[] { "2020.2.7", "2020.3.0", "2021.1.0" })) { // `FrameTimingManager_CUSTOM_CaptureFrameTimings()` calls `GetRealGfxDevice()` after 4 bytes. m_GetRealGfxDevice = (GetRealGfxDeviceDelegate)Marshal.GetDelegateForFunctionPointer( CppUtils.ResolveRelativeInstruction( (IntPtr)((long)UnityInternals.ResolveICall("UnityEngine.FrameTimingManager::CaptureFrameTimings") + (MelonUtils.IsGame32Bit() ? 0 : 4))), typeof(GetRealGfxDeviceDelegate)); } }
public unsafe static Type internal_from_handle(IntPtr handle) { void **args = stackalloc void *[1]; args[0] = &handle; IntPtr returnedException = default; IntPtr intPtr = UnityInternals.runtime_invoke(Type.m_internal_from_handle, IntPtr.Zero, (void **)args, ref returnedException); Il2CppException.RaiseExceptionIfNecessary(returnedException); return((intPtr != IntPtr.Zero) ? new Type(intPtr) : null); }
public unsafe bool Populate(string str, TextGenerationSettings settings) { void **args = stackalloc void *[2]; args[0] = (void *)UnityInternals.ManagedStringToInternal(str); args[1] = (void *)UnityInternals.object_unbox(UnityInternals.ObjectBaseToPtrNotNull(settings)); IntPtr returnedException = default; IntPtr obj = UnityInternals.runtime_invoke(m_Populate, UnityInternals.ObjectBaseToPtrNotNull(this), args, ref returnedException); Il2CppException.RaiseExceptionIfNecessary(returnedException); return(*(bool *)UnityInternals.object_unbox(obj)); }
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 ImageConversion() { IntPtr ptr = UnityInternals.ResolveICall("UnityEngine.ImageConversion::LoadImage(UnityEngine.Texture2D,System.Byte[],System.Boolean)"); if (ptr != IntPtr.Zero) { ImageConversion_LoadImage = (ImageConversion_LoadImage_Delegate)Marshal.GetDelegateForFunctionPointer(ptr, typeof(ImageConversion_LoadImage_Delegate)); } else { MelonLogger.Error("Failed to resolve icall UnityEngine.ImageConversion::LoadImage(UnityEngine.Texture2D,System.Byte[],System.Boolean)"); } }
public unsafe static IntPtr GetUnityTlsInterface() { if (m_GetUnityTlsInterface == null) { return(IntPtr.Zero); } IntPtr *param = null; IntPtr returnedException = IntPtr.Zero; IntPtr intPtr = UnityInternals.il2cpp_runtime_invoke(m_GetUnityTlsInterface, IntPtr.Zero, (void **)param, ref returnedException); Il2CppException.RaiseExceptionIfNecessary(returnedException); return(*(IntPtr *)UnityInternals.il2cpp_object_unbox(intPtr)); }
public unsafe static void DrawTexture(Rect screenRect, Texture2D texture) { if ((texture == null) || (texture.Pointer == IntPtr.Zero)) { return; } if (m_DrawTexture_Internal_struct == 0) { Internal_DrawTextureArguments_2017 args = default; args.screenRect = screenRect; args.sourceRect = new Rect(0, 0, 1, 1); args.color = new Color32(128, 128, 128, 128); args.texture = UnityInternals.ObjectBaseToPtrNotNull(texture); fd_Internal_DrawTexture((IntPtr)(&args)); } else if (m_DrawTexture_Internal_struct == 1) { Internal_DrawTextureArguments_2018 args = default; args.screenRect = screenRect; args.sourceRect = new Rect(0, 0, 1, 1); args.color = new Color32(128, 128, 128, 128); args.texture = UnityInternals.ObjectBaseToPtrNotNull(texture); fd_Internal_DrawTexture((IntPtr)(&args)); } else if (m_DrawTexture_Internal_struct == 2) { Internal_DrawTextureArguments_2019 args = default; args.screenRect = screenRect; args.sourceRect = new Rect(0, 0, 1, 1); args.color = new Color(0.5f, 0.5f, 0.5f, 0.5f); args.texture = UnityInternals.ObjectBaseToPtrNotNull(texture); fd_Internal_DrawTexture((IntPtr)(&args)); } else if (m_DrawTexture_Internal_struct == 3) { Internal_DrawTextureArguments_2020 args = default; args.screenRect = screenRect; args.sourceRect = new Rect(0, 0, 1, 1); args.color = new Color(0.5f, 0.5f, 0.5f, 0.5f); args.leftBorderColor = new Color(0, 0, 0, 1); args.topBorderColor = new Color(0, 0, 0, 1); args.rightBorderColor = new Color(0, 0, 0, 1); args.bottomBorderColor = new Color(0, 0, 0, 1); args.smoothCorners = true; args.texture = UnityInternals.ObjectBaseToPtrNotNull(texture); fd_Internal_DrawTexture((IntPtr)(&args)); } }
public unsafe static IntPtr GetBuiltinResource(Il2CppSystem.Type type, string path) { void **ptr = stackalloc void *[2]; ptr[0] = (void *)UnityInternals.ObjectBaseToPtr(type); ptr[1] = (void *)UnityInternals.ManagedStringToInternal(path); IntPtr returnedException = default; MelonDebug.Msg("Calling runtime_invoke for GetBuiltinResource"); IntPtr objectPointer = UnityInternals.runtime_invoke(m_GetBuiltinResource, IntPtr.Zero, ptr, ref returnedException); MelonDebug.Msg("returnedException: " + returnedException + ", objectPointer: " + objectPointer); Il2CppException.RaiseExceptionIfNecessary(returnedException); return(objectPointer); }
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"); }
unsafe public void DontDestroyOnLoad() { if (Pointer == IntPtr.Zero) { return; } void **args = stackalloc void *[1]; args[0] = Pointer.ToPointer(); IntPtr returnedException = IntPtr.Zero; UnityInternals.runtime_invoke(m_DontDestroyOnLoad, IntPtr.Zero, args, ref returnedException); Il2CppException.RaiseExceptionIfNecessary(returnedException); }
public unsafe UIVertexWrapper[] GetVerticesArray() { IntPtr intPtr = fd_GetVerticesArray(UnityInternals.ObjectBaseToPtrNotNull(this)); if (intPtr == IntPtr.Zero) { return(null); } UIVertexWrapper[] arr = new UIVertexWrapper[UnityInternals.array_length(intPtr)]; for (int i = 0; i < arr.Length; ++i) { arr[i] = new UIVertexWrapper((IntPtr)((long)intPtr + 4 * IntPtr.Size + i * UIVertexWrapper.sizeOfElement)); } // arr[i] = ( (UIVertex*)((long)intPtr + 4 * IntPtr.Size) )[i]; // arr[i] = *( (UIVertex*)((long)intPtr + 4 * IntPtr.Size) + (i * sizeof(UIVertex))) return(arr); }
public unsafe static bool LoadImage(Texture2D tex, byte[] data, bool markNonReadable) { if (ImageConversion_LoadImage == null) { MelonLogger.Error("Failed to run UnityEngine.ImageConversion::LoadImage(UnityEngine.Texture2D,System.Byte[],System.Boolean)"); return(false); } IntPtr dataPtr = UnityInternals.array_new(InternalClassPointerStore <byte> .NativeClassPtr, (uint)data.Length); for (var i = 0; i < data.Length; i++) { IntPtr arrayStartPointer = (IntPtr)((long)dataPtr + 4 * IntPtr.Size); ((byte *)arrayStartPointer.ToPointer())[i] = data[i]; } return(ImageConversion_LoadImage(tex.Pointer, dataPtr, markNonReadable)); }
public unsafe void SetPixelsImpl(int x, int y, int w, int h, Color[] pixel, int miplevel, int frame) { IntPtr pixelArrayPtr = UnityInternals.array_new(InternalClassPointerStore <Color> .NativeClassPtr, (uint)pixel.Length); for (var i = 0; i < pixel.Length; i++) { IntPtr arrayStartPointer = (IntPtr)((long)pixelArrayPtr + 4 * IntPtr.Size); ((Color *)arrayStartPointer.ToPointer())[i] = pixel[i]; } if (type_SetPixelsImpl == 0) { m_SetPixelsImpl_2017(UnityInternals.ObjectBaseToPtrNotNull(this), x, y, w, h, pixelArrayPtr, miplevel); } else if (type_SetPixelsImpl == 1) { m_SetPixelsImpl_2018(UnityInternals.ObjectBaseToPtrNotNull(this), x, y, w, h, pixelArrayPtr, miplevel, frame); } }
private unsafe void SetArrayForChannelImpl(int channel, IntPtr values, int channelDimensions, int valuesCount) { if (type_SetArrayForChannelImpl == 0) { m_SetArrayForChannelImpl_2017(UnityInternals.ObjectBaseToPtrNotNull(this), channel, 0 /* float */, channelDimensions, values, valuesCount); } else if (type_SetArrayForChannelImpl == 1) { m_SetArrayForChannelImpl_2019(UnityInternals.ObjectBaseToPtrNotNull(this), channel, 0 /* float */, channelDimensions, values, valuesCount, 0, valuesCount); } else if (type_SetArrayForChannelImpl == 2) { m_SetArrayForChannelImpl_2020(UnityInternals.ObjectBaseToPtrNotNull(this), channel, 0 /* float */, channelDimensions, values, valuesCount, 0, valuesCount, 0 /* MeshUpdateFlags.Default */); } else { throw new NotImplementedException("SetArrayForChannel isn't implemented for this version of Unity"); } }
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"); }