imgui not used atm removed

This commit is contained in:
georgemoralis 2024-02-27 20:08:33 +02:00
parent 8a076ddc5c
commit 63ba867902
6 changed files with 1 additions and 146 deletions

4
.gitmodules vendored
View File

@ -1,7 +1,3 @@
[submodule "third-party/imgui"]
path = third-party/imgui
url = https://github.com/ocornut/imgui
shallow = true
[submodule "third-party/SDL"] [submodule "third-party/SDL"]
path = third-party/SDL path = third-party/SDL
url = https://github.com/libsdl-org/SDL url = https://github.com/libsdl-org/SDL

View File

@ -157,8 +157,6 @@ add_executable(shadps4
src/main.cpp src/main.cpp
src/core/loader/elf.cpp src/core/loader/elf.cpp
src/core/loader/elf.h src/core/loader/elf.h
src/GUI/ElfViewer.cpp
src/GUI/ElfViewer.h
src/Util/config.cpp src/Util/config.cpp
src/Util/config.h src/Util/config.h
src/core/virtual_memory.cpp src/core/virtual_memory.cpp
@ -214,7 +212,7 @@ add_executable(shadps4
create_target_directory_groups(shadps4) create_target_directory_groups(shadps4)
target_link_libraries(shadps4 PRIVATE magic_enum::magic_enum fmt::fmt spdlog::spdlog toml11::toml11) target_link_libraries(shadps4 PRIVATE magic_enum::magic_enum fmt::fmt spdlog::spdlog toml11::toml11)
target_link_libraries(shadps4 PRIVATE discord-rpc imgui SDL3-shared vulkan-1 xxhash Zydis) target_link_libraries(shadps4 PRIVATE discord-rpc SDL3-shared vulkan-1 xxhash Zydis)
if (WIN32) if (WIN32)
target_link_libraries(shadps4 PRIVATE mincore winpthread clang_rt.builtins-x86_64.lib) target_link_libraries(shadps4 PRIVATE mincore winpthread clang_rt.builtins-x86_64.lib)
endif() endif()

View File

@ -1,100 +0,0 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "GUI/ElfViewer.h"
#include "core/loader/elf.h"
#include "imgui.h"
ElfViewer::ElfViewer(Core::Loader::Elf* elf) {
this->elf = elf;
}
void ElfViewer::Display(bool enabled) {
int SELF_HEADER = 0;
int ELF_HEADER = 1;
int SEG_HEADER_START = 100;
int ELF_PROGRAM_HEADER_START = 200;
static int selected = -1;
ImGui::Begin("Self/Elf Viewer", &enabled);
ImGui::BeginChild("Left Tree pane", ImVec2(300, 0), false); // left tree
if (elf->isSelfFile()) {
if (ImGui::TreeNode("Self")) {
if (ImGui::TreeNodeEx("Self Header",
ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen,
"Self Header")) {
if (ImGui::IsItemClicked())
selected = SELF_HEADER;
}
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");
ImGui::TreePop();
}
}
if (ImGui::TreeNode("Elf")) {
const auto elf_header = elf->GetElfHeader();
if (ImGui::TreeNodeEx("Elf Header",
ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen,
"Elf Header")) {
if (ImGui::IsItemClicked())
selected = ELF_HEADER;
}
if (ImGui::TreeNode("Elf Program Headers")) {
const auto pheader = elf->GetProgramHeader();
for (u16 i = 0; i < elf_header.e_phnum; i++) {
std::string ProgramInfo = elf->ElfPheaderFlagsStr(pheader[i].p_flags) + " " +
elf->ElfPheaderTypeStr(pheader[i].p_type);
if (ImGui::TreeNodeEx((void*)(intptr_t)i,
ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen,
"%d - %s", i, ProgramInfo.c_str())) {
if (ImGui::IsItemClicked())
selected = ELF_PROGRAM_HEADER_START + i;
}
}
ImGui::TreePop();
}
if (elf_header.e_shnum != 0) {
if (ImGui::TreeNode("Elf Section Headers")) {
ImGui::TreePop();
}
}
ImGui::TreePop();
}
ImGui::EndChild(); // end of left tree
ImGui::SameLine();
ImGui::BeginChild(
"Table View",
ImVec2(0, -ImGui::GetFrameHeightWithSpacing())); // Leave room for 1 line below us
if (selected == SELF_HEADER) {
ImGui::TextWrapped("%s", elf->SElfHeaderStr().c_str());
}
if (selected >= 100 && selected < 200) {
ImGui::TextWrapped("%s", elf->SELFSegHeader(selected - 100).c_str());
}
if (selected == ELF_HEADER) {
ImGui::TextWrapped("%s", elf->ElfHeaderStr().c_str());
}
if (selected >= 200 && selected < 300) {
ImGui::TextWrapped("%s", elf->ElfPHeaderStr(selected - 200).c_str());
}
ImGui::EndChild();
ImGui::End();
}

View File

@ -1,18 +0,0 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
namespace Core::Loader {
class Elf;
}
class ElfViewer {
public:
explicit ElfViewer(Core::Loader::Elf* elf);
void Display(bool enabled);
private:
Core::Loader::Elf* elf;
};

View File

@ -44,25 +44,5 @@ option(ZYDIS_BUILD_TOOLS "" OFF)
option(ZYDIS_BUILD_EXAMPLES "" OFF) option(ZYDIS_BUILD_EXAMPLES "" OFF)
add_subdirectory(zydis EXCLUDE_FROM_ALL) add_subdirectory(zydis EXCLUDE_FROM_ALL)
# Imgui
add_library(imgui STATIC)
target_sources(imgui PRIVATE
imgui/imgui_demo.cpp
imgui/imgui_draw.cpp
imgui/imgui_tables.cpp
imgui/imgui_widgets.cpp
imgui/imgui.cpp
imgui/backends/imgui_impl_opengl3.cpp
imgui/backends/imgui_impl_sdl3.cpp
)
target_include_directories(imgui PUBLIC
imgui
imgui/backends
imgui/include
)
target_link_libraries(imgui PRIVATE SDL3-shared ${CMAKE_DL_LIBS} Zydis)

1
third-party/imgui vendored

@ -1 +0,0 @@
Subproject commit 52125a54a57a458e89bc61502010e964add3cdd5