diff --git a/CMakeLists.txt b/CMakeLists.txt index 3eed7a600..89a1ea6d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -148,6 +148,7 @@ set(ES_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/MathExp.h ${CMAKE_CURRENT_SOURCE_DIR}/src/MetaData.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/Settings.h ${CMAKE_CURRENT_SOURCE_DIR}/src/Sound.h diff --git a/src/PlatformId.h b/src/PlatformId.h index 1ce1cda0b..bfdc37b12 100644 --- a/src/PlatformId.h +++ b/src/PlatformId.h @@ -2,53 +2,52 @@ namespace PlatformIds { - enum PlatformId + enum PlatformId : unsigned int { - PLATFORM_UNKNOWN, - THREEDO, //can't start with a constant - AMIGA, - ARCADE, - ATARI_2600, - ATARI_5200, - ATARI_7800, - ATARI_JAGUAR, - ATARI_JAGUAR_CD, - ATARI_XE, - COLECOVISION, - COMMODORE_64, - INTELLIVISION, - MAC_OS, - XBOX, - XBOX_360, - NEOGEO, - NINTENDO_3DS, - NINTENDO_64, - NINTENDO_DS, - NINTENDO_ENTERTAINMENT_SYSTEM, - GAME_BOY, - GAME_BOY_ADVANCE, - GAME_BOY_COLOR, - NINTENDO_GAMECUBE, - NINTENDO_WII, - NINTENDO_WII_U, - PC, - SEGA_32X, - SEGA_CD, - SEGA_DREAMCAST, - SEGA_GAME_GEAR, - SEGA_GENESIS, - SEGA_MASTER_SYSTEM, - SEGA_MEGA_DRIVE, - SEGA_SATURN, - PLAYSTATION, - PLAYSTATION_2, - PLAYSTATION_3, - PLAYSTATION_4, - PLAYSTATION_VITA, - PLAYSTATION_PORTABLE, - SUPER_NINTENDO, - TURBOGRAFX_16, - PLATFORM_COUNT + PLATFORM_UNKNOWN = 0, + THREEDO = 1, //can't start with a constant + AMIGA = 2, + ARCADE = 3, + ATARI_2600 = 4, + ATARI_5200 = 5, + ATARI_7800 = 6, + ATARI_JAGUAR = 7, + ATARI_JAGUAR_CD = 8, + ATARI_XE = 9, + COLECOVISION = 10, + COMMODORE_64 = 11, + INTELLIVISION = 12, + MAC_OS = 13, + XBOX = 14, + XBOX_360 = 15, + NEOGEO = 16, + NINTENDO_3DS = 17, + NINTENDO_64 = 18, + NINTENDO_DS = 19, + NINTENDO_ENTERTAINMENT_SYSTEM = 20, + GAME_BOY = 21, + GAME_BOY_ADVANCE = 22, + GAME_BOY_COLOR = 23, + NINTENDO_GAMECUBE = 24, + NINTENDO_WII = 25, + NINTENDO_WII_U = 26, + PC = 27, + SEGA_32X = 28, + SEGA_CD = 29, + SEGA_DREAMCAST = 30, + SEGA_GAME_GEAR = 31, + SEGA_GENESIS = 32, + SEGA_MASTER_SYSTEM = 33, + SEGA_MEGA_DRIVE = 34, + SEGA_SATURN = 35, + PLAYSTATION = 36, + PLAYSTATION_2 = 37, + PLAYSTATION_3 = 38, + PLAYSTATION_4 = 39, + PLAYSTATION_VITA = 40, + PLAYSTATION_PORTABLE = 41, + SUPER_NINTENDO = 42, + TURBOGRAFX_16 = 43, + PLATFORM_COUNT = 44 }; } - diff --git a/src/SystemData.cpp b/src/SystemData.cpp index 7e9d913e3..e84a3714b 100644 --- a/src/SystemData.cpp +++ b/src/SystemData.cpp @@ -20,7 +20,8 @@ namespace fs = boost::filesystem; std::string SystemData::getStartPath() { return mStartPath; } 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; mFullName = fullName; @@ -35,6 +36,7 @@ SystemData::SystemData(const std::string& name, const std::string& fullName, con mSearchExtension = extension; mLaunchCommand = command; + mPlatformId = platformId; 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")) { std::string name, fullname, path, ext, cmd; + PlatformIds::PlatformId platformId = PlatformIds::PLATFORM_UNKNOWN; + name = system.child("name").text().get(); fullname = system.child("fullname").text().get(); path = system.child("path").text().get(); ext = system.child("extension").text().get(); cmd = system.child("command").text().get(); + platformId = (PlatformIds::PlatformId)system.child("platformid").text().as_uint(PlatformIds::PLATFORM_UNKNOWN); //validate 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); 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) { LOG(LogWarning) << "System \"" << name << "\" has no games! Ignoring it."; @@ -339,3 +344,8 @@ std::vector SystemData::getGameMDD() { return MetaDataList::getDefaultGameMDD(); } + +PlatformIds::PlatformId SystemData::getPlatformId() +{ + return mPlatformId; +} diff --git a/src/SystemData.h b/src/SystemData.h index acd4540ee..98fb956ba 100644 --- a/src/SystemData.h +++ b/src/SystemData.h @@ -13,7 +13,8 @@ class GameData; class SystemData { 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(); FolderData* getRootFolder(); @@ -22,6 +23,7 @@ public: std::string getStartPath(); std::string getExtension(); std::string getGamelistPath(); + PlatformIds::PlatformId getPlatformId(); bool hasGamelist(); std::vector getGameMDD();