Merge pull request #5922 from sepalani/mem-base

MemoryWindow: base address search added
This commit is contained in:
Leo Lam 2017-10-11 12:17:57 +02:00 committed by GitHub
commit bc6846ce3b
1 changed files with 8 additions and 3 deletions

View File

@ -345,7 +345,7 @@ void CMemoryWindow::Search(SearchType search_type)
{
u8* ram_ptr = nullptr;
std::size_t ram_size = 0;
// NOTE: We're assuming the base address is zero.
u32 base_address = 0;
switch (m_memory_view->GetMemoryType())
{
case 0:
@ -354,6 +354,7 @@ void CMemoryWindow::Search(SearchType search_type)
{
ram_ptr = Memory::m_pRAM;
ram_size = Memory::REALRAM_SIZE;
base_address = 0x80000000;
}
break;
case 1:
@ -363,6 +364,7 @@ void CMemoryWindow::Search(SearchType search_type)
{
ram_ptr = aram;
ram_size = DSP::ARAM_SIZE;
base_address = 0x0c005000;
}
}
break;
@ -419,7 +421,7 @@ void CMemoryWindow::Search(SearchType search_type)
}
// Search starting from specified address if there is one.
u32 addr = 0; // Base address
u32 addr = 0; // Physical address
{
wxString addr_val = m_address_search_ctrl->GetValue();
addr_val.Trim(true).Trim(false);
@ -429,6 +431,9 @@ void CMemoryWindow::Search(SearchType search_type)
if (addr_val.ToULong(&addr_ul, 16))
{
addr = static_cast<u32>(addr_ul);
// Get physical address
if (addr >= base_address)
addr -= base_address;
// Don't find the result we're already looking at
if (m_continue_search && addr == m_last_search_address &&
search_type == SearchType::FindNext)
@ -466,7 +471,7 @@ void CMemoryWindow::Search(SearchType search_type)
m_search_result_msg->SetLabel(_("Match Found"));
u32 offset = static_cast<u32>(ptr - ram_ptr);
// NOTE: SetValue() generates a synthetic wxEVT_TEXT
m_address_search_ctrl->SetValue(wxString::Format("%08x", offset));
m_address_search_ctrl->SetValue(wxString::Format("%08x", base_address + offset));
m_last_search_address = offset;
m_continue_search = true;
return;