diff --git a/src/core/devtools/help.txt b/src/core/devtools/help.txt new file mode 100644 index 000000000..9670c5cea --- /dev/null +++ b/src/core/devtools/help.txt @@ -0,0 +1,8 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later +R"( +* If you hold shift, you can move the window without docking it. +* You don't need to close every window you open. When a parent window is closed, all its children will be closed too. +* If you want to inspect or compare more than 1 frame dump without undocking, there's a option to keep showing opened popups even when in hide/minimize the frame dump window. +* To use the disassembly viewer, you need to set up a cli to use a external disassembler and use "{src}" as a placeholder for the source code file, e.g. dis.exe --some-opt "{src}" +)" \ No newline at end of file diff --git a/src/core/devtools/layer.cpp b/src/core/devtools/layer.cpp index 69959181c..38b17c863 100644 --- a/src/core/devtools/layer.cpp +++ b/src/core/devtools/layer.cpp @@ -31,6 +31,12 @@ static float debug_popup_timing = 3.0f; static bool just_opened_options = false; +// clang-format off +static std::string help_text = +#include "help.txt" + ; +// clang-format on + void L::DrawMenuBar() { const auto& ctx = *GImGui; const auto& io = ctx.IO; @@ -38,6 +44,7 @@ void L::DrawMenuBar() { auto isSystemPaused = DebugState.IsGuestThreadsPaused(); bool open_popup_options = false; + bool open_popup_help = false; if (BeginMainMenuBar()) { if (BeginMenu("Options")) { @@ -60,6 +67,7 @@ void L::DrawMenuBar() { ImGui::EndMenu(); } open_popup_options = MenuItem("Options"); + open_popup_help = MenuItem("Help & Tips"); ImGui::EndMenu(); } EndMainMenuBar(); @@ -84,6 +92,9 @@ void L::DrawMenuBar() { OpenPopup("GPU Tools Options"); just_opened_options = true; } + if (open_popup_help) { + OpenPopup("HelpTips"); + } } void L::DrawAdvanced() { @@ -181,6 +192,22 @@ void L::DrawAdvanced() { } EndPopup(); } + + if (BeginPopup("HelpTips", ImGuiWindowFlags_AlwaysAutoResize | + ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoMove)) { + CentralizeWindow(); + + PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2{10.0f}); + PushTextWrapPos(600.0f); + + const char* begin = help_text.data(); + TextUnformatted(begin, begin + help_text.size()); + + PopTextWrapPos(); + PopStyleVar(); + + EndPopup(); + } } void L::DrawSimple() { diff --git a/src/core/devtools/widget/reg_view.cpp b/src/core/devtools/widget/reg_view.cpp index 27892c651..10cc88085 100644 --- a/src/core/devtools/widget/reg_view.cpp +++ b/src/core/devtools/widget/reg_view.cpp @@ -150,12 +150,6 @@ void RegView::DrawGraphicsRegs() { TableNextRow(); DrawValueRow("Primitive type", regs.primitive_type); - auto& s = regs.screen_scissor; - DrawRow("Scissor", "(%d, %d, %d, %d)", s.top_left_x, s.top_left_y, s.bottom_right_x, - s.bottom_right_y); - - auto cc_mode = regs.color_control.mode.Value(); - DrawRow("Color control", "%X (%s)", cc_mode, enum_name(cc_mode).data()); const auto open_new_popup = [&](int cb, auto... args) { const auto pos = GetItemRectMax() + ImVec2(5.0f, 0.0f); @@ -211,6 +205,12 @@ void RegView::DrawGraphicsRegs() { } } + auto& s = regs.screen_scissor; + DrawRow("Scissor", "(%d, %d, %d, %d)", s.top_left_x, s.top_left_y, s.bottom_right_x, + s.bottom_right_y); + + DrawValueRow("Color control", regs.color_control.mode); + DrawRow("Primitive restart", "%X (IDX: %X)", regs.enable_primitive_restart & 1, regs.primitive_restart_index); // clang-format off diff --git a/src/core/libraries/dialogs/ime_dialog_ui.cpp b/src/core/libraries/dialogs/ime_dialog_ui.cpp index 48f5d75dc..9d50d2fbb 100644 --- a/src/core/libraries/dialogs/ime_dialog_ui.cpp +++ b/src/core/libraries/dialogs/ime_dialog_ui.cpp @@ -245,7 +245,7 @@ void ImeDialogUi::Draw() { window_size = {500.0f, 150.0f}; } - CentralizeWindow(); + CentralizeNextWindow(); SetNextWindowSize(window_size); SetNextWindowCollapsed(false); diff --git a/src/imgui/imgui_std.h b/src/imgui/imgui_std.h index 0bd77da45..cd7208064 100644 --- a/src/imgui/imgui_std.h +++ b/src/imgui/imgui_std.h @@ -31,7 +31,7 @@ inline void CentralizeNextWindow() { } inline void CentralizeWindow() { - const auto display_size = GetIO().DisplaySize; + const auto display_size = GetIO().DisplaySize - GetCurrentWindowRead()->SizeFull; SetWindowPos(display_size / 2.0f); }