Esempio n. 1
0
        unsafe public static IntPtr Create_UnityAction(IntPtr function)
        {
            if (UnityAction == null)
            {
                UnityAction = SDK.GetClass("UnityEngine.Events.UnityAction");
            }
            if (UnityAction == null)
            {
                return(IntPtr.Zero);
            }
            var obj = IL2CPP.il2cpp_object_new(UnityAction.Ptr);
            var o   = Marshal.AllocHGlobal(8);

            *(IntPtr *)o         = function;
            *((IntPtr *)obj + 2) = function;
            *((IntPtr *)obj + 4) = IntPtr.Zero;
            *((IntPtr *)obj + 5) = o;
            return(obj);
        }
Esempio n. 2
0
        internal static void Initialize()
        {
            Domain = MelonLoader.Imports.GetIl2CppDomain();
            uint   assembly_count = 0;
            IntPtr assemblies     = IL2CPP.il2cpp_domain_get_assemblies(Domain, ref assembly_count);

            IntPtr[] assembliesarr = IL2CPP.IntPtrToStructureArray <IntPtr>(assemblies, assembly_count);
            List <IL2CPP_Assembly> assemblyList = new List <IL2CPP_Assembly>();

            for (int i = 0; i < assembliesarr.Length; i++)
            {
                IntPtr assembly = assembliesarr[i];
                if (assembly != IntPtr.Zero)
                {
                    assemblyList.Add(new IL2CPP_Assembly(IL2CPP.il2cpp_assembly_get_image(assembly)));
                }
            }
            AssemblyList = assemblyList.ToArray();
        }