dolphin/Source/Core/Core/TitleDatabase.h
JosJuice 9df763b4ac TitleDatabase: Don't merge multiple languages into same map
Instead of selecting languages based on the user config at the time
of TitleDatabase creation and merging the different languages into one
map for GC and one map for Wii, have one map for each language, and
have the caller supply the language they want. This makes us not need
the IsGCTitle function, which is inaccurate for IDs that start with D.
2019-02-25 19:55:46 +01:00

45 lines
1.3 KiB
C++

// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <string>
#include <unordered_map>
#include "Common/CommonTypes.h"
#include "Common/Lazy.h"
namespace DiscIO
{
enum class Language;
}
namespace Core
{
// Reader for title database files.
class TitleDatabase final
{
public:
TitleDatabase();
~TitleDatabase();
// Get a user friendly title name for a GameTDB ID.
// This falls back to returning an empty string if none could be found.
const std::string& GetTitleName(const std::string& gametdb_id, DiscIO::Language language) const;
// Same as above, but takes a title ID instead of a GameTDB ID, and only works for channels.
const std::string& GetChannelName(u64 title_id, DiscIO::Language language) const;
// Get a description for a GameTDB ID (title name if available + GameTDB ID).
std::string Describe(const std::string& gametdb_id, DiscIO::Language language) const;
private:
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;
};
} // namespace Core