mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-19 21:40:43 +00:00
Kernel Explorer implemented
This commit is contained in:
parent
d53327f8bb
commit
d3e9e1296c
@ -26,7 +26,7 @@ enum IDType
|
||||
TYPE_LWCOND,
|
||||
TYPE_EVENT_FLAG,
|
||||
|
||||
// Generic
|
||||
// Any other objects
|
||||
TYPE_OTHER,
|
||||
};
|
||||
|
||||
@ -104,7 +104,7 @@ class IdManager
|
||||
static const u32 s_max_id = -1;
|
||||
|
||||
std::unordered_map<u32, ID> m_id_map;
|
||||
std::set<IDType> m_types[TYPE_OTHER];
|
||||
std::set<u32> m_types[TYPE_OTHER];
|
||||
std::mutex m_mtx_main;
|
||||
|
||||
u32 m_cur_id;
|
||||
@ -179,12 +179,13 @@ public:
|
||||
|
||||
bool HasID(const s64 id)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mtx_main);
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mtx_main);
|
||||
|
||||
if(id == rID_ANY) {
|
||||
return m_id_map.begin() != m_id_map.end();
|
||||
if(id == rID_ANY) {
|
||||
return m_id_map.begin() != m_id_map.end();
|
||||
}
|
||||
}
|
||||
|
||||
return CheckID(id);
|
||||
}
|
||||
|
||||
|
167
rpcs3/Gui/KernelExplorer.cpp
Normal file
167
rpcs3/Gui/KernelExplorer.cpp
Normal file
@ -0,0 +1,167 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
|
||||
#include "KernelExplorer.h"
|
||||
|
||||
KernelExplorer::KernelExplorer(wxWindow* parent)
|
||||
: wxFrame(parent, wxID_ANY, "Kernel Explorer", wxDefaultPosition, wxSize(700, 450))
|
||||
{
|
||||
this->SetBackgroundColour(wxColour(240,240,240)); //This fix the ugly background color under Windows
|
||||
wxBoxSizer* s_panel = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
// Buttons
|
||||
wxBoxSizer* box_buttons = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxButton* b_refresh = new wxButton(this, wxID_ANY, "Refresh");
|
||||
box_buttons->AddSpacer(10);
|
||||
box_buttons->Add(b_refresh);
|
||||
box_buttons->AddSpacer(10);
|
||||
|
||||
wxStaticBoxSizer* box_tree = new wxStaticBoxSizer(wxHORIZONTAL, this, "Kernel");
|
||||
m_tree = new wxTreeCtrl(this, wxID_ANY, wxDefaultPosition, wxSize(600,300));
|
||||
box_tree->Add(m_tree);
|
||||
|
||||
// Merge and display everything
|
||||
s_panel->AddSpacer(10);
|
||||
s_panel->Add(box_buttons);
|
||||
s_panel->AddSpacer(10);
|
||||
s_panel->Add(box_tree, 0, 0, 100);
|
||||
s_panel->AddSpacer(10);
|
||||
SetSizerAndFit(s_panel);
|
||||
|
||||
// Events
|
||||
b_refresh->Bind(wxEVT_BUTTON, &KernelExplorer::OnRefresh, this);
|
||||
|
||||
// Fill the wxTreeCtrl
|
||||
Update();
|
||||
};
|
||||
|
||||
void KernelExplorer::Update()
|
||||
{
|
||||
int count;
|
||||
char name[4096];
|
||||
|
||||
m_tree->DeleteAllItems();
|
||||
auto& root = m_tree->AddRoot("Process, ID = 0x00000001, Total Memory Usage = 0x0C8A9000 (200.7 MB)");
|
||||
|
||||
// TODO: PPU Threads
|
||||
// TODO: SPU/RawSPU Threads
|
||||
// TODO: FileSystem
|
||||
|
||||
// Semaphores
|
||||
count = Emu.GetIdManager().GetTypeCount(TYPE_SEMAPHORE);
|
||||
if (count) {
|
||||
sprintf(name, "Semaphores (%d)", count);
|
||||
auto& node = m_tree->AppendItem(root, name);
|
||||
auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_SEMAPHORE);
|
||||
for (const auto& id : objects) {
|
||||
sprintf(name, "Semaphore: ID = 0x%08x", id);
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
}
|
||||
|
||||
// Mutexes
|
||||
count = Emu.GetIdManager().GetTypeCount(TYPE_MUTEX);
|
||||
if (count) {
|
||||
sprintf(name, "Mutexes (%d)", count);
|
||||
auto& node = m_tree->AppendItem(root, name);
|
||||
auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_MUTEX);
|
||||
for (const auto& id : objects) {
|
||||
sprintf(name, "Mutex: ID = 0x%08x", id);
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
}
|
||||
|
||||
// Light Weight Mutexes
|
||||
count = Emu.GetIdManager().GetTypeCount(TYPE_LWMUTEX);
|
||||
if (count) {
|
||||
sprintf(name, "Light Weight Mutexes (%d)", count);
|
||||
auto& node = m_tree->AppendItem(root, name);
|
||||
auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_LWMUTEX);
|
||||
for (const auto& id : objects) {
|
||||
sprintf(name, "LW Mutex: ID = 0x%08x", id);
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
}
|
||||
|
||||
// Condition Variables
|
||||
count = Emu.GetIdManager().GetTypeCount(TYPE_COND);
|
||||
if (count) {
|
||||
sprintf(name, "Condition Variables (%d)", count);
|
||||
auto& node = m_tree->AppendItem(root, name);
|
||||
auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_COND);
|
||||
for (const auto& id : objects) {
|
||||
sprintf(name, "Condition Variable: ID = 0x%08x", id);
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
}
|
||||
|
||||
// Light Weight Condition Variables
|
||||
count = Emu.GetIdManager().GetTypeCount(TYPE_LWCOND);
|
||||
if (count) {
|
||||
sprintf(name, "Light Weight Condition Variables (%d)", count);
|
||||
auto& node = m_tree->AppendItem(root, name);
|
||||
auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_LWCOND);
|
||||
for (const auto& id : objects) {
|
||||
sprintf(name, "LW Condition Variable: ID = 0x%08x", id);
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
}
|
||||
|
||||
// Event Queues
|
||||
count = Emu.GetIdManager().GetTypeCount(TYPE_EVENT_QUEUE);
|
||||
if (count) {
|
||||
sprintf(name, "Event Queues (%d)", count);
|
||||
auto& node = m_tree->AppendItem(root, name);
|
||||
auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_EVENT_QUEUE);
|
||||
for (const auto& id : objects) {
|
||||
sprintf(name, "Event Queue: ID = 0x%08x", id);
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
}
|
||||
|
||||
// Modules
|
||||
count = Emu.GetIdManager().GetTypeCount(TYPE_PRX);
|
||||
if (count) {
|
||||
sprintf(name, "Modules (%d)", count);
|
||||
auto& node = m_tree->AppendItem(root, name);
|
||||
auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_PRX);
|
||||
sprintf(name, "Segment List (%d)", 2 * objects.size()); // TODO: Assuming 2 segments per PRX file is not good
|
||||
m_tree->AppendItem(node, name);
|
||||
for (const auto& id : objects) {
|
||||
sprintf(name, "PRX: ID = 0x%08x", id);
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
}
|
||||
|
||||
// Memory Containers
|
||||
count = Emu.GetIdManager().GetTypeCount(TYPE_MEM);
|
||||
if (count) {
|
||||
sprintf(name, "Memory Containers (%d)", count);
|
||||
auto& node = m_tree->AppendItem(root, name);
|
||||
auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_MEM);
|
||||
for (const auto& id : objects) {
|
||||
sprintf(name, "Memory Container: ID = 0x%08x", id);
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
}
|
||||
// Event Flags
|
||||
count = Emu.GetIdManager().GetTypeCount(TYPE_EVENT_FLAG);
|
||||
if (count) {
|
||||
sprintf(name, "Event Flags (%d)", count);
|
||||
auto& node = m_tree->AppendItem(root, name);
|
||||
auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_EVENT_FLAG);
|
||||
for (const auto& id : objects) {
|
||||
sprintf(name, "Event Flag: ID = 0x%08x", id);
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
}
|
||||
|
||||
m_tree->Expand(root);
|
||||
}
|
||||
|
||||
void KernelExplorer::OnRefresh(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Update();
|
||||
}
|
15
rpcs3/Gui/KernelExplorer.h
Normal file
15
rpcs3/Gui/KernelExplorer.h
Normal file
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <wx/listctrl.h>
|
||||
#include <wx/treectrl.h>
|
||||
|
||||
class KernelExplorer : public wxFrame
|
||||
{
|
||||
wxTreeCtrl* m_tree;
|
||||
|
||||
public:
|
||||
KernelExplorer(wxWindow* parent);
|
||||
void Update();
|
||||
|
||||
void OnRefresh(wxCommandEvent& WXUNUSED(event));
|
||||
};
|
@ -4,20 +4,22 @@
|
||||
#include "Emu/System.h"
|
||||
#include "rpcs3.h"
|
||||
#include "MainFrame.h"
|
||||
#include "CompilerELF.h"
|
||||
#include "MemoryViewer.h"
|
||||
#include "RSXDebugger.h"
|
||||
#include "PADManager.h"
|
||||
|
||||
#include "git-version.h"
|
||||
#include "Ini.h"
|
||||
#include "Emu/RSX/sysutil_video.h"
|
||||
#include "Gui/PADManager.h"
|
||||
#include "Gui/VHDDManager.h"
|
||||
#include "Gui/VFSManager.h"
|
||||
#include "Gui/AboutDialog.h"
|
||||
#include "Gui/GameViewer.h"
|
||||
#include "Gui/CompilerELF.h"
|
||||
#include "Gui/AutoPauseManager.h"
|
||||
#include "Gui/SaveDataUtility.h"
|
||||
#include "Gui/KernelExplorer.h"
|
||||
#include "Gui/MemoryViewer.h"
|
||||
#include "Gui/RSXDebugger.h"
|
||||
|
||||
#include <wx/dynlib.h>
|
||||
|
||||
#include "Loader/PKG.h"
|
||||
@ -42,6 +44,7 @@ enum IDs
|
||||
id_config_autopause_manager,
|
||||
id_config_savedata_manager,
|
||||
id_tools_compiler,
|
||||
id_tools_kernel_explorer,
|
||||
id_tools_memory_viewer,
|
||||
id_tools_rsx_debugger,
|
||||
id_help_about,
|
||||
@ -98,6 +101,7 @@ MainFrame::MainFrame()
|
||||
wxMenu* menu_tools = new wxMenu();
|
||||
menubar->Append(menu_tools, "Tools");
|
||||
menu_tools->Append(id_tools_compiler, "ELF Compiler");
|
||||
menu_tools->Append(id_tools_kernel_explorer, "Kernel Explorer")->Enable(false);
|
||||
menu_tools->Append(id_tools_memory_viewer, "Memory Viewer")->Enable(false);
|
||||
menu_tools->Append(id_tools_rsx_debugger, "RSX Debugger")->Enable(false);
|
||||
|
||||
@ -134,6 +138,7 @@ MainFrame::MainFrame()
|
||||
Bind(wxEVT_MENU, &MainFrame::ConfigSaveData, this, id_config_savedata_manager);
|
||||
|
||||
Bind(wxEVT_MENU, &MainFrame::OpenELFCompiler, this, id_tools_compiler);
|
||||
Bind(wxEVT_MENU, &MainFrame::OpenKernelExplorer, this, id_tools_kernel_explorer);
|
||||
Bind(wxEVT_MENU, &MainFrame::OpenMemoryViewer, this, id_tools_memory_viewer);
|
||||
Bind(wxEVT_MENU, &MainFrame::OpenRSXDebugger, this, id_tools_rsx_debugger);
|
||||
|
||||
@ -635,6 +640,11 @@ void MainFrame::OpenELFCompiler(wxCommandEvent& WXUNUSED(event))
|
||||
(new CompilerELF(this)) -> Show();
|
||||
}
|
||||
|
||||
void MainFrame::OpenKernelExplorer(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
(new KernelExplorer(this)) -> Show();
|
||||
}
|
||||
|
||||
void MainFrame::OpenMemoryViewer(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
(new MemoryViewerPanel(this)) -> Show();
|
||||
@ -732,8 +742,10 @@ void MainFrame::UpdateUI(wxCommandEvent& event)
|
||||
send_exit.Enable(enable_commands);
|
||||
|
||||
// Tools
|
||||
wxMenuItem& memory_viewer = *menubar.FindItem( id_tools_memory_viewer );
|
||||
wxMenuItem& rsx_debugger = *menubar.FindItem( id_tools_rsx_debugger);
|
||||
wxMenuItem& kernel_explorer = *menubar.FindItem(id_tools_kernel_explorer);
|
||||
wxMenuItem& memory_viewer = *menubar.FindItem(id_tools_memory_viewer);
|
||||
wxMenuItem& rsx_debugger = *menubar.FindItem(id_tools_rsx_debugger);
|
||||
kernel_explorer.Enable(!is_stopped);
|
||||
memory_viewer.Enable(!is_stopped);
|
||||
rsx_debugger.Enable(!is_stopped);
|
||||
|
||||
|
@ -41,6 +41,7 @@ private:
|
||||
void ConfigAutoPause(wxCommandEvent& event);
|
||||
void ConfigSaveData(wxCommandEvent& event);
|
||||
void OpenELFCompiler(wxCommandEvent& evt);
|
||||
void OpenKernelExplorer(wxCommandEvent& evt);
|
||||
void OpenMemoryViewer(wxCommandEvent& evt);
|
||||
void OpenRSXDebugger(wxCommandEvent& evt);
|
||||
void OpenFnIdGenerator(wxCommandEvent& evt);
|
||||
|
@ -173,6 +173,7 @@
|
||||
<ClCompile Include="Gui\GLGSFrame.cpp" />
|
||||
<ClCompile Include="Gui\GSFrame.cpp" />
|
||||
<ClCompile Include="Gui\InterpreterDisAsm.cpp" />
|
||||
<ClCompile Include="Gui\KernelExplorer.cpp" />
|
||||
<ClCompile Include="Gui\MainFrame.cpp" />
|
||||
<ClCompile Include="Gui\MemoryViewer.cpp" />
|
||||
<ClCompile Include="Gui\PADManager.cpp" />
|
||||
@ -218,6 +219,7 @@
|
||||
<ClInclude Include="Gui\GLGSFrame.h" />
|
||||
<ClInclude Include="Gui\GSFrame.h" />
|
||||
<ClInclude Include="Gui\InterpreterDisAsm.h" />
|
||||
<ClInclude Include="Gui\KernelExplorer.h" />
|
||||
<ClInclude Include="Gui\MainFrame.h" />
|
||||
<ClInclude Include="Gui\MemoryViewer.h" />
|
||||
<ClInclude Include="Gui\RegisterEditor.h" />
|
||||
|
@ -101,6 +101,9 @@
|
||||
</ClCompile>
|
||||
<ClCompile Include="Gui\SaveDataUtility.cpp">
|
||||
<Filter>Gui</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Gui\KernelExplorer.cpp">
|
||||
<Filter>Gui</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -214,6 +217,9 @@
|
||||
</ClInclude>
|
||||
<ClInclude Include="Gui\SaveDataUtility.h">
|
||||
<Filter>Gui</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Gui\KernelExplorer.h">
|
||||
<Filter>Gui</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
x
Reference in New Issue
Block a user