mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-14 18:19:36 +01:00
Merge pull request #11641 from xebra/improve_stepcount
GE Debugger: Add step count dialog.
This commit is contained in:
4 files changed
+95
-17
No files matched your search
@@ -57,13 +57,76 @@ enum PrimaryDisplayType {
|
||||
PRIMARY_STENCILBUF,
|
||||
};
|
||||
|
||||
StepCountDlg::StepCountDlg(HINSTANCE _hInstance, HWND _hParent) : Dialog((LPCSTR)IDD_GEDBG_STEPCOUNT, _hInstance, _hParent) {
|
||||
DialogManager::AddDlg(this);
|
||||
|
||||
for (int i = 0; i < 4; i++) // Add items 1, 10, 100, 1000
|
||||
SendMessageA(GetDlgItem(m_hDlg, IDC_GEDBG_STEPCOUNT_COMBO), CB_ADDSTRING, 0, (LPARAM)std::to_string((int)pow(10, i)).c_str());
|
||||
SetWindowTextA(GetDlgItem(m_hDlg, IDC_GEDBG_STEPCOUNT_COMBO), "1");
|
||||
}
|
||||
|
||||
StepCountDlg::~StepCountDlg() {
|
||||
DialogManager::RemoveDlg(this);
|
||||
}
|
||||
|
||||
void StepCountDlg::Jump(int count, bool relative) {
|
||||
if (relative && count == 0)
|
||||
return;
|
||||
SetBreakNext(BreakNext::COUNT);
|
||||
SetBreakCount(count, relative);
|
||||
};
|
||||
|
||||
BOOL StepCountDlg::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
int count;
|
||||
bool relative;
|
||||
auto GetValue = [&]() {
|
||||
char str[7]; // +/-99999\0
|
||||
GetWindowTextA(GetDlgItem(m_hDlg, IDC_GEDBG_STEPCOUNT_COMBO), str, 7);
|
||||
relative = str[0] == '+' || str[0] == '-';
|
||||
return TryParse(str, &count);
|
||||
};
|
||||
|
||||
switch (message) {
|
||||
case WM_CLOSE:
|
||||
Show(false);
|
||||
return TRUE;
|
||||
case WM_COMMAND:
|
||||
switch (wParam) {
|
||||
case IDC_GEDBG_STEPCOUNT_DEC:
|
||||
if (GetValue())
|
||||
Jump(-abs(count), true);
|
||||
return TRUE;
|
||||
case IDC_GEDBG_STEPCOUNT_INC:
|
||||
if (GetValue())
|
||||
Jump(abs(count), true);
|
||||
return TRUE;
|
||||
case IDC_GEDBG_STEPCOUNT_JUMP:
|
||||
if (GetValue())
|
||||
Jump(abs(count), false);
|
||||
return TRUE;
|
||||
case IDOK:
|
||||
if (GetValue())
|
||||
Jump(count, relative);
|
||||
Show(false);
|
||||
return TRUE;
|
||||
case IDCANCEL:
|
||||
SetFocus(m_hParent);
|
||||
Show(false);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CGEDebugger::Init() {
|
||||
SimpleGLWindow::RegisterClass();
|
||||
CtrlDisplayListView::registerClass();
|
||||
}
|
||||
|
||||
CGEDebugger::CGEDebugger(HINSTANCE _hInstance, HWND _hParent)
|
||||
: Dialog((LPCSTR)IDD_GEDEBUGGER, _hInstance, _hParent) {
|
||||
: Dialog((LPCSTR)IDD_GEDEBUGGER, _hInstance, _hParent)
|
||||
, stepCountDlg(_hInstance, m_hDlg) {
|
||||
// minimum size = a little more than the default
|
||||
RECT windowRect;
|
||||
GetWindowRect(m_hDlg, &windowRect);
|
||||
@@ -658,6 +721,7 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
case WM_CLOSE:
|
||||
GPUDebug::SetActive(false);
|
||||
|
||||
stepCountDlg.Show(false);
|
||||
Show(false);
|
||||
return TRUE;
|
||||
|
||||
@@ -726,22 +790,7 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
break;
|
||||
|
||||
case IDC_GEDBG_STEPCOUNT:
|
||||
{
|
||||
std::string value;
|
||||
int count;
|
||||
if (InputBox_GetString(GetModuleHandle(NULL), m_hDlg, L"Prim count", "", value)) {
|
||||
if (value.length() > 1 && value[0] == '+' && TryParse(value.substr(1), &count)) {
|
||||
SetBreakNext(BreakNext::COUNT);
|
||||
SetBreakCount(count, true);
|
||||
} else if (value.length() > 1 && value[0] == '-' && TryParse(value.substr(1), &count)) {
|
||||
SetBreakNext(BreakNext::COUNT);
|
||||
SetBreakCount(-count, true);
|
||||
} else if (TryParse(value, &count)) {
|
||||
SetBreakNext(BreakNext::COUNT);
|
||||
SetBreakCount(count);
|
||||
}
|
||||
}
|
||||
}
|
||||
stepCountDlg.Show(true);
|
||||
break;
|
||||
|
||||
case IDC_GEDBG_BREAKTEX:
|
||||
|
||||
@@ -44,6 +44,16 @@ class TabMatrices;
|
||||
class TabStateWatch;
|
||||
struct GPUgstate;
|
||||
|
||||
class StepCountDlg : public Dialog {
|
||||
public:
|
||||
StepCountDlg(HINSTANCE _hInstance, HWND _hParent);
|
||||
~StepCountDlg();
|
||||
protected:
|
||||
BOOL DlgProc(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
private:
|
||||
void Jump(int value, bool relative);
|
||||
};
|
||||
|
||||
class CGEDebugger : public Dialog {
|
||||
public:
|
||||
CGEDebugger(HINSTANCE _hInstance, HWND _hParent);
|
||||
@@ -100,4 +110,6 @@ private:
|
||||
int previewsEnabled_ = 3;
|
||||
int minWidth_;
|
||||
int minHeight_;
|
||||
|
||||
StepCountDlg stepCountDlg;
|
||||
};
|
||||
@@ -234,6 +234,18 @@ BEGIN
|
||||
PUSHBUTTON "Break on Target...",IDC_GEDBG_BREAKTARGET,394,211,100,14
|
||||
END
|
||||
|
||||
IDD_GEDBG_STEPCOUNT DIALOGEX 0, 0, 124, 18
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
|
||||
EXSTYLE WS_EX_TOOLWINDOW
|
||||
CAPTION "Step Count"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
COMBOBOX IDC_GEDBG_STEPCOUNT_COMBO,6,3,50,13,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP | ES_NUMBER
|
||||
PUSHBUTTON "-",IDC_GEDBG_STEPCOUNT_DEC,58,2,14,14
|
||||
PUSHBUTTON "+",IDC_GEDBG_STEPCOUNT_INC,73,2,14,14
|
||||
PUSHBUTTON "Jump",IDC_GEDBG_STEPCOUNT_JUMP,88,2,30,14
|
||||
END
|
||||
|
||||
|
||||
IDD_GEDBG_TAB_VALUES DIALOGEX 0, 0, 316, 183
|
||||
STYLE DS_SETFONT | WS_CHILD | DS_CONTROL
|
||||
|
||||
@@ -81,6 +81,7 @@
|
||||
#define IDD_DUMPMEMORY 253
|
||||
#define IDD_GEDBG_TAB_VERTICES 254
|
||||
#define IDD_GEDBG_TAB_MATRICES 255
|
||||
#define IDD_GEDBG_STEPCOUNT 256
|
||||
|
||||
#define IDC_STOPGO 1001
|
||||
#define IDC_ADDRESS 1002
|
||||
@@ -364,6 +365,10 @@
|
||||
#define ID_OPTIONS_SCREENFILTER_MENU 40197
|
||||
#define ID_OPTIONS_TEXTURESCALING_MENU 40198
|
||||
#define IDC_GEDBG_STEPCOUNT 40199
|
||||
#define IDC_GEDBG_STEPCOUNT_DEC 40200
|
||||
#define IDC_GEDBG_STEPCOUNT_INC 40201
|
||||
#define IDC_GEDBG_STEPCOUNT_JUMP 40202
|
||||
#define IDC_GEDBG_STEPCOUNT_COMBO 40203
|
||||
|
||||
// Dummy option to let the buffered rendering hotkey cycle through all the options.
|
||||
#define ID_OPTIONS_BUFFEREDRENDERINGDUMMY 40500
|
||||
|
||||
Reference in new issue
Block a user