mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 08:22:32 +00:00
devtools: tips popup
This commit is contained in:
parent
5d3c2eccd1
commit
8860574ef3
8
src/core/devtools/help.txt
Normal file
8
src/core/devtools/help.txt
Normal 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}"
|
||||
)"
|
@ -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() {
|
||||
|
@ -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
|
||||
|
@ -245,7 +245,7 @@ void ImeDialogUi::Draw() {
|
||||
window_size = {500.0f, 150.0f};
|
||||
}
|
||||
|
||||
CentralizeWindow();
|
||||
CentralizeNextWindow();
|
||||
SetNextWindowSize(window_size);
|
||||
SetNextWindowCollapsed(false);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user