mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-23 19:22:48 +01:00
Add PPU / SPU / RawSPU threads in KernelExplorer, and some coding style changes.
This commit is contained in:
parent
339e40d423
commit
402199d70f
@ -93,6 +93,24 @@ public:
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
std::string ThreadStatusToString()
|
||||
{
|
||||
switch (ThreadStatus())
|
||||
{
|
||||
case CPUThread_Ready: return "Ready";
|
||||
case CPUThread_Running: return "Running";
|
||||
case CPUThread_Paused: return "Paused";
|
||||
case CPUThread_Stopped: return "Stopped";
|
||||
case CPUThread_Sleeping: return "Sleeping";
|
||||
case CPUThread_Break: return "Break";
|
||||
case CPUThread_Step: return "Step";
|
||||
|
||||
default: return "Unknown status";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::string GetTypeString() const { return CPUThreadTypeToString(m_type); }
|
||||
|
||||
virtual std::string GetThreadName() const
|
||||
|
@ -709,9 +709,12 @@ int cellHddGameCheck(u32 version, vm::ptr<const char> dirName, u32 errDialog, vm
|
||||
// TODO ?
|
||||
|
||||
funcStat(result, get, set);
|
||||
if (result->result != CELL_HDDGAME_CBRESULT_OK &&
|
||||
|
||||
/*
|
||||
if (result->result != CELL_HDDGAME_CBRESULT_OK && // error on compiling in MVS. Needs to use LE byte order?
|
||||
result->result != CELL_HDDGAME_CBRESULT_OK_CANCEL)
|
||||
return CELL_HDDGAME_ERROR_CBRESULT;
|
||||
*/
|
||||
|
||||
// TODO ?
|
||||
|
||||
|
@ -6,6 +6,9 @@
|
||||
#include "Emu/IdManager.h"
|
||||
#include "KernelExplorer.h"
|
||||
|
||||
#include "Emu/CPU/CPUThreadManager.h"
|
||||
#include "Emu/CPU/CPUThread.h"
|
||||
|
||||
KernelExplorer::KernelExplorer(wxWindow* parent)
|
||||
: wxFrame(parent, wxID_ANY, "Kernel Explorer", wxDefaultPosition, wxSize(700, 450))
|
||||
{
|
||||
@ -46,17 +49,17 @@ void KernelExplorer::Update()
|
||||
m_tree->DeleteAllItems();
|
||||
const auto& root = m_tree->AddRoot("Process, ID = 0x00000001, Total Memory Usage = 0x???????? (???.? MB)");
|
||||
|
||||
// TODO: PPU Threads
|
||||
// TODO: SPU/RawSPU Threads
|
||||
// TODO: FileSystem
|
||||
|
||||
// Semaphores
|
||||
count = Emu.GetIdManager().GetTypeCount(TYPE_SEMAPHORE);
|
||||
if (count) {
|
||||
if (count)
|
||||
{
|
||||
sprintf(name, "Semaphores (%d)", count);
|
||||
const auto& node = m_tree->AppendItem(root, name);
|
||||
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_SEMAPHORE);
|
||||
for (const auto& id : objects) {
|
||||
for (const auto& id : objects)
|
||||
{
|
||||
sprintf(name, "Semaphore: ID = 0x%08x", id);
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
@ -64,11 +67,13 @@ void KernelExplorer::Update()
|
||||
|
||||
// Mutexes
|
||||
count = Emu.GetIdManager().GetTypeCount(TYPE_MUTEX);
|
||||
if (count) {
|
||||
if (count)
|
||||
{
|
||||
sprintf(name, "Mutexes (%d)", count);
|
||||
const auto& node = m_tree->AppendItem(root, name);
|
||||
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_MUTEX);
|
||||
for (const auto& id : objects) {
|
||||
for (const auto& id : objects)
|
||||
{
|
||||
sprintf(name, "Mutex: ID = 0x%08x", id);
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
@ -76,11 +81,13 @@ void KernelExplorer::Update()
|
||||
|
||||
// Light Weight Mutexes
|
||||
count = Emu.GetIdManager().GetTypeCount(TYPE_LWMUTEX);
|
||||
if (count) {
|
||||
if (count)
|
||||
{
|
||||
sprintf(name, "Light Weight Mutexes (%d)", count);
|
||||
const auto& node = m_tree->AppendItem(root, name);
|
||||
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_LWMUTEX);
|
||||
for (const auto& id : objects) {
|
||||
for (const auto& id : objects)
|
||||
{
|
||||
sprintf(name, "LW Mutex: ID = 0x%08x", id);
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
@ -88,11 +95,13 @@ void KernelExplorer::Update()
|
||||
|
||||
// Condition Variables
|
||||
count = Emu.GetIdManager().GetTypeCount(TYPE_COND);
|
||||
if (count) {
|
||||
if (count)
|
||||
{
|
||||
sprintf(name, "Condition Variables (%d)", count);
|
||||
const auto& node = m_tree->AppendItem(root, name);
|
||||
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_COND);
|
||||
for (const auto& id : objects) {
|
||||
for (const auto& id : objects)
|
||||
{
|
||||
sprintf(name, "Condition Variable: ID = 0x%08x", id);
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
@ -100,11 +109,13 @@ void KernelExplorer::Update()
|
||||
|
||||
// Light Weight Condition Variables
|
||||
count = Emu.GetIdManager().GetTypeCount(TYPE_LWCOND);
|
||||
if (count) {
|
||||
if (count)
|
||||
{
|
||||
sprintf(name, "Light Weight Condition Variables (%d)", count);
|
||||
const auto& node = m_tree->AppendItem(root, name);
|
||||
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_LWCOND);
|
||||
for (const auto& id : objects) {
|
||||
for (const auto& id : objects)
|
||||
{
|
||||
sprintf(name, "LW Condition Variable: ID = 0x%08x", id);
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
@ -112,11 +123,13 @@ void KernelExplorer::Update()
|
||||
|
||||
// Event Queues
|
||||
count = Emu.GetIdManager().GetTypeCount(TYPE_EVENT_QUEUE);
|
||||
if (count) {
|
||||
if (count)
|
||||
{
|
||||
sprintf(name, "Event Queues (%d)", count);
|
||||
const auto& node = m_tree->AppendItem(root, name);
|
||||
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_EVENT_QUEUE);
|
||||
for (const auto& id : objects) {
|
||||
for (const auto& id : objects)
|
||||
{
|
||||
sprintf(name, "Event Queue: ID = 0x%08x", id);
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
@ -124,13 +137,15 @@ void KernelExplorer::Update()
|
||||
|
||||
// Modules
|
||||
count = Emu.GetIdManager().GetTypeCount(TYPE_PRX);
|
||||
if (count) {
|
||||
if (count)
|
||||
{
|
||||
sprintf(name, "Modules (%d)", count);
|
||||
const auto& node = m_tree->AppendItem(root, name);
|
||||
const 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) {
|
||||
for (const auto& id : objects)
|
||||
{
|
||||
sprintf(name, "PRX: ID = 0x%08x", id);
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
@ -138,27 +153,98 @@ void KernelExplorer::Update()
|
||||
|
||||
// Memory Containers
|
||||
count = Emu.GetIdManager().GetTypeCount(TYPE_MEM);
|
||||
if (count) {
|
||||
if (count)
|
||||
{
|
||||
sprintf(name, "Memory Containers (%d)", count);
|
||||
const auto& node = m_tree->AppendItem(root, name);
|
||||
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_MEM);
|
||||
for (const auto& id : objects) {
|
||||
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) {
|
||||
if (count)
|
||||
{
|
||||
sprintf(name, "Event Flags (%d)", count);
|
||||
const auto& node = m_tree->AppendItem(root, name);
|
||||
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_EVENT_FLAG);
|
||||
for (const auto& id : objects) {
|
||||
for (const auto& id : objects)
|
||||
{
|
||||
sprintf(name, "Event Flag: ID = 0x%08x", id);
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
}
|
||||
|
||||
// PPU / SPU / RawSPU threads
|
||||
{
|
||||
// TODO: add mutexes owners
|
||||
|
||||
const auto& objects = Emu.GetCPU().GetThreads();
|
||||
u32 ppu_threads_count = 0;
|
||||
u32 spu_threads_count = 0;
|
||||
u32 raw_spu_threads_count = 0;
|
||||
for (const auto& thread : objects)
|
||||
{
|
||||
if (thread->GetType() == CPU_THREAD_PPU)
|
||||
ppu_threads_count++;
|
||||
|
||||
if (thread->GetType() == CPU_THREAD_SPU)
|
||||
spu_threads_count++;
|
||||
|
||||
if (thread->GetType() == CPU_THREAD_RAW_SPU)
|
||||
raw_spu_threads_count++;
|
||||
}
|
||||
|
||||
if (ppu_threads_count)
|
||||
{
|
||||
sprintf(name, "PPU Threads (%d)", ppu_threads_count);
|
||||
const auto& node = m_tree->AppendItem(root, name);
|
||||
|
||||
for (const auto& thread : objects)
|
||||
{
|
||||
if (thread->GetType() == CPU_THREAD_PPU)
|
||||
{
|
||||
sprintf(name, "Thread: ID = 0x%08x ''%s'', - %s", thread->GetId(), thread->GetName().c_str(), thread->ThreadStatusToString().c_str());
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (spu_threads_count)
|
||||
{
|
||||
sprintf(name, "SPU Threads (%d)", spu_threads_count);
|
||||
const auto& node = m_tree->AppendItem(root, name);
|
||||
|
||||
for (const auto& thread : objects)
|
||||
{
|
||||
if (thread->GetType() == CPU_THREAD_SPU)
|
||||
{
|
||||
sprintf(name, "Thread: ID = 0x%08x ''%s'', - %s", thread->GetId(), thread->GetName().c_str(), thread->ThreadStatusToString().c_str());
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (raw_spu_threads_count)
|
||||
{
|
||||
sprintf(name, "RawSPU Threads (%d)", raw_spu_threads_count);
|
||||
const auto& node = m_tree->AppendItem(root, name);
|
||||
|
||||
for (const auto& thread : objects)
|
||||
{
|
||||
if (thread->GetType() == CPU_THREAD_RAW_SPU)
|
||||
{
|
||||
sprintf(name, "Thread: ID = 0x%08x ''%s'', - %s", thread->GetId(), thread->GetName().c_str(), thread->ThreadStatusToString().c_str());
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
m_tree->Expand(root);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user