Fix disasm copy paste feature.

This commit is contained in:
Jean-Philip Desjardins 2024-03-22 17:18:50 -04:00
parent 956b1fa7e9
commit 08f2d44a1d
3 changed files with 2 additions and 9 deletions

View file

@ -339,15 +339,9 @@ std::string CDisAsmTableModel::GetInstructionMetadata(uint32 address) const
return disAsm.c_str(); return disAsm.c_str();
} }
uint32 CDisAsmTableModel::TranslateAddress(uint32 windowAddress) const
{
uint32 address = windowAddress + m_windowStart;
return address;
}
uint32 CDisAsmTableModel::TranslateModelIndexToAddress(const QModelIndex& index) const uint32 CDisAsmTableModel::TranslateModelIndexToAddress(const QModelIndex& index) const
{ {
return TranslateAddress(index.row() * m_instructionSize); return m_windowStart + (index.row() * m_instructionSize);
} }
QModelIndex CDisAsmTableModel::TranslateAddressToModelIndex(uint32 address) const QModelIndex CDisAsmTableModel::TranslateAddressToModelIndex(uint32 address) const

View file

@ -35,7 +35,6 @@ public:
void Redraw(); void Redraw();
void Redraw(uint32); void Redraw(uint32);
uint32 TranslateAddress(uint32) const;
uint32 TranslateModelIndexToAddress(const QModelIndex&) const; uint32 TranslateModelIndexToAddress(const QModelIndex&) const;
QModelIndex TranslateAddressToModelIndex(uint32) const; QModelIndex TranslateAddressToModelIndex(uint32) const;

View file

@ -559,7 +559,7 @@ void CDisAsmWnd::OnCopy()
{ {
std::string text; std::string text;
auto selectionRange = GetSelectionRange(); auto selectionRange = GetSelectionRange();
for(uint32 address = selectionRange.first; address <= selectionRange.second; address = m_model->TranslateAddress(address + m_instructionSize)) for(uint32 address = selectionRange.first; address <= selectionRange.second; address += m_instructionSize)
{ {
if(address != selectionRange.first) if(address != selectionRange.first)
{ {