Added <theme> tag to es_systems.cfg.

This commit is contained in:
Aloshi 2014-06-15 12:34:22 -05:00
parent 0b83c7dc96
commit 71700bd0c9
4 changed files with 47 additions and 25 deletions

View file

@ -3,9 +3,17 @@ EmulationStation
A cross-platform graphical front-end for emulators with controller navigation.
Project website: http://emulationstation.org
**Raspberry Pi users:**
A cool guy named petrockblog made a script which automatically installs many emulators and ES. It also includes options for configuring your RPi and setting it up to boot directly into ES. You can find it here: https://github.com/petrockblog/RetroPie-Setup
Download
========
Download a pre-compiled version at [emulationstation.org](http://emulationstation.org#download).
I found a bug! I have a problem!
================================
@ -33,21 +41,20 @@ EmulationStation has a few dependencies. For building, you'll need SDL2, Boost (
**On Debian/Ubuntu:**
All of this be easily installed with apt-get:
```bash
sudo apt-get install libsdl2-dev libboost-dev libboost-system-dev libboost-filesystem-dev libboost-date-time-dev libfreeimage-dev libfreetype6-dev libeigen3-dev libcurl-dev libasound2-dev
sudo apt-get install libsdl2-dev libboost-system-dev libboost-filesystem-dev libboost-date-time-dev libfreeimage-dev libfreetype6-dev libeigen3-dev libcurl4-openssl-dev libasound2-dev libgl1-mesa-dev
```
Unless you're on the Raspberry Pi, you'll also need OpenGL:
```bash
sudo apt-get install libgl1-mesa-dev
```
**Generate and Build Makefile with CMake:**
Then, generate and build the Makefile with CMake:
```bash
cd YourEmulationStationDirectory
cmake .
make
```
**On the Raspberry Pi:**
Complete Raspberry Pi build instructions at [emulationstation.org](http://emulationstation.org/gettingstarted.html#install_rpi_standalone).
**On Windows:**
[Boost](http://www.boost.org/users/download/) (you'll need to compile yourself or get the pre-compiled binaries)
@ -62,7 +69,7 @@ make
[CURL](http://curl.haxx.se/download.html) (you'll need to compile or get the pre-compiled (DLL version))
(remember to copy necessary .DLLs into the same folder as the executable: FreeImage.dll, freetype6.dll, SDL2.dll, and zlib1.dll)
(remember to copy necessary .DLLs into the same folder as the executable: FreeImage.dll, freetype6.dll, SDL2.dll, libcurl.dll, and zlib1.dll)
[CMake](http://www.cmake.org/cmake/resources/software.html) (this is used for generating the Visual Studio project)
@ -73,12 +80,10 @@ Configuring
===========
**~/.emulationstation/es_systems.cfg:**
When first run, an example systems configuration file will be created at $HOME/.emulationstation/es_systems.cfg. This example has some comments explaining how to write the configuration file, and an example RetroArch launch command. See the "Writing an es_systems.cfg" section for more information.
When first run, an example systems configuration file will be created at `~/.emulationstation/es_systems.cfg`. `~` is `$HOME` on Linux, and `%HOMEPATH%` on Windows. This example has some comments explaining how to write the configuration file. See the "Writing an es_systems.cfg" section for more information.
**Keep in mind you'll have to set up your emulator separately from EmulationStation!**
After you launch a game, EmulationStation will return once your system's command terminates (i.e. your emulator closes).
**~/.emulationstation/es_input.cfg:**
When you first start EmulationStation, you will be prompted to configure an input device. The process is thus:
@ -94,7 +99,7 @@ The new configuration will be added to the `~/.emulationstation/es_input.cfg` fi
**Both new and old devices can be (re)configured at any time by pressing the Start button and choosing "CONFIGURE INPUT".** From here, you may unplug the device you used to open the menu and plug in a new one, if necessary. New devices will be appended to the existing input configuration file, so your old devices will remain configured.
**If things stop working, you can delete the `~/.emulationstation/es_input.cfg` file to make the input configuration screen reappear on next run.**
**If your controller stops working, you can delete the `~/.emulationstation/es_input.cfg` file to make the input configuration screen re-appear on next run.**
You can use `--help` or `-h` to view a list of command-line options. Briefly outlined here:
@ -115,6 +120,8 @@ As long as ES hasn't frozen, you can always press F4 to close the application.
Writing an es_systems.cfg
=========================
Complete configuration instructions at [emulationstation.org](http://emulationstation.org/gettingstarted.html#config).
The `es_systems.cfg` file contains the system configuration data for EmulationStation, written in XML. This tells EmulationStation what systems you have, what platform they correspond to (for scraping), and where the games are located.
ES will check two places for an es_systems.cfg file, in the following order, stopping after it finds one that works:
@ -135,12 +142,12 @@ All systems must be contained within the <systemList> tag.-->
<!-- Here's an example system to get you started. -->
<system>
<!-- A short name, used internally. -->
<name>SNES</name>
<name>snes</name>
<!-- A "pretty" name, displayed in the menus and such. This one is optional. -->
<fullname>Super Nintendo Entertainment System</fullname>
<!-- The path to start searching for ROMs in. '~' will be expanded to $HOME or $HOMEPATH, depending on platform.
<!-- The path to start searching for ROMs in. '~' will be expanded to $HOME or %HOMEPATH%, depending on platform.
All subdirectories (and non-recursive links) will be included. -->
<path>~/roms/snes</path>
@ -148,14 +155,18 @@ All systems must be contained within the <systemList> tag.-->
You MUST include the period at the start of the extension! It's also case sensitive. -->
<extension>.smc .sfc .SMC .SFC</extension>
<!-- The shell command executed when a game is selected. A few special tags are replaced if found in a command, like %ROM%. -->
<!-- The shell command executed when a game is selected. A few special tags are replaced if found in a command, like %ROM% (see below). -->
<command>snesemulator %ROM%</command>
<!-- This example would run the bash command "snesemulator /home/user/roms/snes/Super\ Mario\ World.sfc". -->
<!-- The platform(s) to use when scraping. You can see the full list of accepted platforms in src/PlatformIds.cpp.
It's case sensitive, but everything is lowercase. This tag is optional.
You can use multiple platforms too, delimited with any of the whitespace characters (", \r\n\t"), eg: "<platform>genesis, megadrive</platform>" -->
You can use multiple platforms too, delimited with any of the whitespace characters (", \r\n\t"), eg: "genesis, megadrive" -->
<platform>snes</platform>
<!-- The theme to load from the current theme set. See THEMES.md for more information.
This tag is optional; if not set, it will use the value of <name>. -->
<theme>snes</theme>
</system>
</systemList>
```

View file

@ -32,8 +32,10 @@ If that file doesn't exist, ES will try to find the theme in the current **theme
The theme set system makes it easy for users to try different themes and allows distributions to include multiple theme options. Users can change the currently active theme set in the "UI Settings" menu. The option is only visible if at least one theme set exists.
There are two places ES can load theme sets from:
* `[HOME]/.emulationstation/themes/[CURRENT_THEME_SET]/[SYSTEM_NAME]/theme.xml`
* `/etc/emulationstation/themes/[CURRENT_THEME_SET]/[SYSTEM_NAME]/theme.xml`
* `[HOME]/.emulationstation/themes/[CURRENT_THEME_SET]/[SYSTEM_THEME]/theme.xml`
* `/etc/emulationstation/themes/[CURRENT_THEME_SET]/[SYSTEM_THEME]/theme.xml`
`[SYSTEM_THEME]` is the `<theme>` tag for the system, as defined in `es_systems.cfg`. If the `<theme>` tag is not set, ES will use the system's `<name>`.
If both files happen to exist, ES will pick the first one (the one located in the home directory).

View file

@ -18,7 +18,7 @@ std::vector<SystemData*> SystemData::sSystemVector;
namespace fs = boost::filesystem;
SystemData::SystemData(const std::string& name, const std::string& fullName, const std::string& startPath, const std::vector<std::string>& extensions,
const std::string& command, const std::vector<PlatformIds::PlatformId>& platformIds)
const std::string& command, const std::vector<PlatformIds::PlatformId>& platformIds, const std::string& themeFolder)
{
mName = name;
mFullName = fullName;
@ -34,6 +34,7 @@ SystemData::SystemData(const std::string& name, const std::string& fullName, con
mSearchExtensions = extensions;
mLaunchCommand = command;
mPlatformIds = platformIds;
mThemeFolder = themeFolder;
mRootFolder = new FileData(FOLDER, mStartPath, this);
mRootFolder->metadata.set("name", mFullName);
@ -254,7 +255,7 @@ bool SystemData::loadConfig()
for(pugi::xml_node system = systemList.child("system"); system; system = system.next_sibling("system"))
{
std::string name, fullname, path, cmd;
std::string name, fullname, path, cmd, themeFolder;
PlatformIds::PlatformId platformId = PlatformIds::PLATFORM_UNKNOWN;
name = system.child("name").text().get();
@ -290,6 +291,9 @@ bool SystemData::loadConfig()
platformIds.push_back(platformId);
}
// theme folder
themeFolder = system.child("theme").text().as_string(name.c_str());
//validate
if(name.empty() || path.empty() || extensions.empty() || cmd.empty())
{
@ -301,7 +305,7 @@ bool SystemData::loadConfig()
boost::filesystem::path genericPath(path);
path = genericPath.generic_string();
SystemData* newSys = new SystemData(name, fullname, path, extensions, cmd, platformIds);
SystemData* newSys = new SystemData(name, fullname, path, extensions, cmd, platformIds, themeFolder);
if(newSys->getRootFolder()->getChildren().size() == 0)
{
LOG(LogWarning) << "System \"" << name << "\" has no games! Ignoring it.";
@ -328,7 +332,7 @@ void SystemData::writeExampleConfig(const std::string& path)
" <!-- A short name, used internally. Traditionally lower-case. -->\n"
" <name>nes</name>\n"
"\n"
" <!-- A \"pretty\" name, displayed in the header and such. -->\n"
" <!-- A \"pretty\" name, displayed in menus and such. -->\n"
" <fullname>Nintendo Entertainment System</fullname>\n"
"\n"
" <!-- The path to start searching for ROMs in. '~' will be expanded to $HOME on Linux or %HOMEPATH% on Windows. -->\n"
@ -346,9 +350,12 @@ void SystemData::writeExampleConfig(const std::string& path)
"\n"
" <!-- The platform to use when scraping. You can see the full list of accepted platforms in src/PlatformIds.cpp.\n"
" It's case sensitive, but everything is lowercase. This tag is optional.\n"
" You can use multiple platforms too, delimited with any of the whitespace characters (\", \\r\\n\\t\"), eg: \"<platform>genesis, megadrive</platform>\" -->\n"
" You can use multiple platforms too, delimited with any of the whitespace characters (\", \\r\\n\\t\"), eg: \"genesis, megadrive\" -->\n"
" <platform>nes</platform>\n"
"\n"
" <!-- The theme to load from the current theme set. See THEMES.md for more information.\n"
" This tag is optional. If not set, it will default to the value of <name>. -->\n"
" <theme>nes</theme>\n"
" </system>\n"
"</systemList>\n";
@ -404,7 +411,7 @@ std::string SystemData::getThemePath() const
return localThemePath.generic_string();
// not in game folder, try theme sets
return ThemeData::getThemeFromCurrentSet(mName).generic_string();
return ThemeData::getThemeFromCurrentSet(mThemeFolder).generic_string();
}
bool SystemData::hasGamelist() const

View file

@ -12,7 +12,7 @@ class SystemData
{
public:
SystemData(const std::string& name, const std::string& fullName, const std::string& startPath, const std::vector<std::string>& extensions,
const std::string& command, const std::vector<PlatformIds::PlatformId>& platformIds);
const std::string& command, const std::vector<PlatformIds::PlatformId>& platformIds, const std::string& themeFolder);
~SystemData();
inline FileData* getRootFolder() const { return mRootFolder; };
@ -20,6 +20,7 @@ public:
inline const std::string& getFullName() const { return mFullName; }
inline const std::string& getStartPath() const { return mStartPath; }
inline const std::vector<std::string>& getExtensions() const { return mSearchExtensions; }
inline const std::string& getThemeFolder() const { return mThemeFolder; }
inline const std::vector<PlatformIds::PlatformId>& getPlatformIds() const { return mPlatformIds; }
inline bool hasPlatformId(PlatformIds::PlatformId id) { return std::find(mPlatformIds.begin(), mPlatformIds.end(), id) != mPlatformIds.end(); }
@ -70,6 +71,7 @@ private:
std::vector<std::string> mSearchExtensions;
std::string mLaunchCommand;
std::vector<PlatformIds::PlatformId> mPlatformIds;
std::string mThemeFolder;
std::shared_ptr<ThemeData> mTheme;
void populateFolder(FileData* folder);