diff --git a/src/AnalThread.cpp b/src/AnalThread.cpp index 91636771..2c3ed2f4 100644 --- a/src/AnalThread.cpp +++ b/src/AnalThread.cpp @@ -106,6 +106,10 @@ void AnalThread::run() core->loadPDB(ui->pdbLineEdit->text()); } + if (ui->scriptCheckBox->isChecked()) { + core->loadScript(ui->scriptLineEdit->text()); + } + if (optionsDialog->getSelectedEndianness() != OptionsDialog::Endianness::Auto) { core->setEndianness(optionsDialog->getSelectedEndianness() == OptionsDialog::Endianness::Big); } diff --git a/src/dialogs/OptionsDialog.cpp b/src/dialogs/OptionsDialog.cpp index 0f9d53b6..f12bbc67 100644 --- a/src/dialogs/OptionsDialog.cpp +++ b/src/dialogs/OptionsDialog.cpp @@ -54,6 +54,10 @@ OptionsDialog::OptionsDialog(MainWindow *main): connect(ui->pdbCheckBox, SIGNAL(stateChanged(int)), this, SLOT(updatePDBLayout())); + updateScriptLayout(); + + connect(ui->scriptCheckBox, SIGNAL(stateChanged(int)), this, SLOT(updateScriptLayout())); + // Add this so the dialog resizes when widgets are shown/hidden //this->layout()->setSizeConstraint(QLayout::SetFixedSize); @@ -343,6 +347,30 @@ void OptionsDialog::on_pdbSelectButton_clicked() } } + +void OptionsDialog::updateScriptLayout() +{ + ui->scriptWidget->setEnabled(ui->scriptCheckBox->isChecked()); +} + +void OptionsDialog::on_scriptSelectButton_clicked() +{ + QFileDialog dialog(this); + dialog.setWindowTitle(tr("Select radare2 script file")); + dialog.setNameFilters({ tr("Script file (*.r2)"), tr("All files (*)") }); + + if (!dialog.exec()) { + return; + } + + QString fileName = dialog.selectedFiles().first(); + + if (!fileName.isEmpty()) { + ui->scriptLineEdit->setText(fileName); + } +} + + void OptionsDialog::reject() { done(0); diff --git a/src/dialogs/OptionsDialog.h b/src/dialogs/OptionsDialog.h index d618b0cc..9d1d359f 100644 --- a/src/dialogs/OptionsDialog.h +++ b/src/dialogs/OptionsDialog.h @@ -33,11 +33,13 @@ private slots: void on_analCheckBox_clicked(bool checked); void on_archComboBox_currentIndexChanged(int index); void on_pdbSelectButton_clicked(); + void on_scriptSelectButton_clicked(); void updateProgressTimer(); void updatePDBLayout(); - + void updateScriptLayout(); + void anal_finished(); protected: diff --git a/src/dialogs/OptionsDialog.ui b/src/dialogs/OptionsDialog.ui index c3af33af..b75cb77f 100644 --- a/src/dialogs/OptionsDialog.ui +++ b/src/dialogs/OptionsDialog.ui @@ -885,7 +885,51 @@ + + + + Load script file + + + + + + + true + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Path to radare2 script file + + + + + + + Select + + + + + + + + @@ -904,7 +948,7 @@ - + 1024