mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
Added a new window class
This commit is contained in:
parent
f3d95a2cef
commit
b8dbe02010
@ -2373,6 +2373,8 @@ set(WindowsFiles
|
||||
Windows/Debugger/Debugger_VFPUDlg.h
|
||||
Windows/Debugger/WatchItemWindow.cpp
|
||||
Windows/Debugger/WatchItemWindow.h
|
||||
Windows/Debugger/ScanRemoveWindow.cpp
|
||||
Windows/Debugger/ScanRemoveWindow.h
|
||||
Windows/GEDebugger/CtrlDisplayListView.cpp
|
||||
Windows/GEDebugger/SimpleGLWindow.cpp
|
||||
Windows/GEDebugger/TabState.cpp
|
||||
|
@ -11,7 +11,8 @@ INT_PTR CALLBACK BreakpointWindow::StaticDlgFunc(HWND hWnd, UINT iMsg, WPARAM wP
|
||||
if (iMsg == WM_INITDIALOG) {
|
||||
SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)lParam);
|
||||
thiz = (BreakpointWindow *)lParam;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
thiz = (BreakpointWindow *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
|
||||
}
|
||||
|
||||
@ -40,15 +41,15 @@ INT_PTR BreakpointWindow::DlgFunc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lP
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_BREAKPOINT_ONCHANGE), memory);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_BREAKPOINT_SIZE), memory);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_BREAKPOINT_LOG_FORMAT), log);
|
||||
|
||||
|
||||
if (address != -1) {
|
||||
snprintf(str, sizeof(str), "0x%08X", address);
|
||||
SetWindowTextA(GetDlgItem(hwnd,IDC_BREAKPOINT_ADDRESS),str);
|
||||
SetWindowTextA(GetDlgItem(hwnd, IDC_BREAKPOINT_ADDRESS), str);
|
||||
}
|
||||
|
||||
snprintf(str, sizeof(str), "0x%08X", size);
|
||||
SetWindowTextA(GetDlgItem(hwnd, IDC_BREAKPOINT_SIZE),str);
|
||||
|
||||
SetWindowTextA(GetDlgItem(hwnd, IDC_BREAKPOINT_SIZE), str);
|
||||
|
||||
SetWindowTextW(GetDlgItem(hwnd, IDC_BREAKPOINT_CONDITION), ConvertUTF8ToWString(condition).c_str());
|
||||
SetWindowTextW(GetDlgItem(hwnd, IDC_BREAKPOINT_LOG_FORMAT), ConvertUTF8ToWString(logFormat).c_str());
|
||||
return TRUE;
|
||||
@ -121,7 +122,7 @@ INT_PTR BreakpointWindow::DlgFunc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lP
|
||||
|
||||
bool BreakpointWindow::fetchDialogData(HWND hwnd)
|
||||
{
|
||||
char str[256],errorMessage[512];
|
||||
char str[256], errorMessage[512];
|
||||
PostfixExpression exp;
|
||||
|
||||
memory = GetCheckState(hwnd, IDC_BREAKPOINT_MEMORY);
|
||||
@ -132,36 +133,36 @@ bool BreakpointWindow::fetchDialogData(HWND hwnd)
|
||||
onChange = GetCheckState(hwnd, IDC_BREAKPOINT_ONCHANGE);
|
||||
|
||||
// parse address
|
||||
GetWindowTextA(GetDlgItem(hwnd,IDC_BREAKPOINT_ADDRESS),str,256);
|
||||
if (cpu->initExpression(str,exp) == false)
|
||||
GetWindowTextA(GetDlgItem(hwnd, IDC_BREAKPOINT_ADDRESS), str, 256);
|
||||
if (cpu->initExpression(str, exp) == false)
|
||||
{
|
||||
snprintf(errorMessage, sizeof(errorMessage), "Invalid expression \"%s\": %s", str, getExpressionError());
|
||||
MessageBoxA(hwnd,errorMessage,"Error",MB_OK);
|
||||
MessageBoxA(hwnd, errorMessage, "Error", MB_OK);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cpu->parseExpression(exp,address) == false)
|
||||
if (cpu->parseExpression(exp, address) == false)
|
||||
{
|
||||
snprintf(errorMessage, sizeof(errorMessage), "Invalid expression \"%s\": %s", str, getExpressionError());
|
||||
MessageBoxA(hwnd,errorMessage,"Error",MB_OK);
|
||||
MessageBoxA(hwnd, errorMessage, "Error", MB_OK);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (memory)
|
||||
{
|
||||
// parse size
|
||||
GetWindowTextA(GetDlgItem(hwnd,IDC_BREAKPOINT_SIZE),str,256);
|
||||
if (cpu->initExpression(str,exp) == false)
|
||||
GetWindowTextA(GetDlgItem(hwnd, IDC_BREAKPOINT_SIZE), str, 256);
|
||||
if (cpu->initExpression(str, exp) == false)
|
||||
{
|
||||
snprintf(errorMessage, sizeof(errorMessage), "Invalid expression \"%s\": %s", str, getExpressionError());
|
||||
MessageBoxA(hwnd,errorMessage,"Error",MB_OK);
|
||||
MessageBoxA(hwnd, errorMessage, "Error", MB_OK);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cpu->parseExpression(exp,size) == false)
|
||||
if (cpu->parseExpression(exp, size) == false)
|
||||
{
|
||||
snprintf(errorMessage, sizeof(errorMessage), "Invalid expression \"%s\": %s", str, getExpressionError());
|
||||
MessageBoxA(hwnd,errorMessage,"Error",MB_OK);
|
||||
MessageBoxA(hwnd, errorMessage, "Error", MB_OK);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -176,7 +177,7 @@ bool BreakpointWindow::fetchDialogData(HWND hwnd)
|
||||
if (cpu->initExpression(condition.c_str(), compiledCondition) == false)
|
||||
{
|
||||
snprintf(errorMessage, sizeof(errorMessage), "Invalid expression \"%s\": %s", condition.c_str(), getExpressionError());
|
||||
MessageBoxA(hwnd,errorMessage,"Error",MB_OK);
|
||||
MessageBoxA(hwnd, errorMessage, "Error", MB_OK);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -229,16 +230,17 @@ void BreakpointWindow::addBreakpoint() {
|
||||
}
|
||||
|
||||
CBreakPoints::ChangeMemCheckLogFormat(address, address + size, logFormat);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// add breakpoint
|
||||
CBreakPoints::AddBreakPoint(address,false);
|
||||
CBreakPoints::AddBreakPoint(address, false);
|
||||
|
||||
if (!condition.empty()) {
|
||||
BreakPointCond cond;
|
||||
cond.debug = cpu;
|
||||
cond.expressionString = condition;
|
||||
cond.expression = compiledCondition;
|
||||
CBreakPoints::ChangeBreakPointAddCond(address,cond);
|
||||
CBreakPoints::ChangeBreakPointAddCond(address, cond);
|
||||
}
|
||||
|
||||
CBreakPoints::ChangeBreakPoint(address, result);
|
||||
@ -257,11 +259,12 @@ void BreakpointWindow::loadFromMemcheck(const MemCheck &memcheck) {
|
||||
enabled = (memcheck.result & BREAK_ACTION_PAUSE) != 0;
|
||||
|
||||
address = memcheck.start;
|
||||
size = memcheck.end-address;
|
||||
size = memcheck.end - address;
|
||||
|
||||
if (memcheck.hasCondition) {
|
||||
condition = memcheck.condition.expressionString;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
condition.clear();
|
||||
}
|
||||
|
||||
@ -278,7 +281,8 @@ void BreakpointWindow::loadFromBreakpoint(const BreakPoint& breakpoint) {
|
||||
|
||||
if (breakpoint.hasCond) {
|
||||
condition = breakpoint.cond.expressionString;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
condition.clear();
|
||||
}
|
||||
|
||||
|
142
Windows/Debugger/ScanRemoveWindow.cpp
Normal file
142
Windows/Debugger/ScanRemoveWindow.cpp
Normal file
@ -0,0 +1,142 @@
|
||||
|
||||
#include "ScanRemoveWindow.h"
|
||||
#include "../resource.h"
|
||||
|
||||
|
||||
|
||||
bool ScanRemoveWindow::GetCheckState(HWND hwnd, int dlgItem) {
|
||||
return SendMessage(GetDlgItem(hwnd, dlgItem), BM_GETCHECK, 0, 0) != 0;
|
||||
}
|
||||
|
||||
bool ScanRemoveWindow::fetchDialogData(HWND hwnd)
|
||||
{
|
||||
char str[256], errorMessage[512];
|
||||
PostfixExpression exp;
|
||||
|
||||
scan = GetCheckState(hwnd, IDC_SCANREMOVE_SCAN);
|
||||
|
||||
// Parse the address
|
||||
GetWindowTextA(GetDlgItem(hwnd, IDC_SCANREMOVE_ADDRESS), str, 256);
|
||||
|
||||
if (cpu->initExpression(str, exp) == false)
|
||||
{
|
||||
snprintf(errorMessage, sizeof(errorMessage), "Invalid expression \"%s\": %s", str, getExpressionError());
|
||||
MessageBoxA(hwnd, errorMessage, "Error", MB_OK);
|
||||
return false;
|
||||
}
|
||||
if (cpu->parseExpression(exp, address) == false)
|
||||
{
|
||||
snprintf(errorMessage, sizeof(errorMessage), "Invalid expression \"%s\": %s", str, getExpressionError());
|
||||
MessageBoxA(hwnd, errorMessage, "Error", MB_OK);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Parse the size
|
||||
GetWindowTextA(GetDlgItem(hwnd, IDC_SCANREMOVE_SIZE), str, 256);
|
||||
|
||||
if (cpu->initExpression(str, exp) == false)
|
||||
{
|
||||
snprintf(errorMessage, sizeof(errorMessage), "Invalid expression \"%s\": %s", str, getExpressionError());
|
||||
MessageBoxA(hwnd, errorMessage, "Error", MB_OK);
|
||||
return false;
|
||||
}
|
||||
if (cpu->parseExpression(exp, size) == false)
|
||||
{
|
||||
snprintf(errorMessage, sizeof(errorMessage), "Invalid expression \"%s\": %s", str, getExpressionError());
|
||||
MessageBoxA(hwnd, errorMessage, "Error", MB_OK);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
INT_PTR CALLBACK ScanRemoveWindow::StaticDlgFunc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam) {
|
||||
ScanRemoveWindow *thiz;
|
||||
if (iMsg == WM_INITDIALOG) {
|
||||
SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)lParam);
|
||||
thiz = (ScanRemoveWindow *)lParam;
|
||||
}
|
||||
else {
|
||||
thiz = (ScanRemoveWindow *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
|
||||
}
|
||||
|
||||
if (!thiz)
|
||||
return FALSE;
|
||||
return thiz->DlgFunc(hWnd, iMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
INT_PTR ScanRemoveWindow::DlgFunc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
char str[128];
|
||||
|
||||
switch (iMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
|
||||
// Set the radiobutton values
|
||||
SendMessage(GetDlgItem(hwnd, IDC_SCANREMOVE_SCAN), BM_SETCHECK, scan ? BST_CHECKED : BST_UNCHECKED, 0);
|
||||
SendMessage(GetDlgItem(hwnd, IDC_SCANREMOVE_REMOVE), BM_SETCHECK, scan ? BST_UNCHECKED : BST_CHECKED, 0);
|
||||
|
||||
// Set the text in the textboxes
|
||||
if (address != -1) {
|
||||
snprintf(str, sizeof(str), "0x%08X", address);
|
||||
SetWindowTextA(GetDlgItem(hwnd, IDC_SCANREMOVE_ADDRESS), str);
|
||||
}
|
||||
snprintf(str, sizeof(str), "0x%08X", size);
|
||||
SetWindowTextA(GetDlgItem(hwnd, IDC_SCANREMOVE_SIZE), str);
|
||||
|
||||
return TRUE;
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDC_SCANREMOVE_SCAN:
|
||||
switch (HIWORD(wParam))
|
||||
{
|
||||
case BN_CLICKED:
|
||||
scan = true;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case IDC_SCANREMOVE_REMOVE:
|
||||
switch (HIWORD(wParam))
|
||||
{
|
||||
case BN_CLICKED:
|
||||
scan = false;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case IDC_SCANREMOVE_OK:
|
||||
switch (HIWORD(wParam))
|
||||
{
|
||||
case BN_CLICKED:
|
||||
if (fetchDialogData(hwnd)) {
|
||||
EndDialog(hwnd, true);
|
||||
}
|
||||
break;
|
||||
};
|
||||
break;
|
||||
case IDC_SCANREMOVE_CANCEL:
|
||||
switch (HIWORD(wParam))
|
||||
{
|
||||
case BN_CLICKED:
|
||||
EndDialog(hwnd, false);
|
||||
break;
|
||||
};
|
||||
break;
|
||||
case IDOK:
|
||||
if (fetchDialogData(hwnd)) {
|
||||
EndDialog(hwnd, true);
|
||||
}
|
||||
break;
|
||||
case IDCANCEL:
|
||||
EndDialog(hwnd, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool ScanRemoveWindow::exec() {
|
||||
return DialogBoxParam(GetModuleHandle(0), MAKEINTRESOURCE(IDD_BREAKPOINT), parentHwnd, StaticDlgFunc, (LPARAM)this) != 0;
|
||||
}
|
30
Windows/Debugger/ScanRemoveWindow.h
Normal file
30
Windows/Debugger/ScanRemoveWindow.h
Normal file
@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include "Common/CommonWindows.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/Debugger/DebugInterface.h"
|
||||
|
||||
class ScanRemoveWindow {
|
||||
HWND parentHwnd;
|
||||
DebugInterface* cpu;
|
||||
|
||||
bool scan;
|
||||
u32 address;
|
||||
u32 size;
|
||||
|
||||
bool GetCheckState(HWND hwnd, int dlgItem);
|
||||
bool fetchDialogData(HWND hwnd);
|
||||
|
||||
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:
|
||||
ScanRemoveWindow(HWND parent, DebugInterface* cpu) : cpu(cpu) {
|
||||
parentHwnd = parent;
|
||||
scan = true;
|
||||
address = -1;
|
||||
size = 1;
|
||||
}
|
||||
|
||||
bool exec();
|
||||
};
|
@ -844,6 +844,7 @@
|
||||
<ClCompile Include="GPU\D3D11Context.cpp" />
|
||||
<ClCompile Include="GPU\D3D9Context.cpp" />
|
||||
<ClCompile Include="Debugger\BreakpointWindow.cpp" />
|
||||
<ClCompile Include="Debugger\ScanRemoveWindow.cpp" />
|
||||
<ClCompile Include="Debugger\CtrlDisAsmView.cpp" />
|
||||
<ClCompile Include="Debugger\CtrlMemView.cpp" />
|
||||
<ClCompile Include="Debugger\CtrlRegisterList.cpp" />
|
||||
@ -1400,6 +1401,7 @@
|
||||
<ClInclude Include="GPU\D3D11Context.h" />
|
||||
<ClInclude Include="GPU\D3D9Context.h" />
|
||||
<ClInclude Include="Debugger\BreakpointWindow.h" />
|
||||
<ClInclude Include="Debugger\ScanRemoveWindow.h" />
|
||||
<ClInclude Include="Debugger\CtrlDisAsmView.h" />
|
||||
<ClInclude Include="Debugger\CtrlMemView.h" />
|
||||
<ClInclude Include="Debugger\CtrlRegisterList.h" />
|
||||
|
@ -280,6 +280,9 @@
|
||||
<ClCompile Include="Debugger\WatchItemWindow.cpp">
|
||||
<Filter>Windows\Debugger</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Debugger\ScanRemoveWindow.cpp">
|
||||
<Filter>Windows\Debugger</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Debugger\CtrlDisAsmView.h">
|
||||
@ -568,6 +571,9 @@
|
||||
<ClInclude Include="Debugger\WatchItemWindow.h">
|
||||
<Filter>Windows\Debugger</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Debugger\ScanRemoveWindow.h">
|
||||
<Filter>Windows\Debugger</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\SDL\CocoaBarItems.h">
|
||||
<Filter>Other Platforms\Mac</Filter>
|
||||
</ClInclude>
|
||||
|
@ -122,6 +122,12 @@
|
||||
#define IDC_SHOWOFFSETS 1200
|
||||
#define IDC_GEDBG_PRIMCOUNTER 1201
|
||||
#define IDC_BUTTON_SEARCH 1204
|
||||
#define IDC_SCANREMOVE_SCAN 1205
|
||||
#define IDC_SCANREMOVE_REMOVE 1206
|
||||
#define IDC_SCANREMOVE_ADDRESS 1207
|
||||
#define IDC_SCANREMOVE_SIZE 1208
|
||||
#define IDC_SCANREMOVE_OK 1209
|
||||
#define IDC_SCANREMOVE_CANCEL 1210
|
||||
|
||||
#define ID_FILE_EXIT 40000
|
||||
#define ID_DEBUG_SAVEMAPFILE 40001
|
||||
|
Loading…
Reference in New Issue
Block a user