devtools: tips popup

This commit is contained in:
Vinicius Rangel 2024-10-16 02:26:07 -03:00
parent 5d3c2eccd1
commit 8860574ef3
No known key found for this signature in database
GPG Key ID: A5B154D904B761D9
5 changed files with 43 additions and 8 deletions

View File

@ -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}"
)"

View File

@ -31,6 +31,12 @@ static float debug_popup_timing = 3.0f;
static bool just_opened_options = false; static bool just_opened_options = false;
// clang-format off
static std::string help_text =
#include "help.txt"
;
// clang-format on
void L::DrawMenuBar() { void L::DrawMenuBar() {
const auto& ctx = *GImGui; const auto& ctx = *GImGui;
const auto& io = ctx.IO; const auto& io = ctx.IO;
@ -38,6 +44,7 @@ void L::DrawMenuBar() {
auto isSystemPaused = DebugState.IsGuestThreadsPaused(); auto isSystemPaused = DebugState.IsGuestThreadsPaused();
bool open_popup_options = false; bool open_popup_options = false;
bool open_popup_help = false;
if (BeginMainMenuBar()) { if (BeginMainMenuBar()) {
if (BeginMenu("Options")) { if (BeginMenu("Options")) {
@ -60,6 +67,7 @@ void L::DrawMenuBar() {
ImGui::EndMenu(); ImGui::EndMenu();
} }
open_popup_options = MenuItem("Options"); open_popup_options = MenuItem("Options");
open_popup_help = MenuItem("Help & Tips");
ImGui::EndMenu(); ImGui::EndMenu();
} }
EndMainMenuBar(); EndMainMenuBar();
@ -84,6 +92,9 @@ void L::DrawMenuBar() {
OpenPopup("GPU Tools Options"); OpenPopup("GPU Tools Options");
just_opened_options = true; just_opened_options = true;
} }
if (open_popup_help) {
OpenPopup("HelpTips");
}
} }
void L::DrawAdvanced() { void L::DrawAdvanced() {
@ -181,6 +192,22 @@ void L::DrawAdvanced() {
} }
EndPopup(); 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() { void L::DrawSimple() {

View File

@ -150,12 +150,6 @@ void RegView::DrawGraphicsRegs() {
TableNextRow(); TableNextRow();
DrawValueRow("Primitive type", regs.primitive_type); 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 open_new_popup = [&](int cb, auto... args) {
const auto pos = GetItemRectMax() + ImVec2(5.0f, 0.0f); 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, DrawRow("Primitive restart", "%X (IDX: %X)", regs.enable_primitive_restart & 1,
regs.primitive_restart_index); regs.primitive_restart_index);
// clang-format off // clang-format off

View File

@ -245,7 +245,7 @@ void ImeDialogUi::Draw() {
window_size = {500.0f, 150.0f}; window_size = {500.0f, 150.0f};
} }
CentralizeWindow(); CentralizeNextWindow();
SetNextWindowSize(window_size); SetNextWindowSize(window_size);
SetNextWindowCollapsed(false); SetNextWindowCollapsed(false);

View File

@ -31,7 +31,7 @@ inline void CentralizeNextWindow() {
} }
inline void CentralizeWindow() { inline void CentralizeWindow() {
const auto display_size = GetIO().DisplaySize; const auto display_size = GetIO().DisplaySize - GetCurrentWindowRead()->SizeFull;
SetWindowPos(display_size / 2.0f); SetWindowPos(display_size / 2.0f);
} }