From 63ba867902804f7b5f591eb73a92403c7f551c54 Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Tue, 27 Feb 2024 20:08:33 +0200 Subject: [PATCH] imgui not used atm removed --- .gitmodules | 4 -- CMakeLists.txt | 4 +- src/GUI/ElfViewer.cpp | 100 ------------------------------------- src/GUI/ElfViewer.h | 18 ------- third-party/CMakeLists.txt | 20 -------- third-party/imgui | 1 - 6 files changed, 1 insertion(+), 146 deletions(-) delete mode 100644 src/GUI/ElfViewer.cpp delete mode 100644 src/GUI/ElfViewer.h delete mode 160000 third-party/imgui diff --git a/.gitmodules b/.gitmodules index 12d751713..9267baa77 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,3 @@ -[submodule "third-party/imgui"] - path = third-party/imgui - url = https://github.com/ocornut/imgui - shallow = true [submodule "third-party/SDL"] path = third-party/SDL url = https://github.com/libsdl-org/SDL diff --git a/CMakeLists.txt b/CMakeLists.txt index e63f41ab2..ecb5613b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -157,8 +157,6 @@ add_executable(shadps4 src/main.cpp src/core/loader/elf.cpp src/core/loader/elf.h - src/GUI/ElfViewer.cpp - src/GUI/ElfViewer.h src/Util/config.cpp src/Util/config.h src/core/virtual_memory.cpp @@ -214,7 +212,7 @@ add_executable(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 discord-rpc imgui SDL3-shared vulkan-1 xxhash Zydis) +target_link_libraries(shadps4 PRIVATE discord-rpc SDL3-shared vulkan-1 xxhash Zydis) if (WIN32) target_link_libraries(shadps4 PRIVATE mincore winpthread clang_rt.builtins-x86_64.lib) endif() diff --git a/src/GUI/ElfViewer.cpp b/src/GUI/ElfViewer.cpp deleted file mode 100644 index 344e417fd..000000000 --- a/src/GUI/ElfViewer.cpp +++ /dev/null @@ -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(); -} diff --git a/src/GUI/ElfViewer.h b/src/GUI/ElfViewer.h deleted file mode 100644 index 6e7aa6dda..000000000 --- a/src/GUI/ElfViewer.h +++ /dev/null @@ -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; -}; diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt index 574e7863b..c640ab74e 100644 --- a/third-party/CMakeLists.txt +++ b/third-party/CMakeLists.txt @@ -44,25 +44,5 @@ option(ZYDIS_BUILD_TOOLS "" OFF) option(ZYDIS_BUILD_EXAMPLES "" OFF) 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) diff --git a/third-party/imgui b/third-party/imgui deleted file mode 160000 index 52125a54a..000000000 --- a/third-party/imgui +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 52125a54a57a458e89bc61502010e964add3cdd5