Beispiel #1
0
            public static void ExecutePatch()
            {
                switch (input)
                {
                case CurrentInput.Method:
                    if (patchType == UpdateMode.Tick)
                    {
                        CustomProfilersTick.PatchMeth(currentInput);
                        AnalyzerState.SwapTab("Custom Tick", UpdateMode.Tick);
                    }
                    else
                    {
                        CustomProfilersUpdate.PatchMeth(currentInput);
                        AnalyzerState.SwapTab("Custom Update", UpdateMode.Update);
                    }
                    return;

                case CurrentInput.Type:
                    CustomProfilersUpdate.PatchType(currentInput);
                    AnalyzerState.SwapTab("Custom Update", UpdateMode.Update);
                    return;

                case CurrentInput.MethodHarmony:
                    CustomProfilersHarmony.PatchMeth(currentInput);
                    AnalyzerState.SwapTab("Custom Harmony", UpdateMode.Update);
                    return;

                case CurrentInput.TypeHarmony:
                    CustomProfilersHarmony.PatchType(currentInput);
                    AnalyzerState.SwapTab("Custom Harmony", UpdateMode.Update);
                    return;

                case CurrentInput.InternalMethod:
                    PatchUtils.PatchInternalMethod(currentInput);
                    return;

                case CurrentInput.Assembly:
                    PatchUtils.PatchAssembly(currentInput, false);
                    return;
                }
            }
        public void DoSettings(Rect canvas)
        {
            listing.Begin(canvas.ContractedBy(10f));

            var rec = listing.GetRect(24f);

            Widgets.DrawTextureFitted(rec.LeftPartPixels(40f), Gfx.Support, 1f);
            if (Widgets.ButtonText(rec.RightPartPixels(rec.width - 40), "Performance Analyzer Wiki", false, true))
            {
                Application.OpenURL("https://github.com/Dubwise56/Dubs-Performance-Analyzer/wiki");
            }

            rec = listing.GetRect(24f);
            Widgets.DrawTextureFitted(rec.LeftPartPixels(40f), Gfx.disco, 1f);
            if (Widgets.ButtonText(rec.RightPartPixels(rec.width - 40), "Dubs Mods Discord", false, true))
            {
                Application.OpenURL("https://discord.gg/Az5CnDW");
            }

            listing.GapLine();
            listing.Label("Optimizations and fixes");
            DubGUI.Checkbox("Speed up temperature stats (Fixes lots of stutters)", listing,
                            ref Analyzer.Settings.FixGame);
            //   DubGUI.Checkbox("Fix memory leak on beds and room stats", listing, ref Analyzer.Settings.FixBedMemLeak);
            DubGUI.Checkbox("Optimize build roof job scanner", listing, ref Analyzer.Settings.OverrideBuildRoof);
            DubGUI.Checkbox("Override alerts (ctrl click analyzed alerts to kill them)", listing,
                            ref Analyzer.Settings.OverrideAlerts);
            DubGUI.Checkbox("Optimize DrawInspectGizmoGrid (Buttons when selecting things)", listing,
                            ref Analyzer.Settings.OptimizeDrawInspectGizmoGrid);
            var jam = Analyzer.Settings.MeshOnlyBuildings;

            DubGUI.Checkbox("Disable realtime drawing on walls and conduit", listing,
                            ref Analyzer.Settings.MeshOnlyBuildings);
            if (jam != Analyzer.Settings.MeshOnlyBuildings)
            {
                H_FixWallsNConduits.Swapclasses();
            }
            // dirk("Never check jobs on take damage", ref Analyzer.Settings.NeverCheckJobsOnDamage);

            DubGUI.Checkbox("Disable music manager", listing, ref Analyzer.Settings.KillMusicMan);
            //  dirk("Replace bill ingredient finder (Testing only)", ref Analyzer.Settings.ReplaceIngredientFinder);
            //var dan = Analyzer.Settings.HumanoidOnlyWarden;
            //dirk("Replace warden jobs to only scan Humanoids (Testing only)", ref Analyzer.Settings.HumanoidOnlyWarden);
            //if (dan != Analyzer.Settings.HumanoidOnlyWarden)
            //{
            //    H_WardenRequest.Swapclasses();
            //}
            listing.GapLine();
            DubGUI.Checkbox("Show analyzer button on main tabs", listing, ref Analyzer.Settings.ShowOnMainTab);
            //   DubGUI.Checkbox("Mute GC messages", listing, ref Analyzer.Settings.MuteGC);
            DubGUI.Checkbox("Advanced mode (More data)", listing, ref Analyzer.Settings.AdvancedMode);
            DubGUI.Checkbox("Tick Pawns", listing, ref H_PawnTick.TickPawns);
            listing.GapLine();
            if (Analyzer.Settings.AdvancedMode)
            {
                listing.Label("Profile a method e.g. ResourceReadout:ResourceReadoutOnGUI");
                var r = listing.GetRect(25f);
                DubGUI.InputField(r, "Type:Method", ref methToPatch, ShowName: true);
                r = listing.GetRect(25f).LeftPartPixels(150);
                if (Widgets.RadioButtonLabeled(r, "Custom Tick", customPatchMode == UpdateMode.Tick))
                {
                    customPatchMode = UpdateMode.Tick;
                }
                r = listing.GetRect(25f).LeftPartPixels(150);
                if (Widgets.RadioButtonLabeled(r, "Custom Update", customPatchMode == UpdateMode.Update))
                {
                    customPatchMode = UpdateMode.Update;
                }
                var b = listing.GetRect(25);
                if (Widgets.ButtonText(b.LeftPartPixels(100), "Try patch"))
                {
                    if (customPatchMode == UpdateMode.Tick)
                    {
                        CustomProfilersTick.PatchMeth(methToPatch);
                    }
                    else
                    {
                        CustomProfilersUpdate.PatchMeth(methToPatch);
                    }
                }
            }


            listing.End();
        }