GraphicsModFeature.cpp 1.5 KB

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