Beispiel #1
0
            public static void DrawUnPatches(Rect right)
            {
                var rListing = new Listing_Standard();

                rListing.Begin(right);

                DubGUI.CenterText(() => rListing.Label("UnProfilePatchMethod".Translate()));
                rListing.GapLine(6);
                DubGUI.OptionalBox(rListing.GetRect(Text.LineHeight + 3), "input.unpatchmethod".Translate(), () => unPatchType          = UnPatchType.Method, unPatchType == UnPatchType.Method);
                DubGUI.OptionalBox(rListing.GetRect(Text.LineHeight + 3), "input.unpatchmethodsonmethod".Translate(), () => unPatchType = UnPatchType.MethodsOnMethod, unPatchType == UnPatchType.MethodsOnMethod);
                DubGUI.OptionalBox(rListing.GetRect(Text.LineHeight + 3), "input.unpatchtype".Translate(), () => unPatchType            = UnPatchType.Type, unPatchType == UnPatchType.Type);
                DubGUI.OptionalBox(rListing.GetRect(Text.LineHeight + 3), "input.unpatchinternalmethod".Translate(), () => unPatchType  = UnPatchType.InternalMethod, unPatchType == UnPatchType.InternalMethod);
                DubGUI.OptionalBox(rListing.GetRect(Text.LineHeight + 3), "input.unpatchall".Translate(), () => unPatchType             = UnPatchType.All, unPatchType == UnPatchType.All);
                rListing.curY += 2;

                DisplayUnPatchInputField(rListing);
                rListing.curY += 2;
                if (Widgets.ButtonText(rListing.GetRect(Text.LineHeight + 3), "unpatch".Translate()))
                {
                    if (currentInput != null || unPatchType == UnPatchType.All)
                    {
                        ExecuteUnPatch();
                    }
                }

                rListing.End();
            }
Beispiel #2
0
        public static void DrawOptions(Listing_Standard listing)
        {
            var left  = listing.GetRect(Text.LineHeight * 11); // the average height of this is ~226, which is 10.2 * Text.LineHeight
            var right = left.RightPart(0.48f);

            left = left.LeftPart(0.48f);

            PatchOptions.DrawPatches(left);
            PatchOptions.DrawUnPatches(right);

            DubGUI.CenterText(() => listing.Label("Utilites"));
        }
Beispiel #3
0
                public static void DrawSearchBar(Rect rect)
                {
                    rect.height = Text.LineHeight * 6;

                    var baseRect = rect.AtZero();

                    baseRect.y     += Text.LineHeight;
                    baseRect.height = yHeigthCache;

                    Widgets.BeginScrollView(rect, ref searchpos, baseRect, false);
                    GUI.BeginGroup(baseRect);
                    listing.Begin(baseRect);

                    float yHeight = 0;

                    Text.Anchor = TextAnchor.MiddleLeft;
                    Text.Font   = GameFont.Tiny;

                    var count = 0;

                    foreach (var entry in cachedEntries)
                    {
                        count++;
                        if (count == 50)
                        {
                            break;
                        }

                        var r = listing.GetRect(Text.LineHeight);

                        if (Widgets.ButtonInvisible(r))
                        {
                            currentInput = entry;
                        }

                        Widgets.DrawBoxSolid(r, Analyzer.Settings.GraphCol);

                        r.width = 2000;
                        Widgets.Label(r, " " + entry);
                        listing.GapLine(0f);
                        yHeight += 4f;
                        yHeight += r.height;
                    }

                    listing.End();
                    yHeigthCache = yHeight;
                    GUI.EndGroup();

                    DubGUI.ResetFont();
                    Widgets.EndScrollView();
                }
        /* For Dev Tools */

        public void DrawDevOptions()
        {
            listing.Label("settings.developer.heading".Translate());
            DubGUI.Checkbox("SidePanel".Translate(), listing, ref SidePanel);
            DubGUI.Checkbox("TickPawnTog".Translate(), listing, ref H_PawnTick.TickPawns);
            DubGUI.Checkbox("DevMode".Translate(), listing, ref DevMode);
            if (DevMode)
            {
                DubGUI.InputField(listing.GetRect(Text.LineHeight), "Path to Dnspy.exe (including the exe)", ref PathToDnspy, ShowName: true);
            }

            listing.GapLine();

            Dialog_DeveloperSettings.DrawOptions(listing);
        }
