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 <reloadableImage type="manufacturer", you should now use <reloadableImage type="manufacturer" mode="common", and the files are expected in collections/_common/medium_artwork/manufacturer/ in stead of collections/_manufacturer. It may seem like more work, but at least it's a generic way for all common art to be handled.
This commit is contained in:
Pieter Hulshoff 2016-07-17 13:17:24 +02:00
parent 1689d570c2
commit 15aef92009
4 changed files with 50 additions and 28 deletions

View File

@ -354,27 +354,7 @@ void Configuration::getMediaPropertyAbsolutePath(std::string collectionName, std
baseMediaPath = Utils::combinePath(absolutePath, "collections");
}
if(mediaType == "manufacturer")
{
value = Utils::combinePath(baseMediaPath, "_manufacturer");
}
else if(mediaType == "genre")
{
value = Utils::combinePath(baseMediaPath, "_genre");
}
else if(mediaType == "year")
{
value = Utils::combinePath(baseMediaPath, "_year");
}
else if(mediaType == "number_players")
{
value = Utils::combinePath(baseMediaPath, "_number_players");
}
else if(mediaType == "number_buttons")
{
value = Utils::combinePath(baseMediaPath, "_number_buttons");
}
else if(system)
if(system)
{
value = Utils::combinePath(baseMediaPath, collectionName, "system_artwork");
}

View File

@ -28,11 +28,12 @@
#include <vector>
#include <iostream>
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")

View File

@ -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_;

View File

@ -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")