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/Debugger/CtrlRegisterList.h
Views: 1401
1
#pragma once
2
3
//////////////////////////////////////////////////////////////////////////
4
//CtrlRegisterList
5
// CtrlRegisterList.cpp
6
//////////////////////////////////////////////////////////////////////////
7
//This Win32 control is made to be flexible and usable with
8
//every kind of CPU architechture that has fixed width instruction words.
9
//Just supply it an instance of a class derived from Debugger, with all methods
10
//overridden for full functionality. Look at the ppc one for an example.
11
//
12
//To add to a dialog box, just draw a User Control in the dialog editor,
13
//and set classname to "CtrlRegisterList". you also need to call CtrlRegisterList::init()
14
//before opening this dialog, to register the window class.
15
//
16
//To get a class instance to be able to access it, just use
17
// CtrlRegisterList::getFrom(GetDlgItem(yourdialog, IDC_yourid)).
18
19
#include "../../Core/Debugger/DebugInterface.h"
20
21
class CtrlRegisterList
22
{
23
HWND wnd;
24
HFONT font;
25
RECT rect;
26
27
int rowHeight;
28
int selection = 0;
29
int category = 0;
30
31
int oldSelection = 0;
32
33
bool selecting = false;
34
bool hasFocus = false;
35
DebugInterface *cpu = nullptr;
36
static TCHAR szClassName[];
37
38
u32 lastPC = 0;
39
u32 *lastCat0Values = nullptr;
40
bool *changedCat0Regs = nullptr;
41
bool ctrlDown = false;
42
43
u32 getSelectedRegValue(char *out, size_t size);
44
void copyRegisterValue();
45
void editRegisterValue();
46
public:
47
CtrlRegisterList(HWND _wnd);
48
~CtrlRegisterList();
49
static void init();
50
static void deinit();
51
static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
52
static CtrlRegisterList * getFrom(HWND wnd);
53
54
void onPaint(WPARAM wParam, LPARAM lParam);
55
void onKeyDown(WPARAM wParam, LPARAM lParam);
56
void onMouseDown(WPARAM wParam, LPARAM lParam, int button);
57
void onMouseUp(WPARAM wParam, LPARAM lParam, int button);
58
void onMouseMove(WPARAM wParam, LPARAM lParam, int button);
59
void redraw();
60
61
int yToIndex(int y);
62
63
void setCPU(DebugInterface *deb)
64
{
65
cpu = deb;
66
67
int regs = cpu->GetNumRegsInCategory(0);
68
lastCat0Values = new u32[regs+3];
69
changedCat0Regs = new bool[regs+3];
70
memset(lastCat0Values, 0, (regs+3) * sizeof(u32));
71
memset(changedCat0Regs, 0, (regs+3) * sizeof(bool));
72
}
73
DebugInterface *getCPU()
74
{
75
return cpu;
76
}
77
78
private:
79
bool redrawScheduled_ = false;
80
};
81
82