DPI fixes in the old Win32 debugger. Fixes #11856.

Also some general cleanup of it but decided it wasn't worth it to continue.
This commit is contained in:
Henrik Rydgård 2019-03-03 09:18:11 +01:00
parent 748110c1ba
commit e74be9c492
4 changed files with 80 additions and 90 deletions

View File

@ -21,6 +21,7 @@
#include "Common/CommonWindows.h"
#include "util/text/utf8.h"
#include "ext/xxhash.h"
#include "base/display.h"
#include <CommDlg.h>
#include <tchar.h>
@ -154,17 +155,21 @@ CtrlDisAsmView::CtrlDisAsmView(HWND _wnd)
wnd=_wnd;
SetWindowLongPtr(wnd, GWLP_USERDATA, (LONG_PTR)this);
SetWindowLong(wnd, GWL_STYLE, GetWindowLong(wnd,GWL_STYLE) | WS_VSCROLL);
SetScrollRange(wnd, SB_VERT, -1,1,TRUE);
SetScrollRange(wnd, SB_VERT, -1, 1, TRUE);
charWidth = g_Config.iFontWidth;
rowHeight = g_Config.iFontHeight+2;
const float fontScale = 1.0f / g_dpi_scale_real_y;
charWidth = g_Config.iFontWidth * fontScale;
rowHeight = (g_Config.iFontHeight + 2) * fontScale;
int scaledFontHeight = g_Config.iFontHeight * fontScale;
font = CreateFont(scaledFontHeight, charWidth, 0, 0,
FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH,
L"Lucida Console");
boldfont = CreateFont(scaledFontHeight, charWidth, 0, 0,
FW_DEMIBOLD, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH,
L"Lucida Console");
font = CreateFont(rowHeight-2,charWidth,0,0,FW_DONTCARE,FALSE,FALSE,FALSE,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,
L"Lucida Console");
boldfont = CreateFont(rowHeight-2,charWidth,0,0,FW_DEMIBOLD,FALSE,FALSE,FALSE,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,
L"Lucida Console");
curAddress=0;
showHex=false;
curAddress = 0;
showHex = false;
hasFocus = false;
dontRedraw = false;
keyTaken = false;

View File

@ -4,12 +4,13 @@
#include <math.h>
#include "Core/Config.h"
#include "../resource.h"
#include "../../Core/MemMap.h"
#include "../W32Util/Misc.h"
#include "Windows/resource.h"
#include "Core/MemMap.h"
#include "Windows/W32Util/Misc.h"
#include "Windows/InputBox.h"
#include "../Main.h"
#include "../../Core/Debugger/SymbolMap.h"
#include "Windows/main.h"
#include "Core/Debugger/SymbolMap.h"
#include "base/display.h"
#include "Debugger_Disasm.h"
#include "DebuggerShared.h"
@ -26,17 +27,18 @@ CtrlMemView::CtrlMemView(HWND _wnd)
SetWindowLong(wnd, GWL_STYLE, GetWindowLong(wnd,GWL_STYLE) | WS_VSCROLL);
SetScrollRange(wnd, SB_VERT, -1,1,TRUE);
rowHeight = g_Config.iFontHeight;
charWidth = g_Config.iFontWidth;
offsetPositionY = offsetLine*rowHeight;
const float fontScale = 1.0f / g_dpi_scale_real_y;
rowHeight = g_Config.iFontHeight * fontScale;
charWidth = g_Config.iFontWidth * fontScale;
offsetPositionY = offsetLine * rowHeight;
font =
CreateFont(rowHeight,charWidth,0,0,FW_DONTCARE,FALSE,FALSE,FALSE,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,L"Lucida Console");
underlineFont =
CreateFont(rowHeight,charWidth,0,0,FW_DONTCARE,FALSE,TRUE,FALSE,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,L"Lucida Console");
curAddress=0;
font = CreateFont(rowHeight, charWidth, 0, 0,
FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH,
L"Lucida Console");
underlineFont = CreateFont(rowHeight, charWidth, 0, 0,
FW_DONTCARE, FALSE, TRUE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH,
L"Lucida Console");
curAddress = 0;
debugger = 0;
searchQuery = "";

View File

