2020-09-21 17:17:34 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
2020-06-06 11:10:33 +00:00
|
|
|
//
|
2020-09-21 17:17:34 +00:00
|
|
|
// EmulationStation Desktop Edition
|
2020-06-21 12:25:28 +00:00
|
|
|
// MameNames.h
|
2020-06-06 11:10:33 +00:00
|
|
|
//
|
2020-06-21 12:25:28 +00:00
|
|
|
// 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 in the .emulationstation/resources directory
|
|
|
|
// as the files mamebioses.xml, mamedevices.xml and mamenames.xml.
|
2020-06-06 11:10:33 +00:00
|
|
|
//
|
|
|
|
|
2018-02-09 17:23:58 +00:00
|
|
|
#ifndef ES_CORE_MAMENAMES_H
|
|
|
|
#define ES_CORE_MAMENAMES_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2020-06-06 11:10:33 +00:00
|
|
|
// Expand MAME names to full game names.
|
2018-02-09 17:23:58 +00:00
|
|
|
class MameNames
|
|
|
|
{
|
|
|
|
public:
|
2020-06-26 15:17:35 +00:00
|
|
|
static void init();
|
|
|
|
static void deinit();
|
2020-06-21 12:25:28 +00:00
|
|
|
static MameNames* getInstance();
|
2020-06-26 15:17:35 +00:00
|
|
|
std::string getRealName(const std::string& _mameName);
|
|
|
|
std::string getCleanName(const std::string& _mameName);
|
2021-07-07 18:31:46 +00:00
|
|
|
const bool isBios(const std::string& _biosName)
|
|
|
|
{
|
|
|
|
return MameNames::find(mMameBioses, _biosName);
|
|
|
|
}
|
|
|
|
const bool isDevice(const std::string& _deviceName)
|
|
|
|
{
|
|
|
|
return MameNames::find(mMameDevices, _deviceName);
|
|
|
|
}
|
2018-02-09 17:23:58 +00:00
|
|
|
|
|
|
|
private:
|
2020-06-21 12:25:28 +00:00
|
|
|
struct NamePair {
|
|
|
|
std::string mameName;
|
|
|
|
std::string realName;
|
|
|
|
};
|
2018-02-09 17:23:58 +00:00
|
|
|
|
2020-06-21 12:25:28 +00:00
|
|
|
typedef std::vector<NamePair> namePairVector;
|
2018-02-09 17:23:58 +00:00
|
|
|
|
2021-07-07 18:31:46 +00:00
|
|
|
MameNames();
|
|
|
|
~MameNames() {}
|
2018-02-09 17:23:58 +00:00
|
|
|
|
2020-06-21 12:25:28 +00:00
|
|
|
static MameNames* sInstance;
|
2018-02-09 17:23:58 +00:00
|
|
|
|
2020-06-21 12:25:28 +00:00
|
|
|
namePairVector mNamePairs;
|
|
|
|
std::vector<std::string> mMameBioses;
|
|
|
|
std::vector<std::string> mMameDevices;
|
2019-08-25 15:23:02 +00:00
|
|
|
|
2020-06-21 12:25:28 +00:00
|
|
|
const bool find(const std::vector<std::string> devices, const std::string& name);
|
2020-06-26 15:17:35 +00:00
|
|
|
};
|
2018-02-09 17:23:58 +00:00
|
|
|
|
|
|
|
#endif // ES_CORE_MAMENAMES_H
|