Process debug imgui

This commit is contained in:
PJB3005
2026-02-28 19:39:52 +01:00
parent 7215ed5c1c
commit a23721bc7d
5 changed files with 942 additions and 793 deletions
+2
View File
@@ -1329,6 +1329,8 @@ set(DUSK_FILES
src/dusk/J3DTransforms_C.cpp
#src/dusk/m_Do_ext_dusk.cpp
src/dusk/dvd_emu.cpp
src/dusk/imgui/imgui.hpp
src/dusk/imgui/processes.cpp
src/dolphin/os/OSContext.cpp
src/dolphin/os/OSThread.cpp
src/dolphin/os/OSMutex.cpp
+819 -793
View File
File diff suppressed because it is too large Load Diff
+5
View File
@@ -1,4 +1,5 @@
#include "dusk/imgui.h"
#include "imgui/imgui.hpp"
#include <array>
#include <atomic>
@@ -72,6 +73,8 @@ static std::string BytesToString(size_t bytes)
return fmt::format(FMT_STRING("{:.1f}{}"), count, suffixes[s]);
}
static void ShowProcesses();
void imgui_main(const AuroraInfo *info)
{
@@ -164,6 +167,8 @@ void imgui_main(const AuroraInfo *info)
}
}
ImGui::End();
DuskImguiProcesses();
}
class Limiter
+6
View File
@@ -0,0 +1,6 @@
#ifndef DUSK_IMGUI_HPP
#define DUSK_IMGUI_HPP
void DuskImguiProcesses();
#endif // DUSK_IMGUI_HPP
+110
View File
@@ -0,0 +1,110 @@
#define PROCS_DUMP_NAMES 1
#include <cstdio>
#include "d/d_procname.h"
#include "f_pc/f_pc_create_iter.h"
#include "f_pc/f_pc_create_req.h"
#include "f_pc/f_pc_layer.h"
#include "f_pc/f_pc_layer_iter.h"
#include "f_pc/f_pc_leaf.h"
#include "f_pc/f_pc_node.h"
#include "imgui.h"
#include "imgui.hpp"
#include "imgui_internal.h"
static const char* getProcName(s16 id) {
for (auto procName : procNames) {
if (procName.id == id) {
return procName.name;
}
}
return nullptr;
}
bool showTreeRecursive;
static int ShowProcess(void* p, void*) {
auto proc = static_cast<base_process_class*>(p);
char buf[64];
snprintf(buf, sizeof(buf), "%d", proc->id);
ImVec2 avail = ImGui::GetContentRegionAvail();
ImVec2 vec = {avail.x, 0};
if (ImGui::BeginChild(buf, vec, ImGuiChildFlags_Border | ImGuiChildFlags_AutoResizeY)) {
ImGui::Text("[%d] %s", proc->id, getProcName(proc->profname));
ImGui::Text("init_state: %d, create_phase: %d", proc->state.init_state, proc->state.create_phase);
const char* ofTypeName = "unknown";
if (proc->subtype == g_fpcNd_type) {
ofTypeName = "Node";
} else if (proc->subtype == g_fpcLf_type) {
ofTypeName = "Leaf";
}
ImGui::Text("OfType: %d (%s), layer: %d", proc->subtype, ofTypeName, proc->layer_tag.layer->layer_id);
if (proc->create_req != nullptr) {
ImGui::TextColored(ImVec4(1.0f, 0.0f, 0.0f, 1.0f), "Pending create request");
}
if (showTreeRecursive) {
if (fpcBs_Is_JustOfType(g_fpcNd_type, proc->subtype)) {
auto procNode = static_cast<process_node_class*>(p);
ImGui::Text("Owns layer %d", procNode->layer.layer_id);
fpcLyIt_OnlyHere(&procNode->layer, ShowProcess, nullptr);
}
}
}
ImGui::EndChild();
return 1;
}
static int ShowCreateRequest(void* p, void*) {
create_request* req = (create_request*)p;
if (req->process != nullptr) {
ShowProcess(req->process, nullptr);
}
return 1;
}
void DuskImguiProcesses() {
if (ImGui::Begin("Processes")) {
if (ImGui::BeginTabBar("Tabs")) {
showTreeRecursive = true;
if (ImGui::BeginTabItem("Tree")) {
fpcLyIt_OnlyHere(fpcLy_RootLayer(), ShowProcess, nullptr);
ImGui::EndTabItem();
}
showTreeRecursive = false;
if (ImGui::BeginTabItem("All layers")) {
fpcLyIt_All(ShowProcess, nullptr);
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Creation queue")) {
fpcCtIt_Method(ShowCreateRequest, nullptr);
ImGui::EndTabItem();
}
ImGui::EndTabBar();
}
}
ImGui::End();
/*
bool open = true;
ImGui::ShowDemoWindow(&open);
*/
}