Added options for disasm (#306)

This commit is contained in:
Jubal 2018-01-31 03:01:16 -05:00 committed by xarkes
parent 25d2606bfc
commit 806fc5bded
5 changed files with 119 additions and 4 deletions

View File

@ -507,7 +507,11 @@ void CutterCore::resetDefaultAsmOptions()
setConfig("asm.offset", Config()->getAsmOffset());
setConfig("asm.describe", Config()->getAsmDescribe());
setConfig("asm.stackptr", Config()->getAsmStackPointer());
setConfig("asm.slow", Config()->getAsmSlow());
setConfig("asm.lines", Config()->getAsmLines());
setConfig("asm.emu", Config()->getAsmEmu());
setConfig("asm.cmtright", Config()->getAsmCmtRight());
setConfig("asm.varsum", Config()->getAsmVarSum());
setConfig("asm.bytes", Config()->getAsmBytes());
setConfig("asm.bytespace", Config()->getAsmBytespace());
setConfig("asm.lbytes", Config()->getAsmLBytes());
@ -517,6 +521,7 @@ void CutterCore::resetDefaultAsmOptions()
setConfig("asm.capitalize", Config()->getAsmCapitalize());
setConfig("asm.varsub", Config()->getAsmVarsub());
setConfig("asm.varsub_only", Config()->getAsmVarsubOnly());
setConfig("asm.tabs", Config()->getAsmTabs());
}
void CutterCore::saveDefaultAsmOptions()
@ -526,7 +531,11 @@ void CutterCore::saveDefaultAsmOptions()
Config()->setAsmOffset(getConfigb("asm.offset"));
Config()->setAsmDescribe(getConfigb("asm.describe"));
Config()->setAsmStackPointer(getConfigb("asm.stackptr"));
Config()->setAsmSlow(getConfigb("asm.slow"));
Config()->setAsmLines(getConfigb("asm.lines"));
Config()->setAsmEmu(getConfigb("asm.emu"));
Config()->setAsmCmtRight(getConfigb("asm.cmtright"));
Config()->setAsmVarSum(getConfigb("asm.varsum"));
Config()->setAsmBytes(getConfigb("asm.bytes"));
Config()->setAsmBytespace(getConfigb("asm.bytespace"));
Config()->setAsmLBytes(getConfigb("asm.lbytes"));
@ -536,6 +545,7 @@ void CutterCore::saveDefaultAsmOptions()
Config()->setAsmCapitalize(getConfigb("asm.capitalize"));
Config()->setAsmVarsub(getConfigb("asm.varsub"));
Config()->setAsmVarsubOnly(getConfigb("asm.varsub_only"));
Config()->setAsmTabs(getConfigi("asm.tabs"));
}
QString CutterCore::getConfig(const QString &k)
@ -768,12 +778,10 @@ void CutterCore::setSettings()
//setConfig("asm.functions", "false");
setConfig("hex.pairs", false);
setConfig("asm.cmtflgrefs", false);
setConfig("asm.cmtright", true);
setConfig("asm.cmtcol", 70);
setConfig("asm.xrefs", false);
setConfig("asm.fcnlines", false);
setConfig("asm.tabs", 5);
setConfig("asm.tabsonce", true);
setConfig("asm.tabsoff", 5);
setConfig("asm.nbytes", 10);

View File

