diff --git a/CMakeLists.txt b/CMakeLists.txt index 306b897d8..0de8d1aef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,6 +119,10 @@ else() add_definitions(-DUSE_OPENGLES_10) endif() +#add installation prefix and datarootdir +add_definitions(-DES_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}") +add_definitions(-DES_DATAROOTDIR="${CMAKE_INSTALL_DATAROOTDIR}") + # Enable additional defines for the Debug build configuration set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG") diff --git a/es-app/src/guis/GuiCollectionSystemsOptions.cpp b/es-app/src/guis/GuiCollectionSystemsOptions.cpp index fddcc9753..e93986843 100644 --- a/es-app/src/guis/GuiCollectionSystemsOptions.cpp +++ b/es-app/src/guis/GuiCollectionSystemsOptions.cpp @@ -57,7 +57,7 @@ void GuiCollectionSystemsOptions::initializeMenu() ComponentListRow row; row.addElement(std::make_shared(mWindow, "CREATE NEW CUSTOM COLLECTION", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true); auto bracket = std::make_shared(mWindow); - bracket->setImage(":/arrow.svg"); + bracket->setImage(":/graphics/arrow.svg"); bracket->setResize(Vector2f(0, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight())); row.addElement(bracket, false); auto createCustomCollection = [this](const std::string& newVal) { diff --git a/es-app/src/guis/GuiGameScraper.cpp b/es-app/src/guis/GuiGameScraper.cpp index 0b25513b1..93335b7d4 100644 --- a/es-app/src/guis/GuiGameScraper.cpp +++ b/es-app/src/guis/GuiGameScraper.cpp @@ -22,7 +22,7 @@ GuiGameScraper::GuiGameScraper( std::function doneFunc) : GuiComponent(window), mGrid(window, Vector2i(1, 7)), - mBox(window, ":/frame.png"), + mBox(window, ":/graphics/frame.png"), mSearchParams(params), mClose(false) { diff --git a/es-app/src/guis/GuiInfoPopup.cpp b/es-app/src/guis/GuiInfoPopup.cpp index e759e27f7..b0efc4477 100644 --- a/es-app/src/guis/GuiInfoPopup.cpp +++ b/es-app/src/guis/GuiInfoPopup.cpp @@ -44,7 +44,7 @@ GuiInfoPopup::GuiInfoPopup(Window* window, std::string message, int duration) : setPosition(posX, posY, 0); - mFrame->setImagePath(":/frame.png"); + mFrame->setImagePath(":/graphics/frame.png"); mFrame->fitTo(mSize, Vector3f::Zero(), Vector2f(-32, -32)); addChild(mFrame); diff --git a/es-app/src/guis/GuiMetaDataEd.cpp b/es-app/src/guis/GuiMetaDataEd.cpp index 431a05fee..0a83f796b 100644 --- a/es-app/src/guis/GuiMetaDataEd.cpp +++ b/es-app/src/guis/GuiMetaDataEd.cpp @@ -40,7 +40,7 @@ GuiMetaDataEd::GuiMetaDataEd( : GuiComponent(window), mScraperParams(scraperParams), - mBackground(window, ":/frame.png"), + mBackground(window, ":/graphics/frame.png"), mGrid(window, Vector2i(1, 3)), mMetaDataDecl(mdd), @@ -146,7 +146,7 @@ GuiMetaDataEd::GuiMetaDataEd( row.addElement(spacer, false); auto bracket = std::make_shared(mWindow); - bracket->setImage(":/arrow.svg"); + bracket->setImage(":/graphics/arrow.svg"); bracket->setResize(Vector2f(0, lbl->getFont()->getLetterHeight())); row.addElement(bracket, false); @@ -179,7 +179,7 @@ GuiMetaDataEd::GuiMetaDataEd( row.addElement(spacer, false); auto bracket = std::make_shared(mWindow); - bracket->setImage(":/arrow.svg"); + bracket->setImage(":/graphics/arrow.svg"); bracket->setResize(Vector2f(0, lbl->getFont()->getLetterHeight())); row.addElement(bracket, false); diff --git a/es-app/src/guis/GuiScraperMulti.cpp b/es-app/src/guis/GuiScraperMulti.cpp index aa897f1d0..2cf4796e5 100644 --- a/es-app/src/guis/GuiScraperMulti.cpp +++ b/es-app/src/guis/GuiScraperMulti.cpp @@ -25,7 +25,7 @@ GuiScraperMulti::GuiScraperMulti( const std::queue& searches, bool approveResults) : GuiComponent(window), - mBackground(window, ":/frame.png"), + mBackground(window, ":/graphics/frame.png"), mGrid(window, Vector2i(1, 5)), mSearchQueue(searches) { diff --git a/es-app/src/guis/GuiScreensaverOptions.cpp b/es-app/src/guis/GuiScreensaverOptions.cpp index 90d88ae37..1f6b1228e 100644 --- a/es-app/src/guis/GuiScreensaverOptions.cpp +++ b/es-app/src/guis/GuiScreensaverOptions.cpp @@ -74,7 +74,7 @@ void GuiScreensaverOptions::addEditableTextComponent(ComponentListRow row, const row.addElement(spacer, false); auto bracket = std::make_shared(mWindow); - bracket->setImage(":/arrow.svg"); + bracket->setImage(":/graphics/arrow.svg"); bracket->setResize(Vector2f(0, lbl->getFont()->getLetterHeight())); row.addElement(bracket, false); diff --git a/es-core/src/MameNames.cpp b/es-core/src/MameNames.cpp index e90593076..63bd8ccfe 100644 --- a/es-core/src/MameNames.cpp +++ b/es-core/src/MameNames.cpp @@ -42,7 +42,7 @@ MameNames* MameNames::getInstance() MameNames::MameNames() { - std::string xmlpath = ResourceManager::getInstance()->getResourcePath(":/mamenames.xml"); + std::string xmlpath = ResourceManager::getInstance()->getResourcePath(":/MAME/mamenames.xml"); if (!Utils::FileSystem::exists(xmlpath)) return; @@ -68,7 +68,7 @@ MameNames::MameNames() } // Read BIOS file. - xmlpath = ResourceManager::getInstance()->getResourcePath(":/mamebioses.xml"); + xmlpath = ResourceManager::getInstance()->getResourcePath(":/MAME/mamebioses.xml"); if (!Utils::FileSystem::exists(xmlpath)) return; @@ -90,7 +90,7 @@ MameNames::MameNames() } // Read devices file. - xmlpath = ResourceManager::getInstance()->getResourcePath(":/mamedevices.xml"); + xmlpath = ResourceManager::getInstance()->getResourcePath(":/MAME/mamedevices.xml"); if (!Utils::FileSystem::exists(xmlpath)) return; diff --git a/es-core/src/Window.cpp b/es-core/src/Window.cpp index 2685ce60c..88215a46c 100644 --- a/es-core/src/Window.cpp +++ b/es-core/src/Window.cpp @@ -96,7 +96,7 @@ bool Window::init() mDefaultFonts.push_back(Font::get(FONT_SIZE_LARGE)); } - mBackgroundOverlay->setImage(":/scroll_gradient.png"); + mBackgroundOverlay->setImage(":/graphics/scroll_gradient.png"); mBackgroundOverlay->setResize((float)Renderer::getScreenWidth(), (float)Renderer::getScreenHeight()); @@ -309,7 +309,7 @@ void Window::renderLoadingScreen(std::string text) ImageComponent splash(this, true); splash.setResize(Renderer::getScreenWidth() * 0.6f, 0.0f); - splash.setImage(":/splash.svg"); + splash.setImage(":/graphics/splash.svg"); splash.setPosition((Renderer::getScreenWidth() - splash.getSize().x()) / 2, (Renderer::getScreenHeight() - splash.getSize().y()) / 2 * 0.6f); splash.render(trans); diff --git a/es-core/src/components/BusyComponent.cpp b/es-core/src/components/BusyComponent.cpp index a37d690be..ba7219d00 100644 --- a/es-core/src/components/BusyComponent.cpp +++ b/es-core/src/components/BusyComponent.cpp @@ -6,15 +6,15 @@ // animation definition AnimationFrame BUSY_ANIMATION_FRAMES[] = { - {":/busy_0.svg", 300}, - {":/busy_1.svg", 300}, - {":/busy_2.svg", 300}, - {":/busy_3.svg", 300}, + {":/graphics/busy_0.svg", 300}, + {":/graphics/busy_1.svg", 300}, + {":/graphics/busy_2.svg", 300}, + {":/graphics/busy_3.svg", 300}, }; const AnimationDef BUSY_ANIMATION_DEF = { BUSY_ANIMATION_FRAMES, 4, true }; BusyComponent::BusyComponent(Window* window) : GuiComponent(window), - mBackground(window, ":/frame.png"), mGrid(window, Vector2i(5, 3)) + mBackground(window, ":/graphics/frame.png"), mGrid(window, Vector2i(5, 3)) { mAnimation = std::make_shared(mWindow); mAnimation->load(&BUSY_ANIMATION_DEF); diff --git a/es-core/src/components/ButtonComponent.cpp b/es-core/src/components/ButtonComponent.cpp index d0f47ce3a..daa888253 100644 --- a/es-core/src/components/ButtonComponent.cpp +++ b/es-core/src/components/ButtonComponent.cpp @@ -4,7 +4,7 @@ #include "utils/StringUtil.h" ButtonComponent::ButtonComponent(Window* window, const std::string& text, const std::string& helpText, const std::function& func) : GuiComponent(window), - mBox(window, ":/button.png"), + mBox(window, ":/graphics/button.png"), mFont(Font::get(FONT_SIZE_MEDIUM)), mFocused(false), mEnabled(true), @@ -72,7 +72,7 @@ void ButtonComponent::updateImage() { if(!mEnabled || !mPressedFunc) { - mBox.setImagePath(":/button_filled.png"); + mBox.setImagePath(":/graphics/button_filled.png"); mBox.setCenterColor(0x770000FF); mBox.setEdgeColor(0x770000FF); return; @@ -80,7 +80,7 @@ void ButtonComponent::updateImage() mBox.setCenterColor(0xFFFFFFFF); mBox.setEdgeColor(0xFFFFFFFF); - mBox.setImagePath(mFocused ? ":/button_filled.png" : ":/button.png"); + mBox.setImagePath(mFocused ? ":/graphics/button_filled.png" : ":/graphics/button.png"); } void ButtonComponent::render(const Transform4x4f& parentTrans) diff --git a/es-core/src/components/GridTileComponent.cpp b/es-core/src/components/GridTileComponent.cpp index ec7e329ea..d6f5312a0 100644 --- a/es-core/src/components/GridTileComponent.cpp +++ b/es-core/src/components/GridTileComponent.cpp @@ -9,7 +9,7 @@ GridTileComponent::GridTileComponent(Window* window) : GuiComponent(window), mBa mDefaultProperties.mSize = getDefaultTileSize(); mDefaultProperties.mPadding = Vector2f(16.0f, 16.0f); mDefaultProperties.mImageColor = 0xAAAAAABB; - mDefaultProperties.mBackgroundImage = ":/frame.png"; + mDefaultProperties.mBackgroundImage = ":/graphics/frame.png"; mDefaultProperties.mBackgroundCornerSize = Vector2f(16 ,16); mDefaultProperties.mBackgroundCenterColor = 0xAAAAEEFF; mDefaultProperties.mBackgroundEdgeColor = 0xAAAAEEFF; diff --git a/es-core/src/components/IList.h b/es-core/src/components/IList.h index 4a1b2424b..ce94560f3 100644 --- a/es-core/src/components/IList.h +++ b/es-core/src/components/IList.h @@ -89,7 +89,7 @@ public: mTitleOverlayOpacity = 0x00; mTitleOverlayColor = 0xFFFFFF00; mGradient.setResize((float)Renderer::getScreenWidth(), (float)Renderer::getScreenHeight()); - mGradient.setImage(":/scroll_gradient.png"); + mGradient.setImage(":/graphics/scroll_gradient.png"); mTitleOverlayFont = Font::get(FONT_SIZE_LARGE); } diff --git a/es-core/src/components/ImageGridComponent.h b/es-core/src/components/ImageGridComponent.h index bc863c378..882be806c 100644 --- a/es-core/src/components/ImageGridComponent.h +++ b/es-core/src/components/ImageGridComponent.h @@ -123,8 +123,8 @@ ImageGridComponent::ImageGridComponent(Window* window) : IList(mWindow); @@ -159,7 +159,7 @@ std::shared_ptr makeButtonGrid(Window* window, std::shared_ptr makeArrow(Window* window) { auto bracket = std::make_shared(window); - bracket->setImage(":/arrow.svg"); + bracket->setImage(":/graphics/arrow.svg"); bracket->setResize(0, Math::round(Font::get(FONT_SIZE_MEDIUM)->getLetterHeight())); return bracket; } diff --git a/es-core/src/components/OptionListComponent.h b/es-core/src/components/OptionListComponent.h index 6313e95d6..15f3a7029 100644 --- a/es-core/src/components/OptionListComponent.h +++ b/es-core/src/components/OptionListComponent.h @@ -9,8 +9,8 @@ #ifndef ES_CORE_COMPONENTS_OPTION_LIST_COMPONENT_H #define ES_CORE_COMPONENTS_OPTION_LIST_COMPONENT_H -#define CHECKED_PATH ":/checkbox_checked.svg" -#define UNCHECKED_PATH ":/checkbox_unchecked.svg" +#define CHECKED_PATH ":/graphics/checkbox_checked.svg" +#define UNCHECKED_PATH ":/graphics/checkbox_unchecked.svg" #include "GuiComponent.h" #include "Log.h" @@ -51,15 +51,15 @@ public: mRightArrow.setResize(0, mText.getFont()->getLetterHeight()); if(mMultiSelect) { - mRightArrow.setImage(":/arrow.svg"); + mRightArrow.setImage(":/graphics/arrow.svg"); addChild(&mRightArrow); } else { - mLeftArrow.setImage(":/option_arrow.svg"); + mLeftArrow.setImage(":/graphics/option_arrow.svg"); mLeftArrow.setFlipX(true); addChild(&mLeftArrow); - mRightArrow.setImage(":/option_arrow.svg"); + mRightArrow.setImage(":/graphics/option_arrow.svg"); addChild(&mRightArrow); } diff --git a/es-core/src/components/RatingComponent.cpp b/es-core/src/components/RatingComponent.cpp index c6572925c..9c66623d3 100644 --- a/es-core/src/components/RatingComponent.cpp +++ b/es-core/src/components/RatingComponent.cpp @@ -14,8 +14,8 @@ RatingComponent::RatingComponent(Window* window) : GuiComponent(window), mColorShift(0xFFFFFFFF), mColorShiftEnd(0xFFFFFFFF), mUnfilledColor(0xFFFFFFFF) { - mFilledTexture = TextureResource::get(":/star_filled.svg", true); - mUnfilledTexture = TextureResource::get(":/star_unfilled.svg", true); + mFilledTexture = TextureResource::get(":/graphics/star_filled.svg", true); + mUnfilledTexture = TextureResource::get(":/graphics/star_unfilled.svg", true); mValue = 0.5f; mSize = Vector2f(64 * NUM_RATING_STARS, 64); updateVertices(); diff --git a/es-core/src/components/SliderComponent.cpp b/es-core/src/components/SliderComponent.cpp index 385058cee..934aefe42 100644 --- a/es-core/src/components/SliderComponent.cpp +++ b/es-core/src/components/SliderComponent.cpp @@ -14,7 +14,7 @@ SliderComponent::SliderComponent(Window* window, float min, float max, float inc mValue = (max + min) / 2; mKnob.setOrigin(0.5f, 0.5f); - mKnob.setImage(":/slider_knob.svg"); + mKnob.setImage(":/graphics/slider_knob.svg"); setSize(Renderer::getScreenWidth() * 0.15f, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight()); } diff --git a/es-core/src/components/SwitchComponent.cpp b/es-core/src/components/SwitchComponent.cpp index b24d80502..15f7cdaa1 100644 --- a/es-core/src/components/SwitchComponent.cpp +++ b/es-core/src/components/SwitchComponent.cpp @@ -15,7 +15,7 @@ SwitchComponent::SwitchComponent( mImage(window), mState(state) { - mImage.setImage(":/off.svg"); + mImage.setImage(":/graphics/off.svg"); mImage.setResize(0, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight()); mSize = mImage.getSize(); } @@ -70,7 +70,7 @@ void SwitchComponent::setValue(const std::string& statestring) void SwitchComponent::onStateChanged() { - mImage.setImage(mState ? ":/on.svg" : ":/off.svg"); + mImage.setImage(mState ? ":/graphics/on.svg" : ":/graphics/off.svg"); } std::vector SwitchComponent::getHelpPrompts() diff --git a/es-core/src/components/TextEditComponent.cpp b/es-core/src/components/TextEditComponent.cpp index 6d34f0973..eebc423ce 100644 --- a/es-core/src/components/TextEditComponent.cpp +++ b/es-core/src/components/TextEditComponent.cpp @@ -18,7 +18,7 @@ TextEditComponent::TextEditComponent( Window* window) : GuiComponent(window), - mBox(window, ":/textinput_ninepatch.png"), + mBox(window, ":/graphics/textinput_ninepatch.png"), mFocused(false), mScrollOffset(0.0f, 0.0f), mCursor(0), mEditing(false), @@ -33,13 +33,13 @@ TextEditComponent::TextEditComponent( void TextEditComponent::onFocusGained() { mFocused = true; - mBox.setImagePath(":/textinput_ninepatch_active.png"); + mBox.setImagePath(":/graphics/textinput_ninepatch_active.png"); } void TextEditComponent::onFocusLost() { mFocused = false; - mBox.setImagePath(":/textinput_ninepatch.png"); + mBox.setImagePath(":/graphics/textinput_ninepatch.png"); } void TextEditComponent::onSizeChanged() diff --git a/es-core/src/guis/GuiComplexTextEditPopup.cpp b/es-core/src/guis/GuiComplexTextEditPopup.cpp index 1cc305985..40b94987e 100644 --- a/es-core/src/guis/GuiComplexTextEditPopup.cpp +++ b/es-core/src/guis/GuiComplexTextEditPopup.cpp @@ -27,7 +27,7 @@ GuiComplexTextEditPopup::GuiComplexTextEditPopup( const char* saveConfirmationText) : GuiComponent(window), mHelpStyle(helpstyle), - mBackground(window, ":/frame.png"), + mBackground(window, ":/graphics/frame.png"), mGrid(window, Vector2i(1, 5)), mMultiLine(multiLine), mInitValue(initValue), diff --git a/es-core/src/guis/GuiDetectDevice.cpp b/es-core/src/guis/GuiDetectDevice.cpp index 45d9a6bd2..a12c28ccf 100644 --- a/es-core/src/guis/GuiDetectDevice.cpp +++ b/es-core/src/guis/GuiDetectDevice.cpp @@ -11,7 +11,7 @@ #define HOLD_TIME 1000 GuiDetectDevice::GuiDetectDevice(Window* window, bool firstRun, const std::function& doneCallback) : GuiComponent(window), mFirstRun(firstRun), - mBackground(window, ":/frame.png"), mGrid(window, Vector2i(1, 5)) + mBackground(window, ":/graphics/frame.png"), mGrid(window, Vector2i(1, 5)) { mHoldingConfig = NULL; mHoldTime = 0; diff --git a/es-core/src/guis/GuiInputConfig.cpp b/es-core/src/guis/GuiInputConfig.cpp index 61ee522f9..0a8ce29ab 100755 --- a/es-core/src/guis/GuiInputConfig.cpp +++ b/es-core/src/guis/GuiInputConfig.cpp @@ -51,7 +51,7 @@ static const InputConfigStructure GUI_INPUT_CONFIG_LIST[inputCount] = #define HOLD_TO_SKIP_MS 1000 GuiInputConfig::GuiInputConfig(Window* window, InputConfig* target, bool reconfigureAll, const std::function& okCallback) : GuiComponent(window), - mBackground(window, ":/frame.png"), mGrid(window, Vector2i(1, 7)), + mBackground(window, ":/graphics/frame.png"), mGrid(window, Vector2i(1, 7)), mTargetConfig(target), mHoldingInput(false), mBusyAnim(window) { LOG(LogInfo) << "Configuring device " << target->getDeviceId() << " (" << target->getDeviceName() << ")."; diff --git a/es-core/src/guis/GuiMsgBox.cpp b/es-core/src/guis/GuiMsgBox.cpp index 5bec2cf64..4e1a6bd9a 100644 --- a/es-core/src/guis/GuiMsgBox.cpp +++ b/es-core/src/guis/GuiMsgBox.cpp @@ -18,7 +18,7 @@ GuiMsgBox::GuiMsgBox(Window* window, const HelpStyle& helpstyle, const std::stri const std::string& name3, const std::function& func3) : GuiComponent(window), mHelpStyle(helpstyle), - mBackground(window, ":/frame.png"), + mBackground(window, ":/graphics/frame.png"), mGrid(window, Vector2i(1, 2)) { float width = Renderer::getScreenWidth() * 0.6f; // Max width. diff --git a/es-core/src/guis/GuiTextEditPopup.cpp b/es-core/src/guis/GuiTextEditPopup.cpp index f3df84c54..de139974e 100644 --- a/es-core/src/guis/GuiTextEditPopup.cpp +++ b/es-core/src/guis/GuiTextEditPopup.cpp @@ -23,7 +23,7 @@ GuiTextEditPopup::GuiTextEditPopup( const char* saveConfirmationText) : GuiComponent(window), mHelpStyle(helpstyle), - mBackground(window, ":/frame.png"), + mBackground(window, ":/graphics/frame.png"), mGrid(window, Vector2i(1, 3)), mMultiLine(multiLine), mInitValue(initValue), diff --git a/es-core/src/renderers/Renderer.cpp b/es-core/src/renderers/Renderer.cpp index 52630f911..d70ddc19a 100644 --- a/es-core/src/renderers/Renderer.cpp +++ b/es-core/src/renderers/Renderer.cpp @@ -27,7 +27,7 @@ namespace Renderer { size_t width = 0; size_t height = 0; - ResourceData resData = ResourceManager::getInstance()->getFileData(":/window_icon_256.png"); + ResourceData resData = ResourceManager::getInstance()->getFileData(":/graphics/window_icon_256.png"); std::vector rawData = ImageIO::loadFromMemoryRGBA32(resData.ptr.get(), resData.length, width, height); if(!rawData.empty()) diff --git a/es-core/src/resources/Font.cpp b/es-core/src/resources/Font.cpp index e92703672..82ba1714f 100644 --- a/es-core/src/resources/Font.cpp +++ b/es-core/src/resources/Font.cpp @@ -253,19 +253,19 @@ std::vector getFallbackFontPaths() // Vera sans Unicode: fontPaths.push_back(ResourceManager::getInstance()-> - getResourcePath(":/DejaVuSans.ttf")); + getResourcePath(":/fonts/DejaVuSans.ttf")); // Freefont monospaced: fontPaths.push_back(ResourceManager::getInstance()-> - getResourcePath(":/FreeMono.ttf")); + getResourcePath(":/fonts/FreeMono.ttf")); // Various languages, such as Japanese and Chinese: fontPaths.push_back(ResourceManager::getInstance()-> - getResourcePath(":/DroidSansFallbackFull.ttf")); + getResourcePath(":/fonts/DroidSansFallbackFull.ttf")); // Korean: fontPaths.push_back(ResourceManager::getInstance()-> - getResourcePath(":/NanumMyeongjo.ttf")); + getResourcePath(":/fonts/NanumMyeongjo.ttf")); // Font Awesome icon glyphs, used for star-flagging favorites in the gamelists: fontPaths.push_back(ResourceManager::getInstance()-> - getResourcePath(":/fontawesome-webfont.ttf")); + getResourcePath(":/fonts/fontawesome-webfont.ttf")); fontPaths.shrink_to_fit(); return fontPaths; diff --git a/es-core/src/resources/Font.h b/es-core/src/resources/Font.h index c8cac2d75..ab8cc80a0 100644 --- a/es-core/src/resources/Font.h +++ b/es-core/src/resources/Font.h @@ -29,8 +29,8 @@ class TextCache; #define FONT_SIZE_LARGE ((unsigned int)(0.085f * Math::min((int)Renderer::getScreenHeight(), \ (int)Renderer::getScreenWidth()))) -#define FONT_PATH_LIGHT ":/opensans_hebrew_condensed_light.ttf" -#define FONT_PATH_REGULAR ":/opensans_hebrew_condensed_regular.ttf" +#define FONT_PATH_LIGHT ":/fonts/opensans_hebrew_condensed_light.ttf" +#define FONT_PATH_REGULAR ":/fonts/opensans_hebrew_condensed_regular.ttf" enum Alignment { ALIGN_LEFT, diff --git a/es-core/src/resources/ResourceManager.cpp b/es-core/src/resources/ResourceManager.cpp index 1d53cbc8f..1d9d4706c 100644 --- a/es-core/src/resources/ResourceManager.cpp +++ b/es-core/src/resources/ResourceManager.cpp @@ -10,6 +10,18 @@ #include "utils/FileSystemUtil.h" #include +#ifdef ES_INSTALL_PREFIX +std::string installPrefix = ES_INSTALL_PREFIX; +#else +std::string installPrefix = "/usr/local"; +#endif + +#ifdef ES_DATAROOTDIR +std::string dataRootDir = ES_DATAROOTDIR; +#else +std::string dataRootDir = "share"; +#endif + auto array_deleter = [](unsigned char* p) { delete[] p; }; auto nop_deleter = [](unsigned char* /*p*/) { }; @@ -33,18 +45,17 @@ std::string ResourceManager::getResourcePath(const std::string& path) const if ((path[0] == ':') && (path[1] == '/')) { std::string test; - // Check in homepath. + // Check under the home directory. test = Utils::FileSystem::getHomePath() + "/.emulationstation/resources/" + &path[2]; if (Utils::FileSystem::exists(test)) return test; - // Check in exepath. - test = Utils::FileSystem::getExePath() + "/resources/" + &path[2]; - if (Utils::FileSystem::exists(test)) - return test; - - // Check in cwd. - test = Utils::FileSystem::getCWDPath() + "/resources/" + &path[2]; + // Check under the data installation directory. + // The base directory is the value set for CMAKE_INSTALL_DIRECTORY during build. + // The datarootdir directory is the value set for CMAKE_INSTALL_DATAROOTDIR during build. + // If not defined, the default prefix path '/usr/local' and the default datarootdir + // directory 'share' will be used, i.e. '/usr/local/share'. + test = installPrefix + "/" + dataRootDir + "/emulationstation/resources/" + &path[2]; if (Utils::FileSystem::exists(test)) return test; } diff --git a/resources/mamebioses.xml b/resources/MAME/mamebioses.xml similarity index 100% rename from resources/mamebioses.xml rename to resources/MAME/mamebioses.xml diff --git a/resources/mamedevices.xml b/resources/MAME/mamedevices.xml similarity index 100% rename from resources/mamedevices.xml rename to resources/MAME/mamedevices.xml diff --git a/resources/mamenames.xml b/resources/MAME/mamenames.xml similarity index 100% rename from resources/mamenames.xml rename to resources/MAME/mamenames.xml diff --git a/resources/DejaVuSans.ttf b/resources/fonts/DejaVuSans.ttf similarity index 100% rename from resources/DejaVuSans.ttf rename to resources/fonts/DejaVuSans.ttf diff --git a/resources/DroidSansFallbackFull.ttf b/resources/fonts/DroidSansFallbackFull.ttf similarity index 100% rename from resources/DroidSansFallbackFull.ttf rename to resources/fonts/DroidSansFallbackFull.ttf diff --git a/resources/FreeMono.ttf b/resources/fonts/FreeMono.ttf similarity index 100% rename from resources/FreeMono.ttf rename to resources/fonts/FreeMono.ttf diff --git a/resources/NanumMyeongjo.ttf b/resources/fonts/NanumMyeongjo.ttf similarity index 100% rename from resources/NanumMyeongjo.ttf rename to resources/fonts/NanumMyeongjo.ttf diff --git a/resources/fontawesome-webfont.ttf b/resources/fonts/fontawesome-webfont.ttf similarity index 100% rename from resources/fontawesome-webfont.ttf rename to resources/fonts/fontawesome-webfont.ttf diff --git a/resources/opensans_hebrew_condensed_light.ttf b/resources/fonts/opensans_hebrew_condensed_light.ttf similarity index 100% rename from resources/opensans_hebrew_condensed_light.ttf rename to resources/fonts/opensans_hebrew_condensed_light.ttf diff --git a/resources/opensans_hebrew_condensed_regular.ttf b/resources/fonts/opensans_hebrew_condensed_regular.ttf similarity index 100% rename from resources/opensans_hebrew_condensed_regular.ttf rename to resources/fonts/opensans_hebrew_condensed_regular.ttf diff --git a/resources/arrow.svg b/resources/graphics/arrow.svg similarity index 100% rename from resources/arrow.svg rename to resources/graphics/arrow.svg diff --git a/resources/busy_0.svg b/resources/graphics/busy_0.svg similarity index 100% rename from resources/busy_0.svg rename to resources/graphics/busy_0.svg diff --git a/resources/busy_1.svg b/resources/graphics/busy_1.svg similarity index 100% rename from resources/busy_1.svg rename to resources/graphics/busy_1.svg diff --git a/resources/busy_2.svg b/resources/graphics/busy_2.svg similarity index 100% rename from resources/busy_2.svg rename to resources/graphics/busy_2.svg diff --git a/resources/busy_3.svg b/resources/graphics/busy_3.svg similarity index 100% rename from resources/busy_3.svg rename to resources/graphics/busy_3.svg diff --git a/resources/button.png b/resources/graphics/button.png similarity index 100% rename from resources/button.png rename to resources/graphics/button.png diff --git a/resources/button_filled.png b/resources/graphics/button_filled.png similarity index 100% rename from resources/button_filled.png rename to resources/graphics/button_filled.png diff --git a/resources/cartridge.svg b/resources/graphics/cartridge.svg similarity index 100% rename from resources/cartridge.svg rename to resources/graphics/cartridge.svg diff --git a/resources/checkbox_checked.svg b/resources/graphics/checkbox_checked.svg similarity index 100% rename from resources/checkbox_checked.svg rename to resources/graphics/checkbox_checked.svg diff --git a/resources/checkbox_unchecked.svg b/resources/graphics/checkbox_unchecked.svg similarity index 100% rename from resources/checkbox_unchecked.svg rename to resources/graphics/checkbox_unchecked.svg diff --git a/resources/fav_add.svg b/resources/graphics/fav_add.svg similarity index 100% rename from resources/fav_add.svg rename to resources/graphics/fav_add.svg diff --git a/resources/fav_remove.svg b/resources/graphics/fav_remove.svg similarity index 100% rename from resources/fav_remove.svg rename to resources/graphics/fav_remove.svg diff --git a/resources/folder.svg b/resources/graphics/folder.svg similarity index 100% rename from resources/folder.svg rename to resources/graphics/folder.svg diff --git a/resources/frame.png b/resources/graphics/frame.png similarity index 100% rename from resources/frame.png rename to resources/graphics/frame.png diff --git a/resources/off.svg b/resources/graphics/off.svg similarity index 100% rename from resources/off.svg rename to resources/graphics/off.svg diff --git a/resources/on.svg b/resources/graphics/on.svg similarity index 100% rename from resources/on.svg rename to resources/graphics/on.svg diff --git a/resources/option_arrow.svg b/resources/graphics/option_arrow.svg similarity index 100% rename from resources/option_arrow.svg rename to resources/graphics/option_arrow.svg diff --git a/resources/scroll_gradient.png b/resources/graphics/scroll_gradient.png similarity index 100% rename from resources/scroll_gradient.png rename to resources/graphics/scroll_gradient.png diff --git a/resources/slider_knob.svg b/resources/graphics/slider_knob.svg similarity index 100% rename from resources/slider_knob.svg rename to resources/graphics/slider_knob.svg diff --git a/resources/splash.svg b/resources/graphics/splash.svg similarity index 100% rename from resources/splash.svg rename to resources/graphics/splash.svg diff --git a/resources/star_filled.svg b/resources/graphics/star_filled.svg similarity index 100% rename from resources/star_filled.svg rename to resources/graphics/star_filled.svg diff --git a/resources/star_unfilled.svg b/resources/graphics/star_unfilled.svg similarity index 100% rename from resources/star_unfilled.svg rename to resources/graphics/star_unfilled.svg diff --git a/resources/textinput_ninepatch.png b/resources/graphics/textinput_ninepatch.png similarity index 100% rename from resources/textinput_ninepatch.png rename to resources/graphics/textinput_ninepatch.png diff --git a/resources/textinput_ninepatch_active.png b/resources/graphics/textinput_ninepatch_active.png similarity index 100% rename from resources/textinput_ninepatch_active.png rename to resources/graphics/textinput_ninepatch_active.png diff --git a/resources/window_icon_256.png b/resources/graphics/window_icon_256.png similarity index 100% rename from resources/window_icon_256.png rename to resources/graphics/window_icon_256.png