GameModDescriptor.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright 2021 Dolphin Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include <optional>
  5. #include <string>
  6. #include <string_view>
  7. #include <vector>
  8. #include "Common/CommonTypes.h"
  9. namespace DiscIO
  10. {
  11. struct GameModDescriptorRiivolutionPatchOption
  12. {
  13. std::string section_name;
  14. std::string option_id;
  15. std::string option_name;
  16. u32 choice = 0;
  17. };
  18. struct GameModDescriptorRiivolutionPatch
  19. {
  20. std::string xml;
  21. std::string root;
  22. std::vector<GameModDescriptorRiivolutionPatchOption> options;
  23. };
  24. struct GameModDescriptorRiivolution
  25. {
  26. std::vector<GameModDescriptorRiivolutionPatch> patches;
  27. };
  28. struct GameModDescriptor
  29. {
  30. std::string base_file;
  31. std::string display_name;
  32. std::string maker;
  33. std::string banner;
  34. std::optional<GameModDescriptorRiivolution> riivolution = std::nullopt;
  35. };
  36. std::optional<GameModDescriptor> ParseGameModDescriptorFile(const std::string& filename);
  37. std::optional<GameModDescriptor> ParseGameModDescriptorString(std::string_view json,
  38. std::string_view json_path);
  39. std::string WriteGameModDescriptorString(const GameModDescriptor& descriptor, bool pretty);
  40. bool WriteGameModDescriptorFile(const std::string& filename, const GameModDescriptor& descriptor,
  41. bool pretty);
  42. } // namespace DiscIO