Beispiel #5
0
            public static void DisplayUnPatchInputField(Listing_Standard listing)
            {
                string FieldDescription = null;

                switch (unPatchType)
                {
                case UnPatchType.Method: FieldDescription = "Type:Method"; break;

                case UnPatchType.MethodsOnMethod: FieldDescription = "Type:Method"; break;

                case UnPatchType.Type: FieldDescription = "Type"; break;

                case UnPatchType.InternalMethod: FieldDescription = "Type:Method"; break;

                case UnPatchType.All: FieldDescription = "N/A"; break;
                }

                Rect inputBox = listing.GetRect(Text.LineHeight);

                DubGUI.InputField(inputBox, FieldDescription, ref currentUnPatch, ShowName: true);
            }
Beispiel #6
0
            public static void DisplayInputField(Listing_Standard listing)
            {
                string FieldDescription = null;

                switch (input)
                {
                case CurrentInput.Method: FieldDescription = "Type:Method"; break;

                case CurrentInput.Type: FieldDescription = "Type"; break;

                case CurrentInput.MethodHarmony: FieldDescription = "Type:Method"; break;

                case CurrentInput.TypeHarmony: FieldDescription = "Type"; break;

                case CurrentInput.InternalMethod: FieldDescription = "Type:Method"; break;

                case CurrentInput.Assembly: FieldDescription = "Mod or PackageId"; break;
                }

                Rect inputBox = listing.GetRect(Text.LineHeight);

                DubGUI.InputField(inputBox, FieldDescription, ref currentInput, ShowName: true);
                //SearchBar.PopulateSearch(inputBox, currentInput, input);
            }
Beispiel #7
0
            public static void DrawPatches(Rect left)
            {
                var lListing = new Listing_Standard();

                lListing.Begin(left);

                DubGUI.CenterText(() => lListing.Label("ProfilePatchMethod".Translate()));

                lListing.GapLine(6);
                DubGUI.OptionalBox(lListing.GetRect(Text.LineHeight + 3), "input.method".Translate(), () => input         = CurrentInput.Method, input == CurrentInput.Method);
                DubGUI.OptionalBox(lListing.GetRect(Text.LineHeight + 3), "input.type".Translate(), () => input           = CurrentInput.Type, input == CurrentInput.Type);
                DubGUI.OptionalBox(lListing.GetRect(Text.LineHeight + 3), "input.methodharmony".Translate(), () => input  = CurrentInput.MethodHarmony, input == CurrentInput.MethodHarmony);
                DubGUI.OptionalBox(lListing.GetRect(Text.LineHeight + 3), "input.typeharmony".Translate(), () => input    = CurrentInput.TypeHarmony, input == CurrentInput.TypeHarmony);
                DubGUI.OptionalBox(lListing.GetRect(Text.LineHeight + 3), "input.methodinternal".Translate(), () => input = CurrentInput.InternalMethod, input == CurrentInput.InternalMethod);
                DubGUI.OptionalBox(lListing.GetRect(Text.LineHeight + 3), "input.assembly".Translate(), () => input       = CurrentInput.Assembly, input == CurrentInput.Assembly);
                lListing.curY += 2;

                DisplayInputField(lListing);
                lListing.curY += 2;

                var box = lListing.GetRect(Text.LineHeight + 3);

                DubGUI.OptionalBox(box.LeftPart(.3f), "patch.type.tick".Translate(), () => patchType = UpdateMode.Tick, patchType == UpdateMode.Tick);
                box = box.RightPart(.65f);
                DubGUI.OptionalBox(box.LeftPart(.4f), "patch.type.update".Translate(), () => patchType = UpdateMode.Update, patchType == UpdateMode.Update);

                if (Widgets.ButtonText(box.RightPart(.5f), "patch".Translate()))
                {
                    if (currentInput != null)
                    {
                        ExecutePatch();
                    }
                }

                lListing.End();
            }
