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