Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hrydgard
GitHub Repository: hrydgard/ppsspp
Path: blob/master/Windows/GEDebugger/GEDebugger.h
3185 views
1
// Copyright (c) 2012- 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 "Common/Common.h"
21
#include "Common/CommonWindows.h"
22
#include "GPU/Common/GPUDebugInterface.h"
23
#include "GPU/Debugger/Debugger.h"
24
#include "Windows/resource.h"
25
#include "Windows/W32Util/DialogManager.h"
26
#include "Windows/W32Util/TabControl.h"
27
#include "Windows/GEDebugger/SimpleGLWindow.h"
28
29
enum {
30
WM_GEDBG_STEPDISPLAYLIST = WM_USER + 200,
31
WM_GEDBG_TOGGLEPCBREAKPOINT,
32
WM_GEDBG_RUNTOWPARAM,
33
WM_GEDBG_SETCMDWPARAM,
34
WM_GEDBG_UPDATE_WATCH,
35
};
36
37
class CtrlDisplayListView;
38
class TabDisplayLists;
39
class TabStateFlags;
40
class TabStateLighting;
41
class TabStateTexture;
42
class TabStateSettings;
43
class TabVertices;
44
class TabMatrices;
45
class TabStateWatch;
46
struct GPUgstate;
47
48
enum class GETabPosition {
49
LEFT = 1,
50
RIGHT = 2,
51
TOPRIGHT = 4,
52
ALL = 7,
53
};
54
ENUM_CLASS_BITOPS(GETabPosition);
55
56
enum class GETabType {
57
LIST_DISASM,
58
LISTS,
59
STATE,
60
WATCH,
61
};
62
63
struct GEDebuggerTab {
64
const wchar_t *name;
65
GETabPosition pos;
66
GETabType type;
67
struct {
68
union {
69
Dialog *dlg;
70
CtrlDisplayListView *displayList;
71
void *ptr;
72
};
73
int index = -1;
74
} state[3];
75
void *(*add)(GEDebuggerTab *tab, TabControl *tabs, GETabPosition pos, HINSTANCE inst, HWND parent);
76
void (*remove)(GEDebuggerTab *tab, TabControl *tabs, GETabPosition pos, void *ptr);
77
void (*update)(GEDebuggerTab *tab, TabControl *tabs, GETabPosition pos, void *ptr);
78
};
79
80
class StepCountDlg : public Dialog {
81
public:
82
StepCountDlg(HINSTANCE _hInstance, HWND _hParent);
83
~StepCountDlg();
84
protected:
85
BOOL DlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
86
private:
87
void Jump(int count, bool relative);
88
};
89
90
class CGEDebugger : public Dialog {
91
public:
92
CGEDebugger(HINSTANCE _hInstance, HWND _hParent);
93
~CGEDebugger();
94
95
static void Init();
96
97
protected:
98
BOOL DlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
99
100
private:
101
void SetupPreviews();
102
void UpdatePreviews();
103
void UpdatePrimaryPreview(const GPUgstate &state);
104
void UpdateSecondPreview(const GPUgstate &state);
105
static u32 PrimPreviewOp();
106
void UpdatePrimPreview(u32 op, int which);
107
void CleanupPrimPreview();
108
void HandleRedraw(int which);
109
void UpdateSize(WORD width, WORD height);
110
void SavePosition();
111
void UpdateTextureLevel(int level);
112
void DescribePrimaryPreview(const GPUgstate &state, char desc[256]);
113
void DescribeSecondPreview(const GPUgstate &state, char desc[256]);
114
void PrimaryPreviewHover(int x, int y);
115
void SecondPreviewHover(int x, int y);
116
void PreviewExport(const GPUDebugBuffer *buffer);
117
void PreviewToClipboard(const GPUDebugBuffer *buffer, bool saveAlpha);
118
void UpdateMenus();
119
void UpdateTab(GEDebuggerTab *tab);
120
void AddTab(GEDebuggerTab *tab, GETabPosition mask);
121
void RemoveTab(GEDebuggerTab *tab, GETabPosition mask);
122
int HasTabIndex(GEDebuggerTab *tab, GETabPosition pos);
123
void CheckTabMessage(TabControl *t, GETabPosition pos, LPARAM lParam);
124
125
u32 TexturePreviewFlags(const GPUgstate &state);
126
127
SimpleGLWindow *primaryWindow = nullptr;
128
SimpleGLWindow *secondWindow = nullptr;
129
std::vector<GEDebuggerTab> tabStates_;
130
TabControl *tabs = nullptr;
131
TabControl *tabsRight_ = nullptr;
132
TabControl *tabsTR_ = nullptr;
133
TabControl *fbTabs = nullptr;
134
int textureLevel_ = 0;
135
bool showClut_ = false;
136
bool forceOpaque_ = false;
137
bool autoFlush_ = true;
138
// The most recent primary/framebuffer and texture buffers.
139
const GPUDebugBuffer *primaryBuffer_ = nullptr;
140
const GPUDebugBuffer *secondBuffer_ = nullptr;
141
bool primaryIsFramebuffer_ = false;
142
bool secondIsFramebuffer_ = false;
143
144
uint32_t primaryTrackX_ = 0xFFFFFFFF;
145
uint32_t primaryTrackY_ = 0xFFFFFFFF;
146
uint32_t secondTrackX_ = 0xFFFFFFFF;
147
uint32_t secondTrackY_ = 0xFFFFFFFF;
148
149
bool updating_ = false;
150
int previewsEnabled_ = 3;
151
int minWidth_;
152
int minHeight_;
153
154
StepCountDlg stepCountDlg;
155
};
156
157