Beispiel #8
0
        private void DoThingTab(Rect rect)
        {
            if (!Analyzer.SelectedMode.IsPatched)
            {
                Text.Font   = GameFont.Medium;
                Text.Anchor = TextAnchor.MiddleCenter;
                Widgets.Label(rect, $"Loading{GenText.MarchingEllipsis(0f)}");
                Text.Font   = GameFont.Small;
                Text.Anchor = TextAnchor.UpperLeft;
                return;
            }

            var  topslot = rect.TopPartPixels(20f);
            Rect rowby   = topslot.LeftPartPixels(25f);

            if (Widgets.ButtonImage(rowby, TexButton.SpeedButtonTextures[Analyzer.running ? 0 : 1]))
            {
                Analyzer.running = !Analyzer.running;
            }

            TooltipHandler.TipRegion(rowby, "Start and stop logging");
            bool save = false;

            if (Analyzer.Settings.AdvancedMode)
            {
                Rect searchbox = topslot.LeftPartPixels(topslot.width - 300f);
                searchbox.x += 25f;
                DubGUI.InputField(searchbox, "Search", ref TimesFilter, DubGUI.MintSearch);
                rowby.x     = searchbox.xMax;
                rowby.width = 175f;
                if (Widgets.ButtonTextSubtle(rowby, stlank, Mathf.Clamp01(Mathf.InverseLerp(H_RootUpdate.LastMinGC, H_RootUpdate.LastMaxGC, totalBytesOfMemoryUsed)), 5))
                {
                    totalBytesOfMemoryUsed = GC.GetTotalMemory(true);
                }
                TooltipHandler.TipRegion(rowby, "Approximation of total bytes currently allocated in managed memory + rate of new allocation\n\nClick to force GC");

                rowby.x     = rowby.xMax;
                rowby.width = 100f;
                save        = Widgets.ButtonTextSubtle(rowby, "Save .CSV");
                TooltipHandler.TipRegion(rowby, $"Save the current list of times to a csv file in {GenFilePaths.FolderUnderSaveData("Profiling")}");
            }
            else
            {
                Rect searchbox = topslot.RightPartPixels(topslot.width - 25f);
                DubGUI.InputField(searchbox, "Search", ref TimesFilter, DubGUI.MintSearch);
            }

            rowby.x     = rowby.xMax;
            rowby.width = 25f;


            rect.y      += 25f;
            rect.height -= 25f;

            var innyrek = rect.AtZero();

            innyrek.width -= 16f;
            innyrek.height = groaner;

            GizmoListRect    = rect.AtZero();
            GizmoListRect.y += scrolpos.y;
            Widgets.BeginScrollView(rect, ref scrolpos, innyrek);

            GUI.BeginGroup(innyrek);

            listing.Begin(innyrek);

            float goat = 0;

            //List<ProfileLog> logs = null;

            //if (Analyzer.SortBy == "First")
            //{
            //    logs = Analyzer.Logs.ToList();
            //}
            //else if (Analyzer.SortBy == "A-Z")
            //{
            //    logs = Analyzer.Logs.ToList().OrderBy(x => x.Key).ToList();
            //}
            //else if (Analyzer.SortBy == "Usage")
            //{
            //    logs = Analyzer.Logs.ToList().OrderByDescending(x => x.Average).ToList();
            //}

            Text.Anchor = TextAnchor.MiddleLeft;
            Text.Font   = GameFont.Tiny;

            lock (Analyzer.sync)
            {
                foreach (var log in Analyzer.Logs)
                {
                    if (!log.Label.Has(TimesFilter))
                    {
                        continue;
                    }

                    var r = listing.GetRect(40f);

                    if (r.Overlaps(GizmoListRect))
                    {
                        var profile = Analyzer.Profiles[log.Key];

                        if (Input.GetKey(KeyCode.LeftControl))
                        {
                            if (Widgets.ButtonInvisible(r))
                            {
                                Analyzer.SelectedMode.Clicked?.Invoke(null, new object[] { profile, log });
                                Analyzer.Settings.Write();
                            }
                        }

                        bool on = true;

                        if (Analyzer.SelectedMode.Selected != null)
                        {
                            on = (bool)Analyzer.SelectedMode.Selected.Invoke(null, new object[] { profile, log });
                        }

                        if (Analyzer.SelectedMode.Checkbox != null)
                        {
                            var r2 = new Rect(r.x, r.y, 25f, r.height);
                            r.x += 25f;
                            if (DubGUI.Checkbox(r2, "", ref on))
                            {
                                Analyzer.SelectedMode.Checkbox?.Invoke(null, new object[] { profile, log });
                                Analyzer.Settings.Write();
                            }
                        }

                        Widgets.DrawHighlightIfMouseover(r);

                        if (Widgets.ButtonInvisible(r))
                        {
                            Dialog_Graph.RunKey(log.Key);
                        }

                        if (Dialog_Graph.key == log.Key)
                        {
                            Widgets.DrawHighlightSelected(r);
                        }


                        var col = grey;
                        if (log.Percent > 0.25f)
                        {
                            col = blue;
                        }

                        if (log.Percent > 0.75f)
                        {
                            col = red;
                        }


                        Widgets.FillableBar(r.BottomPartPixels(8f), log.Percent, col, clear, false);

                        r = r.LeftPartPixels(50);

                        if (!on)
                        {
                            GUI.color = Color.grey;
                        }

                        Widgets.Label(r, log.Average_s);

                        if (Analyzer.Settings.AdvancedMode)
                        {
                            r.x = r.xMax;

                            Widgets.Label(r, profile.memRiseStr);
                        }

                        r.x     = r.xMax;
                        r.width = 2000;
                        Widgets.Label(r, log.Label);

                        GUI.color = Color.white;

                        if (save)
                        {
                            csv.Append($"{log.Label},{log.Average},{profile.BytesUsed}");
                            foreach (var historyTime in profile.History.times)
                            {
                                csv.Append($",{historyTime}");
                            }
                            csv.AppendLine();
                        }
                    }
                    listing.GapLine(0f);
                    goat += 4f;
                    goat += r.height;
                }
            }

            if (save)
            {
                var path = GenFilePaths.FolderUnderSaveData("Profiling") + $"/{Analyzer.SelectedMode.name}_{DateTime.Now.ToFileTime()}.csv";
                File.WriteAllText(path, csv.ToString());
                csv.Clear();
                Messages.Message($"Saved to {path}", MessageTypeDefOf.TaskCompletion, false);
            }

            listing.End();
            groaner = goat;
            GUI.EndGroup();

            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.UpperLeft;
            Widgets.EndScrollView();
        }
