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