コード例 #1
0
        /// <summary>
        /// Transpiles Render to disable the actual Graphics.DrawMesh call.
        /// </summary>
        internal static TranspiledMethod Transpiler(TranspiledMethod instructions)
        {
            var drawMesh = typeof(Graphics).GetMethodSafe(nameof(Graphics.DrawMesh),
                                                          true, typeof(Mesh), typeof(Vector3), typeof(Quaternion), typeof(Material),
                                                          typeof(int), typeof(Camera), typeof(int), typeof(MaterialPropertyBlock));
            var newMethod = instructions;

            if (drawMesh != null)
            {
                newMethod = PPatchTools.RemoveMethodCall(instructions, drawMesh);
            }
            else
            {
                PUtil.LogWarning("Unable to patch FallingWater.Render");
            }
            foreach (var instr in newMethod)
            {
                yield return(instr);
            }
        }
コード例 #2
0
        internal static void Update(SolidUtilityNetworkManager instance)
        {
            /// <summary>
            /// Transpiles Update to avoid calling onNetworksRebuilt.
            /// </summary>
            TranspiledMethod Transpiler(TranspiledMethod instructions)
            {
                var remove = typeof(OnNetworksRebuilt).GetMethodSafe(nameof(OnNetworksRebuilt.
                                                                            Invoke), false, PPatchTools.AnyArguments);

                return((remove == null) ? instructions : PPatchTools.RemoveMethodCall(
                           instructions, remove));
            }

            _ = instance;
            _ = Transpiler(null);

            // Dummy code to ensure no inlining
            while (System.DateTime.Now.Ticks > 0L)
            {
                throw new NotImplementedException("Reverse patch stub");
            }
        }
コード例 #3
0
 /// <summary>
 /// Transpiles GetMostSuitableArchive to remove all debug log calls.
 /// </summary>
 internal static TranspiledMethod Transpiler(TranspiledMethod method)
 {
     return(PPatchTools.RemoveMethodCall(method, typeof(Mod).GetMethodSafe(nameof(
                                                                               Mod.ModDevLog), false, typeof(string))));
 }
コード例 #4
0
 /// <summary>
 /// Transpiles Subscribe to remove all debug log calls.
 /// </summary>
 internal static TranspiledMethod Transpiler(TranspiledMethod method)
 {
     return(PPatchTools.RemoveMethodCall(method, typeof(Debug).GetMethodSafe(nameof(
                                                                                 Debug.LogFormat), true, typeof(string), typeof(object[]))));
 }