diff --git a/Windows/Debugger/CtrlMemView.cpp b/Windows/Debugger/CtrlMemView.cpp index 4868f43dab46..417ee0dbac65 100644 --- a/Windows/Debugger/CtrlMemView.cpp +++ b/Windows/Debugger/CtrlMemView.cpp @@ -797,3 +797,10 @@ void CtrlMemView::toggleOffsetScale(CommonToggles toggle) updateStatusBarText(); redraw(); } + +void CtrlMemView::setHighlightType(MemBlockFlags flags) { + if (highlightFlags_ != flags) { + highlightFlags_ = flags; + redraw(); + } +} diff --git a/Windows/Debugger/CtrlMemView.h b/Windows/Debugger/CtrlMemView.h index 44ab3bcdf02b..0a3bb2a583a2 100644 --- a/Windows/Debugger/CtrlMemView.h +++ b/Windows/Debugger/CtrlMemView.h @@ -17,7 +17,8 @@ // //To get a class instance to be able to access it, just use getFrom(HWND wnd). -#include "../../Core/Debugger/DebugInterface.h" +#include "Core/Debugger/DebugInterface.h" +#include "Core/Debugger/MemBlockInfo.h" enum OffsetSpacing { offsetSpace = 3, // the number of blank lines that should be left to make space for the offsets @@ -63,6 +64,9 @@ class CtrlMemView bool hasFocus; static wchar_t szClassName[]; DebugInterface *debugger; + + MemBlockFlags highlightFlags_ = MemBlockFlags::ALLOC; + void updateStatusBarText(); void search(bool continueSearch); public: @@ -99,4 +103,5 @@ class CtrlMemView void drawOffsetScale(HDC hdc); void toggleOffsetScale(CommonToggles toggle); void toggleStringSearch(CommonToggles toggle); + void setHighlightType(MemBlockFlags flags); }; diff --git a/Windows/Debugger/Debugger_MemoryDlg.cpp b/Windows/Debugger/Debugger_MemoryDlg.cpp index 33027861604f..9214a3467366 100644 --- a/Windows/Debugger/Debugger_MemoryDlg.cpp +++ b/Windows/Debugger/Debugger_MemoryDlg.cpp @@ -4,11 +4,12 @@ #include #include "..\resource.h" -#include "Common/System/Display.h" #include "Common/Data/Encoding/Utf8.h" +#include "Common/System/Display.h" +#include "Core/Debugger/MemBlockInfo.h" #include "Core/Debugger/SymbolMap.h" -#include "Core/MIPS/MIPSDebugInterface.h" // BAD +#include "Core/MIPS/MIPSDebugInterface.h" #include "Debugger_MemoryDlg.h" #include "CtrlMemView.h" @@ -68,6 +69,18 @@ CMemoryDlg::CMemoryDlg(HINSTANCE _hInstance, HWND _hParent, DebugInterface *_cpu searchBoxHdl = GetDlgItem(m_hDlg, IDC_SEARCH_BOX); srcListHdl = GetDlgItem(m_hDlg, IDC_SEARCH_RESULTS); + layerDropdown_ = GetDlgItem(m_hDlg, IDC_REGIONS); + ComboBox_ResetContent(layerDropdown_); + ComboBox_AddString(layerDropdown_, L"Show allocations"); + ComboBox_SetItemData(layerDropdown_, 0, MemBlockFlags::ALLOC); + ComboBox_AddString(layerDropdown_, L"Show sub allocations"); + ComboBox_SetItemData(layerDropdown_, 1, MemBlockFlags::SUB_ALLOC); + ComboBox_AddString(layerDropdown_, L"Show writes"); + ComboBox_SetItemData(layerDropdown_, 2, MemBlockFlags::WRITE); + ComboBox_AddString(layerDropdown_, L"Show textures"); + ComboBox_SetItemData(layerDropdown_, 3, MemBlockFlags::TEXTURE); + ComboBox_SetCurSel(layerDropdown_, 0); + memView = CtrlMemView::getFrom(memViewHdl); memView->setDebugger(_cpu); @@ -118,66 +131,53 @@ void CMemoryDlg::searchBoxRedraw(std::vector results) { void CMemoryDlg::NotifyMapLoaded() { if (m_hDlg) - { - g_symbolMap->FillSymbolListBox(symListHdl,ST_DATA); - int sel = ComboBox_GetCurSel(memViewHdl); - ComboBox_ResetContent(memViewHdl); - /* - for (int i = 0; i < cpu->getMemMap()->numRegions; i++) - { - // TODO: wchar_t - int n = ComboBox_AddString(lb,cpu->getMemMap()->regions[i].name); - ComboBox_SetItemData(lb,n,cpu->getMemMap()->regions[i].start); - }*/ - ComboBox_SetCurSel(memViewHdl,sel>=0?sel:0); - } + g_symbolMap->FillSymbolListBox(symListHdl, ST_DATA); Update(); } -BOOL CMemoryDlg::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) -{ - switch(message){ - case WM_COMMAND:{ +BOOL CMemoryDlg::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) { + wchar_t temp[256]{}; + int n; + + switch (message) { + case WM_COMMAND: { HWND lb = GetDlgItem(m_hDlg, LOWORD(wParam)); - switch (LOWORD(wParam)){ + switch (LOWORD(wParam)) { case IDC_REGIONS: switch (HIWORD(wParam)) { - case LBN_DBLCLK:{ - int n = ComboBox_GetCurSel(lb); - if (n != -1) { - unsigned int addr = (unsigned int)ComboBox_GetItemData(lb,n); - memView->gotoAddr(addr); - } + case CBN_SELENDOK: + n = ComboBox_GetCurSel(lb); + if (n != CB_ERR) { + MemBlockFlags flags = (MemBlockFlags)ComboBox_GetItemData(lb, n); + memView->setHighlightType(MemBlockFlags(flags)); } break; - }; - break; + } + break; case IDC_SYMBOLS: switch (HIWORD(wParam)) { - case LBN_DBLCLK:{ - int n = ListBox_GetCurSel(lb); - if (n != -1) { - unsigned int addr = (unsigned int)ListBox_GetItemData(lb,n); - memView->gotoAddr(addr); - } + case LBN_DBLCLK: + n = ListBox_GetCurSel(lb); + if (n != -1) { + unsigned int addr = (unsigned int)ListBox_GetItemData(lb,n); + memView->gotoAddr(addr); + } + break; } break; - }; case IDC_SEARCH_RESULTS: switch (HIWORD(wParam)) { - case LBN_DBLCLK: { - int n = ListBox_GetCurSel(lb); - if (n != -1) { - unsigned int addr = (unsigned int)ListBox_GetItemData(lb, n); - memView->gotoAddr(addr); - } + case LBN_DBLCLK: + n = ListBox_GetCurSel(lb); + if (n != -1) { + unsigned int addr = (unsigned int)ListBox_GetItemData(lb, n); + memView->gotoAddr(addr); + } + break; } break; - }; - break; case IDC_SHOWOFFSETS: - switch (HIWORD(wParam)) - { + switch (HIWORD(wParam)) { case BN_CLICKED: if (SendDlgItemMessage(m_hDlg, IDC_SHOWOFFSETS, BM_GETCHECK, 0, 0)) memView->toggleOffsetScale(On); @@ -187,10 +187,8 @@ BOOL CMemoryDlg::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) } break; case IDC_BUTTON_SEARCH: - switch (HIWORD(wParam)) - { + switch (HIWORD(wParam)) { case BN_CLICKED: - wchar_t temp[256]; GetWindowText(searchBoxHdl, temp, 255); std::vector results = memView->searchString(ConvertWStringToUTF8(temp).c_str()); if (results.size() > 0){ @@ -198,14 +196,14 @@ BOOL CMemoryDlg::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) } break; } + break; } } break; case WM_DEB_MAPLOADED: NotifyMapLoaded(); break; - case WM_DEB_GOTOADDRESSEDIT:{ - wchar_t temp[256]; + case WM_DEB_GOTOADDRESSEDIT: { u32 addr; GetWindowText(editWnd,temp,255); @@ -223,10 +221,7 @@ BOOL CMemoryDlg::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) return TRUE; case WM_INITDIALOG: - { - return TRUE; - } - break; + return TRUE; case WM_SIZE: Size(); diff --git a/Windows/Debugger/Debugger_MemoryDlg.h b/Windows/Debugger/Debugger_MemoryDlg.h index 91bf07e9864c..f8a9d20b5086 100644 --- a/Windows/Debugger/Debugger_MemoryDlg.h +++ b/Windows/Debugger/Debugger_MemoryDlg.h @@ -17,6 +17,7 @@ class CMemoryDlg : public Dialog RECT winRect, srRect; CtrlMemView *memView; HWND memViewHdl, symListHdl, editWnd, searchBoxHdl, srcListHdl; + HWND layerDropdown_; BOOL DlgProc(UINT message, WPARAM wParam, LPARAM lParam); public: diff --git a/Windows/ppsspp.rc b/Windows/ppsspp.rc index 4a29a62ea0ce..24bf02b4df0b 100644 --- a/Windows/ppsspp.rc +++ b/Windows/ppsspp.rc @@ -321,14 +321,14 @@ BEGIN CONTROL "Normal",IDC_MODENORMAL,"Button",BS_AUTORADIOBUTTON | WS_GROUP,198,9,40,9 CONTROL "Symbols",IDC_MODESYMBOLS,"Button",BS_AUTORADIOBUTTON,241,9,43,8 GROUPBOX "Mode",IDC_STATIC,191,0,104,22 - AUTOCHECKBOX "Show Offsets",IDC_SHOWOFFSETS,300,9,55,8 - COMBOBOX IDC_REGIONS,87,5,88,139,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + AUTOCHECKBOX "Show Offsets",IDC_SHOWOFFSETS,300,9,55,8 + COMBOBOX IDC_REGIONS,95,5,88,139,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LISTBOX IDC_SEARCH_RESULTS,557,14,140,272,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP EDITTEXT IDC_SEARCH_BOX,397,6,100,13,ES_AUTOHSCROLL PUSHBUTTON "Search",IDC_BUTTON_SEARCH,504,5,50,14 - LTEXT "Search:",IDC_STATIC,369,6,27,8 + LTEXT "Search:",IDC_STATIC,369,8,27,8 END IDD_INPUTBOX DIALOGEX 0, 0, 163, 55