Added PlatformId to SystemData.

This commit is contained in:
Aloshi 2013-09-28 11:10:06 -05:00
parent 10ed603f27
commit c5d772657b
4 changed files with 62 additions and 50 deletions

View file

@ -148,6 +148,7 @@ set(ES_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/src/MathExp.h ${CMAKE_CURRENT_SOURCE_DIR}/src/MathExp.h
${CMAKE_CURRENT_SOURCE_DIR}/src/MetaData.h ${CMAKE_CURRENT_SOURCE_DIR}/src/MetaData.h
${CMAKE_CURRENT_SOURCE_DIR}/src/platform.h ${CMAKE_CURRENT_SOURCE_DIR}/src/platform.h
${CMAKE_CURRENT_SOURCE_DIR}/src/PlatformId.h
${CMAKE_CURRENT_SOURCE_DIR}/src/Renderer.h ${CMAKE_CURRENT_SOURCE_DIR}/src/Renderer.h
${CMAKE_CURRENT_SOURCE_DIR}/src/Settings.h ${CMAKE_CURRENT_SOURCE_DIR}/src/Settings.h
${CMAKE_CURRENT_SOURCE_DIR}/src/Sound.h ${CMAKE_CURRENT_SOURCE_DIR}/src/Sound.h

View file

@ -2,53 +2,52 @@
namespace PlatformIds namespace PlatformIds
{ {
enum PlatformId enum PlatformId : unsigned int
{ {
PLATFORM_UNKNOWN, PLATFORM_UNKNOWN = 0,
THREEDO, //can't start with a constant THREEDO = 1, //can't start with a constant
AMIGA, AMIGA = 2,
ARCADE, ARCADE = 3,
ATARI_2600, ATARI_2600 = 4,
ATARI_5200, ATARI_5200 = 5,
ATARI_7800, ATARI_7800 = 6,
ATARI_JAGUAR, ATARI_JAGUAR = 7,
ATARI_JAGUAR_CD, ATARI_JAGUAR_CD = 8,
ATARI_XE, ATARI_XE = 9,
COLECOVISION, COLECOVISION = 10,
COMMODORE_64, COMMODORE_64 = 11,
INTELLIVISION, INTELLIVISION = 12,
MAC_OS, MAC_OS = 13,
XBOX, XBOX = 14,
XBOX_360, XBOX_360 = 15,
NEOGEO, NEOGEO = 16,
NINTENDO_3DS, NINTENDO_3DS = 17,
NINTENDO_64, NINTENDO_64 = 18,
NINTENDO_DS, NINTENDO_DS = 19,
NINTENDO_ENTERTAINMENT_SYSTEM, NINTENDO_ENTERTAINMENT_SYSTEM = 20,
GAME_BOY, GAME_BOY = 21,
GAME_BOY_ADVANCE, GAME_BOY_ADVANCE = 22,
GAME_BOY_COLOR, GAME_BOY_COLOR = 23,
NINTENDO_GAMECUBE, NINTENDO_GAMECUBE = 24,
NINTENDO_WII, NINTENDO_WII = 25,
NINTENDO_WII_U, NINTENDO_WII_U = 26,
PC, PC = 27,
SEGA_32X, SEGA_32X = 28,
SEGA_CD, SEGA_CD = 29,
SEGA_DREAMCAST, SEGA_DREAMCAST = 30,
SEGA_GAME_GEAR, SEGA_GAME_GEAR = 31,
SEGA_GENESIS, SEGA_GENESIS = 32,
SEGA_MASTER_SYSTEM, SEGA_MASTER_SYSTEM = 33,
SEGA_MEGA_DRIVE, SEGA_MEGA_DRIVE = 34,
SEGA_SATURN, SEGA_SATURN = 35,
PLAYSTATION, PLAYSTATION = 36,
PLAYSTATION_2, PLAYSTATION_2 = 37,
PLAYSTATION_3, PLAYSTATION_3 = 38,
PLAYSTATION_4, PLAYSTATION_4 = 39,
PLAYSTATION_VITA, PLAYSTATION_VITA = 40,
PLAYSTATION_PORTABLE, PLAYSTATION_PORTABLE = 41,
SUPER_NINTENDO, SUPER_NINTENDO = 42,
TURBOGRAFX_16, TURBOGRAFX_16 = 43,
PLATFORM_COUNT PLATFORM_COUNT = 44
}; };
} }

View file

@ -20,7 +20,8 @@ namespace fs = boost::filesystem;
std::string SystemData::getStartPath() { return mStartPath; } std::string SystemData::getStartPath() { return mStartPath; }
std::string SystemData::getExtension() { return mSearchExtension; } std::string SystemData::getExtension() { return mSearchExtension; }
SystemData::SystemData(const std::string& name, const std::string& fullName, const std::string& startPath, const std::string& extension, const std::string& command) SystemData::SystemData(const std::string& name, const std::string& fullName, const std::string& startPath, const std::string& extension,
const std::string& command, PlatformIds::PlatformId platformId)
{ {
mName = name; mName = name;
mFullName = fullName; mFullName = fullName;
@ -35,6 +36,7 @@ SystemData::SystemData(const std::string& name, const std::string& fullName, con
mSearchExtension = extension; mSearchExtension = extension;
mLaunchCommand = command; mLaunchCommand = command;
mPlatformId = platformId;
mRootFolder = new FolderData(this, mStartPath, "Search Root"); mRootFolder = new FolderData(this, mStartPath, "Search Root");
@ -217,11 +219,14 @@ bool SystemData::loadConfig(const std::string& path, bool writeExample)
for(pugi::xml_node system = systemList.child("system"); system; system = system.next_sibling("system")) for(pugi::xml_node system = systemList.child("system"); system; system = system.next_sibling("system"))
{ {
std::string name, fullname, path, ext, cmd; std::string name, fullname, path, ext, cmd;
PlatformIds::PlatformId platformId = PlatformIds::PLATFORM_UNKNOWN;
name = system.child("name").text().get(); name = system.child("name").text().get();
fullname = system.child("fullname").text().get(); fullname = system.child("fullname").text().get();
path = system.child("path").text().get(); path = system.child("path").text().get();
ext = system.child("extension").text().get(); ext = system.child("extension").text().get();
cmd = system.child("command").text().get(); cmd = system.child("command").text().get();
platformId = (PlatformIds::PlatformId)system.child("platformid").text().as_uint(PlatformIds::PLATFORM_UNKNOWN);
//validate //validate
if(name.empty() || path.empty() || ext.empty() || cmd.empty()) if(name.empty() || path.empty() || ext.empty() || cmd.empty())
@ -234,7 +239,7 @@ bool SystemData::loadConfig(const std::string& path, bool writeExample)
boost::filesystem::path genericPath(path); boost::filesystem::path genericPath(path);
path = genericPath.generic_string(); path = genericPath.generic_string();
SystemData* newSys = new SystemData(name, fullname, path, ext, cmd); SystemData* newSys = new SystemData(name, fullname, path, ext, cmd, platformId);
if(newSys->getRootFolder()->getFileCount() == 0) if(newSys->getRootFolder()->getFileCount() == 0)
{ {
LOG(LogWarning) << "System \"" << name << "\" has no games! Ignoring it."; LOG(LogWarning) << "System \"" << name << "\" has no games! Ignoring it.";
@ -339,3 +344,8 @@ std::vector<MetaDataDecl> SystemData::getGameMDD()
{ {
return MetaDataList::getDefaultGameMDD(); return MetaDataList::getDefaultGameMDD();
} }
PlatformIds::PlatformId SystemData::getPlatformId()
{
return mPlatformId;
}

View file

@ -13,7 +13,8 @@ class GameData;
class SystemData class SystemData
{ {
public: public:
SystemData(const std::string& name, const std::string& fullName, const std::string& startPath, const std::string& extension, const std::string& command); SystemData(const std::string& name, const std::string& fullName, const std::string& startPath, const std::string& extension,
const std::string& command, PlatformIds::PlatformId platformId = PlatformIds::PLATFORM_UNKNOWN);
~SystemData(); ~SystemData();
FolderData* getRootFolder(); FolderData* getRootFolder();
@ -22,6 +23,7 @@ public:
std::string getStartPath(); std::string getStartPath();
std::string getExtension(); std::string getExtension();
std::string getGamelistPath(); std::string getGamelistPath();
PlatformIds::PlatformId getPlatformId();
bool hasGamelist(); bool hasGamelist();
std::vector<MetaDataDecl> getGameMDD(); std::vector<MetaDataDecl> getGameMDD();