std::shared_ptr in IdManager

This commit is contained in:
Nekotekina 2014-12-24 02:38:13 +03:00
parent b2de24db73
commit d8239a39c9
47 changed files with 654 additions and 622 deletions

View file

@ -53,200 +53,200 @@ void KernelExplorer::Update()
// TODO: FileSystem
// Semaphores
count = Emu.GetIdManager().GetTypeCount(TYPE_SEMAPHORE);
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)
{
sprintf(name, "Semaphore: ID = 0x%08x '%s', Count = %d, Max Count = %d", id, Emu.GetSyncPrimManager().GetSemaphoreData(id).name.c_str(),
Emu.GetSyncPrimManager().GetSemaphoreData(id).count, Emu.GetSyncPrimManager().GetSemaphoreData(id).max_count);
m_tree->AppendItem(node, name);
}
}
//count = Emu.GetIdManager().GetTypeCount(TYPE_SEMAPHORE);
//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)
// {
// sprintf(name, "Semaphore: ID = 0x%08x '%s', Count = %d, Max Count = %d", id, Emu.GetSyncPrimManager().GetSemaphoreData(id).name.c_str(),
// Emu.GetSyncPrimManager().GetSemaphoreData(id).count, Emu.GetSyncPrimManager().GetSemaphoreData(id).max_count);
// m_tree->AppendItem(node, name);
// }
//}
// Mutexes
count = Emu.GetIdManager().GetTypeCount(TYPE_MUTEX);
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)
{
sprintf(name, "Mutex: ID = 0x%08x '%s'", id, Emu.GetSyncPrimManager().GetSyncPrimName(TYPE_MUTEX, id).c_str());
m_tree->AppendItem(node, name);
}
}
//count = Emu.GetIdManager().GetTypeCount(TYPE_MUTEX);
//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)
// {
// sprintf(name, "Mutex: ID = 0x%08x '%s'", id, Emu.GetSyncPrimManager().GetSyncPrimName(TYPE_MUTEX, id).c_str());
// m_tree->AppendItem(node, name);
// }
//}
// Light Weight Mutexes
count = Emu.GetIdManager().GetTypeCount(TYPE_LWMUTEX);
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)
{
sprintf(name, "LW Mutex: ID = 0x%08x '%s', Owner Thread ID = 0x%08x - %s", id, Emu.GetSyncPrimManager().GetLwMutexData(id).name.c_str(),
Emu.GetSyncPrimManager().GetLwMutexData(id).owner_id, Emu.GetSyncPrimManager().GetLwMutexData(id).status.c_str());
m_tree->AppendItem(node, name);
}
}
//count = Emu.GetIdManager().GetTypeCount(TYPE_LWMUTEX);
//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)
// {
// sprintf(name, "LW Mutex: ID = 0x%08x '%s', Owner Thread ID = 0x%08x - %s", id, Emu.GetSyncPrimManager().GetLwMutexData(id).name.c_str(),
// Emu.GetSyncPrimManager().GetLwMutexData(id).owner_id, Emu.GetSyncPrimManager().GetLwMutexData(id).status.c_str());
// m_tree->AppendItem(node, name);
// }
//}
// Condition Variables
count = Emu.GetIdManager().GetTypeCount(TYPE_COND);
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)
{
sprintf(name, "Condition Variable: ID = 0x%08x '%s'", id, Emu.GetSyncPrimManager().GetSyncPrimName(TYPE_COND, id).c_str());
m_tree->AppendItem(node, name);
}
}
//count = Emu.GetIdManager().GetTypeCount(TYPE_COND);
//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)
// {
// sprintf(name, "Condition Variable: ID = 0x%08x '%s'", id, Emu.GetSyncPrimManager().GetSyncPrimName(TYPE_COND, id).c_str());
// 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);
const auto& node = m_tree->AppendItem(root, name);
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_LWCOND);
//count = Emu.GetIdManager().GetTypeCount(TYPE_LWCOND);
//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)
{
sprintf(name, "LW Condition Variable: ID = 0x%08x '%s'", id, Emu.GetSyncPrimManager().GetSyncPrimName(TYPE_LWCOND, id).c_str());
m_tree->AppendItem(node, name);
}
}
// for (const auto& id : objects)
// {
// sprintf(name, "LW Condition Variable: ID = 0x%08x '%s'", id, Emu.GetSyncPrimManager().GetSyncPrimName(TYPE_LWCOND, id).c_str());
// m_tree->AppendItem(node, name);
// }
//}
// Event Queues
count = Emu.GetIdManager().GetTypeCount(TYPE_EVENT_QUEUE);
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)
{
sprintf(name, "Event Queue: ID = 0x%08x", id);
m_tree->AppendItem(node, name);
}
}
//count = Emu.GetIdManager().GetTypeCount(TYPE_EVENT_QUEUE);
//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)
// {
// 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);
const auto& node = m_tree->AppendItem(root, name);
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_PRX);
sprintf(name, "Segment List (%l)", 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);
}
}
//count = Emu.GetIdManager().GetTypeCount(TYPE_PRX);
//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 (%l)", 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);
const auto& node = m_tree->AppendItem(root, name);
const 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);
}
}
//count = Emu.GetIdManager().GetTypeCount(TYPE_MEM);
//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)
// {
// 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);
const auto& node = m_tree->AppendItem(root, name);
const 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);
}
}
//count = Emu.GetIdManager().GetTypeCount(TYPE_EVENT_FLAG);
//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)
// {
// 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();
//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++;
//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_SPU)
// spu_threads_count++;
if (thread->GetType() == CPU_THREAD_RAW_SPU)
raw_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);
//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);
}
}
}
// 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);
//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);
}
}
}
// 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);
//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);
}
}
}
// 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);
// }
// }
//}
}