mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
GameFile: Use enums for custom/length parameters
This commit is contained in:
@ -472,15 +472,15 @@ const std::string& GameFile::GetName(const Core::TitleDatabase& title_database)
|
||||
return m_custom_name;
|
||||
|
||||
const std::string& database_name = title_database.GetTitleName(m_gametdb_id, GetConfigLanguage());
|
||||
return database_name.empty() ? GetName(true) : database_name;
|
||||
return database_name.empty() ? GetName(Variant::LongAndPossiblyCustom) : database_name;
|
||||
}
|
||||
|
||||
const std::string& GameFile::GetName(bool allow_custom_name, bool long_name) const
|
||||
const std::string& GameFile::GetName(Variant variant) const
|
||||
{
|
||||
if (allow_custom_name && !m_custom_name.empty())
|
||||
if (variant == Variant::LongAndPossiblyCustom && !m_custom_name.empty())
|
||||
return m_custom_name;
|
||||
|
||||
const std::string& name = long_name ? GetLongName() : GetShortName();
|
||||
const std::string& name = variant == Variant::ShortAndNotCustom ? GetShortName() : GetLongName();
|
||||
if (!name.empty())
|
||||
return name;
|
||||
|
||||
@ -488,12 +488,13 @@ const std::string& GameFile::GetName(bool allow_custom_name, bool long_name) con
|
||||
return m_file_name;
|
||||
}
|
||||
|
||||
const std::string& GameFile::GetMaker(bool allow_custom_maker, bool long_maker) const
|
||||
const std::string& GameFile::GetMaker(Variant variant) const
|
||||
{
|
||||
if (allow_custom_maker && !m_custom_maker.empty())
|
||||
if (variant == Variant::LongAndPossiblyCustom && !m_custom_maker.empty())
|
||||
return m_custom_maker;
|
||||
|
||||
const std::string& maker = long_maker ? GetLongMaker() : GetShortMaker();
|
||||
const std::string& maker =
|
||||
variant == Variant::ShortAndNotCustom ? GetShortMaker() : GetLongMaker();
|
||||
if (!maker.empty())
|
||||
return maker;
|
||||
|
||||
@ -503,9 +504,9 @@ const std::string& GameFile::GetMaker(bool allow_custom_maker, bool long_maker)
|
||||
return EMPTY_STRING;
|
||||
}
|
||||
|
||||
const std::string& GameFile::GetDescription(bool allow_custom_description) const
|
||||
const std::string& GameFile::GetDescription(Variant variant) const
|
||||
{
|
||||
if (allow_custom_description && !m_custom_description.empty())
|
||||
if (variant == Variant::LongAndPossiblyCustom && !m_custom_description.empty())
|
||||
return m_custom_description;
|
||||
|
||||
return LookupUsingConfigLanguage(m_descriptions);
|
||||
|
@ -44,6 +44,13 @@ bool operator!=(const GameBanner& lhs, const GameBanner& rhs);
|
||||
class GameFile final
|
||||
{
|
||||
public:
|
||||
enum class Variant
|
||||
{
|
||||
LongAndPossiblyCustom,
|
||||
LongAndNotCustom,
|
||||
ShortAndNotCustom,
|
||||
};
|
||||
|
||||
GameFile();
|
||||
explicit GameFile(std::string path);
|
||||
~GameFile();
|
||||
@ -52,8 +59,8 @@ public:
|
||||
const std::string& GetFilePath() const { return m_file_path; }
|
||||
const std::string& GetFileName() const { return m_file_name; }
|
||||
const std::string& GetName(const Core::TitleDatabase& title_database) const;
|
||||
const std::string& GetName(bool allow_custom_name, bool long_name = true) const;
|
||||
const std::string& GetMaker(bool allow_custom_maker, bool long_maker = true) const;
|
||||
const std::string& GetName(Variant variant) const;
|
||||
const std::string& GetMaker(Variant variant) const;
|
||||
const std::string& GetShortName(DiscIO::Language l) const { return Lookup(l, m_short_names); }
|
||||
const std::string& GetShortName() const { return LookupUsingConfigLanguage(m_short_names); }
|
||||
const std::string& GetLongName(DiscIO::Language l) const { return Lookup(l, m_long_names); }
|
||||
@ -63,7 +70,7 @@ public:
|
||||
const std::string& GetLongMaker(DiscIO::Language l) const { return Lookup(l, m_long_makers); }
|
||||
const std::string& GetLongMaker() const { return LookupUsingConfigLanguage(m_long_makers); }
|
||||
const std::string& GetDescription(DiscIO::Language l) const { return Lookup(l, m_descriptions); }
|
||||
const std::string& GetDescription(bool allow_custom_description) const;
|
||||
const std::string& GetDescription(Variant variant) const;
|
||||
std::vector<DiscIO::Language> GetLanguages() const;
|
||||
const std::string& GetInternalName() const { return m_internal_name; }
|
||||
const std::string& GetGameID() const { return m_game_id; }
|
||||
|
Reference in New Issue
Block a user