-
Notifications
You must be signed in to change notification settings - Fork 14
/
mainwindow.h
212 lines (162 loc) · 4.89 KB
/
mainwindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "discord/discord_game_sdk.h"
#include "vkwindow.h"
#include "workerthread.h"
#include "logviewer.h"
#include "keypressfilter.h"
extern "C"
{
#include "osal/osal_dynamiclib.h"
}
#include <QMainWindow>
#include <QSettings>
#include <QWidgetAction>
#include <QSlider>
#include <QMessageBox>
#include <QLabel>
#include <QVulkanInstance>
#include <QNetworkReply>
#include <QJsonObject>
namespace Ui
{
class MainWindow;
}
struct Discord_Application
{
struct IDiscordCore *core;
struct IDiscordActivityManager *activities;
};
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
WorkerThread *getWorkerThread();
VkWindow *getVkWindow();
QSettings *getSettings();
LogViewer *getLogViewer();
m64p_dynlib_handle getAudioPlugin();
m64p_dynlib_handle getRspPlugin();
m64p_dynlib_handle getInputPlugin();
m64p_dynlib_handle getGfxPlugin();
void openROM(QString filename, QString netplay_ip, int netplay_port, int netplay_player, QJsonObject cheats);
void setVerbose();
int getVerbose();
void setNoGUI();
int getNoGUI();
void setTest(int value);
int getTest();
void updatePlugins();
void resetCore();
m64p_dynlib_handle getCoreLib();
struct Discord_Application *getDiscordApp();
explicit MainWindow(QWidget *parent = 0);
void updateApp();
~MainWindow();
protected:
void closeEvent(QCloseEvent *event);
public slots:
void resizeMainWindow(int Width, int Height);
void toggleFS(int force);
void createVkWindow(QVulkanInstance *instance);
void deleteVkWindow();
void showMessage(QString message);
void updateDiscordActivity(struct DiscordActivity activity);
void clearDiscordActivity();
void addFrameCount();
void setCheats(QJsonObject cheatsData, bool netplay);
private slots:
void killThread();
void updateFrameCount();
void discordCallback();
void updateDownloadFinished(QNetworkReply *reply);
void updateReplyFinished(QNetworkReply *reply);
void volumeValueChanged(int value);
void on_actionOpen_ROM_triggered();
void on_actionPlugin_Paths_triggered();
void on_actionStop_Game_triggered();
void on_actionExit_triggered();
void on_actionPlugin_Settings_triggered();
void on_actionPause_Game_triggered();
void on_actionMute_triggered();
void on_actionHard_Reset_triggered();
void on_actionSoft_Reset_triggered();
void on_actionTake_Screenshot_triggered();
void on_actionSave_State_triggered();
void on_actionLoad_State_triggered();
void on_actionToggle_Fullscreen_triggered();
void on_actionCheats_triggered();
void on_actionSave_State_To_triggered();
void on_actionLoad_State_From_triggered();
void on_actionController_Configuration_triggered();
void on_actionHotkey_Configuration_triggered();
void on_actionToggle_Speed_Limiter_triggered();
void on_actionView_Log_triggered();
void on_actionCreate_Room_triggered();
void on_actionJoin_Room_triggered();
void on_actionSupport_on_Patreon_triggered();
void on_actionSupport_on_GithubSponser_triggered();
void on_actionOpen_Discord_Channel_triggered();
private:
void setupDiscord();
void stopGame();
void updateOpenRecent();
void updateGB(Ui::MainWindow *ui);
void loadCoreLib();
void loadPlugins();
void closeCoreLib();
void closePlugins();
void simulateInput();
Ui::MainWindow *ui;
QMenu *OpenRecent;
int verbose;
int nogui;
int run_test;
int test_key_value;
uint32_t frame_count;
QMessageBox *download_message = nullptr;
VkWindow *my_window = nullptr;
WorkerThread *workerThread = nullptr;
LogViewer logViewer;
QSettings *settings = nullptr;
KeyPressFilter keyPressFilter;
QTimer *frame_timer = nullptr;
QLabel *FPSLabel = nullptr;
QTimer *kill_timer = nullptr;
bool m_cheatsEnabled = false;
m64p_dynlib_handle coreLib;
m64p_dynlib_handle rspPlugin;
m64p_dynlib_handle audioPlugin;
m64p_dynlib_handle gfxPlugin;
m64p_dynlib_handle inputPlugin;
struct Discord_Application discord_app;
};
extern MainWindow *w;
class VolumeAction : public QWidgetAction
{
public:
VolumeAction(const QString &title, QObject *parent) : QWidgetAction(parent)
{
QWidget *pWidget = new QWidget;
QHBoxLayout *pLayout = new QHBoxLayout(pWidget);
QLabel *pLabel = new QLabel(title, pWidget);
pLayout->addWidget(pLabel);
pSlider = new QSlider(Qt::Horizontal, pWidget);
pSlider->setMinimum(0);
pSlider->setMaximum(100);
pLayout->addWidget(pSlider);
pWidget->setLayout(pLayout);
setDefaultWidget(pWidget);
}
void releaseWidget(QWidget *widget)
{
widget->deleteLater();
}
QSlider *slider()
{
return pSlider;
}
private:
QSlider *pSlider;
};
#endif // MAINWINDOW_H