From 739a32324dc683b35c3c63c2ba5a6df28fb72bad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 7 Dec 2024 16:44:48 +0100 Subject: [PATCH] Thread view: Show wait type --- Core/HLE/sceKernelThread.cpp | 1 + Core/HLE/sceKernelThread.h | 1 + UI/ImDebugger/ImDebugger.cpp | 14 ++++++++++---- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index 7a791c34e6..6c517c3159 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -3566,6 +3566,7 @@ std::vector GetThreadsInfo() { info.stackSize = (u32)t->nt.stackSize; info.priority = t->nt.currentPriority; info.waitType = (WaitType)(u32)t->nt.waitType; + info.waitID = t->nt.waitID; info.isCurrent = uid == currentThread; if (info.isCurrent) info.curPC = currentMIPS->pc; diff --git a/Core/HLE/sceKernelThread.h b/Core/HLE/sceKernelThread.h index 70c380245d..99605448a2 100644 --- a/Core/HLE/sceKernelThread.h +++ b/Core/HLE/sceKernelThread.h @@ -326,6 +326,7 @@ struct DebugThreadInfo int stackSize; int priority; WaitType waitType; + SceUID waitID; bool isCurrent; }; diff --git a/UI/ImDebugger/ImDebugger.cpp b/UI/ImDebugger/ImDebugger.cpp index 5f425ed004..ebb9c586ff 100644 --- a/UI/ImDebugger/ImDebugger.cpp +++ b/UI/ImDebugger/ImDebugger.cpp @@ -168,17 +168,18 @@ void DrawThreadView(ImConfig &cfg) { } std::vector info = GetThreadsInfo(); - if (ImGui::BeginTable("threads", 5, ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersH)) { + if (ImGui::BeginTable("threads", 6, ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersH)) { ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthFixed); ImGui::TableSetupColumn("PC", ImGuiTableColumnFlags_WidthFixed); ImGui::TableSetupColumn("Entry", ImGuiTableColumnFlags_WidthFixed); ImGui::TableSetupColumn("Priority", ImGuiTableColumnFlags_WidthFixed); - ImGui::TableSetupColumn("State", ImGuiTableColumnFlags_WidthStretch); - + ImGui::TableSetupColumn("State", ImGuiTableColumnFlags_WidthFixed); + ImGui::TableSetupColumn("Wait Type", ImGuiTableColumnFlags_WidthStretch); + // .initialStack, .stackSize, etc ImGui::TableHeadersRow(); for (int i = 0; i < (int)info.size(); i++) { - const auto &thread = info[i]; + const DebugThreadInfo &thread = info[i]; ImGui::TableNextRow(); ImGui::TableNextColumn(); ImGui::PushID(i); @@ -197,6 +198,11 @@ void DrawThreadView(ImConfig &cfg) { ImGui::Text("%d", thread.priority); ImGui::TableNextColumn(); ImGui::TextUnformatted(ThreadStatusToString(thread.status)); + ImGui::TableNextColumn(); + if (thread.waitType != WAITTYPE_NONE) { + ImGui::TextUnformatted(getWaitTypeName(thread.waitType)); + } + if (ImGui::BeginPopup("threadPopup")) { DebugThreadInfo &thread = info[i]; ImGui::Text("Thread: %s", thread.name);