imgui elfviewer window . first draft
This commit is contained in:
parent
f35f7b62cd
commit
dda7020ef4
|
@ -2,6 +2,10 @@ cmake_minimum_required(VERSION 3.16.3)
|
|||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
|
||||
project(shadps4)
|
||||
|
||||
include_directories(third-party/)
|
||||
|
@ -21,7 +25,8 @@ add_executable(shadps4
|
|||
src/Core/FsFile.h
|
||||
src/Loader/Elf.cpp
|
||||
src/Loader/Elf.h
|
||||
)
|
||||
src/GUI/ElfViewer.cpp
|
||||
src/GUI/ElfViewer.h)
|
||||
|
||||
find_package(OpenGL REQUIRED)
|
||||
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
#include "ElfViewer.h"
|
||||
#include "imgui.h"
|
||||
|
||||
ElfViewer::ElfViewer(Elf* elf)
|
||||
{
|
||||
this->elf = elf;
|
||||
}
|
||||
|
||||
//function to display Self/Elf window
|
||||
void ElfViewer::display(bool enabled)
|
||||
{
|
||||
ImGui::Begin("Self/Elf Viewer", &enabled);
|
||||
if (elf->isSelfFile())
|
||||
{
|
||||
if (ImGui::TreeNode("Self"))
|
||||
{
|
||||
if (ImGui::TreeNode("Self Header"))
|
||||
{
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
if (ImGui::TreeNode("Self Segment Header"))
|
||||
{
|
||||
ImGui::TreePop();
|
||||
}
|
||||
if (ImGui::TreeNode("Self Id Header"))
|
||||
{
|
||||
ImGui::TreePop();
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
if (ImGui::TreeNode("Elf"))
|
||||
{
|
||||
if (ImGui::TreeNode("Elf Header"))
|
||||
{
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
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))
|
||||
{
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
if (ImGui::TreeNode("Elf Section Headers"))
|
||||
{
|
||||
ImGui::TreePop();
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
ImGui::End();
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
#include "../Loader/Elf.h"
|
||||
|
||||
class ElfViewer {
|
||||
private:
|
||||
Elf* elf;
|
||||
public:
|
||||
ElfViewer(Elf* elf);
|
||||
void display(bool enabled);//display imgui window
|
||||
|
||||
};
|
|
@ -293,6 +293,8 @@ public:
|
|||
bool isSelfFile() const;
|
||||
bool isElfFile() const;
|
||||
void DebugDump();
|
||||
[[nodiscard]] const elf_header* GetElfHeader() const { return m_elf_header; }
|
||||
[[nodiscard]] const elf_program_header* GetProgramHeader() const { return m_elf_phdr; }
|
||||
private:
|
||||
|
||||
void Reset();
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "spdlog/spdlog.h"
|
||||
#include "types.h"
|
||||
#include "Loader/Elf.h"
|
||||
#include "GUI/ElfViewer.h"
|
||||
|
||||
// This example can also compile and run with Emscripten! See 'Makefile.emscripten' for details.
|
||||
#ifdef __EMSCRIPTEN__
|
||||
|
@ -186,6 +187,8 @@ int main(int argc, char* argv[])
|
|||
ImGui::End();
|
||||
}
|
||||
|
||||
ElfViewer elfview(elf);
|
||||
elfview.display(show_another_window);
|
||||
// Rendering
|
||||
ImGui::Render();
|
||||
glViewport(0, 0, (int)io.DisplaySize.x, (int)io.DisplaySize.y);
|
||||
|
|
Loading…
Reference in New Issue