@ -40,7 +40,11 @@ void AsmOptionsWidget::updateAsmOptionsFromVars()
qhelpers::setCheckedWithoutSignals(ui->offsetCheckBox, Core()->getConfigb("asm.offset"));
qhelpers::setCheckedWithoutSignals(ui->describeCheckBox, Core()->getConfigb("asm.describe"));
qhelpers::setCheckedWithoutSignals(ui->stackpointerCheckBox, Core()->getConfigb("asm.stackptr"));
qhelpers::setCheckedWithoutSignals(ui->slowCheckBox, Core()->getConfigb("asm.slow"));
qhelpers::setCheckedWithoutSignals(ui->linesCheckBox, Core()->getConfigb("asm.lines"));
qhelpers::setCheckedWithoutSignals(ui->emuCheckBox, Core()->getConfigb("asm.emu"));
qhelpers::setCheckedWithoutSignals(ui->cmtrightCheckBox, Core()->getConfigb("asm.cmtright"));
qhelpers::setCheckedWithoutSignals(ui->varsumCheckBox, Core()->getConfigb("asm.varsum"));
bool bytesEnabled = Core()->getConfigb("asm.bytes");
qhelpers::setCheckedWithoutSignals(ui->bytesCheckBox, bytesEnabled);
@ -76,6 +80,10 @@ void AsmOptionsWidget::updateAsmOptionsFromVars()
}
ui->caseComboBox->blockSignals(false);
ui->asmTabsSpinBox->blockSignals(true);
ui->asmTabsSpinBox->setValue(Core()->getConfigi("asm.tabs"));
ui->asmTabsSpinBox->blockSignals(false);
qhelpers::setCheckedWithoutSignals(ui->bblineCheckBox, Core()->getConfigb("asm.bbline"));
bool varsubEnabled = Core()->getConfigb("asm.varsub");
@ -135,12 +143,36 @@ void AsmOptionsWidget::on_stackpointerCheckBox_toggled(bool checked)
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_slowCheckBox_toggled(bool checked)
{
Core()->setConfig("asm.slow", checked);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_linesCheckBox_toggled(bool checked)
{
Core()->setConfig("asm.lines", checked);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_emuCheckBox_toggled(bool checked)
{
Core()->setConfig("asm.emu", checked);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_cmtrightCheckBox_toggled(bool checked)
{
Core()->setConfig("asm.cmtright", checked);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_varsumCheckBox_toggled(bool checked)
{
Core()->setConfig("asm.varsum", checked);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_bytesCheckBox_toggled(bool checked)
{
Core()->setConfig("asm.bytes", checked);
@ -199,6 +231,12 @@ void AsmOptionsWidget::on_caseComboBox_currentIndexChanged(int index)
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_asmTabsSpinBox_valueChanged(int value)
{
Core()->setConfig("asm.tabs", value);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_bblineCheckBox_toggled(bool checked)
{
Core()->setConfig("asm.bbline", checked);

View File

@ -39,12 +39,17 @@ private slots:
void on_offsetCheckBox_toggled(bool checked);
void on_describeCheckBox_toggled(bool checked);
void on_stackpointerCheckBox_toggled(bool checked);
void on_slowCheckBox_toggled(bool checked);
void on_linesCheckBox_toggled(bool checked);
void on_emuCheckBox_toggled(bool checked);
void on_cmtrightCheckBox_toggled(bool checked);
void on_varsumCheckBox_toggled(bool checked);
void on_bytesCheckBox_toggled(bool checked);
void on_bytespaceCheckBox_toggled(bool checked);
void on_lbytesCheckBox_toggled(bool checked);
void on_syntaxComboBox_currentIndexChanged(int index);
void on_caseComboBox_currentIndexChanged(int index);
void on_asmTabsSpinBox_valueChanged(int value);
void on_bblineCheckBox_toggled(bool checked);
void on_varsubCheckBox_toggled(bool checked);
void on_varsubOnlyCheckBox_toggled(bool checked);

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>541</width>
<height>478</height>
<width>545</width>
<height>638</height>
</rect>
</property>
<property name="windowTitle">
@ -49,6 +49,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="slowCheckBox">
<property name="text">
<string>Slow Analysis (asm.slow)</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="linesCheckBox">
<property name="text">
@ -56,6 +63,27 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="emuCheckBox">
<property name="text">
<string>Run ESIL emulation analysis (asm.emu)</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cmtrightCheckBox">
<property name="text">
<string>Show comments at right of assembly (asm.cmtright)</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="varsumCheckBox">
<property name="text">
<string>Show variables summary instead of full list (asm.varsum)</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="bytesCheckBox">
<property name="text">
@ -117,6 +145,27 @@
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Tabs in assembly (asm.tabs):</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="asmTabsSpinBox">
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>5</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="bblineCheckBox">
<property name="text">

View File

@ -58,9 +58,21 @@ public:
bool getAsmStackPointer() const { return s.value("asm.stackptr", false).toBool(); }
void setAsmStackPointer(bool v) { s.setValue("asm.stackptr", v); }
bool getAsmSlow() const { return s.value("asm.slow", false).toBool(); }
void setAsmSlow(bool v) { s.setValue("asm.slow", v); }
bool getAsmLines() const { return s.value("asm.lines", false).toBool(); }
void setAsmLines(bool v) { s.setValue("asm.lines", v); }
bool getAsmEmu() const { return s.value("asm.emu", false).toBool(); }
void setAsmEmu(bool v) { s.setValue("asm.emu", v); }
bool getAsmCmtRight() const { return s.value("asm.cmtright", true).toBool(); }
void setAsmCmtRight(bool v) { s.setValue("asm.cmtright", v); }
bool getAsmVarSum() const { return s.value("asm.varsum", false).toBool(); }
void setAsmVarSum(bool v) { s.setValue("asm.varsum", v); }
bool getAsmBytes() const { return s.value("asm.bytes", false).toBool(); }
void setAsmBytes(bool v) { s.setValue("asm.bytes", v); }
@ -88,6 +100,9 @@ public:
bool getAsmVarsubOnly() const { return s.value("asm.varsub_only", true).toBool(); }
void setAsmVarsubOnly(bool v) { s.setValue("asm.varsub_only", v); }
int getAsmTabs() const { return s.value("asm.tabs", 5).toInt(); }
void setAsmTabs(int v) { s.setValue("asm.tabs", v); }
signals:
void fontsUpdated();
void colorsUpdated();