diff --git a/src/CutterApplication.cpp b/src/CutterApplication.cpp index dcf982b7..7d101022 100644 --- a/src/CutterApplication.cpp +++ b/src/CutterApplication.cpp @@ -80,6 +80,11 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc QObject::tr("level")); cmd_parser.addOption(analOption); + QCommandLineOption formatOption({"F", "format"}, + QObject::tr("Force using a specific file format (bin plugin)"), + QObject::tr("name")); + cmd_parser.addOption(formatOption); + QCommandLineOption scriptOption("i", QObject::tr("Run script file"), QObject::tr("file")); @@ -178,6 +183,7 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc } else { // filename specified as positional argument InitialOptions options; options.filename = args[0]; + options.forceBinPlugin = cmd_parser.value(formatOption); if (analLevelSpecified) { switch (analLevel) { case 0: diff --git a/src/dialogs/InitialOptionsDialog.cpp b/src/dialogs/InitialOptionsDialog.cpp index 57233719..1a8c0513 100644 --- a/src/dialogs/InitialOptionsDialog.cpp +++ b/src/dialogs/InitialOptionsDialog.cpp @@ -153,6 +153,12 @@ void InitialOptionsDialog::loadOptions(const InitialOptions &options) shellcode = options.shellcode; + if (!options.forceBinPlugin.isEmpty()) { + ui->formatComboBox->setCurrentText(options.forceBinPlugin); + } else { + ui->formatComboBox->setCurrentIndex(0); + } + // TODO: all other options should also be applied to the ui }