mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-09 15:49:25 +01:00
Core: Require game mod descriptor json to self-identify as one.
This commit is contained in:
parent
f4e2d369c0
commit
b50861ea44
@ -115,10 +115,15 @@ std::optional<GameModDescriptor> ParseGameModDescriptorString(std::string_view j
|
|||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
|
||||||
GameModDescriptor descriptor;
|
GameModDescriptor descriptor;
|
||||||
|
bool is_game_mod_descriptor = false;
|
||||||
bool is_valid_version = false;
|
bool is_valid_version = false;
|
||||||
for (const auto& [key, value] : json_root.get<picojson::object>())
|
for (const auto& [key, value] : json_root.get<picojson::object>())
|
||||||
{
|
{
|
||||||
if (key == "version" && value.is<double>())
|
if (key == "type" && value.is<std::string>())
|
||||||
|
{
|
||||||
|
is_game_mod_descriptor = value.get<std::string>() == "dolphin-game-mod-descriptor";
|
||||||
|
}
|
||||||
|
else if (key == "version" && value.is<double>())
|
||||||
{
|
{
|
||||||
is_valid_version = value.get<double>() == 1.0;
|
is_valid_version = value.get<double>() == 1.0;
|
||||||
}
|
}
|
||||||
@ -140,7 +145,7 @@ std::optional<GameModDescriptor> ParseGameModDescriptorString(std::string_view j
|
|||||||
ParseRiivolutionObject(json_directory, value.get<picojson::object>());
|
ParseRiivolutionObject(json_directory, value.get<picojson::object>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!is_valid_version)
|
if (!is_game_mod_descriptor || !is_valid_version)
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
return descriptor;
|
return descriptor;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user