Merge pull request #10334 from AdmiralCurtiss/json-maker

Core: Add a Maker field for GameModDescriptors.
This commit is contained in:
Léo Lam 2022-01-03 01:43:02 +01:00 committed by GitHub
commit 7abb501e0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 0 deletions

View File

@ -135,6 +135,10 @@ std::optional<GameModDescriptor> ParseGameModDescriptorString(std::string_view j
{
descriptor.display_name = value.get<std::string>();
}
else if (key == "maker" && value.is<std::string>())
{
descriptor.maker = value.get<std::string>();
}
else if (key == "banner" && value.is<std::string>())
{
descriptor.banner = MakeAbsolute(json_directory, value.get<std::string>());
@ -195,6 +199,8 @@ std::string WriteGameModDescriptorString(const GameModDescriptor& descriptor, bo
json_root["base-file"] = picojson::value(descriptor.base_file);
if (!descriptor.display_name.empty())
json_root["display-name"] = picojson::value(descriptor.display_name);
if (!descriptor.maker.empty())
json_root["maker"] = picojson::value(descriptor.maker);
if (!descriptor.banner.empty())
json_root["banner"] = picojson::value(descriptor.banner);
if (descriptor.riivolution)

View File

@ -36,6 +36,7 @@ struct GameModDescriptor
{
std::string base_file;
std::string display_name;
std::string maker;
std::string banner;
std::optional<GameModDescriptorRiivolution> riivolution = std::nullopt;
};

View File

@ -177,6 +177,8 @@ GameFile::GameFile(std::string path) : m_file_path(std::move(path))
m_valid = true;
m_file_size = File::GetSize(m_file_path);
m_long_names.emplace(DiscIO::Language::English, std::move(descriptor->display_name));
if (!descriptor->maker.empty())
m_long_makers.emplace(DiscIO::Language::English, std::move(descriptor->maker));
m_internal_name = proxy.GetInternalName();
m_game_id = proxy.GetGameID();
m_gametdb_id = proxy.GetGameTDBID();

View File

@ -17,6 +17,9 @@
"display-name": {
"type": "string"
},
"maker": {
"type": "string"
},
"banner": {
"type": "string"
},