From 15aef9200950d43a9ffe5ecb8ea70eda5f331f8e Mon Sep 17 00:00:00 2001 From: Pieter Hulshoff Date: Sun, 17 Jul 2016 13:17:24 +0200 Subject: [PATCH] Increased support for common reloadableImage files for: - numberButtons - numberPlayers - year - title - manufacturer - genre - ctrlType - joyWays - rating These files, if supported, used to be in directories starting with _ in the collections directory, e.g. collections/_manufacturer. They should now be placed in collections/_common/medium_artwork/manufacturer etc. Two modes were added to support this: - mode="common" - mode="commonlayout" This last mode forces RetroFE to expect the files in the selected layout directory, so e.g. layouts/Aeon Nox 16x9/collections/_common/medium_artwork/manufacturer/. So, where before you would use #include -ReloadableMedia::ReloadableMedia(Configuration &config, bool systemMode, bool layoutMode, std::string type, Page &p, int displayOffset, bool isVideo, Font *font, float scaleX, float scaleY) +ReloadableMedia::ReloadableMedia(Configuration &config, bool systemMode, bool layoutMode, bool commonMode, std::string type, Page &p, int displayOffset, bool isVideo, Font *font, float scaleX, float scaleY) : Component(p) , config_(config) , systemMode_(systemMode) , layoutMode_(layoutMode) + , commonMode_(commonMode) , loadedComponent_(NULL) , videoInst_(NULL) , isVideo_(isVideo) @@ -222,11 +223,11 @@ void ReloadableMedia::reloadTexture() std::string typeLC = Utils::toLower(type_); - if(typeLC == "numberButtons") + if(typeLC == "numberbuttons") { basename = selectedItem->numberButtons; } - else if(typeLC == "numberPlayers") + else if(typeLC == "numberplayers") { basename = selectedItem->numberPlayers; } @@ -249,6 +250,18 @@ void ReloadableMedia::reloadTexture() { basename = selectedItem->genre; } + else if(typeLC == "ctrltype") + { + basename = selectedItem->ctrlType; + } + else if(typeLC == "joyways") + { + basename = selectedItem->joyWays; + } + else if(typeLC == "rating") + { + basename = selectedItem->rating; + } Utils::replaceSlashesWithUnderscores(basename); @@ -334,7 +347,14 @@ Component *ReloadableMedia::findComponent(std::string collection, std::string ty { std::string layoutName; config_.getProperty("layout", layoutName); - imagePath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, "collections", collection); + if (commonMode_) + { + imagePath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, "collections", "_common"); + } + else + { + imagePath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, "collections", collection); + } if (systemMode) imagePath = Utils::combinePath(imagePath, "system_artwork"); else @@ -342,7 +362,18 @@ Component *ReloadableMedia::findComponent(std::string collection, std::string ty } else { - config_.getMediaPropertyAbsolutePath(collection, type, systemMode, imagePath); + if (commonMode_) + { + imagePath = Utils::combinePath(Configuration::absolutePath, "collections", "_common" ); + if (systemMode) + imagePath = Utils::combinePath(imagePath, "system_artwork"); + else + imagePath = Utils::combinePath(imagePath, "medium_artwork", type); + } + else + { + config_.getMediaPropertyAbsolutePath(collection, type, systemMode, imagePath); + } } if(type == "video") diff --git a/RetroFE/Source/Graphics/Component/ReloadableMedia.h b/RetroFE/Source/Graphics/Component/ReloadableMedia.h index ed07d77..47bd789 100644 --- a/RetroFE/Source/Graphics/Component/ReloadableMedia.h +++ b/RetroFE/Source/Graphics/Component/ReloadableMedia.h @@ -27,7 +27,7 @@ class Image; class ReloadableMedia : public Component { public: - ReloadableMedia(Configuration &config, bool systemMode, bool layoutMode, std::string type, Page &page, int displayOffset, bool isVideo, Font *font, float scaleX, float scaleY); + ReloadableMedia(Configuration &config, bool systemMode, bool layoutMode, bool commonMode, std::string type, Page &page, int displayOffset, bool isVideo, Font *font, float scaleX, float scaleY); virtual ~ReloadableMedia(); void update(float dt); void draw(); @@ -44,6 +44,7 @@ private: Configuration &config_; bool systemMode_; bool layoutMode_; + bool commonMode_; Component *loadedComponent_; IVideo *videoInst_; bool isVideo_; diff --git a/RetroFE/Source/Graphics/PageBuilder.cpp b/RetroFE/Source/Graphics/PageBuilder.cpp index 0e34492..c0b5fe8 100644 --- a/RetroFE/Source/Graphics/PageBuilder.cpp +++ b/RetroFE/Source/Graphics/PageBuilder.cpp @@ -463,6 +463,7 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName, xml_attribute<> *alignmentXml = componentXml->first_attribute("alignment"); bool systemMode = false; bool layoutMode = false; + bool commonMode = false; int selectedOffset = 0; if(tagName == "reloadableVideo") { @@ -495,6 +496,15 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName, { layoutMode = true; } + if(sysMode == "common") + { + commonMode = true; + } + if(sysMode == "commonlayout") + { + layoutMode = true; + commonMode = true; + } if(sysMode == "systemlayout") { systemMode = true; @@ -596,7 +606,7 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName, else { Font *font = addFont(componentXml, NULL); - c = new ReloadableMedia(config_, systemMode, layoutMode, type->value(), *page, selectedOffset, (tagName == "reloadableVideo"), font, scaleX_, scaleY_); + c = new ReloadableMedia(config_, systemMode, layoutMode, commonMode, type->value(), *page, selectedOffset, (tagName == "reloadableVideo"), font, scaleX_, scaleY_); xml_attribute<> *textFallback = componentXml->first_attribute("textFallback"); if(textFallback && Utils::toLower(textFallback->value()) == "true")