mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-19 09:54:54 +00:00
elfview imgui : added segment headers
This commit is contained in:
parent
cda7c67e36
commit
6511b280cf
3 changed files with 33 additions and 19 deletions
|
@ -9,11 +9,10 @@ ElfViewer::ElfViewer(Elf* elf)
|
|||
//function to display Self/Elf window
|
||||
void ElfViewer::display(bool enabled)
|
||||
{
|
||||
enum
|
||||
{
|
||||
SELF_HEADER,
|
||||
ELF_HEADER
|
||||
};
|
||||
int SELF_HEADER = 0;
|
||||
int ELF_HEADER = 1;
|
||||
int SEG_HEADER_START = 100;
|
||||
|
||||
static int selected = -1;
|
||||
ImGui::Begin("Self/Elf Viewer", &enabled);
|
||||
|
||||
|
@ -30,6 +29,15 @@ void ElfViewer::display(bool enabled)
|
|||
|
||||
if (ImGui::TreeNode("Self Segment Header"))
|
||||
{
|
||||
const auto* self = elf->GetSElfHeader();
|
||||
for (u16 i = 0; i < self->segment_count; i++)
|
||||
{
|
||||
if (ImGui::TreeNodeEx((void*)(intptr_t)i, ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen, "%d", i))
|
||||
{
|
||||
if (ImGui::IsItemClicked())
|
||||
selected = SEG_HEADER_START+i;
|
||||
}
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
ImGui::TreeNodeEx("Self Id Header", ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen, "Self Id Header");
|
||||
|
@ -46,12 +54,10 @@ void ElfViewer::display(bool enabled)
|
|||
if (ImGui::TreeNode("Elf Program Headers"))
|
||||
{
|
||||
const auto* elf_header = elf->GetElfHeader();
|
||||
const auto* program_header = elf->GetProgramHeader();
|
||||
for (u16 i = 0; i < elf_header->e_phnum; i++)
|
||||
{
|
||||
if (ImGui::TreeNode((void*)(intptr_t)i, "%d", i))
|
||||
if (ImGui::TreeNodeEx((void*)(intptr_t)i,ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen, "%d", i))
|
||||
{
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
ImGui::TreePop();
|
||||
|
@ -70,6 +76,10 @@ void ElfViewer::display(bool enabled)
|
|||
if (selected == SELF_HEADER) {
|
||||
ImGui::TextWrapped(elf->SElfHeaderStr().c_str());
|
||||
}
|
||||
if (selected >= 100 && selected < 200)
|
||||
{
|
||||
ImGui::TextWrapped(elf->SELFSegHeader(selected-100).c_str());
|
||||
}
|
||||
ImGui::EndChild();
|
||||
ImGui::End();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue