diff --git a/Source/Project64/UserInterface/Debugger/Debugger-MemorySearch.cpp b/Source/Project64/UserInterface/Debugger/Debugger-MemorySearch.cpp index 982e8bb08..9e3f9f882 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-MemorySearch.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-MemorySearch.cpp @@ -1108,7 +1108,7 @@ LRESULT CDebugMemorySearch::OnWatchListPopupCopyGamesharkCode(WORD /*wNotifyCode int length = presult->GetStrLength(); char str[1024]; - presult->GetMemoryValueString(str, 1024); + presult->GetMemoryValueString(str, 1024, true); bool haveOddLength = (length & 1) != 0; int evenLength = length & ~1; @@ -1168,8 +1168,7 @@ LRESULT CDebugMemorySearch::OnWatchListPopupCopyGamesharkCode(WORD /*wNotifyCode } HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, strGSCode.length()); - - strGSCode.copy((char*)GlobalLock(hMem), strGSCode.length() - 1); + strncpy((char*)GlobalLock(hMem), strGSCode.c_str(), strGSCode.length() - 1); GlobalUnlock(hMem); OpenClipboard(); EmptyClipboard(); @@ -1205,7 +1204,7 @@ LRESULT CDebugMemorySearch::OnWatchListPopupCopyAddressAndDescription(WORD /*wNo 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); OpenClipboard(); EmptyClipboard(); diff --git a/Source/Project64/UserInterface/Debugger/MemoryScanner.cpp b/Source/Project64/UserInterface/Debugger/MemoryScanner.cpp index f7d82e77b..200115eae 100644 --- a/Source/Project64/UserInterface/Debugger/MemoryScanner.cpp +++ b/Source/Project64/UserInterface/Debugger/MemoryScanner.cpp @@ -238,7 +238,7 @@ bool CScanResult::GetMemoryValue(CMixed* v) return true; } -int CScanResult::GetMemoryValueString(char* buffer, size_t size) +int CScanResult::GetMemoryValueString(char* buffer, size_t size, bool bIgnoreHex) { if (g_MMU == NULL) { @@ -246,7 +246,7 @@ int CScanResult::GetMemoryValueString(char* buffer, size_t size) return 1; } - bool bHex = (m_DisplayFormat == DisplayHex); + bool bHex = (m_DisplayFormat == DisplayHex) && !bIgnoreHex; uint32_t paddr = m_Address & 0x1FFFFFFF; @@ -737,7 +737,7 @@ void CMemoryScanner::FirstScanLoopString(DisplayFormat resultDisplayFormat) for (int i = 0; i < length; i++) { 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; } @@ -766,7 +766,7 @@ void CMemoryScanner::FirstScanLoopIString(DisplayFormat resultDisplayFormat) for (int i = 0; i < length; i++) { 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; } @@ -782,7 +782,7 @@ void CMemoryScanner::FirstScanLoopIString(DisplayFormat resultDisplayFormat) // scan for text of unknown single-byte encoding void CMemoryScanner::FirstScanLoopUnkString(void) { - const char *str = m_Value._string; + const uint8_t* str = (const uint8_t*)m_Value._string; int length = m_StringValueLength; uint32_t startAddr = m_RangeStartAddress; diff --git a/Source/Project64/UserInterface/Debugger/MemoryScanner.h b/Source/Project64/UserInterface/Debugger/MemoryScanner.h index 1f7a7a85e..016c5b0bb 100644 --- a/Source/Project64/UserInterface/Debugger/MemoryScanner.h +++ b/Source/Project64/UserInterface/Debugger/MemoryScanner.h @@ -151,7 +151,7 @@ public: public: 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); uint32_t GetVirtualAddress(void); bool SetMemoryValueFromString(char* str);