-fixed "Copy value" in memory view

-SetFocus on right click in memory view
-added a few more default symbols to the symbol map
This commit is contained in:
Kingcom 2013-06-25 13:17:27 +02:00
parent 3c8b7d3f33
commit 41fc339362
3 changed files with 33 additions and 15 deletions

View file

@ -247,18 +247,32 @@ char *SymbolMap::GetDescription(unsigned int address)
}
#ifdef _WIN32
static const int defaultSymbolsAddresses[] = {
0x08800000, 0x08804000, 0x04000000, 0x88000000, 0x00010000
};
static const char* defaultSymbolsNames[] = {
"User memory", "Default load address", "VRAM","Kernel memory","Scratchpad"
};
static const int defaultSymbolsAmount = sizeof(defaultSymbolsAddresses)/sizeof(const int);
void SymbolMap::FillSymbolListBox(HWND listbox,SymbolType symmask)
{
ShowWindow(listbox,SW_HIDE);
ListBox_ResetContent(listbox);
//int style = GetWindowLong(listbox,GWL_STYLE);
ListBox_AddString(listbox,"(0x80000000)");
ListBox_SetItemData(listbox,0,0x80000000);
//ListBox_AddString(listbox,"(0x80002000)");
//ListBox_SetItemData(listbox,1,0x80002000);
if (symmask & ST_DATA)
{
for (int i = 0; i < defaultSymbolsAmount; i++)
{
char temp[256];
sprintf(temp,"0x%08X (%s)",defaultSymbolsAddresses[i],defaultSymbolsNames[i]);
int index = ListBox_AddString(listbox,temp);
ListBox_SetItemData(listbox,index,defaultSymbolsAddresses[i]);
}
}
SendMessage(listbox, WM_SETREDRAW, FALSE, 0);
SendMessage(listbox, LB_INITSTORAGE, (WPARAM)entries.size(), (LPARAM)entries.size() * 30);
@ -267,7 +281,7 @@ void SymbolMap::FillSymbolListBox(HWND listbox,SymbolType symmask)
if (entries[i].type & symmask)
{
char temp[256];
sprintf(temp,"%s (%d)",entries[i].name,entries[i].size);
sprintf(temp,"0x%08X (%s)",entries[i].vaddress,entries[i].name);
int index = ListBox_AddString(listbox,temp);
ListBox_SetItemData(listbox,index,entries[i].vaddress);
}

View file

@ -32,7 +32,6 @@ CtrlMemView::CtrlMemView(HWND _wnd)
"Lucida Console");
curAddress=0;
rowHeight=12;
selecting=false;
mode=MV_NORMAL;
debugger = 0;
@ -125,7 +124,7 @@ LRESULT CALLBACK CtrlMemView::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
ccp->onChar(wParam,lParam);
break;
case WM_LBUTTONDOWN: SetFocus(hwnd); lmbDown=true; ccp->onMouseDown(wParam,lParam,1); break;
case WM_RBUTTONDOWN: rmbDown=true; ccp->onMouseDown(wParam,lParam,2); break;
case WM_RBUTTONDOWN: SetFocus(hwnd); rmbDown=true; ccp->onMouseDown(wParam,lParam,2); break;
case WM_MOUSEMOVE: ccp->onMouseMove(wParam,lParam,(lmbDown?1:0) | (rmbDown?2:0)); break;
case WM_LBUTTONUP: lmbDown=false; ccp->onMouseUp(wParam,lParam,1); break;
case WM_RBUTTONUP: rmbDown=false; ccp->onMouseUp(wParam,lParam,2); break;
@ -449,7 +448,16 @@ void CtrlMemView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
case ID_MEMVIEW_COPYVALUE:
{
char temp[24];
sprintf(temp,"%08x",Memory::ReadUnchecked_U32(selection));
// it's admittedly not really useful like this
if (asciiSelected)
{
unsigned char c = Memory::IsValidAddress(curAddress) ? Memory::ReadUnchecked_U8(curAddress) : '.';
if (c < 32 || c >= 128) c = '.';
sprintf(temp,"%c",c);
} else {
sprintf(temp,"%02X",Memory::IsValidAddress(curAddress) ? Memory::ReadUnchecked_U8(curAddress) : 0xFF);
}
W32Util::CopyTextToClipboard(wnd,temp);
}
break;

View file

@ -47,10 +47,6 @@ class CtrlMemView
int visibleRows;
int selection;
int oldSelection;
bool selectionChanged;
bool selecting;
bool hasFocus;
static TCHAR szClassName[];
DebugInterface *debugger;