Added Qt Hex Editor goto Address Dialog. Added RAM search to Qt GUI capability list.

This commit is contained in:
mjbudd77 2020-10-16 23:53:20 -04:00
parent e77dd77b7c
commit 5715ec235a
3 changed files with 53 additions and 3 deletions

View File

@ -38,7 +38,7 @@ Game genie load/enable capability | YES | YES
Movie record/save/play functionality | YES | YES |
Cheat search window | YES | YES |
Active Cheat window | YES | YES |
RAM Search Window | NO | NO |
RAM Search Window | YES | NO |
RAM Watch Window | YES | YES |
Memory Watch Window | NO | NO |
TAS Editor | NO | NO |

View File

@ -563,7 +563,7 @@ HexEditorDialog_t::HexEditorDialog_t(QWidget *parent)
// File -> Save ROM
saveROM = new QAction(tr("Save ROM"), this);
//saveROM->setShortcuts(QKeySequence::Open);
//saveROM->setShortcut(QKeySequence::Open);
saveROM->setStatusTip(tr("Save ROM File"));
connect(saveROM, SIGNAL(triggered()), this, SLOT(saveRomFile(void)) );
@ -571,12 +571,20 @@ HexEditorDialog_t::HexEditorDialog_t(QWidget *parent)
// File -> Save ROM As
saveROM = new QAction(tr("Save ROM As"), this);
//saveROM->setShortcuts(QKeySequence::Open);
//saveROM->setShortcut(QKeySequence::Open);
saveROM->setStatusTip(tr("Save ROM File As"));
connect(saveROM, SIGNAL(triggered()), this, SLOT(saveRomFileAs(void)) );
fileMenu->addAction(saveROM);
// File -> Goto Address
gotoAddrAct = new QAction(tr("Goto Addresss"), this);
gotoAddrAct->setShortcut(QKeySequence(tr("Ctrl+A")));
gotoAddrAct->setStatusTip(tr("Goto Address"));
connect(gotoAddrAct, SIGNAL(triggered()), this, SLOT(openGotoAddrDialog(void)) );
fileMenu->addAction(gotoAddrAct);
fileMenu->addSeparator();
// File -> Close
@ -1132,6 +1140,11 @@ void HexEditorDialog_t::updatePeriodic(void)
}
}
//----------------------------------------------------------------------------
void HexEditorDialog_t::openGotoAddrDialog(void)
{
editor->openGotoAddrDialog();
}
//----------------------------------------------------------------------------
QHexEdit::QHexEdit(QWidget *parent)
: QWidget( parent )
{
@ -1361,6 +1374,33 @@ void QHexEdit::resizeEvent(QResizeEvent *event)
}
//----------------------------------------------------------------------------
void QHexEdit::openGotoAddrDialog(void)
{
int ret;
char stmp[128];
QInputDialog dialog(this);
sprintf( stmp, "Specify Address [ 0x0 -> 0x%X ]", mb.size()-1 );
dialog.setWindowTitle( tr("Goto Address") );
dialog.setLabelText( tr(stmp) );
dialog.setOkButtonText( tr("Go") );
//dialog.setTextValue( tr("0") );
dialog.show();
ret = dialog.exec();
if ( QDialog::Accepted == ret )
{
int addr;
std::string s = dialog.textValue().toStdString();
addr = strtol( s.c_str(), NULL, 16 );
parent->gotoAddress(addr);
}
}
//----------------------------------------------------------------------------
void QHexEdit::resetCursor(void)
{
cursorBlink = true;
@ -1599,6 +1639,13 @@ void QHexEdit::keyPressEvent(QKeyEvent *event)
vbar->setValue( lineOffset );
resetCursor();
}
else if (Qt::ControlModifier == event->modifiers())
{
if ( event->key() == Qt::Key_A )
{
openGotoAddrDialog();
}
}
else if (event->key() == Qt::Key_Tab && (cursorPosX < 32) )
{ // switch from hex to ascii edit
cursorPosX = 32 + (cursorPosX / 2);

View File

@ -113,6 +113,7 @@ class QHexEdit : public QWidget
void setForeGroundColor( QColor fg );
void setBackGroundColor( QColor bg );
void memModeUpdate(void);
void openGotoAddrDialog(void);
int checkMemActivity(void);
int getAddr(void){ return cursorAddr; };
@ -221,6 +222,7 @@ class HexEditorDialog_t : public QDialog
QAction *viewPPU;
QAction *viewOAM;
QAction *viewROM;
QAction *gotoAddrAct;
private:
@ -242,6 +244,7 @@ class HexEditorDialog_t : public QDialog
void pickForeGroundColor(void);
void pickBackGroundColor(void);
void removeAllBookmarks(void);
void openGotoAddrDialog(void);
};
int hexEditorNumWindows(void);