diff --git a/Core/HLE/sceKernel.h b/Core/HLE/sceKernel.h index be320275cd..1c521df73d 100644 --- a/Core/HLE/sceKernel.h +++ b/Core/HLE/sceKernel.h @@ -172,6 +172,15 @@ public: return occupied[index]; } + template + bool Is(SceUID handle) const { + int index = handle - handleOffset; + if (index < 0 || index >= maxCount) + return false; + else + return occupied[index] && pool[handle - handleOffset]->GetIDType() == T::GetStaticIDType(); + } + template T* Get(SceUID handle, u32 &outError) { if (handle < handleOffset || handle >= handleOffset+maxCount || !occupied[handle-handleOffset]) { @@ -212,7 +221,7 @@ public: continue; T *t = static_cast(pool[i]); if (t->GetIDType() == type) { - if (!func(i, t)) + if (!func(i + handleOffset, t)) break; } } diff --git a/UI/ImDebugger/ImDebugger.cpp b/UI/ImDebugger/ImDebugger.cpp index 8e61259ec0..33dffbcf34 100644 --- a/UI/ImDebugger/ImDebugger.cpp +++ b/UI/ImDebugger/ImDebugger.cpp @@ -1420,8 +1420,8 @@ static void DrawUtilityModules(ImConfig &cfg, ImControl &control) { ImGui::PushID(i); ImGui::TableNextRow(); ImGui::TableNextColumn(); - if (ImGui::Selectable(info->name, cfg.selectedModule == i, ImGuiSelectableFlags_SpanAllColumns)) { - cfg.selectedModule = i; + if (ImGui::Selectable(info->name, cfg.selectedUtilityModule == i, ImGuiSelectableFlags_SpanAllColumns)) { + cfg.selectedUtilityModule = i; } ImGui::TableNextColumn(); if (loadedAddr) { @@ -1463,8 +1463,8 @@ static void DrawModules(const MIPSDebugInterface *debug, ImConfig &cfg, ImContro ImGui::PushID(id); ImGui::TableNextRow(); ImGui::TableNextColumn(); - if (ImGui::Selectable(module->GetName(), cfg.selectedModule == id, ImGuiSelectableFlags_SpanAllColumns)) { - cfg.selectedModule = id; + if (ImGui::Selectable(module->GetName(), cfg.selectedModuleId == id, ImGuiSelectableFlags_SpanAllColumns)) { + cfg.selectedModuleId = id; } ImGui::TableNextColumn(); ImClickableValue("addr", module->memoryBlockAddr, control, ImCmd::SHOW_IN_MEMORY_VIEWER); @@ -1479,6 +1479,21 @@ static void DrawModules(const MIPSDebugInterface *debug, ImConfig &cfg, ImContro ImGui::EndTable(); } + if (kernelObjects.Is(cfg.selectedModuleId)) { + PSPModule *sel = kernelObjects.GetFast(cfg.selectedModuleId); + if (sel) { + ImGui::Text("%s %d.%d (%s)\n", sel->GetName(), sel->nm.version[1], sel->nm.version[0], sel->isFake ? "FAKE/HLE" : "normal"); + char buf[512]; + sel->GetLongInfo(buf, sizeof(buf)); + ImGui::TextUnformatted(buf); + if (ImGui::CollapsingHeader("Imports")) { + + } + if (ImGui::CollapsingHeader("Exports")) { + + } + } + } //if (cfg.selectedModule >= 0 && cfg.selectedModule < (int)modules.size()) { // TODO: Show details //} @@ -1509,8 +1524,8 @@ static void DrawSymbols(const MIPSDebugInterface *debug, ImConfig &cfg, ImContro ImGui::PushID(i); ImGui::TableNextRow(); ImGui::TableNextColumn(); - if (ImGui::Selectable(module.name.c_str(), cfg.selectedModule == i, ImGuiSelectableFlags_SpanAllColumns)) { - cfg.selectedModule = i; + if (ImGui::Selectable(module.name.c_str(), cfg.selectedSymbolModule == i, ImGuiSelectableFlags_SpanAllColumns)) { + cfg.selectedSymbolModule = i; } ImGui::TableNextColumn(); ImClickableValue("addr", module.address, control, ImCmd::SHOW_IN_MEMORY_VIEWER); @@ -1524,7 +1539,7 @@ static void DrawSymbols(const MIPSDebugInterface *debug, ImConfig &cfg, ImContro ImGui::EndTable(); } - if (cfg.selectedModule >= 0 && cfg.selectedModule < (int)modules.size()) { + if (cfg.selectedModuleId >= 0 && cfg.selectedModuleId < (int)modules.size()) { // TODO: Show details } ImGui::End(); diff --git a/UI/ImDebugger/ImDebugger.h b/UI/ImDebugger/ImDebugger.h index cbea5d9bb0..dd6f291ab6 100644 --- a/UI/ImDebugger/ImDebugger.h +++ b/UI/ImDebugger/ImDebugger.h @@ -159,7 +159,8 @@ struct ImConfig { // bool filterByUsed = true; // Various selections - int selectedModule = 0; + int selectedModuleId = 0; + int selectedSymbolModule = 0; int selectedUtilityModule = 0; int selectedThread = 0; int selectedKernelObject = 0;