CheatsManager.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // Copyright 2018 Dolphin Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include <functional>
  5. #include <memory>
  6. #include <optional>
  7. #include <vector>
  8. #include <QDialog>
  9. #include "Common/CommonTypes.h"
  10. #include "Core/CheatSearch.h"
  11. #include "DolphinQt/GameList/GameListModel.h"
  12. #include "VideoCommon/VideoEvents.h"
  13. class ARCodeWidget;
  14. class GeckoCodeWidget;
  15. class CheatSearchFactoryWidget;
  16. class QDialogButtonBox;
  17. class QHideEvent;
  18. class QShowEvent;
  19. class PartiallyClosableTabWidget;
  20. namespace Core
  21. {
  22. enum class State;
  23. class System;
  24. } // namespace Core
  25. class CheatsManager : public QDialog
  26. {
  27. Q_OBJECT
  28. public:
  29. explicit CheatsManager(Core::System& system, QWidget* parent = nullptr);
  30. ~CheatsManager();
  31. signals:
  32. void OpenGeneralSettings();
  33. #ifdef USE_RETRO_ACHIEVEMENTS
  34. void OpenAchievementSettings();
  35. #endif // USE_RETRO_ACHIEVEMENTS
  36. void ShowMemory(u32 address);
  37. void RequestWatch(QString name, u32 address);
  38. protected:
  39. void hideEvent(QHideEvent* event) override;
  40. void showEvent(QShowEvent* event) override;
  41. private:
  42. void CreateWidgets();
  43. void ConnectWidgets();
  44. void OnStateChanged(Core::State state);
  45. void OnFrameEnd();
  46. void RegisterAfterFrameEventCallback();
  47. void RemoveAfterFrameEventCallback();
  48. void OnNewSessionCreated(const Cheats::CheatSearchSessionBase& session);
  49. void OnTabCloseRequested(int index);
  50. void RefreshCodeTabs(Core::State state);
  51. void UpdateAllCheatSearchWidgetCurrentValues();
  52. std::string m_game_id;
  53. std::string m_game_tdb_id;
  54. u16 m_revision = 0;
  55. Core::System& m_system;
  56. QDialogButtonBox* m_button_box;
  57. PartiallyClosableTabWidget* m_tab_widget = nullptr;
  58. ARCodeWidget* m_ar_code = nullptr;
  59. GeckoCodeWidget* m_gecko_code = nullptr;
  60. CheatSearchFactoryWidget* m_cheat_search_new = nullptr;
  61. Common::EventHook m_VI_end_field_event;
  62. };