From 5a0d6f7a15f9f232238e85d555c6dba30ef7086d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 8 Nov 2024 10:45:15 +0100 Subject: [PATCH] Sort the modules in the HLE module viewer --- UI/ImDebugger/ImDebugger.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/UI/ImDebugger/ImDebugger.cpp b/UI/ImDebugger/ImDebugger.cpp index a4ab7d0a72..4aaf3b8d42 100644 --- a/UI/ImDebugger/ImDebugger.cpp +++ b/UI/ImDebugger/ImDebugger.cpp @@ -1,3 +1,5 @@ +#include + #include "ext/imgui/imgui_internal.h" @@ -241,11 +243,20 @@ void DrawHLEModules(ImConfig &config) { } const int moduleCount = GetNumRegisteredModules(); + std::vector modules; + modules.reserve(moduleCount); for (int i = 0; i < moduleCount; i++) { - const HLEModule *module = GetModuleByIndex(i); - if (ImGui::TreeNode(module->name)) { - for (int j = 0; j < module->numFunctions; j++) { - auto &func = module->funcTable[j]; + modules.push_back(GetModuleByIndex(i)); + } + + std::sort(modules.begin(), modules.end(), [](const HLEModule* a, const HLEModule* b) { + return std::strcmp(a->name, b->name) < 0; + }); + + for (auto mod : modules) { + if (ImGui::TreeNode(mod->name)) { + for (int j = 0; j < mod->numFunctions; j++) { + auto &func = mod->funcTable[j]; ImGui::Text("%s(%s)", func.name, func.argmask); } ImGui::TreePop();