debugger: rework to display disasm bg in white and current PC bg in blue

This commit is contained in:
feos-tas 2016-09-17 19:57:51 +00:00
parent 7b1609e75e
commit 2bf748a94c
2 changed files with 67 additions and 23 deletions

View File

@ -69,6 +69,8 @@ WNDPROC IDC_DEBUGGER_DISASSEMBLY_oldWndProc = 0;
static HFONT hFont;
static SCROLLINFO si;
static HBRUSH WhiteBrush = CreateSolidBrush(RGB(255,255,255));
static HBRUSH BlueBrush = CreateSolidBrush(RGB(208,255,255));
bool debuggerAutoload = false;
bool debuggerSaveLoadDEBFiles = true;
@ -86,6 +88,7 @@ std::vector<uint16> disassembly_addresses;
std::vector<std::vector<uint16>> disassembly_operands;
// this is used to autoscroll the Disassembly window while keeping relative position of the ">" pointer inside this window
unsigned int PC_pointerOffset = 0;
int PCLine = -1;
// this is used for dirty, but unavoidable hack, which is necessary to ensure the ">" pointer is visible when stepping/seeking to PC
bool PCPointerWasDrawn = false;
// and another hack...
@ -410,6 +413,7 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr)
int lines = (rect.bottom-rect.top) / debugSystem->fixedFontHeight;
debug_str[0] = 0;
PCLine = -1;
unsigned int instructions_count = 0;
for (int i = 0; i < lines; i++)
{
@ -466,6 +470,7 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr)
PCPointerWasDrawn = true;
beginningOfPCPointerLine = strlen(debug_str);
strcat(debug_str, ">");
PCLine = instructions_count;
} else
{
strcat(debug_str, " ");
@ -1482,8 +1487,31 @@ int Debugger_CheckClickingOnAnAddressOrSymbolicName(unsigned int lineNumber, boo
BOOL CALLBACK IDC_DEBUGGER_DISASSEMBLY_WndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
switch(uMsg)
{
case WM_PAINT:
{
BeginPaint(hwndDlg, &ps);
HDC hdcStatic = GetDC(hwndDlg);
SetBkMode(hdcStatic, TRANSPARENT);
SetTextColor(hdcStatic, RGB(0, 0, 0));
RECT rect;
GetClientRect(hwndDlg, &rect);
SelectObject(hdcStatic, (HGDIOBJ)debugSystem->hFixedFont);
FillRect(hdcStatic, &rect, WhiteBrush);
if (PCLine != -1)
{
RECT PC = {
rect.left, debugSystem->fixedFontHeight * PCLine + 1,
rect.right, debugSystem->fixedFontHeight * PCLine + debugSystem->fixedFontHeight + 1 };
FillRect(hdcStatic, &PC, BlueBrush);
}
OffsetRect(&rect, 1, 1);
DrawText(hdcStatic, debug_str, strlen(debug_str), &rect, NULL);
EndPaint(hwndDlg, &ps);
return 0;
}
case WM_LBUTTONDBLCLK:
{
int offset = Debugger_CheckClickingOnAnAddressOrSymbolicName(GET_Y_LPARAM(lParam) / debugSystem->fixedFontHeight, false);
@ -1498,6 +1526,13 @@ BOOL CALLBACK IDC_DEBUGGER_DISASSEMBLY_WndProc(HWND hwndDlg, UINT uMsg, WPARAM w
}
return 0;
}
case WM_LBUTTONDOWN:
{
RECT rect;
GetClientRect(hwndDlg, &rect);
InvalidateRect(hwndDlg, &rect, 0);
break;
}
case WM_LBUTTONUP:
{
Debugger_CheckClickingOnAnAddressOrSymbolicName(GET_Y_LPARAM(lParam) / debugSystem->fixedFontHeight, true);
@ -1737,6 +1772,14 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
}
break;
case WM_CTLCOLORSTATIC:
if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_DEBUGGER_DISASSEMBLY))
{
SetBkColor((HDC)wParam, RGB(255, 255, 255));
return (LRESULT) GetStockObject(DC_BRUSH);
}
break;
//adelikat: Buttons that don't need a rom loaded to do something, such as autoload
case WM_COMMAND:
{

View File

@ -1259,8 +1259,10 @@ BEGIN
LTEXT "Display on scanline:",-1,173,166,65,9
EDITTEXT IDC_PPUVIEW_SCANLINE,235,164,27,12
CONTROL "Sprites 8x16 mode",IDC_SPRITE16_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,151,75,10
CONTROL "Mask unused graphics (Code/Data Logger)",IDC_MASK_UNUSED_GRAPHICS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,162,140,10
CONTROL "Invert the mask (Code/Data Logger)", IDC_INVERT_THE_MASK, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,173,140,10
CONTROL "Mask unused graphics (Code/Data Logger)",IDC_MASK_UNUSED_GRAPHICS,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,162,140,10
CONTROL "Invert the mask (Code/Data Logger)",IDC_INVERT_THE_MASK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,173,140,10
GROUPBOX "Palettes",LBL_PPUVIEW_PALETTES,2,185,263,46,WS_TABSTOP
END
@ -1697,7 +1699,6 @@ BEGIN
"PPUVIEW", DIALOG
BEGIN
BOTTOMMARGIN, 258
END
"ARCHIVECHOOSERDIALOG", DIALOG