1
0
Fork 0

GUI: automatically set dump/disasm pointer to group start when selecting a patch

This commit is contained in:
Mr. eXoDia 2014-07-06 04:22:11 +02:00
parent 9c241e8e9b
commit 3474cf6f03
2 changed files with 26 additions and 0 deletions

View File

@ -209,3 +209,28 @@ void PatchDialog::on_btnRestoreSelected_clicked()
ui->listModules->setCurrentRow(selModIdx);
GuiUpdateAllViews();
}
void PatchDialog::on_listPatches_itemSelectionChanged()
{
if(!ui->listModules->selectedItems().size() || !ui->listPatches->selectedItems().size())
return;
QString mod = ui->listModules->selectedItems().at(0)->text();
PatchMap::iterator found = mPatches->find(mod);
if(found == mPatches->end()) //not found
return;
PatchInfoList & curPatchList = found.value();
PatchPair & patch = curPatchList[ui->listPatches->row(ui->listPatches->selectedItems().at(0))]; //selected item
int group=patch.second.group;
int_t groupStart = 0;
for(int i=0; i<curPatchList.size(); i++)
if(curPatchList.at(i).second.group==group)
{
groupStart = curPatchList.at(i).first.addr;
break;
}
if(!groupStart)
return;
QString addrText = QString("%1").arg(groupStart, sizeof(int_t)*2, 16, QChar('0')).toUpper();
DbgCmdExecDirect(QString("disasm "+addrText).toUtf8().constData());
DbgCmdExecDirect(QString("dump "+addrText).toUtf8().constData());
}

View File

@ -45,6 +45,7 @@ private slots:
void on_btnSelectAll_clicked();
void on_btnDeselectAll_clicked();
void on_btnRestoreSelected_clicked();
void on_listPatches_itemSelectionChanged();
};
#endif // PATCHDIALOG_H