Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hrydgard
GitHub Repository: hrydgard/ppsspp
Path: blob/master/Windows/Debugger/CtrlRegisterList.h
5663 views
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/MIPS/MIPSDebugInterface.h"
20
21
class CtrlRegisterList {
22
HWND wnd;
23
HFONT font;
24
RECT rect;
25
26
int rowHeight;
27
int selection = 0;
28
int category = 0;
29
30
int oldSelection = 0;
31
32
bool selecting = false;
33
bool hasFocus = false;
34
MIPSDebugInterface *cpu = nullptr;
35
36
u32 lastPC = 0;
37
u32 *lastCat0Values = nullptr;
38
bool *changedCat0Regs = nullptr;
39
bool ctrlDown = false;
40
41
u32 getSelectedRegValue(char *out, size_t size);
42
void copyRegisterValue();
43
void editRegisterValue();
44
public:
45
CtrlRegisterList(HWND _wnd);
46
~CtrlRegisterList();
47
static void init();
48
static void deinit();
49
static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
50
static CtrlRegisterList * getFrom(HWND wnd);
51
52
void onPaint(WPARAM wParam, LPARAM lParam);
53
void onKeyDown(WPARAM wParam, LPARAM lParam);
54
void onMouseDown(WPARAM wParam, LPARAM lParam, int button);
55
void onMouseUp(WPARAM wParam, LPARAM lParam, int button);
56
void onMouseMove(WPARAM wParam, LPARAM lParam, int button);
57
void redraw();
58
59
int yToIndex(int y);
60
61
void setCPU(MIPSDebugInterface *deb) {
62
cpu = deb;
63
constexpr int regs = MIPSDebugInterface::GetNumRegsInCategory(0);
64
lastCat0Values = new u32[regs+3];
65
changedCat0Regs = new bool[regs+3];
66
memset(lastCat0Values, 0, (regs+3) * sizeof(u32));
67
memset(changedCat0Regs, 0, (regs+3) * sizeof(bool));
68
}
69
MIPSDebugInterface *getCPU()
70
{
71
return cpu;
72
}
73
74
private:
75
bool redrawScheduled_ = false;
76
};
77
78