From e59c430b89d129a3f37697d13cf07f39fe7d9563 Mon Sep 17 00:00:00 2001 From: Aloshi Date: Sun, 6 Jan 2013 14:33:50 -0600 Subject: [PATCH] Added support. --- README.md | 5 +++++ THEMES.md | 32 ++++++++++++++++++++++++++++---- changelog.txt | 3 +++ src/XMLReader.cpp | 17 +++++++---------- src/components/GuiGameList.cpp | 2 +- src/components/GuiTheme.cpp | 25 ++++++++++++++++++++++--- src/components/GuiTheme.h | 3 ++- src/main.cpp | 1 + 8 files changed, 69 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index c6b1f98cf..4e81c1182 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,11 @@ The switch `--ignore-gamelist` can be used to ignore the gamelist and use the no **Making a gamelist.xml by hand sucks, so a cool guy named Pendor made a python script which automatically generates a gamelist.xml for you, with boxart automatically downloaded. It can be found here:** https://github.com/elpendor/ES-scraper +I found a bug! +============== + +The best way to report a bug is to post an issue on GitHub. Try to post the simplest steps possible to reproduce the bug. Include files you think might be related (except for ROMs, of course). If you haven't re-run ES since the crash, the log file `~/.emulationstation/es_log.txt` is also helpful. + Themes ====== diff --git a/THEMES.md b/THEMES.md index 5cfd37d65..9b1331628 100644 --- a/THEMES.md +++ b/THEMES.md @@ -16,7 +16,7 @@ Colors are hex values, either 6 or 8 characters, defined as RRGGBB or RRGGBBAA. Example ======= -Here's a simple theme that defines some colors and displays a background: +Here's a theme that defines some colors, displays a background, and displays a logo in the top left corner: ``` 0000FF @@ -29,10 +29,36 @@ Here's a simple theme that defines some colors and displays a background: 1 1 0 0 + + + image + ./theme/logo.png + 0 0 + 0.4 0 + 0 0 + + + + + 0000FF + 00FF00 + + + image + ./theme/background.png + 0 0 + 1 1 + 0 0 + + + ``` -All themes must be enclosed in a `` tag. +Themes can be defined with two tags: `` and ``. +You can define both a normal and basic theme in the same file. + +If EmulationStation is running in "basic" mode, it will try to use ``. If that doesn't exist or ES is running in "detailed" mode (a gamelist.xml is present), `` will be used. Components @@ -82,8 +108,6 @@ Display tags define some "meta" display attributes about your theme. Display tag `` - the percentage to offset the text in the list by. Default is 0.005. Only works in combination with ``. -~~`` - the percentage to offset the displayed game image by. Default is the height of the header font.~~ - **Game image attributes:** diff --git a/changelog.txt b/changelog.txt index 6a49c5000..af1b68104 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,6 @@ +January 6, 2012 +-Added tag support. + December 20, 2012 -Added --debug command-line option. Useful if you're having input config problems. -Changed things so you can finish configuring without a keyboard. You should no longer need a keyboard to set up ES; SSH access should be sufficient. diff --git a/src/XMLReader.cpp b/src/XMLReader.cpp index 03a95f51f..3ccea64f0 100644 --- a/src/XMLReader.cpp +++ b/src/XMLReader.cpp @@ -86,7 +86,7 @@ GameData* createGameFromPath(std::string gameAbsPath, SystemData* system) //if for some reason this function is broken, break out of this while instead of freezing if(loops > gamePath.length() * 2) { - std::cerr << "breaking out of loop for path \"" << gamePath << "\"\n"; + LOG(LogError) << "createGameFromPath breaking out of loop for path \"" << gamePath << "\" to prevent infinite loop (please report this)"; break; } loops++; @@ -108,22 +108,21 @@ void parseGamelist(SystemData* system) if(xmlpath.empty()) return; - std::cout << "Parsing XML file \"" << xmlpath << "\"..."; + LOG(LogInfo) << "Parsing XML file \"" << xmlpath << "\"..."; pugi::xml_document doc; pugi::xml_parse_result result = doc.load_file(xmlpath.c_str()); if(!result) { - std::cerr << "Error parsing XML file \"" << xmlpath << "\"!\n"; - std::cerr << " " << result.description() << "\n"; + LOG(LogError) << "Error parsing XML file \"" << xmlpath << "\"!\n " << result.description(); return; } pugi::xml_node root = doc.child("gameList"); if(!root) { - std::cerr << "Error - could not find node in XML document!\n"; + LOG(LogError) << "Could not find node in gamelist \"" << xmlpath << "\"!"; return; } @@ -132,8 +131,8 @@ void parseGamelist(SystemData* system) pugi::xml_node pathNode = gameNode.child("path"); if(!pathNode) { - std::cerr << "Error - node contains no child!\n"; - return; + LOG(LogError) << " node contains no child!"; + continue; } std::string path = pathNode.text().get(); @@ -179,9 +178,7 @@ void parseGamelist(SystemData* system) game->set(newName, newDesc, newImage); }else{ - std::cerr << "Game at \"" << path << "\" does not exist!\n"; + LOG(LogWarning) << "Game at \"" << path << "\" does not exist!"; } } - - std::cout << "done.\n"; } diff --git a/src/components/GuiGameList.cpp b/src/components/GuiGameList.cpp index 7d13420cd..a0f990569 100644 --- a/src/components/GuiGameList.cpp +++ b/src/components/GuiGameList.cpp @@ -10,7 +10,7 @@ GuiGameList::GuiGameList(bool useDetail) { mDetailed = useDetail; - mTheme = new GuiTheme(); //not a child because it's rendered manually by GuiGameList::onRender (to make sure it's rendered first) + mTheme = new GuiTheme(mDetailed); //not a child because it's rendered manually by GuiGameList::onRender (to make sure it's rendered first) //The GuiGameList can use the older, simple game list if so desired. //The old view only shows a list in the center of the screen; the new view can display an image and description. diff --git a/src/components/GuiTheme.cpp b/src/components/GuiTheme.cpp index 7ffbb538a..09fea9be5 100644 --- a/src/components/GuiTheme.cpp +++ b/src/components/GuiTheme.cpp @@ -51,8 +51,10 @@ Font* GuiTheme::getDescriptionFont() return mDescFont; } -GuiTheme::GuiTheme(std::string path) +GuiTheme::GuiTheme(bool detailed, std::string path) { + mDetailed = detailed; + mSoundMap["menuScroll"] = new Sound(); mSoundMap["menuSelect"] = new Sound(); mSoundMap["menuBack"] = new Sound(); @@ -160,7 +162,24 @@ void GuiTheme::readXML(std::string path) return; } - pugi::xml_node root = doc.child("theme"); + pugi::xml_node root; + + if(!mDetailed) + { + //if we're using the basic view, check if there's a basic version of the theme + root = doc.child("basicTheme"); + } + + if(!root) + { + root = doc.child("theme"); + } + + if(!root) + { + LOG(LogError) << "No theme tag found in theme \"" << path << "\"!"; + return; + } //load non-component theme stuff mColorMap["primary"] = resolveColor(root.child("listPrimaryColor").text().get(), mColorMap["primary"]); @@ -219,7 +238,7 @@ void GuiTheme::readXML(std::string path) //actually read the components createComponentChildren(root, this); - LOG(LogInfo) << "Loading complete."; + LOG(LogInfo) << "Theme loading complete."; } //recursively creates components (with proper parenting) diff --git a/src/components/GuiTheme.h b/src/components/GuiTheme.h index 514289f6f..3f1b1b0b3 100644 --- a/src/components/GuiTheme.h +++ b/src/components/GuiTheme.h @@ -11,7 +11,7 @@ class GuiTheme : public GuiComponent { public: - GuiTheme(std::string path = ""); + GuiTheme(bool detailed, std::string path = ""); ~GuiTheme(); void readXML(std::string path); @@ -42,6 +42,7 @@ private: std::vector mComponentVector; std::string mPath; + bool mDetailed; std::map mColorMap; std::map mBoolMap; diff --git a/src/main.cpp b/src/main.cpp index 01842b927..54708114c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -57,6 +57,7 @@ int main(int argc, char* argv[]) }else if(strcmp(argv[i], "--debug") == 0) { DEBUG = true; + Log::setReportingLevel(LogDebug); }else if(strcmp(argv[i], "--help") == 0) { std::cout << "EmulationStation, a graphical front-end for ROM browsing.\n";