CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/UI/DevScreens.h
Views: 1401
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 OnLogView(UI::EventParams &e);
42
UI::EventReturn OnLogConfig(UI::EventParams &e);
43
UI::EventReturn OnJitCompare(UI::EventParams &e);
44
UI::EventReturn OnShaderView(UI::EventParams &e);
45
UI::EventReturn OnDeveloperTools(UI::EventParams &e);
46
UI::EventReturn OnResetLimitedLogging(UI::EventParams &e);
47
48
private:
49
Path gamePath_;
50
};
51
52
class JitDebugScreen : public UIDialogScreenWithBackground {
53
public:
54
JitDebugScreen() {}
55
void CreateViews() override;
56
57
const char *tag() const override { return "JitDebug"; }
58
59
private:
60
UI::EventReturn OnEnableAll(UI::EventParams &e);
61
UI::EventReturn OnDisableAll(UI::EventParams &e);
62
};
63
64
class LogConfigScreen : public UIDialogScreenWithBackground {
65
public:
66
LogConfigScreen() {}
67
void CreateViews() override;
68
69
const char *tag() const override { return "LogConfig"; }
70
71
private:
72
UI::EventReturn OnToggleAll(UI::EventParams &e);
73
UI::EventReturn OnEnableAll(UI::EventParams &e);
74
UI::EventReturn OnDisableAll(UI::EventParams &e);
75
UI::EventReturn OnLogLevel(UI::EventParams &e);
76
UI::EventReturn OnLogLevelChange(UI::EventParams &e);
77
};
78
79
class LogScreen : public UIDialogScreenWithBackground {
80
public:
81
void CreateViews() override;
82
void update() override;
83
84
const char *tag() const override { return "Log"; }
85
86
private:
87
void UpdateLog();
88
UI::EventReturn OnSubmit(UI::EventParams &e);
89
90
UI::TextEdit *cmdLine_ = nullptr;
91
UI::LinearLayout *vert_ = nullptr;
92
UI::ScrollView *scroll_ = nullptr;
93
bool toBottom_ = false;
94
};
95
96
class LogLevelScreen : public UI::ListPopupScreen {
97
public:
98
LogLevelScreen(std::string_view title);
99
100
const char *tag() const override { return "LogLevel"; }
101
102
private:
103
void OnCompleted(DialogResult result) override;
104
};
105
106
class SystemInfoScreen : public TabbedUIDialogScreenWithGameBackground {
107
public:
108
SystemInfoScreen(const Path &filename) : TabbedUIDialogScreenWithGameBackground(filename) {}
109
110
const char *tag() const override { return "SystemInfo"; }
111
112
void CreateTabs() override;
113
void update() override;
114
115
protected:
116
bool ShowSearchControls() const override { return false; }
117
void CreateInternalsTab(UI::ViewGroup *internals);
118
};
119
120
class GPIGPOScreen : public PopupScreen {
121
public:
122
GPIGPOScreen(std::string_view title) : PopupScreen(title, "OK") {}
123
const char *tag() const override { return "GPIGPO"; }
124
125
protected:
126
void CreatePopupContents(UI::ViewGroup *parent) override;
127
};
128
129
class ShaderListScreen : public UIDialogScreenWithBackground {
130
public:
131
void CreateViews() override;
132
133
const char *tag() const override { return "ShaderList"; }
134
135
private:
136
int ListShaders(DebugShaderType shaderType, UI::LinearLayout *view);
137
138
UI::EventReturn OnShaderClick(UI::EventParams &e);
139
140
UI::TabHolder *tabs_;
141
};
142
143
class ShaderViewScreen : public UIDialogScreenWithBackground {
144
public:
145
ShaderViewScreen(std::string id, DebugShaderType type)
146
: id_(id), type_(type) {}
147
148
void CreateViews() override;
149
bool key(const KeyInput &ki) override;
150
151
const char *tag() const override { return "ShaderView"; }
152
153
private:
154
std::string id_;
155
DebugShaderType type_;
156
};
157
158
class FrameDumpTestScreen : public UIDialogScreenWithBackground {
159
public:
160
FrameDumpTestScreen();
161
~FrameDumpTestScreen();
162
163
void CreateViews() override;
164
void update() override;
165
166
const char *tag() const override { return "FrameDumpTest"; }
167
168
private:
169
UI::EventReturn OnLoadDump(UI::EventParams &e);
170
171
std::vector<std::string> files_;
172
std::shared_ptr<http::Request> listing_;
173
std::shared_ptr<http::Request> dumpDownload_;
174
};
175
176
class TouchTestScreen : public UIDialogScreenWithGameBackground {
177
public:
178
TouchTestScreen(const Path &gamePath) : UIDialogScreenWithGameBackground(gamePath) {
179
for (int i = 0; i < MAX_TOUCH_POINTS; i++) {
180
touches_[i].id = -1;
181
}
182
}
183
184
void touch(const TouchInput &touch) override;
185
void DrawForeground(UIContext &dc) override;
186
187
bool key(const KeyInput &key) override;
188
void axis(const AxisInput &axis) override;
189
190
const char *tag() const override { return "TouchTest"; }
191
192
protected:
193
struct TrackedTouch {
194
int id;
195
float x;
196
float y;
197
};
198
enum {
199
MAX_TOUCH_POINTS = 10,
200
};
201
TrackedTouch touches_[MAX_TOUCH_POINTS]{};
202
203
std::vector<std::string> keyEventLog_;
204
205
UI::TextView *lastKeyEvents_ = nullptr;
206
207
double lastFrameTime_ = 0.0;
208
209
void CreateViews() override;
210
void UpdateLogView();
211
212
UI::EventReturn OnImmersiveModeChange(UI::EventParams &e);
213
UI::EventReturn OnRenderingBackend(UI::EventParams &e);
214
UI::EventReturn OnRecreateActivity(UI::EventParams &e);
215
};
216
217
void DrawProfile(UIContext &ui);
218
219
void AddOverlayList(UI::ViewGroup *items, ScreenManager *screenManager);
220
221