// SPDX-License-Identifier: MIT // // ES-DE // MameNames.h // // Provides expanded game names based on short MAME name arguments. Also contains // functions to check whether a passed argument is a MAME BIOS or a MAME device. // The data sources are stored as the files mamebioses.xml, mamedevices.xml and mamenames.xml. // #ifndef ES_CORE_MAMENAMES_H #define ES_CORE_MAMENAMES_H #include "Settings.h" #include "utils/StringUtil.h" #include #include #include #include // Expand MAME names to full game names and lookup device and BIOS entries. class MameNames { public: static MameNames& getInstance(); std::string getRealName(const std::string& mameName) { std::string name = mNamePairs[mameName]; if (name == "") return mameName; else return name; } std::string getCleanName(const std::string& mameName) { static const bool stripInfo {Settings::getInstance()->getBool("MAMENameStripExtraInfo")}; if (stripInfo) return Utils::String::removeParenthesis(getRealName(mameName)); else return getRealName(mameName); } const bool isBios(const std::string& biosName) { return std::find(mMameBioses.cbegin(), mMameBioses.cend(), biosName) != mMameBioses.cend(); } const bool isDevice(const std::string& deviceName) { return std::find(mMameDevices.cbegin(), mMameDevices.cend(), deviceName) != mMameDevices.cend(); } private: MameNames(); std::unordered_map mNamePairs; std::vector mMameBioses; std::vector mMameDevices; }; #endif // ES_CORE_MAMENAMES_H