Added RAM Watch quick access from RAM search window for Qt GUI

This commit is contained in:
mjbudd77 2020-10-16 22:44:23 -04:00
parent 65bb526951
commit c98276945e
4 changed files with 40 additions and 1 deletions

View File

@ -35,6 +35,7 @@
#include "Qt/RamSearch.h"
#include "Qt/HexEditor.h"
#include "Qt/CheatsConf.h"
#include "Qt/ConsoleWindow.h"
#include "Qt/ConsoleUtilities.h"
static bool ShowROM = false;
@ -237,7 +238,7 @@ RamSearchDialog_t::RamSearchDialog_t(QWidget *parent)
watchButton = new QPushButton( tr("Watch") );
vbox->addWidget( watchButton );
//connect( watchButton, SIGNAL(clicked(void)), this, SLOT(dupWatchClicked(void)));
connect( watchButton, SIGNAL(clicked(void)), this, SLOT(addRamWatchClicked(void)));
watchButton->setEnabled(false);
addCheatButton = new QPushButton( tr("Add Cheat") );
@ -1171,6 +1172,22 @@ void RamSearchDialog_t::addCheatClicked(void)
updateCheatDialog();
}
//----------------------------------------------------------------------------
void RamSearchDialog_t::addRamWatchClicked(void)
{
int addr = ramView->getSelAddr();
char desc[128];
if ( addr < 0 )
{
return;
}
strcpy( desc, "Quick Watch Add");
ramWatchList.add_entry( desc, addr, dpyType, dpySize, 0 );
openRamWatchWindow(consoleWindow);
}
//----------------------------------------------------------------------------
void RamSearchDialog_t::hexEditSelAddr(void)
{
int addr = ramView->getSelAddr();

View File

@ -140,6 +140,7 @@ class RamSearchDialog_t : public QDialog
void eliminateSelAddr(void);
void hexEditSelAddr(void);
void addCheatClicked(void);
void addRamWatchClicked(void);
void periodicUpdate(void);
void hbarChanged(int val);
void vbarChanged(int val);

View File

@ -32,6 +32,18 @@
#include "Qt/ConsoleUtilities.h"
ramWatchList_t ramWatchList;
static RamWatchDialog_t *ramWatchMainWin = NULL;
//----------------------------------------------------------------------------
void openRamWatchWindow( QWidget *parent, int force )
{
if ( !force )
{
if ( ramWatchMainWin != NULL ) return;
}
ramWatchMainWin = new RamWatchDialog_t(parent);
ramWatchMainWin->show();
}
//----------------------------------------------------------------------------
RamWatchDialog_t::RamWatchDialog_t(QWidget *parent)
: QDialog( parent )
@ -264,6 +276,8 @@ RamWatchDialog_t::RamWatchDialog_t(QWidget *parent)
setLayout( mainLayout );
ramWatchMainWin = this;
updateTimer = new QTimer( this );
connect( updateTimer, &QTimer::timeout, this, &RamWatchDialog_t::periodicUpdate );
@ -274,6 +288,11 @@ RamWatchDialog_t::RamWatchDialog_t(QWidget *parent)
RamWatchDialog_t::~RamWatchDialog_t(void)
{
updateTimer->stop();
if ( ramWatchMainWin == this )
{
ramWatchMainWin = NULL;
}
printf("Destroy RAM Watch Config Window\n");
}
//----------------------------------------------------------------------------

View File

@ -254,3 +254,5 @@ class RamWatchDialog_t : public QDialog
};
extern ramWatchList_t ramWatchList;
void openRamWatchWindow( QWidget *parent, int force = 0 );