예제 #1
0
        private void EarlyMarkNoInline()
        {
            foreach (var type in MpUtil.AllModTypes())
            {
                MpPatchExtensions.DoMpPatches(null, type)?.ForEach(m => MpUtil.MarkNoInlining(m));

                var harmonyMethods = type.GetHarmonyMethods();
                if (harmonyMethods?.Count > 0)
                {
                    var original = MpUtil.GetOriginalMethod(HarmonyMethod.Merge(harmonyMethods));
                    if (original != null)
                    {
                        MpUtil.MarkNoInlining(original);
                    }
                }
            }
        }
예제 #2
0
        public static void RegisterAllSyncMethods()
        {
            foreach (Type type in MpUtil.AllModTypes())
            {
                foreach (MethodInfo method in type.GetDeclaredMethods())
                {
                    if (!method.TryGetAttribute(out SyncMethodAttribute syncAttr))
                    {
                        continue;
                    }

                    var syncMethod = RegisterSyncMethod(method, null);
                    syncMethod.context   = syncAttr.context;
                    syncMethod.debugOnly = method.HasAttribute <SyncDebugOnlyAttribute>();
                }
            }
        }