mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
MemoryViewWidget: Fix updates at end of address space
Fix two bugs that occurred when viewing a memory range starting shortly before 0xffffffff. Bug 1: When there was at least one visible memory address at or after 0x0 none of the values would be displayed even when some of the addresses were valid. This happened because the loop condition in GetValues immediately returned false since m_address_range.first > m_address_range.second, causing m_values to be empty. This in turn led every address to be considered INVALID_MEMORY in UpdateColumns. Bug 2: When m_address_range.second was equal to 0xffffffff GetValues would enter an infinite loop. This happened because address would overflow to 0 after printing the last value in the table, causing the loop condition address <= m_address_range.second to be true forever.
This commit is contained in:
@ -473,7 +473,7 @@ void MemoryViewWidget::Update()
|
||||
const int data_span = m_bytes_per_row / GetTypeSize(m_type);
|
||||
|
||||
m_address_range.first = row_address;
|
||||
m_address_range.second = row_address + m_table->rowCount() * m_bytes_per_row - 1;
|
||||
m_address_range.second = row_address + m_table->rowCount() * m_bytes_per_row;
|
||||
|
||||
for (int i = 0; i < m_table->rowCount(); i++, row_address += m_bytes_per_row)
|
||||
{
|
||||
@ -611,9 +611,13 @@ void MemoryViewWidget::GetValues()
|
||||
// Grab memory values as QStrings
|
||||
Core::CPUThreadGuard guard(m_system);
|
||||
|
||||
for (u32 address = m_address_range.first; address <= m_address_range.second;
|
||||
address += GetTypeSize(m_type))
|
||||
const u32 type_size = static_cast<u32>(GetTypeSize(m_type));
|
||||
const auto& [range_begin, range_end] = m_address_range;
|
||||
const u32 address_count = (range_end - range_begin) / type_size;
|
||||
|
||||
for (u32 i = 0; i < address_count; ++i)
|
||||
{
|
||||
const u32 address = range_begin + i * type_size;
|
||||
m_values.insert(std::pair(address, ValueToString(guard, address, m_type)));
|
||||
|
||||
if (m_dual_view)
|
||||
|
Reference in New Issue
Block a user