| 1 | // Copyright 2022 Dolphin Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | |
| 4 | #include "VideoCommon/GraphicsModSystem/Config/GraphicsModFeature.h" |
| 5 | |
| 6 | #include "Common/Logging/Log.h" |
| 7 | |
| 8 | void GraphicsModFeatureConfig::SerializeToConfig(picojson::object& json_obj) const |
| 9 | { |
| 10 | json_obj.emplace("group", m_group); |
| 11 | json_obj.emplace("action", m_action); |
| 12 | json_obj.emplace("action_data", m_action_data); |
| 13 | } |
| 14 | |
| 15 | bool GraphicsModFeatureConfig::DeserializeFromConfig(const picojson::object& obj) |
| 16 | { |
| 17 | if (auto group_iter = obj.find("group"); group_iter != obj.end()) |
| 18 | { |
| 19 | if (!group_iter->second.is<std::string>()) |
| 20 | { |
| 21 | ERROR_LOG_FMT( |
| 22 | VIDEO, |
| 23 | "Failed to load mod configuration file, specified feature's group is not a string"); |
| 24 | return false; |
| 25 | } |
| 26 | m_group = group_iter->second.get<std::string>(); |
| 27 | } |
| 28 | |
| 29 | if (auto action_iter = obj.find("action"); action_iter != obj.end()) |
| 30 | { |
| 31 | if (!action_iter->second.is<std::string>()) |
| 32 | { |
| 33 | ERROR_LOG_FMT( |
| 34 | VIDEO, |
| 35 | "Failed to load mod configuration file, specified feature's action is not a string"); |
| 36 | return false; |
| 37 | } |
| 38 | m_action = action_iter->second.get<std::string>(); |
| 39 | } |
| 40 | |
| 41 | if (auto action_data_iter = obj.find("action_data"); action_data_iter != obj.end()) |
| 42 | { |
| 43 | m_action_data = action_data_iter->second; |
| 44 | } |
| 45 | |
| 46 | return true; |
| 47 | } |
| 48 | |
| 49 | void GraphicsModFeatureConfig::SerializeToProfile(picojson::object*) const |
| 50 | { |
| 51 | } |
| 52 | |
| 53 | void GraphicsModFeatureConfig::DeserializeFromProfile(const picojson::object&) |
| 54 | { |
| 55 | } |