Files
ppsspp/UI/ImDebugger/ImGe.cpp

112 lines
3.1 KiB
C++

#include "ext/imgui/imgui.h"
#include "ext/imgui/imgui_impl_thin3d.h"
#include "UI/ImDebugger/ImGe.h"
#include "UI/ImDebugger/ImDebugger.h"
#include "GPU/Common/FramebufferManagerCommon.h"
#include "GPU/Common/TextureCacheCommon.h"
#include "Core/HLE/sceDisplay.h"
#include "Core/HW/Display.h"
void DrawFramebuffersWindow(ImConfig &cfg, FramebufferManagerCommon *framebufferManager) {
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Framebuffers", &cfg.framebuffersOpen)) {
ImGui::End();
return;
}
framebufferManager->DrawImGuiDebug(cfg.selectedFramebuffer);
ImGui::End();
}
void DrawTexturesWindow(ImConfig &cfg, TextureCacheCommon *textureCache) {
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Textures", &cfg.texturesOpen)) {
ImGui::End();
return;
}
textureCache->DrawImGuiDebug(cfg.selectedTexAddr);
ImGui::End();
}
void DrawDisplayWindow(ImConfig &cfg, FramebufferManagerCommon *framebufferManager) {
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Display", &cfg.displayOpen)) {
ImGui::End();
return;
}
ImGui::Checkbox("Display latched", &cfg.displayLatched);
PSPPointer<u8> topaddr;
u32 linesize;
u32 pixelFormat;
__DisplayGetFramebuf(&topaddr, &linesize, &pixelFormat, cfg.displayLatched);
VirtualFramebuffer *fb = framebufferManager->GetVFBAt(topaddr.ptr);
if (fb && fb->fbo) {
ImTextureID texId = ImGui_ImplThin3d_AddFBAsTextureTemp(fb->fbo, Draw::FB_COLOR_BIT, ImGuiPipeline::TexturedOpaque);
ImGui::Image(texId, ImVec2(fb->width, fb->height));
ImGui::Text("%s - %08x", fb->fbo->Tag(), topaddr.ptr);
} else {
// TODO: Sometimes we should display RAM here.
ImGui::Text("Framebuffer not available to display");
}
ImGui::End();
}
// Note: This is not exclusively graphics.
void DrawDebugStatsWindow(ImConfig &cfg) {
ImGui::SetNextWindowSize(ImVec2(300, 500), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Debug Stats", &cfg.debugStatsOpen)) {
ImGui::End();
return;
}
char statbuf[4096];
__DisplayGetDebugStats(statbuf, sizeof(statbuf));
ImGui::TextUnformatted(statbuf);
ImGui::End();
}
// Stub
void DrawGeDebuggerWindow(ImConfig &cfg) {
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("GE Debugger", &cfg.geDebuggerOpen)) {
ImGui::End();
return;
}
gpu->DrawImGuiDebugger();
ImGui::End();
}
// TODO: Separate window or merge into Ge debugger?
void DrawGeRegistersWindow(ImConfig &cfg) {
ImGui::SetNextWindowSize(ImVec2(300, 500), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Debug Stats", &cfg.geRegistersOpen)) {
ImGui::End();
return;
}
if (ImGui::BeginTabBar("GeRegs", ImGuiTabBarFlags_None)) {
if (ImGui::BeginTabItem("Control")) {
if (ImGui::BeginTable("fpr", 3, ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersH)) {
ImGui::TableSetupColumn("bkpt", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("name", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("value", ImGuiTableColumnFlags_WidthStretch);
ImGui::EndTable();
}
ImGui::EndTabItem();
}
ImGui::EndTabBar();
}
ImGui::End();
}