Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hrydgard
GitHub Repository: hrydgard/ppsspp
Path: blob/master/UI/DevScreens.h
5668 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/BaseScreens.h"
29
#include "UI/PopupScreens.h"
30
#include "UI/SimpleDialogScreen.h"
31
32
#include "GPU/Common/ShaderCommon.h"
33
34
class DevMenuScreen : public UI::PopupScreen {
35
public:
36
DevMenuScreen(const Path &gamePath, I18NCat cat) : PopupScreen(T(cat, "Dev Tools")), gamePath_(gamePath) {}
37
38
const char *tag() const override { return "DevMenu"; }
39
40
void CreatePopupContents(UI::ViewGroup *parent) override;
41
void dialogFinished(const Screen *dialog, DialogResult result) override;
42
43
protected:
44
void OnJitCompare(UI::EventParams &e);
45
void OnShaderView(UI::EventParams &e);
46
void OnDeveloperTools(UI::EventParams &e);
47
void OnResetLimitedLogging(UI::EventParams &e);
48
49
private:
50
Path gamePath_;
51
};
52
53
class JitDebugScreen : public UIBaseDialogScreen {
54
public:
55
JitDebugScreen() {}
56
void CreateViews() override;
57
58
const char *tag() const override { return "JitDebug"; }
59
60
private:
61
void OnEnableAll(UI::EventParams &e);
62
void OnDisableAll(UI::EventParams &e);
63
};
64
65
class LogConfigScreen : public UITwoPaneBaseDialogScreen {
66
public:
67
LogConfigScreen() : UITwoPaneBaseDialogScreen(Path(), TwoPaneFlags::ContentsCanScroll | TwoPaneFlags::SettingsInContextMenu) {}
68
void CreateSettingsViews(UI::ViewGroup *parent) override;
69
void CreateContentViews(UI::ViewGroup *parent) override;
70
71
const char *tag() const override { return "LogConfig"; }
72
73
private:
74
std::string_view GetTitle() const override;
75
76
void OnToggleAll(UI::EventParams &e);
77
void OnEnableAll(UI::EventParams &e);
78
void OnDisableAll(UI::EventParams &e);
79
void OnLogLevel(UI::EventParams &e);
80
void OnLogLevelChange(UI::EventParams &e);
81
};
82
83
class LogViewScreen : public UIBaseDialogScreen {
84
public:
85
void CreateViews() override;
86
void update() override;
87
88
const char *tag() const override { return "Log"; }
89
90
private:
91
void UpdateLog();
92
93
UI::LinearLayout *vert_ = nullptr;
94
UI::ScrollView *scroll_ = nullptr;
95
bool toBottom_ = false;
96
};
97
98
class LogLevelScreen : public UI::ListPopupScreen {
99
public:
100
LogLevelScreen(std::string_view title);
101
102
const char *tag() const override { return "LogLevel"; }
103
104
private:
105
void OnCompleted(DialogResult result) override;
106
};
107
108
class GPIGPOScreen : public UI::PopupScreen {
109
public:
110
GPIGPOScreen(std::string_view title) : PopupScreen(title, "OK") {}
111
const char *tag() const override { return "GPIGPO"; }
112
113
protected:
114
void CreatePopupContents(UI::ViewGroup *parent) override;
115
};
116
117
class ShaderListScreen : public UITabbedBaseDialogScreen {
118
public:
119
ShaderListScreen() : UITabbedBaseDialogScreen(Path()) {}
120
void CreateTabs() override;
121
122
const char *tag() const override { return "ShaderList"; }
123
124
private:
125
bool ForceHorizontalTabs() const override {return true; }
126
int ListShaders(DebugShaderType shaderType, UI::LinearLayout *view);
127
128
void OnShaderClick(UI::EventParams &e);
129
};
130
131
class ShaderViewScreen : public UIBaseDialogScreen {
132
public:
133
ShaderViewScreen(std::string id, DebugShaderType type)
134
: id_(id), type_(type) {}
135
136
void CreateViews() override;
137
bool key(const KeyInput &ki) override;
138
139
const char *tag() const override { return "ShaderView"; }
140
141
private:
142
std::string id_;
143
DebugShaderType type_;
144
};
145
146
class FrameDumpTestScreen : public UITabbedBaseDialogScreen {
147
public:
148
FrameDumpTestScreen() : UITabbedBaseDialogScreen(Path()) {}
149
~FrameDumpTestScreen();
150
151
void CreateTabs() override;
152
void update() override;
153
154
const char *tag() const override { return "FrameDumpTest"; }
155
156
private:
157
void OnLoadDump(UI::EventParams &e);
158
bool ShowSearchControls() const override { return false; }
159
160
std::vector<std::string> files_;
161
std::shared_ptr<http::Request> listing_;
162
std::shared_ptr<http::Request> dumpDownload_;
163
};
164
165
class TouchTestScreen : public UIBaseDialogScreen {
166
public:
167
TouchTestScreen(const Path &gamePath) : UIBaseDialogScreen(gamePath) {
168
for (int i = 0; i < MAX_TOUCH_POINTS; i++) {
169
touches_[i].id = -1;
170
}
171
}
172
173
void touch(const TouchInput &touch) override;
174
void DrawForeground(UIContext &dc) override;
175
176
bool key(const KeyInput &key) override;
177
void axis(const AxisInput &axis) override;
178
179
const char *tag() const override { return "TouchTest"; }
180
181
protected:
182
struct TrackedTouch {
183
int id;
184
float x;
185
float y;
186
};
187
enum {
188
MAX_TOUCH_POINTS = 10,
189
};
190
TrackedTouch touches_[MAX_TOUCH_POINTS]{};
191
192
std::vector<std::string> keyEventLog_;
193
194
UI::TextView *lastKeyEvents_ = nullptr;
195
196
double lastFrameTime_ = 0.0;
197
198
void CreateViews() override;
199
void UpdateLogView();
200
201
void OnImmersiveModeChange(UI::EventParams &e);
202
void OnRenderingBackend(UI::EventParams &e);
203
void OnRecreateActivity(UI::EventParams &e);
204
};
205
206
void DrawProfile(UIContext &ui);
207
208
void AddOverlayList(UI::ViewGroup *items, ScreenManager *screenManager);
209
210