submodules fixes (#87)

* update discord-rpc

* ignore gitmodules on reuse

* imgui not used atm removed
This commit is contained in:
georgemoralis 2024-02-27 20:24:47 +02:00 committed by GitHub
parent e40461b0c2
commit b3084646a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 22 additions and 158 deletions

14
.gitmodules vendored
View File

@ -1,10 +1,3 @@
# SPDX-FileCopyrightText: 2024 shadPS4 Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later
[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
@ -29,9 +22,6 @@
path = third-party/winpthread path = third-party/winpthread
url = https://github.com/shadps4/winpthread.git url = https://github.com/shadps4/winpthread.git
branch = main branch = main
[submodule "third-party/discord-rpc"]
path = third-party/discord-rpc
url = https://github.com/discord/discord-rpc
[submodule "third-party/toml11"] [submodule "third-party/toml11"]
path = third-party/toml11 path = third-party/toml11
url = https://github.com/ToruNiina/toml11 url = https://github.com/ToruNiina/toml11
@ -47,3 +37,7 @@
[submodule "third-party/vulkan"] [submodule "third-party/vulkan"]
path = third-party/vulkan path = third-party/vulkan
url = https://github.com/GPUCode/vulkan url = https://github.com/GPUCode/vulkan
[submodule "externals/discord-rpc"]
path = externals/discord-rpc
url = https://github.com/shadps4-emu/ext-discord-rpc.git
branch = master

View File

@ -8,5 +8,6 @@ Files: CMakeSettings.json
documents/readme.txt documents/readme.txt
.github/shadps4.desktop .github/shadps4.desktop
.github/shadps4.png .github/shadps4.png
.gitmodules
Copyright: shadPS4 Emulator Project Copyright: shadPS4 Emulator Project
License: GPL-2.0-or-later License: GPL-2.0-or-later

View File

@ -81,6 +81,7 @@ if (CLANG_FORMAT)
unset(CCOMMENT) unset(CCOMMENT)
endif() endif()
add_subdirectory(externals)
add_subdirectory(third-party) add_subdirectory(third-party)
include_directories(src) include_directories(src)
@ -156,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
@ -213,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()

14
externals/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,14 @@
# SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later
if (MSVC)
# Silence "deprecation" warnings
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
endif()
# Discord-RPC
set(BUILD_EXAMPLES OFF CACHE BOOL "")
add_subdirectory(discord-rpc EXCLUDE_FROM_ALL)
target_include_directories(discord-rpc INTERFACE ./discord-rpc/include)

1
externals/discord-rpc vendored Submodule

@ -0,0 +1 @@
Subproject commit a3fa5e32f64297247b683c35acb4ab1f207171ed

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

@ -6,11 +6,6 @@ if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS) add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
endif() endif()
# Discord-RPC
set(BUILD_EXAMPLES OFF CACHE BOOL "")
add_subdirectory(discord-rpc EXCLUDE_FROM_ALL)
target_include_directories(discord-rpc INTERFACE ./discord-rpc/include)
# fmtlib # fmtlib
add_subdirectory(fmt EXCLUDE_FROM_ALL) add_subdirectory(fmt EXCLUDE_FROM_ALL)
@ -49,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 discord-rpc)

@ -1 +0,0 @@
Subproject commit 963aa9f3e5ce81a4682c6ca3d136cddda614db33

1
third-party/imgui vendored

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