2014-06-25 16:29:58 +00:00
# pragma once
# include <vector>
# include <string>
# include "FileData.h"
# include "Window.h"
# include "MetaData.h"
# include "PlatformId.h"
# include "ThemeData.h"
2017-03-18 17:54:39 +00:00
# include "FileFilterIndex.h"
2014-06-25 16:29:58 +00:00
class SystemData
{
public :
SystemData ( const std : : string & name , const std : : string & fullName , const std : : string & startPath , const std : : vector < std : : string > & extensions ,
2016-03-29 04:03:39 +00:00
const std : : string & command , const std : : vector < PlatformIds : : PlatformId > & platformIds , const std : : string & themeFolder ) ;
2014-06-25 16:29:58 +00:00
~ SystemData ( ) ;
inline FileData * getRootFolder ( ) const { return mRootFolder ; } ;
inline const std : : string & getName ( ) const { return mName ; }
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 ( ) ; }
inline const std : : shared_ptr < ThemeData > & getTheme ( ) const { return mTheme ; }
std : : string getGamelistPath ( bool forWrite ) const ;
bool hasGamelist ( ) const ;
std : : string getThemePath ( ) const ;
unsigned int getGameCount ( ) const ;
2017-03-18 17:54:39 +00:00
unsigned int getDisplayedGameCount ( ) const ;
2014-06-25 16:29:58 +00:00
void launchGame ( Window * window , FileData * game ) ;
static void deleteSystems ( ) ;
static bool loadConfig ( ) ; //Load the system config file at getConfigPath(). Returns true if no errors were encountered. An example will be written if the file doesn't exist.
static void writeExampleConfig ( const std : : string & path ) ;
static std : : string getConfigPath ( bool forWrite ) ; // if forWrite, will only return ~/.emulationstation/es_systems.cfg, never /etc/emulationstation/es_systems.cfg
static std : : vector < SystemData * > sSystemVector ;
inline std : : vector < SystemData * > : : const_iterator getIterator ( ) const { return std : : find ( sSystemVector . begin ( ) , sSystemVector . end ( ) , this ) ; } ;
inline std : : vector < SystemData * > : : const_reverse_iterator getRevIterator ( ) const { return std : : find ( sSystemVector . rbegin ( ) , sSystemVector . rend ( ) , this ) ; } ;
inline SystemData * getNext ( ) const
{
auto it = getIterator ( ) ;
it + + ;
if ( it = = sSystemVector . end ( ) ) it = sSystemVector . begin ( ) ;
return * it ;
}
inline SystemData * getPrev ( ) const
{
auto it = getRevIterator ( ) ;
it + + ;
if ( it = = sSystemVector . rend ( ) ) it = sSystemVector . rbegin ( ) ;
return * it ;
}
// Load or re-load theme.
void loadTheme ( ) ;
2017-03-18 17:54:39 +00:00
FileFilterIndex * getIndex ( ) { return mFilterIndex ; } ;
2014-06-25 16:29:58 +00:00
private :
std : : string mName ;
std : : string mFullName ;
std : : string mStartPath ;
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 ) ;
2017-03-18 17:54:39 +00:00
FileFilterIndex * mFilterIndex ;
2014-06-25 16:29:58 +00:00
FileData * mRootFolder ;
} ;