예제 #1
0
        public static void Gen()
        {
            using (new CS(IcallWriter))
            {
                CS.Writer.WriteLine("#include \"engine_include.h\"", false);
                CS.Writer.WriteLine("#include \"class_cache_gen.h\"", false);

                RegisterAssemblyMap();

                foreach (var m in methodSet)
                {
                    CS.Writer.Start($"{CTypeResolver.Resolve(m.ReturnType).TypeName()} {CUtils.ImplementMethodName(m, true)}");
                    ImplementBindMethod(m);
                    CS.Writer.End();
                }

                CS.Writer.Start("void regist_icall_gen()");
                foreach (var m in methodSet)
                {
                    CS.Writer.WriteLine($"mono_add_internal_call(\"{CUtils.GetICallDescName(m)}\",(void*) {CUtils.ImplementMethodName(m, false)})");
                }
                CS.Writer.End();
            }

            IcallWriter.EndAll();
        }
예제 #2
0
        public static void Gen()
        {
            using (new CS(EventWriter))
            {
                CS.Writer.WriteLine("#include \"event_binding.h\"", false);
                CS.Writer.WriteLine("#include \"class_cache_gen.h\"", false);

                CS.Writer.WriteLine($"EventMethodDesc methods[{methodSet.Count}]");

                int index = 0;
                foreach (var m in methodSet)
                {
                    CS.Writer.Start($"{CTypeResolver.Resolve(m.ReturnType,true).TypeName()} {CUtils.ImplementMethodName(m, false) + CUtils.GetParamDefine(m, true, "const MethodInfo* imethod")} ");
                    ImplementEventMethod(m, index);
                    CS.Writer.End();
                    index++;
                }

                index = 0;
                CS.Writer.Start("void init_event_gen()");
                foreach (var m in methodSet)
                {
                    CS.Writer.WriteLine($"init_event_method(&methods[{index}],{ClassCacheGenerater.GetClass(m.DeclaringType,false)},{ClassCacheGenerater.GetClass(m.DeclaringType, true)}," +
                                        $"\"{m.Name}\",{m.Parameters.Count},(Il2CppMethodPointer) {CUtils.ImplementMethodName(m, false)})");
                    index++;
                }
                CS.Writer.End();
            }

            EventWriter.EndAll();
        }