2017-05-15 12:25:45 +02:00
|
|
|
// Copyright 2017 Dolphin Emulator Project
|
2021-07-05 03:22:19 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2017-05-15 12:25:45 +02:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <unordered_map>
|
|
|
|
|
2017-10-08 18:23:11 +02:00
|
|
|
#include "Common/CommonTypes.h"
|
2019-02-23 19:18:16 +01:00
|
|
|
#include "Common/Lazy.h"
|
|
|
|
|
|
|
|
namespace DiscIO
|
|
|
|
{
|
|
|
|
enum class Language;
|
|
|
|
}
|
2017-10-08 18:23:11 +02:00
|
|
|
|
2017-05-15 12:25:45 +02:00
|
|
|
namespace Core
|
|
|
|
{
|
|
|
|
// Reader for title database files.
|
|
|
|
class TitleDatabase final
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TitleDatabase();
|
|
|
|
~TitleDatabase();
|
|
|
|
|
2019-02-23 17:49:06 +01:00
|
|
|
// Get a user friendly title name for a GameTDB ID.
|
2017-05-15 12:25:45 +02:00
|
|
|
// This falls back to returning an empty string if none could be found.
|
2019-02-23 19:18:16 +01:00
|
|
|
const std::string& GetTitleName(const std::string& gametdb_id, DiscIO::Language language) const;
|
2017-11-02 17:34:04 +01:00
|
|
|
|
2019-02-23 17:49:06 +01:00
|
|
|
// Same as above, but takes a title ID instead of a GameTDB ID, and only works for channels.
|
2019-02-23 19:18:16 +01:00
|
|
|
const std::string& GetChannelName(u64 title_id, DiscIO::Language language) const;
|
2017-05-15 12:25:45 +02:00
|
|
|
|
2019-02-23 17:49:06 +01:00
|
|
|
// Get a description for a GameTDB ID (title name if available + GameTDB ID).
|
2019-02-23 19:18:16 +01:00
|
|
|
std::string Describe(const std::string& gametdb_id, DiscIO::Language language) const;
|
2017-05-15 12:25:45 +02:00
|
|
|
|
|
|
|
private:
|
2019-02-23 19:18:16 +01:00
|
|
|
void AddLazyMap(DiscIO::Language language, const std::string& language_code);
|
|
|
|
|
|
|
|
std::unordered_map<DiscIO::Language, Common::Lazy<std::unordered_map<std::string, std::string>>>
|
|
|
|
m_title_maps;
|
|
|
|
std::unordered_map<std::string, std::string> m_base_map;
|
|
|
|
std::unordered_map<std::string, std::string> m_user_title_map;
|
2017-05-15 12:25:45 +02:00
|
|
|
};
|
|
|
|
} // namespace Core
|