From 49e64b9e82c4926c1d1d48ea7cc4ff11523de5cc Mon Sep 17 00:00:00 2001 From: Zion Nimchuk Date: Wed, 17 Jan 2018 22:08:51 -0800 Subject: [PATCH] install icons to /usr/share and load them from there --- rpcs3/CMakeLists.txt | 5 +++++ rpcs3/Emu/RSX/overlay_controls.h | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/rpcs3/CMakeLists.txt b/rpcs3/CMakeLists.txt index bd6ae58a52..3e0b8d0ef2 100644 --- a/rpcs3/CMakeLists.txt +++ b/rpcs3/CMakeLists.txt @@ -468,4 +468,9 @@ if(UNIX AND NOT APPLE) DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/48x48/apps) install(FILES rpcs3.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications) + # Install other files + install(DIRECTORY ../bin/Icons + DESTINATION ${CMAKE_INSTALL_PREFIX}/share/rpcs3) + install(DIRECTORY ../bin/GuiConfigs + DESTINATION ${CMAKE_INSTALL_PREFIX}/share/rpcs3) endif() diff --git a/rpcs3/Emu/RSX/overlay_controls.h b/rpcs3/Emu/RSX/overlay_controls.h index 0c533ae239..d543a02fa5 100644 --- a/rpcs3/Emu/RSX/overlay_controls.h +++ b/rpcs3/Emu/RSX/overlay_controls.h @@ -10,6 +10,7 @@ #include #include #include +#include #endif // STB_IMAGE_IMPLEMENTATION and STB_TRUETYPE_IMPLEMENTATION defined externally @@ -470,7 +471,20 @@ namespace rsx { //Resource was not found in config dir, try and grab from relative path (linux) info = std::make_unique(("Icons/ui/" + res).c_str()); +#ifndef _WIN32 + if (info->data == nullptr) + { + char result[ PATH_MAX ]; +#ifdef __linux__ + ssize_t count = readlink( "/proc/self/exe", result, PATH_MAX ); +#else + ssize_t count = readlink( "/proc/curproc/file", result, PATH_MAX ); +#endif + std::string executablePath = dirname(result); + info = std::make_unique((executablePath + "/../share/rpcs3/Icons/ui/" + res).c_str()); + } +#endif if (info->data != nullptr) { //Install the image to config dir @@ -1308,7 +1322,7 @@ namespace rsx u16 m_elements_height = 0; s16 m_selected_entry = -1; u16 m_elements_count = 0; - + public: list_view(u16 width, u16 height) {