Beispiel #9
0
        public override void DoWindowContents(Rect canvas)
        {
            if (Event.current.type == EventType.Layout)
            {
                return;
            }

            //  canvas.y += 35;
            //   canvas.height -= 35f;

            // Widgets.DrawMenuSection(canvas);

            // TabDrawer.DrawTabs(canvas, MainTabs, 150f);

            var ListerBox = canvas.LeftPart(0.30f);

            ListerBox.width -= 10f;
            Widgets.DrawMenuSection(ListerBox);
            ListerBox = ListerBox.ContractedBy(4f);
            var innyrek = ListerBox.AtZero();

            innyrek.width -= 16f;
            innyrek.height = moaner;
            var goat = 0f;

            Text.Anchor = TextAnchor.MiddleLeft;
            Text.Font   = GameFont.Tiny;
            Widgets.BeginScrollView(ListerBox, ref scrolpostabs, innyrek);
            GUI.BeginGroup(innyrek);
            listing.Begin(innyrek);
            // var row = listing.getr

            foreach (var maintab in MainTabs)
            {
                Text.Font   = GameFont.Small;
                Text.Anchor = TextAnchor.UpperLeft;
                goat       += 40f;
                var row = listing.GetRect(30f);
                if (maintab.Selected)
                {
                    Widgets.DrawOptionSelected(row);
                }
                if (Widgets.ButtonInvisible(row))
                {
                    maintab.clickedAction();
                }
                row.x += 5f;
                Widgets.Label(row, maintab.label);

                TooltipHandler.TipRegion(row, maintab.Tip);

                Text.Anchor = TextAnchor.MiddleLeft;
                Text.Font   = GameFont.Tiny;

                foreach (var mode in maintab.Modes)
                {
                    if (!mode.Key.Basics && !Analyzer.Settings.AdvancedMode)
                    {
                        continue;
                    }
                    row = listing.GetRect(30f);
                    Widgets.DrawHighlightIfMouseover(row);
                    if (Analyzer.SelectedMode == mode.Key)
                    {
                        Widgets.DrawOptionSelected(row);
                    }
                    row.x += 20f;
                    goat  += 30f;
                    Widgets.Label(row, mode.Key.name);
                    if (Widgets.ButtonInvisible(row))
                    {
                        if (ShowSettings)
                        {
                            ShowSettings = false;
                            Analyzer.Settings.Write();
                        }
                        if (Analyzer.SelectedMode != null)
                        {
                            AccessTools.Field(Analyzer.SelectedMode.typeRef, "Active").SetValue(null, false);
                        }
                        AccessTools.Field(mode.Value, "Active").SetValue(null, true);
                        Analyzer.SelectedMode = mode.Key;
                        Analyzer.Reset();

                        if (!mode.Key.IsPatched)
                        {
                            mode.Key.ProfilePatch();
                        }
                    }
                    TooltipHandler.TipRegion(row, mode.Key.tip);

                    if (Analyzer.SelectedMode == mode.Key)
                    {
                        var doo = 0;
                        foreach (var keySetting in mode.Key.Settings)
                        {
                            if (keySetting.Key.FieldType == typeof(bool))
                            {
                                row       = listing.GetRect(30f);
                                row.x    += 20f;
                                GUI.color = Widgets.OptionSelectedBGBorderColor;
                                Widgets.DrawLineVertical(row.x, row.y, 15f);
                                if (doo != 0)
                                {
                                    Widgets.DrawLineVertical(row.x, row.y - 15f, 15f);
                                }
                                row.x += 10f;
                                Widgets.DrawLineHorizontal(row.x - 10f, row.y + 15f, 10f);
                                GUI.color = Color.white;
                                goat     += 30f;
                                bool cur = (bool)keySetting.Key.GetValue(null);
                                if (DubGUI.Checkbox(row, keySetting.Value.name, ref cur))
                                {
                                    keySetting.Key.SetValue(null, cur);
                                    Analyzer.Reset();
                                }
                            }
                            if (keySetting.Key.FieldType == typeof(float) || keySetting.Key.FieldType == typeof(int))
                            {
                            }

                            doo++;
                        }
                    }
                }
            }

            listing.End();
            moaner = goat;
            GUI.EndGroup();

            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.UpperLeft;
            Widgets.EndScrollView();


            var inner = canvas.RightPart(0.70f).Rounded();

            if (ShowSettings)
            {
                Analyzer.Settings.DoSettings(inner);
            }
            else
            {
                try
                {
                    if (PatchedEverything)
                    {
                        if (Dialog_Graph.key != string.Empty)
                        {
                            Rect blurg = inner.TopPart(0.75f).Rounded();
                            Widgets.DrawMenuSection(blurg);
                            blurg = blurg.ContractedBy(6f);
                            DoThingTab(blurg);
                            blurg = inner.BottomPart(0.25f).Rounded();
                            //blurg = blurg.BottomPartPixels(inner.height - 10f);
                            Dialog_Graph.DoGraph(blurg);
                        }
                        else
                        {
                            Widgets.DrawMenuSection(inner);
                            DoThingTab(inner.ContractedBy(6f));
                        }
                    }
                    else
                    {
                        Widgets.DrawMenuSection(inner);
                        Text.Font   = GameFont.Medium;
                        Text.Anchor = TextAnchor.MiddleCenter;
                        Widgets.Label(inner, $"Loading{GenText.MarchingEllipsis(0f)}");
                        Text.Font   = GameFont.Small;
                        Text.Anchor = TextAnchor.UpperLeft;
                    }
                }
                catch (Exception e)
                {
                    // Console.WriteLine(e);
                    //  throw;
                }
            }
        }
        public void DrawPerformanceOptions()
        {
            listing.Label("settings.performance.heading".Translate());


            DubGUI.Checkbox("TempSpeedup".Translate(), listing, ref Analyzer.Settings.FixGame);
            //   DubGUI.Checkbox("Fix memory leak on beds and room stats", listing, ref Analyzer.Settings.FixBedMemLeak);
            DubGUI.Checkbox("RoofOptimize".Translate(), listing, ref OverrideBuildRoof);

            if (DubGUI.Checkbox("RepairOptimize".Translate(), listing, ref FixRepair))
            {
                if (Current.ProgramState == ProgramState.Playing)
                {
                    foreach (var gameMap in Current.Game.Maps)
                    {
                        foreach (var k in gameMap.listerBuildingsRepairable.repairables.Keys)
                        {
                            var bs = gameMap.listerBuildingsRepairable.repairables[k];
                            foreach (var b in bs.ToList())
                            {
                                if (!b.def.building.repairable || !b.def.useHitPoints)
                                {
                                    gameMap.listerBuildingsRepairable.repairables[k].Remove(b);
                                }
                            }
                        }

                        foreach (var k in gameMap.listerBuildingsRepairable.repairablesSet.Keys)
                        {
                            var bs = gameMap.listerBuildingsRepairable.repairables[k];
                            foreach (var b in bs.ToList())
                            {
                                if (!b.def.building.repairable || !b.def.useHitPoints)
                                {
                                    gameMap.listerBuildingsRepairable.repairables[k].Remove(b);
                                }
                            }
                        }
                    }
                }
            }
            DubGUI.Checkbox("SnowOptimize".Translate(), listing, ref SnowOptimize);
            DubGUI.Checkbox("OptimizeDrills".Translate(), listing, ref OptimizeDrills);
            DubGUI.Checkbox("OptimizeAlerts".Translate(), listing, ref OptimizeAlerts);
            DubGUI.Checkbox("JobGiverOptimise".Translate(), listing, ref OptimiseJobGiverOptimise);

            DubGUI.Checkbox("GizmoOpti".Translate(), listing, ref OptimizeDrawInspectGizmoGrid);
            var jam = Analyzer.Settings.MeshOnlyBuildings;

            DubGUI.Checkbox("RealtimeCondu".Translate(), listing, ref MeshOnlyBuildings);
            if (jam != Analyzer.Settings.MeshOnlyBuildings)
            {
                H_FixWallsNConduits.Swapclasses();
            }
            DubGUI.Checkbox("DamageJobRecheck".Translate(), listing, ref NeverCheckJobsOnDamage);

            listing.GapLine();
            listing.Label("settings.performance.destructiveheading".Translate());
            DubGUI.Checkbox("OverrideAlerts".Translate(), listing, ref OverrideAlerts);
            DubGUI.Checkbox("KillMusicMan".Translate(), listing, ref KillMusicMan);
            DubGUI.Checkbox("DisableAlerts".Translate(), listing, ref DisableAlerts);
            listing.GapLine();
            listing.Label("settings.experimental.header".Translate());
            DubGUI.Checkbox("DynamicSpeedControl".Translate(), listing, ref DynamicSpeedControl);
            listing.GapLine();
            listing.Label("settings.performance.generalheading".Translate());
            DubGUI.Checkbox("FactionRemovalMode".Translate(), listing, ref FactionRemovalMode);
            DubGUI.Checkbox("ShowAnalBut".Translate(), listing, ref ShowOnMainTab);
            //   DubGUI.Checkbox("Mute GC messages", listing, ref Analyzer.Settings.MuteGC);
            if (DubGUI.Checkbox("UnlockFramerate".Translate(), listing, ref UnlockFramerate))
            {
                if (UnlockFramerate)
                {
                    QualitySettings.vSyncCount  = 0;
                    Application.targetFrameRate = -1;
                }
                else
                {
                    QualitySettings.vSyncCount  = 1;
                    Application.targetFrameRate = 60;
                }
            }

            DubGUI.Checkbox("AdvProfMode".Translate(), listing, ref AdvancedMode);

            //  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();
            //}
        }
        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();
        }