mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 03:16:10 +00:00
Added <file>.r2 auto loading
This commit is contained in:
parent
f357303090
commit
33732291e7
@ -314,6 +314,22 @@ void MainWindow::openNewFile(const QString &fn, int anal_level, QList<QString> a
|
||||
{
|
||||
setFilename(fn);
|
||||
|
||||
/* Reset config */
|
||||
core->resetDefaultAsmOptions();
|
||||
|
||||
/* Prompt to load filename.r2 script */
|
||||
QString script = QString("%1.r2").arg(this->filename);
|
||||
if (r_file_exists(script.toStdString().data())) {
|
||||
QMessageBox mb;
|
||||
mb.setWindowTitle(tr("Script loading"));
|
||||
mb.setText(tr("Do you want to load the '%1' script?").arg(script));
|
||||
mb.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
if (mb.exec() == QMessageBox::Yes) {
|
||||
core->loadScript(script);
|
||||
}
|
||||
}
|
||||
|
||||
/* Show analysis options dialog */
|
||||
OptionsDialog *o = new OptionsDialog(this);
|
||||
o->setAttribute(Qt::WA_DeleteOnClose);
|
||||
o->show();
|
||||
|
@ -1351,3 +1351,8 @@ QList<DisassemblyLine> CutterCore::disassembleLines(RVA offset, int lines)
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
void CutterCore::loadScript(const QString &scriptname)
|
||||
{
|
||||
r_core_cmd_file(core_, scriptname.toStdString().data());
|
||||
}
|
||||
|
@ -333,6 +333,8 @@ public:
|
||||
void resetDefaultAsmOptions();
|
||||
void saveDefaultAsmOptions();
|
||||
|
||||
void loadScript(const QString &scriptname);
|
||||
|
||||
RCoreLocked core() const;
|
||||
|
||||
/* fields */
|
||||
|
@ -139,8 +139,6 @@ void OptionsDialog::setupAndStartAnalysis(int level, QList<QString> advanced)
|
||||
|
||||
main->initUI();
|
||||
|
||||
core->resetDefaultAsmOptions();
|
||||
|
||||
// Timer for showing elapsed analysis time.
|
||||
analTimer.setInterval(1000);
|
||||
analTimer.setSingleShot(false);
|
||||
|
Loading…
Reference in New Issue
Block a user