From b50861ea44e237e69b1c931b4ceb8c9b6dc8db4e Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Thu, 9 Dec 2021 00:01:10 +0100 Subject: [PATCH] Core: Require game mod descriptor json to self-identify as one. --- Source/Core/DiscIO/GameModDescriptor.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/Core/DiscIO/GameModDescriptor.cpp b/Source/Core/DiscIO/GameModDescriptor.cpp index 587faafdaf..f1a50ac649 100644 --- a/Source/Core/DiscIO/GameModDescriptor.cpp +++ b/Source/Core/DiscIO/GameModDescriptor.cpp @@ -115,10 +115,15 @@ std::optional ParseGameModDescriptorString(std::string_view j return std::nullopt; GameModDescriptor descriptor; + bool is_game_mod_descriptor = false; bool is_valid_version = false; for (const auto& [key, value] : json_root.get()) { - if (key == "version" && value.is()) + if (key == "type" && value.is()) + { + is_game_mod_descriptor = value.get() == "dolphin-game-mod-descriptor"; + } + else if (key == "version" && value.is()) { is_valid_version = value.get() == 1.0; } @@ -140,7 +145,7 @@ std::optional ParseGameModDescriptorString(std::string_view j ParseRiivolutionObject(json_directory, value.get()); } } - if (!is_valid_version) + if (!is_game_mod_descriptor || !is_valid_version) return std::nullopt; return descriptor; }