ImDebugger: Add atrac context viewer

This commit is contained in:
Henrik Rydgård committed 2024-11-15 15:59:16 +01:00
1 parent 7c16e332e8
commit 2eaffcf510
5 files changed
+70 -10

No files matched your search

+54 -8
View File
@@ -17,6 +17,7 @@
#include "Common/System/Request.h"
#include "Core/HLE/sceAtrac.h"
#include "Core/HLE/AtracCtx.h"
// Threads window
#include "Core/HLE/sceKernelThread.h"
@@ -134,8 +135,17 @@ void DrawThreadView(ImConfig &cfg) {
cfg.selectedThread = i;
}
if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) {
cfg.selectedThread = i;
ImGui::OpenPopup("threadPopup");
}
ImGui::TableNextColumn();
ImGui::Text("%08x", thread.curPC);
ImGui::TableNextColumn();
ImGui::Text("%08x", thread.entrypoint);
ImGui::TableNextColumn();
ImGui::Text("%d", thread.priority);
ImGui::TableNextColumn();
ImGui::Text("%s", ThreadStatusToString(thread.status));
if (ImGui::BeginPopup("threadPopup")) {
DebugThreadInfo &thread = info[i];
ImGui::Text("Thread: %s", thread.name);
@@ -147,14 +157,6 @@ void DrawThreadView(ImConfig &cfg) {
}
ImGui::EndPopup();
}
ImGui::TableNextColumn();
ImGui::Text("%08x", thread.curPC);
ImGui::TableNextColumn();
ImGui::Text("%08x", thread.entrypoint);
ImGui::TableNextColumn();
ImGui::Text("%d", thread.priority);
ImGui::TableNextColumn();
ImGui::Text("%s", ThreadStatusToString(thread.status));
ImGui::PopID();
}
@@ -163,6 +165,45 @@ void DrawThreadView(ImConfig &cfg) {
ImGui::End();
}
void DrawAtracView(ImConfig &cfg) {
if (!ImGui::Begin("sceAtrac contexts", &cfg.atracOpen)) {
ImGui::End();
return;
}
if (ImGui::BeginTable("atracs", 5, ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersH)) {
ImGui::TableSetupColumn("Type", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("OutChans", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("CurrentSample", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("RemainingFrames", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableHeadersRow();
for (int i = 0; i < PSP_NUM_ATRAC_IDS; i++) {
u32 type = 0;
const AtracBase *atracBase = __AtracGetCtx(i, &type);
ImGui::TableNextRow();
ImGui::TableNextColumn();
if (!atracBase) {
ImGui::Text("-", type);
continue;
}
ImGui::Text("%d", type);
ImGui::TableNextColumn();
ImGui::Text("%d", atracBase->GetOutputChannels());
ImGui::TableNextColumn();
ImGui::Text("%d", atracBase->CurrentSample());
ImGui::TableNextColumn();
ImGui::Text("%d", atracBase->RemainingFrames());
}
ImGui::EndTable();
}
ImGui::End();
}
void DrawCallStacks(MIPSDebugInterface *debug, bool *open) {
if (!ImGui::Begin("Callstacks", open)) {
ImGui::End();
@@ -335,6 +376,7 @@ void ImDebugger::Frame(MIPSDebugInterface *mipsDebug) {
ImGui::Checkbox("Callstacks", &cfg_.callstackOpen);
ImGui::Checkbox("HLE Modules", &cfg_.modulesOpen);
ImGui::Checkbox("HLE Threads", &cfg_.threadsOpen);
ImGui::Checkbox("sceAtrac", &cfg_.atracOpen);
ImGui::EndMenu();
}
ImGui::EndMainMenuBar();
@@ -364,6 +406,10 @@ void ImDebugger::Frame(MIPSDebugInterface *mipsDebug) {
DrawModules(mipsDebug, cfg_);
}
if (cfg_.atracOpen) {
DrawAtracView(cfg_);
}
DrawHLEModules(cfg_);
}