@ -3,11 +3,12 @@
#include <math.h>
#include <tchar.h>
#include "base/display.h"
#include "util/text/utf8.h"
#include "../resource.h"
#include "Windows/resource.h"
#include "Core/MemMap.h"
#include "../W32Util/Misc.h"
#include "../InputBox.h"
#include "Windows/W32Util/Misc.h"
#include "Windows/InputBox.h"
#include "CtrlRegisterList.h"
#include "Debugger_MemoryDlg.h"
@ -16,11 +17,10 @@
#include "Debugger_Disasm.h"
#include "DebuggerShared.h"
#include "../main.h"
#include "Windows/main.h"
static const int numCPUs = 1;
//#include "DbgHelp.h"
extern HMENU g_hPopupMenus;
enum { REGISTER_PC = 32, REGISTER_HI, REGISTER_LO, REGISTERS_END };
@ -35,16 +35,15 @@ void CtrlRegisterList::init()
wc.lpszClassName = szClassName;
wc.hInstance = GetModuleHandle(0);
wc.lpfnWndProc = CtrlRegisterList::wndProc;
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hIcon = 0;
wc.lpszMenuName = 0;
wc.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_WINDOW);
wc.style = CS_DBLCLKS;
wc.cbClsExtra = 0;
wc.cbWndExtra = sizeof( CtrlRegisterList * );
wc.cbWndExtra = sizeof(CtrlRegisterList *);
wc.hIconSm = 0;
RegisterClassEx(&wc);
}
@ -53,8 +52,6 @@ void CtrlRegisterList::deinit()
//UnregisterClass(szClassName, hInst)
}
LRESULT CALLBACK CtrlRegisterList::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
CtrlRegisterList *ccp = CtrlRegisterList::getFrom(hwnd);
@ -116,37 +113,23 @@ LRESULT CALLBACK CtrlRegisterList::wndProc(HWND hwnd, UINT msg, WPARAM wParam, L
return DefWindowProc(hwnd, msg, wParam, lParam);
}
CtrlRegisterList *CtrlRegisterList::getFrom(HWND hwnd)
{
return (CtrlRegisterList *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
}
CtrlRegisterList::CtrlRegisterList(HWND _wnd)
{
wnd=_wnd;
: wnd(_wnd) {
SetWindowLongPtr(wnd, GWLP_USERDATA, (LONG_PTR)this);
//SetWindowLong(wnd, GWL_STYLE, GetWindowLong(wnd,GWL_STYLE) | WS_VSCROLL);
//SetScrollRange(wnd, SB_VERT, -1,1,TRUE);
rowHeight=g_Config.iFontHeight;
font = CreateFont(rowHeight,g_Config.iFontWidth,0,0,FW_DONTCARE,FALSE,FALSE,FALSE,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY,DEFAULT_PITCH,L"Lucida Console");
selecting=false;
selection=0;
category=0;
showHex=false;
cpu=0;
lastPC = 0;
lastCat0Values = NULL;
changedCat0Regs = NULL;
const float fontScale = 1.0f / g_dpi_scale_real_y;
rowHeight = g_Config.iFontHeight * fontScale;
int charWidth = g_Config.iFontWidth * fontScale;
font = CreateFont(rowHeight, charWidth, 0, 0,
FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH,
L"Lucida Console");
}
CtrlRegisterList::~CtrlRegisterList()
{
DeleteObject(font);

View File

@ -27,23 +27,23 @@ class CtrlRegisterList
RECT rect;
int rowHeight;
int selection;
int marker;
int category;
int selection = 0;
int marker = 0;
int category = 0;
int oldSelection;
int oldSelection = 0;
bool selectionChanged;
bool selecting;
bool hasFocus;
bool showHex;
DebugInterface *cpu;
bool selectionChanged = false;
bool selecting = false;
bool hasFocus = false;
bool showHex = false;
DebugInterface *cpu = nullptr;
static TCHAR szClassName[];
u32 lastPC;
u32 *lastCat0Values;
bool *changedCat0Regs;
bool ctrlDown;
u32 lastPC = 0;
u32 *lastCat0Values = nullptr;
bool *changedCat0Regs = nullptr;
bool ctrlDown = false;
u32 getSelectedRegValue(char *out, size_t size);
void copyRegisterValue();