Scaffold it

This commit is contained in:
Henrik Rydgård committed 2025-10-08 13:00:35 -06:00
1 parent 4e82535f9c
commit aba2813ea2
8 files changed
+148

No files matched your search

+2
View File
@@ -1539,6 +1539,8 @@ list(APPEND NativeAppSource
UI/ImDebugger/ImMemView.h
UI/ImDebugger/ImStructViewer.cpp
UI/ImDebugger/ImStructViewer.h
UI/ImDebugger/ImJitViewer.cpp
UI/ImDebugger/ImJitViewer.h
UI/DiscordIntegration.cpp
UI/NativeApp.cpp
UI/BackgroundAudio.h
+2
View File
@@ -5,6 +5,8 @@
#include "ext/imgui/imgui.h"
struct ImConfig;
// Adapted from the ImGui demo.
class ImConsole {
public:
+5
View File
@@ -2395,6 +2395,7 @@ void ImDebugger::Frame(MIPSDebugInterface *mipsDebug, GPUDebugInterface *gpuDebu
ImGui::MenuItem("Callstacks", nullptr, &cfg_.callstackOpen);
ImGui::MenuItem("Breakpoints", nullptr, &cfg_.breakpointsOpen);
ImGui::MenuItem("Watch", nullptr, &cfg_.watchOpen);
ImGui::MenuItem("JIT viewer", nullptr, &cfg_.jitViewerOpen);
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Symbols")) {
@@ -2621,6 +2622,10 @@ void ImDebugger::Frame(MIPSDebugInterface *mipsDebug, GPUDebugInterface *gpuDebu
logWindow_.Draw(cfg_);
}
if (cfg_.jitViewerOpen) {
jitViewer_.Draw(cfg_, control);
}
if (cfg_.displayOpen) {
DrawDisplayWindow(cfg_, gpuDebug->GetFramebufferManagerCommon());
}
+3
View File
@@ -20,6 +20,7 @@
#include "UI/ImDebugger/ImDisasmView.h"
#include "UI/ImDebugger/ImMemView.h"
#include "UI/ImDebugger/ImStructViewer.h"
#include "UI/ImDebugger/ImJitViewer.h"
#include "UI/ImDebugger/ImGe.h"
#include "UI/ImDebugger/ImConsole.h"
@@ -90,6 +91,7 @@ struct ImConfig {
bool luaConsoleOpen;
bool audioOutOpen;
bool paramSFOOpen;
bool jitViewerOpen;
// HLE explorer settings
// bool filterByUsed = true;
@@ -216,6 +218,7 @@ private:
ImAtracToolWindow atracToolWindow_;
ImConsole luaConsole_;
ImLogWindow logWindow_;
ImJitViewerWindow jitViewer_;
ImSnapshotState newSnapshot_;
ImSnapshotState snapshot_;
+110
View File
@@ -0,0 +1,110 @@
#include "ppsspp_config.h"
#include "UI/ImDebugger/ImJitViewer.h"
#include "UI/ImDebugger/ImDebugger.h"
#include "Core/Config.h"
#include "Core/MIPS/JitCommon/JitBlockCache.h"
#include "Core/MIPS/JitCommon/JitCommon.h"
#include "Core/MIPS/JitCommon/JitState.h"
void ImJitViewerWindow::Draw(ImConfig &cfg, ImControl &control) {
ImGui::SetNextWindowSize(ImVec2(500, 400), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("JitViewer", &cfg.jitViewerOpen)) {
ImGui::End();
return;
}
const CPUCore core = (CPUCore)g_Config.iCpuCore;
if (core == CPUCore::INTERPRETER) {
ImGui::TextUnformatted("JIT Viewer is only available with JIT or IR-based CPU cores.");
ImGui::End();
return;
}
// Options menu
if (ImGui::BeginPopup("Options")) {
// ImGui::Checkbox("Auto-scroll", &AutoScroll);
ImGui::EndPopup();
}
#if PPSSPP_ARCH(X64)
const char *TARGET = "X86-64";
#elif PPSSPP_ARCH(X86)
const char *TARGET = "X86";
#elif PPSSPP_ARCH(ARM64)
const char *TARGET = "ARM64";
#elif PPSSPP_ARCH(ARM32)
const char *TARGET = "ARM32";
#else
cosnt char *TARGET = "TARGET";
#endif
// Three or four columns: One table for blocks that can be sorted in various ways,
// then the remaining are either MIPS/IR/TARGET or MIPS/TARGET or MIPS/IR depending on the JIT type.
int numColumns = 3;
if (core == CPUCore::JIT_IR) {
numColumns = 4;
}
if (ImGui::BeginTable("columns", 3, ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersH | ImGuiTableFlags_Resizable)) {
ImGui::TableSetupColumn("Blocks");
ImGui::TableSetupColumn("MIPS");
if (core == CPUCore::JIT_IR || core == CPUCore::IR_INTERPRETER) {
ImGui::TableSetupColumn("IR");
}
if (core == CPUCore::JIT_IR || core == CPUCore::JIT) {
ImGui::TableSetupColumn(TARGET);
}
ImGui::TableHeadersRow();
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::Text("Blocklist");
JitBlockCacheDebugInterface *blockCacheDebug = MIPSComp::jit->GetBlockCacheDebugInterface();
int64_t sumTotalNanos = 0;
int64_t sumExecutions = 0;
bool profiling = blockCacheDebug->SupportsProfiling();
for (int i = 0; i < blockCacheDebug->GetNumBlocks(); i++) {
if (!blockCacheDebug->IsValidBlock(i)) {
continue;
}
JitBlockMeta meta = blockCacheDebug->GetBlockMeta(i);
ImGui::Text("%08x %d", meta.addr, meta.sizeInBytes);
}
ImGui::TableNextColumn();
ImGui::Text("MIPS");
if (core == CPUCore::JIT_IR || core == CPUCore::IR_INTERPRETER) {
ImGui::TableNextColumn();
ImGui::Text("IR");
}
if (core == CPUCore::JIT_IR || core == CPUCore::JIT) {
ImGui::TableNextColumn();
ImGui::Text("Target asm");
}
/*
if (ImGui::BeginTable("blocks", 1, ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersH | ImGuiTableFlags_ScrollY)) {
for (auto &block : blocks) {
char label[64];
snprintf(label, sizeof(label), "0x%08X", block.startAddress);
if (ImGui::Selectable(label, false, ImGuiSelectableFlags_SpanAllColumns)) {
", 3)
*/
ImGui::EndTable();
}
ImGui::End();
}
+18
View File
@@ -0,0 +1,18 @@
#pragma once
#include <cstdint>
#include <vector>
#include "ext/imgui/imgui.h"
#include "Core/Debugger/DebugInterface.h"
struct ImConfig;
struct ImControl;
class ImJitViewerWindow {
public:
void Draw(ImConfig &cfg, ImControl &control);
const char *Title() const {
return "JIT Viewer";
}
};
+2
View File
@@ -49,6 +49,7 @@
<ClCompile Include="ImDebugger\ImDebugger.cpp" />
<ClCompile Include="ImDebugger\ImDisasmView.cpp" />
<ClCompile Include="ImDebugger\ImGe.cpp" />
<ClCompile Include="ImDebugger\ImJitViewer.cpp" />
<ClCompile Include="ImDebugger\ImMemView.cpp" />
<ClCompile Include="ImDebugger\ImStructViewer.cpp" />
<ClCompile Include="JitCompareScreen.cpp" />
@@ -99,6 +100,7 @@
<ClInclude Include="ImDebugger\ImDebugger.h" />
<ClInclude Include="ImDebugger\ImDisasmView.h" />
<ClInclude Include="ImDebugger\ImGe.h" />
<ClInclude Include="ImDebugger\ImJitViewer.h" />
<ClInclude Include="ImDebugger\ImMemView.h" />
<ClInclude Include="ImDebugger\ImStructViewer.h" />
<ClInclude Include="JitCompareScreen.h" />
+6
View File
@@ -126,6 +126,9 @@
<ClCompile Include="SystemInfoScreen.cpp">
<Filter>Screens</Filter>
</ClCompile>
<ClCompile Include="ImDebugger\ImJitViewer.cpp">
<Filter>ImDebugger</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="GameInfoCache.h" />
@@ -252,6 +255,9 @@
<ClInclude Include="SystemInfoScreen.h">
<Filter>Screens</Filter>
</ClInclude>
<ClInclude Include="ImDebugger\ImJitViewer.h">
<Filter>ImDebugger</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="Screens">