mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 06:05:38 +00:00
Added support for lists of file extensions, delimited by a space.
This commit is contained in:
parent
e479746bcb
commit
5786ecae7c
|
@ -21,7 +21,8 @@ There are also a few libraries already on the RPi (located in /opt/vc/, like the
|
|||
Configuring
|
||||
===========
|
||||
|
||||
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. Keep in mind you can define more than one system! Just use all the variables again.
|
||||
**~/.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. Keep in mind you can define more than one system! Just use all the variables again. Also, you can use multiple extensions - just separate them with a space, e.g.: ".nes .NES .bin".
|
||||
|
||||
If an SDL Joystick is detected at startup, and $HOME/.emulationstation/es_input.cfg is nonexistant, an Input Configuration screen will appear instead of the game list. This should be pretty self-explanatory. If you want to reconfigure, just delete $HOME/.emulationstation/es_input.cfg.
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
September 8
|
||||
-Added support for multiple filetypes for systems - just separate them with a space.
|
||||
-Updated example systems config to include example for multiple filetypes and be a little clearer.
|
||||
|
||||
September 7
|
||||
-Tiling is now much faster.
|
||||
-Added --draw-framerate and --help/-h command-line parameters.
|
||||
|
|
|
@ -117,11 +117,29 @@ void SystemData::populateFolder(FolderData* folder)
|
|||
else
|
||||
folder->pushFileData(newFolder);
|
||||
}else{
|
||||
if(filePath.extension().string() == mSearchExtension)
|
||||
{
|
||||
GameData* newGame = new GameData(this, filePath.string(), filePath.stem().string());
|
||||
folder->pushFileData(newGame);
|
||||
}
|
||||
//this is a little complicated because we allow a list of extensions to be defined (delimited with a space)
|
||||
//we first get the extension of the file itself:
|
||||
std::string extension = filePath.extension().string();
|
||||
std::string chkExt;
|
||||
size_t extPos = 0;
|
||||
do {
|
||||
//now we loop through every extension in the list
|
||||
size_t cpos = extPos;
|
||||
extPos = mSearchExtension.find(" ", extPos);
|
||||
chkExt = mSearchExtension.substr(cpos, ((extPos == std::string::npos) ? mSearchExtension.length() - cpos: extPos - cpos));
|
||||
|
||||
//if it matches, add it
|
||||
if(chkExt == mSearchExtension)
|
||||
{
|
||||
GameData* newGame = new GameData(this, filePath.string(), filePath.stem().string());
|
||||
folder->pushFileData(newGame);
|
||||
break;
|
||||
}else if(extPos != std::string::npos) //if not, add one to the "next position" marker to skip the space when reading the next extension
|
||||
{
|
||||
extPos++;
|
||||
}
|
||||
|
||||
} while(extPos != std::string::npos && chkExt != "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -225,13 +243,13 @@ void SystemData::writeExampleConfig()
|
|||
file << "# A sample system might look like this:" << std::endl;
|
||||
file << "#NAME=Nintendo Entertainment System" << std::endl;
|
||||
file << "#PATH=~/ROMs/nes/" << std::endl;
|
||||
file << "#EXTENSION=.nes" << std::endl;
|
||||
file << "#EXTENSION=.nes .NES" << std::endl;
|
||||
file << "#COMMAND=retroarch -L ~/cores/libretro-fceumm.so %ROM%" << std::endl << std::endl;
|
||||
|
||||
file << "#NAME is just a name to identify the system." << std::endl;
|
||||
file << "#PATH is the path to start the recursive search for ROMs in. ~ will be expanded into the $HOME variable." << std::endl;
|
||||
file << "#EXTENSION is the exact extension to search for. You MUST include the period, and it must be exact - no regex or wildcard support (sorry!)." << std::endl;
|
||||
file << "#COMMAND is the shell command to execute when a game is selected. %ROM% will be replaced with the path to the ROM." << std::endl << std::endl;
|
||||
file << "#EXTENSION is a list of extensions to search for, separated by spaces. You MUST include the period, and it must be exact - it's case sensitive, and no wildcards." << std::endl;
|
||||
file << "#COMMAND is the shell command to execute when a game is selected. %ROM% will be replaced with the (bash special-character escaped) path to the ROM." << std::endl << std::endl;
|
||||
|
||||
file << "#Now try your own!" << std::endl;
|
||||
file << "NAME=" << std::endl;
|
||||
|
|
|
@ -85,7 +85,7 @@ GameData* createGameFromPath(std::string gameAbsPath, SystemData* system)
|
|||
|
||||
|
||||
//find gameName
|
||||
std::string gameName = gamePath.substr(separator + 1, gamePath.find(system->getExtension(), separator) - separator - 1);
|
||||
std::string gameName = gamePath.substr(separator + 1, gamePath.find(".", separator) - separator - 1);
|
||||
|
||||
GameData* game = new GameData(system, gameAbsPath, gameName);
|
||||
folder->pushFileData(game);
|
||||
|
|
Loading…
Reference in a new issue