Skip to content
Permalink
Browse files

Merge pull request RPCS3#253 from ItzWarty/memoryviewer_fixes

Improve Memory Viewer: There are bugs in text representation.
  • Loading branch information
AlexAltea committed May 19, 2014
2 parents 9ce9c3c + 85785b4 commit 9209edc15cc45c54f28f3fd8088d87b885509254
Showing with 18 additions and 12 deletions.
  1. +1 −1 rpcs3/Emu/Memory/Memory.cpp
  2. +17 −11 rpcs3/Gui/MemoryViewer.cpp
@@ -87,7 +87,7 @@ MemoryBlock* MemoryBlock::SetRange(const u64 start, const u32 size)

bool MemoryBlock::IsMyAddress(const u64 addr)
{
return mem && addr >= GetStartAddr() && addr < GetEndAddr();
return mem && addr >= GetStartAddr() && addr <= GetEndAddr();
}

template <typename T>
@@ -191,20 +191,26 @@ void MemoryViewerPanel::ShowMemory()
t_mem_addr_str += wxString::Format("%08x ", addr);
}

for(u32 addr = m_addr; addr != m_addr + m_rowcount * m_colcount; addr++)
for (int row = 0; row < m_rowcount; row++)
{
if (Memory.IsGoodAddr(addr))
for (int col = 0; col < m_colcount; col++)
{
const u8 rmem = Memory.Read8(addr);
t_mem_hex_str += wxString::Format("%02x ", rmem);
const wxString c_rmem = wxString::Format("%c", rmem);
t_mem_ascii_str += c_rmem.IsEmpty() ? "." : c_rmem;
}
else
{
t_mem_hex_str += "?? ";
t_mem_ascii_str += "?";
u32 addr = m_addr + row * m_colcount + col;

if (Memory.IsGoodAddr(addr))
{
const u8 rmem = Memory.Read8(addr);
t_mem_hex_str += wxString::Format("%02x ", rmem);
const bool isPrintable = rmem >= 32 && rmem <= 126;
t_mem_ascii_str += isPrintable ? std::string(1, rmem) : ".";
}
else
{
t_mem_hex_str += "?? ";
t_mem_ascii_str += "?";
}
}
t_mem_ascii_str += "\r\n";
}

t_mem_addr->SetValue(t_mem_addr_str);

0 comments on commit 9209edc

Please sign in to comment.
You can’t perform that action at this time.