Ejemplo n.º 1
0
        public static void Init()
        {
            CurrentMenu.Text  = "Main Menu";
            CurrentMenu.Items = new List <DbgMenuItem>()
            {
                //new DbgMenuItem()
                //{
                //    Text = "<-- TESTING -->",
                //    Items = new List<DbgMenuItem>
                //    {
                //        new DbgMenuItem()
                //        {
                //            Text = "Write TextureFetchRequest.DEBUG_AllKnownDS1Formats to Console",
                //            ClickAction = () =>
                //            {
                //                foreach (var f in TextureFetchRequest.DEBUG_AllKnownDS1Formats)
                //                {
                //                    Console.WriteLine(f.ToString());
                //                }
                //            }
                //        }
                //    }
                //},
                new DbgMenuItemSceneList(isModelGroupingKind: false)
                {
                    Text = "Scene Parts"
                },
                new DbgMenuItemSceneList(isModelGroupingKind: true)
                {
                    Text = "Scene Models"
                },
                new DbgMenuItem()
                {
                    Text        = "Click to remove all debug primitives",
                    ClickAction = (m) => DBG.ClearPrimitives()
                },
                new DbgMenuItem()
                {
                    Text  = "Game Data",
                    Items = new List <DbgMenuItem>
                    {
                        new DbgMenuItemTextLabel(() => $"Data Root: \"{InterrootLoader.Interroot}\"\n     [Click to Browse...]")
                        {
                            ClickAction = (m) =>
                            {
                                InterrootLoader.Browse();
                                CurrentMenu.RequestTextRefresh();
                            }
                        },
                        new DbgMenuItemEnum <InterrootLoader.InterrootType>("Game Type",
                                                                            v =>
                        {
                            InterrootLoader.Type = v;
                            CFG.Save();
                        },
                                                                            () => InterrootLoader.Type,
                                                                            nameOverrides: new Dictionary <InterrootLoader.InterrootType, string>
                        {
                            { InterrootLoader.InterrootType.InterrootBloodborne, "Bloodborne" },
                            { InterrootLoader.InterrootType.InterrootDS1, "Dark Souls" },
                            { InterrootLoader.InterrootType.InterrootDS1R, "Dark Souls Remastered" },
                            // { InterrootLoader.InterrootType.InterrootDS2, "Dark Souls II" },
                            { InterrootLoader.InterrootType.InterrootDS3, "Dark Souls III" },
                        }
                                                                            ),
                        new DbgMenuItem()
                        {
                            Text        = "Refresh Spawn Lists",
                            ClickAction = m =>
                            {
                                DbgMenuItemSpawnChr.UpdateSpawnIDs();
                                DbgMenuItemSpawnObj.UpdateSpawnIDs();
                                DbgMenuItemSpawnMap.UpdateSpawnIDs();
                            }
                        },
                        new DbgMenuItemTaskKiller()
                        {
                            Text = "[LOAD TASK KILLER]"
                        },
                        new DbgMenuItem()
                        {
                            Text        = "Scan All Separate Texture Files (DS1 Only)",
                            ClickAction = (m) =>
                            {
                                TexturePool.AddAllExternalDS1TexturesInBackground();
                            }
                        },
                        new DbgMenuItem()
                        {
                            Text        = "Purge Texture Cache",
                            ClickAction = (m) =>
                            {
                                TexturePool.Flush();
                            }
                        },
                        new DbgMenuItem()
                        {
                            Text        = "[CLICK TO CLEAR SCENE MODELS]",
                            ClickAction = (m) => GFX.ModelDrawer.ClearScene()
                        },
                        new DbgMenuItem()
                        {
                            Text        = "[CLICK TO CLEAR SCENE REGIONS]",
                            ClickAction = (m) => DBG.ClearPrimitives()
                        },
                        new DbgMenuItemSpawnChr()
                        {
                            CustomColorFunction = () => Color.Cyan
                        },
                        new DbgMenuItemSpawnObj()
                        {
                            CustomColorFunction = () => Color.Cyan
                        },
                        new DbgMenuItemSpawnMap(isRegionSpawner: false),
                        new DbgMenuItemSpawnMap(isRegionSpawner: true)
                        {
                            CustomColorFunction = () => Color.Cyan
                        },
                        new DbgMenuItem()
                        {
                            Text                = "Load All Characters Lineup",
                            ClickAction         = (m) => GFX.ModelDrawer.TestAddAllChr(),
                            CustomColorFunction = () => LoadingTaskMan.IsTaskRunning($"{nameof(GFX.ModelDrawer.TestAddAllChr)}") ? Color.Cyan * 0.5f : Color.Cyan
                        },
                        new DbgMenuItem()
                        {
                            Text                = "Load All Objects Lineup",
                            ClickAction         = (m) => GFX.ModelDrawer.TestAddAllObj(),
                            CustomColorFunction = () => LoadingTaskMan.IsTaskRunning($"{nameof(GFX.ModelDrawer.TestAddAllObj)}") ? Color.Cyan * 0.5f : Color.Cyan
                        },
                    }
                },
                //new DbgMenuItem()
                //{
                //    Text = "[DIAGNOSTICS]",
                //    Items = new List<DbgMenuItem>
                //    {
                //        new DbgMenuItem()
                //        {
                //            Text = $"Log {nameof(InterrootLoader)}.{nameof(InterrootLoader.DDS_INFO)}",
                //            ClickAction = () =>
                //            {
                //                foreach (var x in InterrootLoader.DDS_INFO)
                //                {
                //                    Console.WriteLine($"{x.Name} - {x.DDSFormat}");
                //                }
                //            }
                //        }
                //    }
                //},
                new DbgMenuItem()
                {
                    Text  = "General Options",
                    Items = new List <DbgMenuItem>
                    {
                        new DbgMenuItemGfxFlverShaderAdjust(),
                        //new DbgMenuItemGfxBlendStateAdjust(),
                        //new DbgMenuItemGfxDepthStencilStateAdjust(),
                        new DbgMenuItemEnum <LODMode>("LOD Mode", v => GFX.LODMode = v, () => GFX.LODMode,
                                                      nameOverrides: new Dictionary <LODMode, string>
                        {
                            { LODMode.ForceFullRes, "Force Full Resolution" },
                            { LODMode.ForceLOD1, "Force LOD Level 1" },
                            { LODMode.ForceLOD2, "Force LOD Level 2" },
                        }),
                        new DbgMenuItemNumber("LOD1 Distance", 0, 10000, 1,
                                              (f) => GFX.LOD1Distance = f, () => GFX.LOD1Distance),
                        new DbgMenuItemNumber("LOD2 Distance", 0, 10000, 1,
                                              (f) => GFX.LOD2Distance = f, () => GFX.LOD2Distance),
                        new DbgMenuItemBool("Show Map Region Names", "YES", "NO",
                                            (b) => DBG.ShowPrimitiveNametags = b, () => DBG.ShowPrimitiveNametags),
                        new DbgMenuItemBool("Show Model Names", "YES", "NO",
                                            (b) => DBG.ShowModelNames = b, () => DBG.ShowModelNames),
                        new DbgMenuItemBool("Show Model Bounding Boxes", "YES", "NO",
                                            (b) => DBG.ShowModelBoundingBoxes = b, () => DBG.ShowModelBoundingBoxes),
                        new DbgMenuItemBool("Show Model Submesh Bounding Boxes", "YES", "NO",
                                            (b) => DBG.ShowModelSubmeshBoundingBoxes = b, () => DBG.ShowModelSubmeshBoundingBoxes),
                        new DbgMenuItemBool("Show Grid", "YES", "NO",
                                            (b) => DBG.ShowGrid = b, () => DBG.ShowGrid),
                        new DbgMenuItemBool("Textures", "ON", "OFF",
                                            (b) => GFX.EnableTextures = b, () => GFX.EnableTextures),
                        new DbgMenuItemBool("Wireframe Mode", "ON", "OFF",
                                            (b) => GFX.Wireframe = b, () => GFX.Wireframe),
                        new DbgMenuItemBool("View Frustum Culling (Experimental)", "ON", "OFF",
                                            (b) => GFX.EnableFrustumCulling = b, () => GFX.EnableFrustumCulling),
                        new DbgMenuItemNumber("Vertical Field of View (Degrees)", 20, 150, 1,
                                              (f) => GFX.World.FieldOfView = f, () => GFX.World.FieldOfView,
                                              (f) => $"{((int)(Math.Round(f)))}"),
                        new DbgMenuItemNumber("Camera Turn Speed (Gamepad)", 0.01f, 10f, 0.01f,
                                              (f) => GFX.World.CameraTurnSpeedGamepad = f, () => GFX.World.CameraTurnSpeedGamepad),
                        new DbgMenuItemNumber("Camera Turn Speed (Mouse)", 0.001f, 10f, 0.001f,
                                              (f) => GFX.World.CameraTurnSpeedMouse = f, () => GFX.World.CameraTurnSpeedMouse),
                        new DbgMenuItemNumber("Camera Move Speed", 0.1f, 100f, 0.1f,
                                              (f) => GFX.World.CameraMoveSpeed = f, () => GFX.World.CameraMoveSpeed),
                        new DbgMenuItemNumber("Near Clip Distance", 0.0001f, 5, 0.0001f,
                                              (f) => GFX.World.NearClipDistance = f, () => GFX.World.NearClipDistance),
                        new DbgMenuItemNumber("Far Clip Distance", 100, 1000000, 100,
                                              (f) => GFX.World.FarClipDistance = f, () => GFX.World.FarClipDistance),
                    }
                },
                new DbgMenuItem()
                {
                    Text  = "Graphics Options",
                    Items = new List <DbgMenuItem>
                    {
                        new DbgMenuItemResolutionChange(),
                        new DbgMenuItemBool("Fullscreen", "YES", "NO", v => GFX.Display.Fullscreen  = v, () => GFX.Display.Fullscreen),
                        new DbgMenuItemBool("Vsync", "ON", "OFF", v => GFX.Display.Vsync            = v, () => GFX.Display.Vsync),
                        new DbgMenuItemBool("Simple MSAA", "ON", "OFF", v => GFX.Display.SimpleMSAA = v, () => GFX.Display.SimpleMSAA),
                        new DbgMenuItem()
                        {
                            Text        = "Apply Changes",
                            ClickAction = (m) => GFX.Display.Apply(),
                        }
                    }
                },
                new DbgMenuItem()
                {
                    Text        = "Return Camera to Origin",
                    ClickAction = m => GFX.World.ResetCameraLocation()
                },
                new DbgMenuItem()
                {
                    Text  = "Help",
                    Items = new List <DbgMenuItem>
                    {
                        new DbgMenuItem()
                        {
                            Text  = "Menu Overlay Controls (Gamepad)",
                            Items = new List <DbgMenuItem>
                            {
                                new DbgMenuItem()
                                {
                                    Text = "Back: Toggle Menu (Active/Visible/Hidden)"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "D-Pad Up/Down: Move Cursor Up/Down"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "A: Enter/Activate (when applicable)"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "B: Go Back (when applicable)"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "D-Pad Left/Right: Decrease/Increase"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "Start: Reset Value to Default"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "Hold LB: Increase/Decrease 10x Faster"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "Hold X: Increase/Decrease 100x Faster"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "Hold RB + Move LS: Move Menu"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "Hold RB + Move RS: Resize Menu"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "Hold LB + Move or Resize Menu: Move or Resize Menu Faster"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "Click RS: Toggle 3D Render Pause"
                                },
                            }
                        },
                        new DbgMenuItem()
                        {
                            Text  = "General 3D Controls (Gamepad)",
                            Items = new List <DbgMenuItem>
                            {
                                new DbgMenuItem()
                                {
                                    Text = "LS: Move Camera Laterally"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "LT: Move Camera Directly Downward"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "RT: Move Camera Directly Upward"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "RS: Turn Camera"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "Hold LB: Move Camera More Slowly"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "Hold RB: Move Camera More Quickly"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "Click LS and Hold: Turn Light With RS Instead of Camera"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "Click RS: Reset Camera To Origin"
                                },
                            }
                        },
                        new DbgMenuItem()
                        {
                            Text  = "Menu Overlay Controls (Mouse & Keyboard)",
                            Items = new List <DbgMenuItem>
                            {
                                new DbgMenuItem()
                                {
                                    Text = "Tilde (~): Toggle Menu (Active/Visible/Hidden)"
                                },

                                new DbgMenuItem()
                                {
                                    Text = "Move Mouse Cursor: Move Cursor"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "Hold Spacebar + Scroll Mouse Wheel: Change Values"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "Mouse Wheel: Scroll Menu"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "Enter/Left Click: Enter/Activate (when applicable)"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "Backspace/Right Click: Go Back (when applicable)"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "Up/Down: Move Cursor Up/Down"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "Left/Right: Decrease/Increase"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "Home/Middle Click: Reset Value to Default"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "Hold Shift: Increase/Decrease 10x Faster"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "Hold Ctrl: Increase/Decrease 100x Faster"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "Pause Key: Toggle 3D Render Pause"
                                },
                            }
                        },
                        new DbgMenuItem()
                        {
                            Text  = "General 3D Controls (Mouse & Keyboard)",
                            Items = new List <DbgMenuItem>
                            {
                                new DbgMenuItem()
                                {
                                    Text = "WASD: Move Camera Laterally"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "Q: Move Camera Directly Downward"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "E: Move Camera Directly Upward"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "Right Click + Move Mouse: Turn Camera"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "Hold Shift: Move Camera More Slowly"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "Hold Ctrl: Move Camera More Quickly"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "Hold Spacebar: Turn Light With Mouse Instead of Camera"
                                },
                                new DbgMenuItem()
                                {
                                    Text = "R: Reset Camera To Origin"
                                },
                            }
                        },
                    }
                },
                new DbgMenuItem()
                {
                    Text  = "Exit",
                    Items = new List <DbgMenuItem>
                    {
                        new DbgMenuItem()
                        {
                            Text = "Are you sure you want to exit?"
                        },
                        new DbgMenuItem()
                        {
                            Text        = "No",
                            ClickAction = (m) => REQUEST_GO_BACK = true
                        },
                        new DbgMenuItem()
                        {
                            Text        = "Yes",
                            ClickAction = (m) => Main.REQUEST_EXIT = true
                        }
                    }
                },
            };
        }