This commit is contained in:
Fire Cube 2025-05-21 22:37:16 +02:00
parent e2513d50be
commit 0753d53767
5 changed files with 112 additions and 0 deletions

View File

@ -621,6 +621,8 @@ set(DEV_TOOLS src/core/devtools/layer.cpp
src/core/devtools/widget/imgui_memory_editor.h
src/core/devtools/widget/memory_map.cpp
src/core/devtools/widget/memory_map.h
src/core/devtools/widget/module_list.cpp
src/core/devtools/widget/module_list.h
src/core/devtools/widget/reg_popup.cpp
src/core/devtools/widget/reg_popup.h
src/core/devtools/widget/reg_view.cpp

View File

@ -18,6 +18,7 @@
#include "widget/frame_graph.h"
#include "widget/memory_map.h"
#include "widget/shader_list.h"
#include "widget/module_list.h"
extern std::unique_ptr<Vulkan::Presenter> presenter;
@ -40,6 +41,7 @@ static bool just_opened_options = false;
static Widget::MemoryMapViewer memory_map;
static Widget::ShaderList shader_list;
static Widget::ModuleList module_list;
// clang-format off
static std::string help_text =
@ -108,6 +110,9 @@ void L::DrawMenuBar() {
if (MenuItem("Memory map")) {
memory_map.open = true;
}
if (MenuItem("Module list")) {
module_list.open = true;
}
ImGui::EndMenu();
}
@ -256,6 +261,9 @@ void L::DrawAdvanced() {
if (shader_list.open) {
shader_list.Draw();
}
if (module_list.open) {
module_list.Draw();
}
}
void L::DrawSimple() {

View File

@ -0,0 +1,51 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "module_list.h"
#include <imgui.h>
#include "common.h"
#include "core/debug_state.h"
#include "imgui/imgui_std.h"
using namespace ImGui;
namespace Core::Devtools::Widget {
void ModuleList::Draw() {
{
std::scoped_lock lock(s_modules_mutex);
modules.clear();
for (const auto& entry : s_modules) {
ModuleInfo info;
info.name = entry.name;
modules.push_back(info);
}
}
SetNextWindowSize({500.0f, 600.0f}, ImGuiCond_FirstUseEver);
if (!Begin("LLE Module List", &open)) {
End();
return;
}
if (BeginTable("ModuleTable", 1,
ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Sortable |
ImGuiTableFlags_RowBg)) {
TableSetupColumn("Modulname", ImGuiTableColumnFlags_WidthStretch);
TableHeadersRow();
for (const auto& module : modules) {
TableNextRow();
TableSetColumnIndex(0);
TextUnformatted(module.name.c_str());
}
EndTable();
}
End();
}
} // namespace Core::Devtools::Widget

View File

@ -0,0 +1,47 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <string>
#include <vector>
#include <filesystem>
#include <mutex>
#include <algorithm>
namespace Core::Devtools::Widget {
class ModuleList {
public:
ModuleList() = default;
~ModuleList() = default;
void Draw();
bool open = false;
char search_box[256] = "";
static void AddModule(const std::string& name) {
if (name == "eboot.bin") {
return;
}
std::scoped_lock lock(s_modules_mutex);
s_modules.push_back({name});
}
private:
struct ModuleInfo {
std::string name;
};
struct ModuleListEntry {
std::string name;
};
static inline std::vector<ModuleListEntry> s_modules;
static inline std::mutex s_modules_mutex;
std::vector<ModuleInfo> modules;
};
} // namespace Core::Devtools::Widget

View File

@ -12,6 +12,7 @@
#include "common/thread.h"
#include "core/aerolib/aerolib.h"
#include "core/aerolib/stubs.h"
#include "core/devtools/widget/module_list.h"
#include "core/libraries/kernel/memory.h"
#include "core/libraries/kernel/threads.h"
#include "core/linker.h"
@ -147,6 +148,9 @@ s32 Linker::LoadModule(const std::filesystem::path& elf_name, bool is_dynamic) {
num_static_modules += !is_dynamic;
m_modules.emplace_back(std::move(module));
Core::Devtools::Widget::ModuleList::AddModule(elf_name.filename().string());
return m_modules.size() - 1;
}