Add Start from Selection
This commit is contained in:
parent
ca637fad33
commit
7dade58481
|
@ -1218,6 +1218,8 @@ void CPUDisassembly::findPatternSlot()
|
||||||
{
|
{
|
||||||
HexEditDialog hexEdit(this);
|
HexEditDialog hexEdit(this);
|
||||||
hexEdit.isDataCopiable(false);
|
hexEdit.isDataCopiable(false);
|
||||||
|
if(sender() == mFindPatternRegion)
|
||||||
|
hexEdit.showStartFromSelection(true, ConfigBool("Disassembler", "FindPatternFromSelection"));
|
||||||
hexEdit.mHexEdit->setOverwriteMode(false);
|
hexEdit.mHexEdit->setOverwriteMode(false);
|
||||||
hexEdit.setWindowTitle(tr("Find Pattern..."));
|
hexEdit.setWindowTitle(tr("Find Pattern..."));
|
||||||
if(hexEdit.exec() != QDialog::Accepted)
|
if(hexEdit.exec() != QDialog::Accepted)
|
||||||
|
@ -1228,6 +1230,9 @@ void CPUDisassembly::findPatternSlot()
|
||||||
QString command;
|
QString command;
|
||||||
if(sender() == mFindPatternRegion)
|
if(sender() == mFindPatternRegion)
|
||||||
{
|
{
|
||||||
|
bool startFromSelection = hexEdit.startFromSelection();
|
||||||
|
Config()->setBool("Disassembler", "FindPatternFromSelection", startFromSelection);
|
||||||
|
if(!startFromSelection)
|
||||||
addr = DbgMemFindBaseAddr(addr, 0);
|
addr = DbgMemFindBaseAddr(addr, 0);
|
||||||
command = QString("findall %1, %2").arg(ToHexString(addr), hexEdit.mHexEdit->pattern());
|
command = QString("findall %1, %2").arg(ToHexString(addr), hexEdit.mHexEdit->pattern());
|
||||||
}
|
}
|
||||||
|
@ -1773,18 +1778,18 @@ void CPUDisassembly::findCommandSlot()
|
||||||
|
|
||||||
LineEditDialog mLineEdit(this);
|
LineEditDialog mLineEdit(this);
|
||||||
mLineEdit.enableCheckBox(refFindType == 0);
|
mLineEdit.enableCheckBox(refFindType == 0);
|
||||||
mLineEdit.setCheckBoxText(tr("Entire &Block"));
|
mLineEdit.setCheckBoxText(tr("Start from &Selection"));
|
||||||
mLineEdit.setCheckBox(ConfigBool("Disassembler", "FindCommandEntireBlock"));
|
mLineEdit.setCheckBox(ConfigBool("Disassembler", "FindCommandFromSelection"));
|
||||||
mLineEdit.setWindowTitle("Find Command");
|
mLineEdit.setWindowTitle("Find Command");
|
||||||
if(mLineEdit.exec() != QDialog::Accepted)
|
if(mLineEdit.exec() != QDialog::Accepted)
|
||||||
return;
|
return;
|
||||||
Config()->setBool("Disassembler", "FindCommandEntireBlock", mLineEdit.bChecked);
|
Config()->setBool("Disassembler", "FindCommandFromSelection", mLineEdit.bChecked);
|
||||||
|
|
||||||
char error[MAX_ERROR_SIZE] = "";
|
char error[MAX_ERROR_SIZE] = "";
|
||||||
unsigned char dest[16];
|
unsigned char dest[16];
|
||||||
int asmsize = 0;
|
int asmsize = 0;
|
||||||
duint va = rvaToVa(getInitialSelection());
|
duint va = rvaToVa(getInitialSelection());
|
||||||
if(mLineEdit.bChecked) // entire block
|
if(!mLineEdit.bChecked) // start search from selection
|
||||||
va = mMemPage->getBase();
|
va = mMemPage->getBase();
|
||||||
|
|
||||||
if(!DbgFunctions()->Assemble(mMemPage->getBase() + mMemPage->getSize() / 2, dest, &asmsize, mLineEdit.editText.toUtf8().constData(), error))
|
if(!DbgFunctions()->Assemble(mMemPage->getBase() + mMemPage->getSize() / 2, dest, &asmsize, mLineEdit.editText.toUtf8().constData(), error))
|
||||||
|
|
|
@ -1444,11 +1444,15 @@ void CPUDump::findPattern()
|
||||||
{
|
{
|
||||||
HexEditDialog hexEdit(this);
|
HexEditDialog hexEdit(this);
|
||||||
hexEdit.isDataCopiable(false);
|
hexEdit.isDataCopiable(false);
|
||||||
|
hexEdit.showStartFromSelection(true, ConfigBool("Gui", "CPUDumpStartFromSelect"));
|
||||||
hexEdit.mHexEdit->setOverwriteMode(false);
|
hexEdit.mHexEdit->setOverwriteMode(false);
|
||||||
hexEdit.setWindowTitle(tr("Find Pattern..."));
|
hexEdit.setWindowTitle(tr("Find Pattern..."));
|
||||||
if(hexEdit.exec() != QDialog::Accepted)
|
if(hexEdit.exec() != QDialog::Accepted)
|
||||||
return;
|
return;
|
||||||
|
bool startFromSelection = hexEdit.startFromSelection();
|
||||||
|
Config()->setBool("Gui", "CPUDumpStartFromSelect", startFromSelection);
|
||||||
dsint addr = rvaToVa(getSelectionStart());
|
dsint addr = rvaToVa(getSelectionStart());
|
||||||
|
if(!startFromSelection)
|
||||||
addr = DbgMemFindBaseAddr(addr, 0);
|
addr = DbgMemFindBaseAddr(addr, 0);
|
||||||
QString addrText = ToPtrString(addr);
|
QString addrText = ToPtrString(addr);
|
||||||
DbgCmdExec(QString("findall " + addrText + ", " + hexEdit.mHexEdit->pattern() + ", &data&"));
|
DbgCmdExec(QString("findall " + addrText + ", " + hexEdit.mHexEdit->pattern() + ", &data&"));
|
||||||
|
|
|
@ -866,12 +866,16 @@ void CPUStack::findPattern()
|
||||||
{
|
{
|
||||||
HexEditDialog hexEdit(this);
|
HexEditDialog hexEdit(this);
|
||||||
hexEdit.isDataCopiable(false);
|
hexEdit.isDataCopiable(false);
|
||||||
|
hexEdit.showStartFromSelection(true, ConfigBool("Gui", "CPUStackStartFromSelect"));
|
||||||
hexEdit.mHexEdit->setOverwriteMode(false);
|
hexEdit.mHexEdit->setOverwriteMode(false);
|
||||||
hexEdit.setWindowTitle(tr("Find Pattern..."));
|
hexEdit.setWindowTitle(tr("Find Pattern..."));
|
||||||
if(hexEdit.exec() != QDialog::Accepted)
|
if(hexEdit.exec() != QDialog::Accepted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dsint addr = rvaToVa(getSelectionStart());
|
dsint addr = rvaToVa(getSelectionStart());
|
||||||
|
bool startFromSelection = hexEdit.startFromSelection();
|
||||||
|
Config()->setBool("Gui", "CPUStackStartFromSelect", startFromSelection);
|
||||||
|
if(!startFromSelection)
|
||||||
addr = DbgMemFindBaseAddr(addr, 0);
|
addr = DbgMemFindBaseAddr(addr, 0);
|
||||||
|
|
||||||
QString addrText = ToPtrString(addr);
|
QString addrText = ToPtrString(addr);
|
||||||
|
|
|
@ -28,6 +28,7 @@ HexEditDialog::HexEditDialog(QWidget* parent) : QDialog(parent), ui(new Ui::HexE
|
||||||
ui->chkKeepSize->setChecked(ConfigBool("HexDump", "KeepSize"));
|
ui->chkKeepSize->setChecked(ConfigBool("HexDump", "KeepSize"));
|
||||||
ui->chkKeepSize->hide();
|
ui->chkKeepSize->hide();
|
||||||
ui->chkEntireBlock->hide();
|
ui->chkEntireBlock->hide();
|
||||||
|
ui->chkFromSelection->hide();
|
||||||
|
|
||||||
mDataInitialized = false;
|
mDataInitialized = false;
|
||||||
stringEditorLock = false;
|
stringEditorLock = false;
|
||||||
|
@ -112,6 +113,12 @@ void HexEditDialog::showKeepSize(bool show)
|
||||||
ui->chkKeepSize->setVisible(show);
|
ui->chkKeepSize->setVisible(show);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HexEditDialog::showStartFromSelection(bool show, bool checked)
|
||||||
|
{
|
||||||
|
ui->chkFromSelection->setVisible(show);
|
||||||
|
ui->chkFromSelection->setChecked(checked);
|
||||||
|
}
|
||||||
|
|
||||||
void HexEditDialog::isDataCopiable(bool copyDataEnabled)
|
void HexEditDialog::isDataCopiable(bool copyDataEnabled)
|
||||||
{
|
{
|
||||||
if(copyDataEnabled == false)
|
if(copyDataEnabled == false)
|
||||||
|
@ -150,6 +157,11 @@ bool HexEditDialog::entireBlock()
|
||||||
return ui->chkEntireBlock->isChecked();
|
return ui->chkEntireBlock->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HexEditDialog::startFromSelection()
|
||||||
|
{
|
||||||
|
return ui->chkFromSelection->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
void HexEditDialog::updateStyle()
|
void HexEditDialog::updateStyle()
|
||||||
{
|
{
|
||||||
QString style = QString("QLineEdit { border-style: outset; border-width: 1px; border-color: %1; color: %1; background-color: %2 }").arg(ConfigColor("HexEditTextColor").name(), ConfigColor("HexEditBackgroundColor").name());
|
QString style = QString("QLineEdit { border-style: outset; border-width: 1px; border-color: %1; color: %1; background-color: %2 }").arg(ConfigColor("HexEditTextColor").name(), ConfigColor("HexEditBackgroundColor").name());
|
||||||
|
|
|
@ -18,10 +18,12 @@ public:
|
||||||
|
|
||||||
void showEntireBlock(bool show, bool checked = false);
|
void showEntireBlock(bool show, bool checked = false);
|
||||||
void showKeepSize(bool show);
|
void showKeepSize(bool show);
|
||||||
|
void showStartFromSelection(bool show, bool checked = false);
|
||||||
void isDataCopiable(bool copyDataEnabled);
|
void isDataCopiable(bool copyDataEnabled);
|
||||||
void updateCodepage();
|
void updateCodepage();
|
||||||
|
|
||||||
bool entireBlock();
|
bool entireBlock();
|
||||||
|
bool startFromSelection();
|
||||||
|
|
||||||
QHexEdit* mHexEdit;
|
QHexEdit* mHexEdit;
|
||||||
|
|
||||||
|
|
|
@ -445,6 +445,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="chkFromSelection">
|
||||||
|
<property name="text">
|
||||||
|
<string>Start from &Selection</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|
|
@ -254,7 +254,8 @@ Configuration::Configuration() : QObject(), noMoreMsgbox(false)
|
||||||
disassemblyBool.insert("KeepSize", false);
|
disassemblyBool.insert("KeepSize", false);
|
||||||
disassemblyBool.insert("FillNOPs", false);
|
disassemblyBool.insert("FillNOPs", false);
|
||||||
disassemblyBool.insert("Uppercase", false);
|
disassemblyBool.insert("Uppercase", false);
|
||||||
disassemblyBool.insert("FindCommandEntireBlock", false);
|
disassemblyBool.insert("FindCommandFromSelection", true);
|
||||||
|
disassemblyBool.insert("FindPatternFromSelection", true);
|
||||||
disassemblyBool.insert("OnlyCipAutoComments", false);
|
disassemblyBool.insert("OnlyCipAutoComments", false);
|
||||||
disassemblyBool.insert("TabbedMnemonic", false);
|
disassemblyBool.insert("TabbedMnemonic", false);
|
||||||
disassemblyBool.insert("LongDataInstruction", false);
|
disassemblyBool.insert("LongDataInstruction", false);
|
||||||
|
@ -292,6 +293,8 @@ Configuration::Configuration() : QObject(), noMoreMsgbox(false)
|
||||||
guiBool.insert("AutoFollowInStack", true);
|
guiBool.insert("AutoFollowInStack", true);
|
||||||
guiBool.insert("EnableQtHighDpiScaling", true);
|
guiBool.insert("EnableQtHighDpiScaling", true);
|
||||||
guiBool.insert("Topmost", false);
|
guiBool.insert("Topmost", false);
|
||||||
|
guiBool.insert("CPUDumpStartFromSelect", true);
|
||||||
|
guiBool.insert("CPUStackStartFromSelect", true);
|
||||||
//Named menu settings
|
//Named menu settings
|
||||||
insertMenuBuilderBools(&guiBool, "CPUDisassembly", 50); //CPUDisassembly
|
insertMenuBuilderBools(&guiBool, "CPUDisassembly", 50); //CPUDisassembly
|
||||||
insertMenuBuilderBools(&guiBool, "CPUDump", 50); //CPUDump
|
insertMenuBuilderBools(&guiBool, "CPUDump", 50); //CPUDump
|
||||||
|
|
Loading…
Reference in New Issue