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/Windows/GEDebugger/CtrlDisplayListView.h
Views: 1401
1
#pragma once
2
3
#include <algorithm>
4
#include "Common/CommonWindows.h"
5
#include "GPU/Common/GPUDebugInterface.h"
6
7
class CtrlDisplayListView
8
{
9
HWND wnd;
10
RECT rect;
11
static LPCTSTR windowClass;
12
DisplayList list;
13
14
HFONT font;
15
HFONT boldfont;
16
u32 windowStart;
17
u32 curAddress;
18
u32 selectRangeStart;
19
u32 selectRangeEnd;
20
21
int visibleRows;
22
int rowHeight;
23
int instructionSize;
24
bool hasFocus;
25
bool validDisplayList;
26
27
struct {
28
int addressStart;
29
int opcodeStart;
30
} pixelPositions;
31
32
void toggleBreakpoint();
33
void PromptBreakpointCond();
34
35
public:
36
CtrlDisplayListView(HWND _wnd);
37
~CtrlDisplayListView();
38
static void registerClass();
39
static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
40
static CtrlDisplayListView * getFrom(HWND wnd);
41
42
HWND GetHWND() {
43
return wnd;
44
}
45
46
void onPaint(WPARAM wParam, LPARAM lParam);
47
void onKeyDown(WPARAM wParam, LPARAM lParam);
48
void onMouseDown(WPARAM wParam, LPARAM lParam, int button);
49
void onMouseUp(WPARAM wParam, LPARAM lParam, int button);
50
void onVScroll(WPARAM wParam, LPARAM lParam);
51
52
void redraw();
53
void setDisplayList(DisplayList& displayList)
54
{
55
validDisplayList = true;
56
list = displayList;
57
gotoAddr(list.pc);
58
}
59
void clearDisplayList()
60
{
61
validDisplayList = false;
62
}
63
64
void scrollWindow(int lines)
65
{
66
windowStart += lines*instructionSize;
67
redraw();
68
}
69
70
void gotoAddr(unsigned int addr)
71
{
72
u32 windowEnd = windowStart+visibleRows*instructionSize;
73
u32 newAddress = addr&(~(instructionSize-1));
74
75
if (newAddress < windowStart || newAddress >= windowEnd)
76
{
77
windowStart = newAddress-visibleRows/2*instructionSize;
78
}
79
80
setCurAddress(newAddress);
81
redraw();
82
}
83
84
void setCurAddress(u32 newAddress, bool extend = false)
85
{
86
u32 after = newAddress + instructionSize;
87
curAddress = newAddress;
88
selectRangeStart = extend ? std::min(selectRangeStart, newAddress) : newAddress;
89
selectRangeEnd = extend ? std::max(selectRangeEnd, after) : after;
90
}
91
92
void scrollAddressIntoView();
93
bool curAddressIsVisible();
94
};
95
96