Add possibility to modify memory values

Optim time when parsing DList for debug.
This commit is contained in:
Xele02 2013-02-17 21:42:54 +01:00
parent 9e0bc2ae89
commit ec8d32378a
3 changed files with 37 additions and 7 deletions

View File

@ -6,6 +6,7 @@
#include <QMessageBox>
#include <QApplication>
#include <QClipboard>
#include <QInputDialog>
#include "EmuThread.h"
#include "Core/MemMap.h"
@ -221,6 +222,10 @@ void CtrlMemView::contextMenu(const QPoint &pos)
connect(copyValue, SIGNAL(triggered()), this, SLOT(CopyValue()));
menu.addAction(copyValue);
QAction *changeValue = new QAction(tr("C&hange value"), this);
connect(changeValue, SIGNAL(triggered()), this, SLOT(Change()));
menu.addAction(changeValue);
QAction *dump = new QAction(tr("Dump..."), this);
connect(dump, SIGNAL(triggered()), this, SLOT(Dump()));
menu.addAction(dump);
@ -230,7 +235,9 @@ void CtrlMemView::contextMenu(const QPoint &pos)
void CtrlMemView::CopyValue()
{
EmuThread_LockDraw(true);
QApplication::clipboard()->setText(QString("%1").arg(Memory::ReadUnchecked_U32(selection),8,16,QChar('0')));
EmuThread_LockDraw(false);
}
void CtrlMemView::Dump()
@ -238,6 +245,27 @@ void CtrlMemView::Dump()
QMessageBox::information(this,"Sorry","This feature has not been implemented.",QMessageBox::Ok);
}
void CtrlMemView::Change()
{
EmuThread_LockDraw(true);
QString curVal = QString("%1").arg(Memory::ReadUnchecked_U32(selection),8,16,QChar('0'));
EmuThread_LockDraw(false);
bool ok;
QString text = QInputDialog::getText(this, tr("Set new value"),
tr("Set new value:"), QLineEdit::Normal,
curVal, &ok);
if (ok && !text.isEmpty())
{
EmuThread_LockDraw(true);
Memory::WriteUnchecked_U32(text.toInt(0,16),selection);
EmuThread_LockDraw(false);
redraw();
}
}
int CtrlMemView::yToAddress(int y)
{
int ydiff=y-rect().bottom()/2-rowHeight/2;

View File

@ -72,6 +72,7 @@ signals:
public slots:
void CopyValue();
void Dump();
void Change();
private:
int curAddress;
int align;

View File

@ -309,15 +309,16 @@ void Debugger_DisplayList::ShowDLCode()
}
usedIdxAddr.insert(iaddr);
}
for(int i = 0; i < ui->texturesList->columnCount(); i++)
ui->texturesList->resizeColumnToContents(i);
for(int i = 0; i < ui->vertexList->columnCount(); i++)
ui->vertexList->resizeColumnToContents(i);
for(int i = 0; i < ui->indexList->columnCount(); i++)
ui->indexList->resizeColumnToContents(i);
}
for(int i = 0; i < ui->texturesList->columnCount(); i++)
ui->texturesList->resizeColumnToContents(i);
for(int i = 0; i < ui->vertexList->columnCount(); i++)
ui->vertexList->resizeColumnToContents(i);
for(int i = 0; i < ui->indexList->columnCount(); i++)
ui->indexList->resizeColumnToContents(i);
UpdateVertexInfo();
UpdateIndexInfo();
}