RiivolutionBootWidget.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 <QDialog>
  7. #include "Common/CommonTypes.h"
  8. #include "DiscIO/RiivolutionParser.h"
  9. #ifdef USE_RETRO_ACHIEVEMENTS
  10. class HardcoreWarningWidget;
  11. #endif // USE_RETRO_ACHIEVEMENTS
  12. class QPushButton;
  13. class QVBoxLayout;
  14. class RiivolutionBootWidget : public QDialog
  15. {
  16. Q_OBJECT
  17. public:
  18. explicit RiivolutionBootWidget(std::string game_id, std::optional<u16> revision,
  19. std::optional<u8> disc, std::string base_game_path,
  20. QWidget* parent = nullptr);
  21. ~RiivolutionBootWidget();
  22. bool ShouldBoot() const { return m_should_boot; }
  23. std::vector<DiscIO::Riivolution::Patch>& GetPatches() { return m_patches; }
  24. #ifdef USE_RETRO_ACHIEVEMENTS
  25. signals:
  26. void OpenAchievementSettings();
  27. #endif // USE_RETRO_ACHIEVEMENTS
  28. private:
  29. void CreateWidgets();
  30. void ConnectWidgets();
  31. void LoadMatchingXMLs();
  32. void OpenXML();
  33. void MakeGUIForParsedFile(std::string path, std::string root,
  34. DiscIO::Riivolution::Disc input_disc);
  35. std::optional<DiscIO::Riivolution::Config> LoadConfigXML(const std::string& root_directory);
  36. void SaveConfigXMLs();
  37. void BootGame();
  38. void SaveAsPreset();
  39. #ifdef USE_RETRO_ACHIEVEMENTS
  40. HardcoreWarningWidget* m_hc_warning;
  41. #endif // USE_RETRO_ACHIEVEMENTS
  42. std::string m_game_id;
  43. std::optional<u16> m_revision;
  44. std::optional<u8> m_disc_number;
  45. std::string m_base_game_path;
  46. bool m_should_boot = false;
  47. struct DiscWithRoot
  48. {
  49. DiscIO::Riivolution::Disc disc;
  50. std::string root;
  51. std::string path;
  52. };
  53. std::vector<DiscWithRoot> m_discs;
  54. std::vector<DiscIO::Riivolution::Patch> m_patches;
  55. QVBoxLayout* m_patch_section_layout;
  56. };