From 704153d7e17c5d02e4cd3111a027d7b309aaad8d Mon Sep 17 00:00:00 2001 From: fgsfds Date: Mon, 9 Oct 2023 15:49:58 +0200 Subject: [PATCH] port: debugger: add a way to list all props --- port/src/debugger.cpp | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/port/src/debugger.cpp b/port/src/debugger.cpp index 6bb4d49b2..365b88988 100644 --- a/port/src/debugger.cpp +++ b/port/src/debugger.cpp @@ -63,6 +63,7 @@ static bool expandLatch = false; static bool expandValue = false; static bool showPropInfo = false; +static bool showActiveProps = true; static void *focusPtr = nullptr; @@ -723,11 +724,13 @@ extern "C" void debuggerFrame(void) } if (g_Vars.activeprops && g_Vars.activeprops != g_Vars.activepropstail) { - if (ImGui::CollapsingHeader("Active props")) { + if (ImGui::CollapsingHeader("Props")) { ImGui::Text("Visible: %d", g_Vars.numonscreenprops); ImGui::Separator(); + ImGui::Checkbox("Active props only", &showActiveProps); + ImGui::Combo("Filter prop", &propFilter, propTypes, ARRAYCOUNT(propTypes)); ImGui::Combo("Filter obj", &objFilter, objTypes, ARRAYCOUNT(objTypes)); @@ -743,13 +746,7 @@ extern "C" void debuggerFrame(void) ImGui::Separator(); - struct prop *prop; - struct prop *next; - bool done; - prop = g_Vars.activeprops; - do { - next = prop->next; - done = next == g_Vars.pausedprops; + auto showProp = [&](struct prop *prop) { if (prop && (!propFilter || propFilter == prop->type)) { if (!objFilter || (prop->obj && prop->obj->type == objFilter)) { const bool focus = (focusPtr && ((void *)prop == focusPtr || (void *)prop->obj == focusPtr)); @@ -768,8 +765,27 @@ extern "C" void debuggerFrame(void) } } } - prop = next; - } while (!done); + }; + + if (showActiveProps) { + // show the active props list + struct prop *prop; + struct prop *next; + bool done; + prop = g_Vars.activeprops; + do { + next = prop->next; + done = next == g_Vars.pausedprops; + showProp(prop); + prop = next; + } while (!done); + } else { + // show all props + for (s32 i = 0; i < g_Vars.maxprops; ++i) { + struct prop *prop = &g_Vars.props[i]; + showProp(prop); + } + } } }