mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Debugger: Cleanup Windows breakpoint dialog.
Just cleanup of how its callback works.
This commit is contained in:
parent
069ff3e58c
commit
1e84047583
@ -6,41 +6,52 @@
|
||||
#include "BreakpointWindow.h"
|
||||
#include "../resource.h"
|
||||
|
||||
BreakpointWindow* BreakpointWindow::bp;
|
||||
INT_PTR CALLBACK BreakpointWindow::StaticDlgFunc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam) {
|
||||
BreakpointWindow *thiz;
|
||||
if (iMsg == WM_INITDIALOG) {
|
||||
SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)lParam);
|
||||
thiz = (BreakpointWindow *)lParam;
|
||||
} else {
|
||||
thiz = (BreakpointWindow *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
|
||||
}
|
||||
|
||||
INT_PTR CALLBACK BreakpointWindow::dlgFunc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||
if (!thiz)
|
||||
return FALSE;
|
||||
return thiz->DlgFunc(hWnd, iMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
INT_PTR BreakpointWindow::DlgFunc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
char str[128];
|
||||
|
||||
switch (iMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
SendMessage(GetDlgItem(hwnd,IDC_BREAKPOINT_EXECUTE),BM_SETCHECK,bp->memory ? BST_UNCHECKED : BST_CHECKED,0);
|
||||
SendMessage(GetDlgItem(hwnd,IDC_BREAKPOINT_MEMORY),BM_SETCHECK,bp->memory ? BST_CHECKED : BST_UNCHECKED,0);
|
||||
SendMessage(GetDlgItem(hwnd,IDC_BREAKPOINT_READ),BM_SETCHECK, bp->read ? BST_CHECKED : BST_UNCHECKED,0);
|
||||
SendMessage(GetDlgItem(hwnd,IDC_BREAKPOINT_WRITE),BM_SETCHECK, bp->write ? BST_CHECKED : BST_UNCHECKED,0);
|
||||
SendMessage(GetDlgItem(hwnd,IDC_BREAKPOINT_ONCHANGE),BM_SETCHECK, bp->onChange ? BST_CHECKED : BST_UNCHECKED,0);
|
||||
SendMessage(GetDlgItem(hwnd,IDC_BREAKPOINT_ENABLED),BM_SETCHECK, bp->enabled ? BST_CHECKED : BST_UNCHECKED,0);
|
||||
SendMessage(GetDlgItem(hwnd,IDC_BREAKPOINT_LOG),BM_SETCHECK, bp->log ? BST_CHECKED : BST_UNCHECKED,0);
|
||||
SendMessage(GetDlgItem(hwnd, IDC_BREAKPOINT_EXECUTE), BM_SETCHECK, memory ? BST_UNCHECKED : BST_CHECKED, 0);
|
||||
SendMessage(GetDlgItem(hwnd, IDC_BREAKPOINT_MEMORY), BM_SETCHECK, memory ? BST_CHECKED : BST_UNCHECKED, 0);
|
||||
SendMessage(GetDlgItem(hwnd, IDC_BREAKPOINT_READ), BM_SETCHECK, read ? BST_CHECKED : BST_UNCHECKED, 0);
|
||||
SendMessage(GetDlgItem(hwnd, IDC_BREAKPOINT_WRITE), BM_SETCHECK, write ? BST_CHECKED : BST_UNCHECKED, 0);
|
||||
SendMessage(GetDlgItem(hwnd, IDC_BREAKPOINT_ONCHANGE), BM_SETCHECK, onChange ? BST_CHECKED : BST_UNCHECKED, 0);
|
||||
SendMessage(GetDlgItem(hwnd, IDC_BREAKPOINT_ENABLED), BM_SETCHECK, enabled ? BST_CHECKED : BST_UNCHECKED, 0);
|
||||
SendMessage(GetDlgItem(hwnd, IDC_BREAKPOINT_LOG), BM_SETCHECK, log ? BST_CHECKED : BST_UNCHECKED, 0);
|
||||
|
||||
EnableWindow(GetDlgItem(hwnd,IDC_BREAKPOINT_READ),bp->memory);
|
||||
EnableWindow(GetDlgItem(hwnd,IDC_BREAKPOINT_WRITE),bp->memory);
|
||||
EnableWindow(GetDlgItem(hwnd,IDC_BREAKPOINT_ONCHANGE),bp->memory);
|
||||
EnableWindow(GetDlgItem(hwnd,IDC_BREAKPOINT_SIZE),bp->memory);
|
||||
EnableWindow(GetDlgItem(hwnd,IDC_BREAKPOINT_CONDITION),!bp->memory);
|
||||
EnableWindow(GetDlgItem(hwnd,IDC_BREAKPOINT_LOG_FORMAT), bp->log);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_BREAKPOINT_READ), memory);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_BREAKPOINT_WRITE), memory);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_BREAKPOINT_ONCHANGE), memory);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_BREAKPOINT_SIZE), memory);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_BREAKPOINT_CONDITION), !memory);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_BREAKPOINT_LOG_FORMAT), log);
|
||||
|
||||
if (bp->address != -1)
|
||||
{
|
||||
snprintf(str, sizeof(str), "0x%08X", bp->address);
|
||||
if (address != -1) {
|
||||
snprintf(str, sizeof(str), "0x%08X", address);
|
||||
SetWindowTextA(GetDlgItem(hwnd,IDC_BREAKPOINT_ADDRESS),str);
|
||||
}
|
||||
|
||||
snprintf(str, sizeof(str), "0x%08X", bp->size);
|
||||
snprintf(str, sizeof(str), "0x%08X", size);
|
||||
SetWindowTextA(GetDlgItem(hwnd, IDC_BREAKPOINT_SIZE),str);
|
||||
|
||||
SetWindowTextW(GetDlgItem(hwnd, IDC_BREAKPOINT_CONDITION), ConvertUTF8ToWString(bp->condition).c_str());
|
||||
SetWindowTextW(GetDlgItem(hwnd, IDC_BREAKPOINT_LOG_FORMAT), ConvertUTF8ToWString(bp->logFormat).c_str());
|
||||
SetWindowTextW(GetDlgItem(hwnd, IDC_BREAKPOINT_CONDITION), ConvertUTF8ToWString(condition).c_str());
|
||||
SetWindowTextW(GetDlgItem(hwnd, IDC_BREAKPOINT_LOG_FORMAT), ConvertUTF8ToWString(logFormat).c_str());
|
||||
return TRUE;
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
@ -49,12 +60,12 @@ INT_PTR CALLBACK BreakpointWindow::dlgFunc(HWND hwnd, UINT iMsg, WPARAM wParam,
|
||||
switch (HIWORD(wParam))
|
||||
{
|
||||
case BN_CLICKED:
|
||||
bp->memory = false;
|
||||
EnableWindow(GetDlgItem(hwnd,IDC_BREAKPOINT_READ),bp->memory);
|
||||
EnableWindow(GetDlgItem(hwnd,IDC_BREAKPOINT_WRITE),bp->memory);
|
||||
EnableWindow(GetDlgItem(hwnd,IDC_BREAKPOINT_ONCHANGE),bp->memory);
|
||||
EnableWindow(GetDlgItem(hwnd,IDC_BREAKPOINT_SIZE),bp->memory);
|
||||
EnableWindow(GetDlgItem(hwnd,IDC_BREAKPOINT_CONDITION),!bp->memory);
|
||||
memory = false;
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_BREAKPOINT_READ), memory);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_BREAKPOINT_WRITE), memory);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_BREAKPOINT_ONCHANGE), memory);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_BREAKPOINT_SIZE), memory);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_BREAKPOINT_CONDITION), !memory);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -62,12 +73,12 @@ INT_PTR CALLBACK BreakpointWindow::dlgFunc(HWND hwnd, UINT iMsg, WPARAM wParam,
|
||||
switch (HIWORD(wParam))
|
||||
{
|
||||
case BN_CLICKED:
|
||||
bp->memory = true;
|
||||
EnableWindow(GetDlgItem(hwnd,IDC_BREAKPOINT_READ),bp->memory);
|
||||
EnableWindow(GetDlgItem(hwnd,IDC_BREAKPOINT_WRITE),bp->memory);
|
||||
EnableWindow(GetDlgItem(hwnd,IDC_BREAKPOINT_ONCHANGE),bp->memory);
|
||||
EnableWindow(GetDlgItem(hwnd,IDC_BREAKPOINT_SIZE),bp->memory);
|
||||
EnableWindow(GetDlgItem(hwnd,IDC_BREAKPOINT_CONDITION),!bp->memory);
|
||||
memory = true;
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_BREAKPOINT_READ), memory);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_BREAKPOINT_WRITE), memory);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_BREAKPOINT_ONCHANGE), memory);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_BREAKPOINT_SIZE), memory);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_BREAKPOINT_CONDITION), !memory);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -75,7 +86,7 @@ INT_PTR CALLBACK BreakpointWindow::dlgFunc(HWND hwnd, UINT iMsg, WPARAM wParam,
|
||||
switch (HIWORD(wParam))
|
||||
{
|
||||
case BN_CLICKED:
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_BREAKPOINT_LOG_FORMAT), bp->GetCheckState(hwnd, IDC_BREAKPOINT_LOG));
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_BREAKPOINT_LOG_FORMAT), GetCheckState(hwnd, IDC_BREAKPOINT_LOG));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -83,9 +94,8 @@ INT_PTR CALLBACK BreakpointWindow::dlgFunc(HWND hwnd, UINT iMsg, WPARAM wParam,
|
||||
switch (HIWORD(wParam))
|
||||
{
|
||||
case BN_CLICKED:
|
||||
if (bp->fetchDialogData(hwnd))
|
||||
{
|
||||
EndDialog(hwnd,true);
|
||||
if (fetchDialogData(hwnd)) {
|
||||
EndDialog(hwnd, true);
|
||||
}
|
||||
break;
|
||||
};
|
||||
@ -94,24 +104,19 @@ INT_PTR CALLBACK BreakpointWindow::dlgFunc(HWND hwnd, UINT iMsg, WPARAM wParam,
|
||||
switch (HIWORD(wParam))
|
||||
{
|
||||
case BN_CLICKED:
|
||||
EndDialog(hwnd,false);
|
||||
EndDialog(hwnd, false);
|
||||
break;
|
||||
};
|
||||
break;
|
||||
case IDOK:
|
||||
if (bp->fetchDialogData(hwnd))
|
||||
{
|
||||
EndDialog(hwnd,true);
|
||||
if (fetchDialogData(hwnd)) {
|
||||
EndDialog(hwnd, true);
|
||||
}
|
||||
break;
|
||||
case IDCANCEL:
|
||||
EndDialog(hwnd,false);
|
||||
EndDialog(hwnd, false);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_KEYDOWN:
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
@ -195,11 +200,8 @@ bool BreakpointWindow::GetCheckState(HWND hwnd, int dlgItem) {
|
||||
return SendMessage(GetDlgItem(hwnd, dlgItem), BM_GETCHECK, 0, 0) != 0;
|
||||
}
|
||||
|
||||
bool BreakpointWindow::exec()
|
||||
{
|
||||
bp = this;
|
||||
bool result = DialogBoxParam(GetModuleHandle(0),MAKEINTRESOURCE(IDD_BREAKPOINT),parentHwnd,dlgFunc,(LPARAM)this) != 0;
|
||||
return result;
|
||||
bool BreakpointWindow::exec() {
|
||||
return DialogBoxParam(GetModuleHandle(0), MAKEINTRESOURCE(IDD_BREAKPOINT), parentHwnd, StaticDlgFunc, (LPARAM)this) != 0;
|
||||
}
|
||||
|
||||
void BreakpointWindow::addBreakpoint()
|
||||
|
@ -22,10 +22,12 @@ class BreakpointWindow
|
||||
std::string logFormat;
|
||||
PostfixExpression compiledCondition;
|
||||
|
||||
static BreakpointWindow* bp;
|
||||
bool fetchDialogData(HWND hwnd);
|
||||
bool GetCheckState(HWND hwnd, int dlgItem);
|
||||
|
||||
static INT_PTR CALLBACK StaticDlgFunc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam);
|
||||
INT_PTR DlgFunc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
public:
|
||||
BreakpointWindow(HWND parent, DebugInterface* cpu): cpu(cpu)
|
||||
{
|
||||
@ -38,8 +40,6 @@ public:
|
||||
size = 1;
|
||||
};
|
||||
|
||||
|
||||
static INT_PTR CALLBACK dlgFunc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam);
|
||||
bool exec();
|
||||
bool isMemoryBreakpoint() { return memory; };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user