Merge pull request #1699 from shygoo/debugger-fixes

[Debugger] Fix hex string search and GS code copy
This commit is contained in:
zilmar 2020-01-26 06:43:36 +10:30 committed by GitHub
commit 14fa68510c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 26 additions and 24 deletions

View File

@ -193,7 +193,7 @@ void CDebugDMALogView::RefreshDMALogWindow(bool bReset)
LRESULT CDebugDMALogView::OnRefresh(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) LRESULT CDebugDMALogView::OnRefresh(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{ {
bool bReset = (bool)wParam; bool bReset = (wParam != 0);
if (bReset) if (bReset)
{ {

View File

@ -84,9 +84,12 @@ LRESULT CDebugExcBreakpoints::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPA
InitCheckboxes(IntrCheckboxMap, Debugger_IntrBreakpoints); InitCheckboxes(IntrCheckboxMap, Debugger_IntrBreakpoints);
InitCheckboxes(RcpIntrCheckboxMap, Debugger_RcpIntrBreakpoints); InitCheckboxes(RcpIntrCheckboxMap, Debugger_RcpIntrBreakpoints);
bool intrEnabled = g_Settings->LoadDword(Debugger_ExceptionBreakpoints) & 0x01; uint32_t excBreakpoints = g_Settings->LoadDword(Debugger_ExceptionBreakpoints);
bool rcpIntrEnabled = g_Settings->LoadDword(Debugger_IntrBreakpoints) & 0x04; uint32_t intrBreakpoints = g_Settings->LoadDword(Debugger_IntrBreakpoints);
bool fpExcEnabled = g_Settings->LoadDword(Debugger_ExceptionBreakpoints) & (1 << 15);
bool intrEnabled = (excBreakpoints & 0x01) != 0;
bool rcpIntrEnabled = (intrBreakpoints & 0x04) != 0;
bool fpExcEnabled = (excBreakpoints & (1 << 15)) != 0;
EnableCheckboxes(IntrCheckboxMap, intrEnabled); EnableCheckboxes(IntrCheckboxMap, intrEnabled);
EnableCheckboxes(RcpIntrCheckboxMap, intrEnabled && rcpIntrEnabled); EnableCheckboxes(RcpIntrCheckboxMap, intrEnabled && rcpIntrEnabled);

View File

@ -1108,7 +1108,7 @@ LRESULT CDebugMemorySearch::OnWatchListPopupCopyGamesharkCode(WORD /*wNotifyCode
int length = presult->GetStrLength(); int length = presult->GetStrLength();
char str[1024]; char str[1024];
presult->GetMemoryValueString(str, 1024); presult->GetMemoryValueString(str, 1024, true);
bool haveOddLength = (length & 1) != 0; bool haveOddLength = (length & 1) != 0;
int evenLength = length & ~1; int evenLength = length & ~1;
@ -1168,8 +1168,7 @@ LRESULT CDebugMemorySearch::OnWatchListPopupCopyGamesharkCode(WORD /*wNotifyCode
} }
HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, strGSCode.length()); HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, strGSCode.length());
strncpy((char*)GlobalLock(hMem), strGSCode.c_str(), strGSCode.length() - 1);
strGSCode.copy((char*)GlobalLock(hMem), strGSCode.length() - 1);
GlobalUnlock(hMem); GlobalUnlock(hMem);
OpenClipboard(); OpenClipboard();
EmptyClipboard(); EmptyClipboard();
@ -1205,7 +1204,7 @@ LRESULT CDebugMemorySearch::OnWatchListPopupCopyAddressAndDescription(WORD /*wNo
HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, str.length()); HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, str.length());
str.copy((char*)GlobalLock(hMem), str.length() - 1); strncpy((char*)GlobalLock(hMem), str.c_str(), str.length() - 1);
GlobalUnlock(hMem); GlobalUnlock(hMem);
OpenClipboard(); OpenClipboard();
EmptyClipboard(); EmptyClipboard();

View File

@ -32,47 +32,47 @@ LRESULT CDebugTlb::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lPara
col.fmt = LVCFMT_LEFT; col.fmt = LVCFMT_LEFT;
col.pszText = "Index"; col.pszText = "Index";
col.cx = 40 * DPIScale; col.cx = (int)(40 * DPIScale);
col.iSubItem = 0; col.iSubItem = 0;
ListView_InsertColumn(GetDlgItem(IDC_LIST), 0, &col); ListView_InsertColumn(GetDlgItem(IDC_LIST), 0, &col);
col.pszText = "Page Mask"; col.pszText = "Page Mask";
col.cx = 90 * DPIScale; col.cx = (int)(90 * DPIScale);
col.iSubItem = 1; col.iSubItem = 1;
ListView_InsertColumn(GetDlgItem(IDC_LIST), 1, &col); ListView_InsertColumn(GetDlgItem(IDC_LIST), 1, &col);
col.pszText = "Entry Hi"; col.pszText = "Entry Hi";
col.cx = 90 * DPIScale; col.cx = (int)(90 * DPIScale);
col.iSubItem = 2; col.iSubItem = 2;
ListView_InsertColumn(GetDlgItem(IDC_LIST), 2, &col); ListView_InsertColumn(GetDlgItem(IDC_LIST), 2, &col);
col.pszText = "Entry Lo0"; col.pszText = "Entry Lo0";
col.cx = 90 * DPIScale; col.cx = (int)(90 * DPIScale);
col.iSubItem = 3; col.iSubItem = 3;
ListView_InsertColumn(GetDlgItem(IDC_LIST), 3, &col); ListView_InsertColumn(GetDlgItem(IDC_LIST), 3, &col);
col.pszText = "Entry Lo1"; col.pszText = "Entry Lo1";
col.cx = 90 * DPIScale; col.cx = (int)(90 * DPIScale);
col.iSubItem = 4; col.iSubItem = 4;
ListView_InsertColumn(GetDlgItem(IDC_LIST), 4, &col); ListView_InsertColumn(GetDlgItem(IDC_LIST), 4, &col);
col.pszText = "Index"; col.pszText = "Index";
col.cx = 40 * DPIScale; col.cx = (int)(40 * DPIScale);
col.iSubItem = 0; col.iSubItem = 0;
ListView_InsertColumn(GetDlgItem(IDC_LIST2), 0, &col); ListView_InsertColumn(GetDlgItem(IDC_LIST2), 0, &col);
col.pszText = "Valid"; col.pszText = "Valid";
col.cx = 40 * DPIScale; col.cx = (int)(40 * DPIScale);
col.iSubItem = 1; col.iSubItem = 1;
ListView_InsertColumn(GetDlgItem(IDC_LIST2), 1, &col); ListView_InsertColumn(GetDlgItem(IDC_LIST2), 1, &col);
col.pszText = "Dirty"; col.pszText = "Dirty";
col.cx = 40 * DPIScale; col.cx = (int)(40 * DPIScale);
col.iSubItem = 2; col.iSubItem = 2;
ListView_InsertColumn(GetDlgItem(IDC_LIST2), 2, &col); ListView_InsertColumn(GetDlgItem(IDC_LIST2), 2, &col);
col.pszText = "Rule"; col.pszText = "Rule";
col.cx = 270 * DPIScale; col.cx = (int)(270 * DPIScale);
col.iSubItem = 3; col.iSubItem = 3;
ListView_InsertColumn(GetDlgItem(IDC_LIST2), 3, &col); ListView_InsertColumn(GetDlgItem(IDC_LIST2), 3, &col);

View File

@ -238,7 +238,7 @@ bool CScanResult::GetMemoryValue(CMixed* v)
return true; return true;
} }
int CScanResult::GetMemoryValueString(char* buffer, size_t size) int CScanResult::GetMemoryValueString(char* buffer, size_t size, bool bIgnoreHex)
{ {
if (g_MMU == NULL) if (g_MMU == NULL)
{ {
@ -246,7 +246,7 @@ int CScanResult::GetMemoryValueString(char* buffer, size_t size)
return 1; return 1;
} }
bool bHex = (m_DisplayFormat == DisplayHex); bool bHex = (m_DisplayFormat == DisplayHex) && !bIgnoreHex;
uint32_t paddr = m_Address & 0x1FFFFFFF; uint32_t paddr = m_Address & 0x1FFFFFFF;
@ -737,7 +737,7 @@ void CMemoryScanner::FirstScanLoopString(DisplayFormat resultDisplayFormat)
for (int i = 0; i < length; i++) for (int i = 0; i < length; i++)
{ {
uint32_t leAddr = (addr + i) ^ 3; uint32_t leAddr = (addr + i) ^ 3;
if (m_Value._string[i] != m_Memory[leAddr]) if ((uint8_t)m_Value._string[i] != m_Memory[leAddr])
{ {
goto next_addr; goto next_addr;
} }
@ -766,7 +766,7 @@ void CMemoryScanner::FirstScanLoopIString(DisplayFormat resultDisplayFormat)
for (int i = 0; i < length; i++) for (int i = 0; i < length; i++)
{ {
uint32_t leAddr = (addr + i) ^ 3; uint32_t leAddr = (addr + i) ^ 3;
if (toupper(m_Value._string[i]) != toupper(m_Memory[leAddr])) if (toupper((uint8_t)m_Value._string[i]) != toupper(m_Memory[leAddr]))
{ {
goto next_addr; goto next_addr;
} }
@ -782,7 +782,7 @@ void CMemoryScanner::FirstScanLoopIString(DisplayFormat resultDisplayFormat)
// scan for text of unknown single-byte encoding // scan for text of unknown single-byte encoding
void CMemoryScanner::FirstScanLoopUnkString(void) void CMemoryScanner::FirstScanLoopUnkString(void)
{ {
const char *str = m_Value._string; const uint8_t* str = (const uint8_t*)m_Value._string;
int length = m_StringValueLength; int length = m_StringValueLength;
uint32_t startAddr = m_RangeStartAddress; uint32_t startAddr = m_RangeStartAddress;

View File

@ -151,7 +151,7 @@ public:
public: public:
int GetValueString(char* buffer, size_t size); int GetValueString(char* buffer, size_t size);
int GetMemoryValueString(char* buffer, size_t size); int GetMemoryValueString(char* buffer, size_t size, bool bIgnoreHex = false);
int GetAddressString(char *buffer); int GetAddressString(char *buffer);
uint32_t GetVirtualAddress(void); uint32_t GetVirtualAddress(void);
bool SetMemoryValueFromString(char* str); bool SetMemoryValueFromString(char* str);

View File

@ -54,7 +54,7 @@ CHexEditCtrl::~CHexEditCtrl(void)
{ {
} }
int CALLBACK CHexEditCtrl::HaveFontCb(CONST LOGFONTA *lplf, CONST TEXTMETRICA *lptm, DWORD FontType, LPARAM lParam) int CALLBACK CHexEditCtrl::HaveFontCb(CONST LOGFONTA* lplf, CONST TEXTMETRICA* /*lptm*/, DWORD /*FontType*/, LPARAM lParam)
{ {
const char* name = (const char*)lParam; const char* name = (const char*)lParam;
if (strcmp(lplf->lfFaceName, name) == 0) if (strcmp(lplf->lfFaceName, name) == 0)