Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hrydgard
GitHub Repository: hrydgard/ppsspp
Path: blob/master/UI/DevScreens.h
3185 views
1
// Copyright (c) 2013- PPSSPP Project.
2
3
// This program is free software: you can redistribute it and/or modify
4
// it under the terms of the GNU General Public License as published by
5
// the Free Software Foundation, version 2.0 or later versions.
6
7
// This program is distributed in the hope that it will be useful,
8
// but WITHOUT ANY WARRANTY; without even the implied warranty of
9
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
// GNU General Public License 2.0 for more details.
11
12
// A copy of the GPL 2.0 should have been included with the program.
13
// If not, see http://www.gnu.org/licenses/
14
15
// Official git repository and contact information can be found at
16
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
17
18
#pragma once
19
20
#include <memory>
21
#include <string>
22
#include <vector>
23
24
#include "Common/Data/Text/I18n.h"
25
#include "Common/Net/HTTPClient.h"
26
#include "Common/UI/UIScreen.h"
27
#include "UI/TabbedDialogScreen.h"
28
#include "UI/MiscScreens.h"
29
#include "GPU/Common/ShaderCommon.h"
30
31
class DevMenuScreen : public PopupScreen {
32
public:
33
DevMenuScreen(const Path &gamePath, I18NCat cat) : PopupScreen(T(cat, "Dev Tools")), gamePath_(gamePath) {}
34
35
const char *tag() const override { return "DevMenu"; }
36
37
void CreatePopupContents(UI::ViewGroup *parent) override;
38
void dialogFinished(const Screen *dialog, DialogResult result) override;
39
40
protected:
41
UI::EventReturn OnJitCompare(UI::EventParams &e);
42
UI::EventReturn OnShaderView(UI::EventParams &e);
43
UI::EventReturn OnDeveloperTools(UI::EventParams &e);
44
UI::EventReturn OnResetLimitedLogging(UI::EventParams &e);
45
46
private:
47
Path gamePath_;
48
};
49
50
class JitDebugScreen : public UIDialogScreenWithBackground {
51
public:
52
JitDebugScreen() {}
53
void CreateViews() override;
54
55
const char *tag() const override { return "JitDebug"; }
56
57
private:
58
UI::EventReturn OnEnableAll(UI::EventParams &e);
59
UI::EventReturn OnDisableAll(UI::EventParams &e);
60
};
61
62
class LogConfigScreen : public UIDialogScreenWithBackground {
63
public:
64
LogConfigScreen() {}
65
void CreateViews() override;
66
67
const char *tag() const override { return "LogConfig"; }
68
69
private:
70
UI::EventReturn OnToggleAll(UI::EventParams &e);
71
UI::EventReturn OnEnableAll(UI::EventParams &e);
72
UI::EventReturn OnDisableAll(UI::EventParams &e);
73
UI::EventReturn OnLogLevel(UI::EventParams &e);
74
UI::EventReturn OnLogLevelChange(UI::EventParams &e);
75
};
76
77
class LogViewScreen : public UIDialogScreenWithBackground {
78
public:
79
void CreateViews() override;
80
void update() override;
81
82
const char *tag() const override { return "Log"; }
83
84
private:
85
void UpdateLog();
86
87
UI::LinearLayout *vert_ = nullptr;
88
UI::ScrollView *scroll_ = nullptr;
89
bool toBottom_ = false;
90
};
91
92
class LogLevelScreen : public UI::ListPopupScreen {
93
public:
94
LogLevelScreen(std::string_view title);
95
96
const char *tag() const override { return "LogLevel"; }
97
98
private:
99
void OnCompleted(DialogResult result) override;
100
};
101
102
class SystemInfoScreen : public TabbedUIDialogScreenWithGameBackground {
103
public:
104
SystemInfoScreen(const Path &filename) : TabbedUIDialogScreenWithGameBackground(filename) {}
105
106
const char *tag() const override { return "SystemInfo"; }
107
108
void CreateTabs() override;
109
void update() override;
110
void resized() override { RecreateViews(); }
111
112
protected:
113
UI::EventReturn CopySummaryToClipboard(UI::EventParams &e);
114
bool ShowSearchControls() const override { return false; }
115
116
private:
117
void CreateDeviceInfoTab(UI::LinearLayout *deviceInfo);
118
void CreateStorageTab(UI::LinearLayout *storage);
119
void CreateBuildConfigTab(UI::LinearLayout *storage);
120
void CreateCPUExtensionsTab(UI::LinearLayout *storage);
121
void CreateDriverBugsTab(UI::LinearLayout *storage);
122
void CreateInternalsTab(UI::ViewGroup *internals);
123
void CreateOpenGLExtsTab(UI::LinearLayout *gpuExtensions);
124
void CreateVulkanExtsTab(UI::LinearLayout *gpuExtensions);
125
126
int testSliderValue_ = 0;
127
};
128
129
class GPIGPOScreen : public PopupScreen {
130
public:
131
GPIGPOScreen(std::string_view title) : PopupScreen(title, "OK") {}
132
const char *tag() const override { return "GPIGPO"; }
133
134
protected:
135
void CreatePopupContents(UI::ViewGroup *parent) override;
136
};
137
138
class ShaderListScreen : public UIDialogScreenWithBackground {
139
public:
140
void CreateViews() override;
141
142
const char *tag() const override { return "ShaderList"; }
143
144
private:
145
int ListShaders(DebugShaderType shaderType, UI::LinearLayout *view);
146
147
UI::EventReturn OnShaderClick(UI::EventParams &e);
148
149
UI::TabHolder *tabs_;
150
};
151
152
class ShaderViewScreen : public UIDialogScreenWithBackground {
153
public:
154
ShaderViewScreen(std::string id, DebugShaderType type)
155
: id_(id), type_(type) {}
156
157
void CreateViews() override;
158
bool key(const KeyInput &ki) override;
159
160
const char *tag() const override { return "ShaderView"; }
161
162
private:
163
std::string id_;
164
DebugShaderType type_;
165
};
166
167
class FrameDumpTestScreen : public UIDialogScreenWithBackground {
168
public:
169
FrameDumpTestScreen();
170
~FrameDumpTestScreen();
171
172
void CreateViews() override;
173
void update() override;
174
175
const char *tag() const override { return "FrameDumpTest"; }
176
177
private:
178
UI::EventReturn OnLoadDump(UI::EventParams &e);
179
180
std::vector<std::string> files_;
181
std::shared_ptr<http::Request> listing_;
182
std::shared_ptr<http::Request> dumpDownload_;
183
};
184
185
class TouchTestScreen : public UIDialogScreenWithGameBackground {
186
public:
187
TouchTestScreen(const Path &gamePath) : UIDialogScreenWithGameBackground(gamePath) {
188
for (int i = 0; i < MAX_TOUCH_POINTS; i++) {
189
touches_[i].id = -1;
190
}
191
}
192
193
void touch(const TouchInput &touch) override;
194
void DrawForeground(UIContext &dc) override;
195
196
bool key(const KeyInput &key) override;
197
void axis(const AxisInput &axis) override;
198
199
const char *tag() const override { return "TouchTest"; }
200
201
protected:
202
struct TrackedTouch {
203
int id;
204
float x;
205
float y;
206
};
207
enum {
208
MAX_TOUCH_POINTS = 10,
209
};
210
TrackedTouch touches_[MAX_TOUCH_POINTS]{};
211
212
std::vector<std::string> keyEventLog_;
213
214
UI::TextView *lastKeyEvents_ = nullptr;
215
216
double lastFrameTime_ = 0.0;
217
218
void CreateViews() override;
219
void UpdateLogView();
220
221
UI::EventReturn OnImmersiveModeChange(UI::EventParams &e);
222
UI::EventReturn OnRenderingBackend(UI::EventParams &e);
223
UI::EventReturn OnRecreateActivity(UI::EventParams &e);
224
};
225
226
void DrawProfile(UIContext &ui);
227
228
void AddOverlayList(UI::ViewGroup *items, ScreenManager *screenManager);
229
230