Added logic to refresh cheat window when adding from RAM search or watch windows for Qt GUI
This commit is contained in:
parent
1dc0181e01
commit
65bb526951
|
@ -27,6 +27,26 @@
|
|||
|
||||
static GuiCheatsDialog_t *win = NULL;
|
||||
//----------------------------------------------------------------------------
|
||||
void openCheatDialog(QWidget *parent)
|
||||
{
|
||||
if ( win != NULL )
|
||||
{
|
||||
return;
|
||||
}
|
||||
win = new GuiCheatsDialog_t(parent);
|
||||
|
||||
win->show();
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void updateCheatDialog(void)
|
||||
{
|
||||
if ( win == NULL )
|
||||
{
|
||||
return;
|
||||
}
|
||||
win->showActiveCheatList( true );
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
GuiCheatsDialog_t::GuiCheatsDialog_t(QWidget *parent)
|
||||
: QDialog( parent )
|
||||
{
|
||||
|
@ -412,6 +432,7 @@ GuiCheatsDialog_t::~GuiCheatsDialog_t(void)
|
|||
}
|
||||
wasPausedByCheats = false;
|
||||
|
||||
win = NULL;
|
||||
printf("Destroy Cheat Window Event\n");
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
|
@ -32,6 +32,8 @@ class GuiCheatsDialog_t : public QDialog
|
|||
|
||||
int activeCheatListCB (char *name, uint32 a, uint8 v, int c, int s, int type, void *data);
|
||||
|
||||
void showActiveCheatList(bool redraw);
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
|
||||
|
@ -75,7 +77,6 @@ class GuiCheatsDialog_t : public QDialog
|
|||
|
||||
private:
|
||||
void showCheatSearchResults(void);
|
||||
void showActiveCheatList(bool redraw);
|
||||
|
||||
public slots:
|
||||
void closeWindow(void);
|
||||
|
@ -97,3 +98,7 @@ class GuiCheatsDialog_t : public QDialog
|
|||
void actvCheatItemClicked( QTreeWidgetItem *item, int column);
|
||||
|
||||
};
|
||||
|
||||
void openCheatDialog(QWidget *parent);
|
||||
|
||||
void updateCheatDialog(void);
|
||||
|
|
|
@ -1026,13 +1026,9 @@ void consoleWin_t::openGuiConfWin(void)
|
|||
|
||||
void consoleWin_t::openCheats(void)
|
||||
{
|
||||
GuiCheatsDialog_t *cheatWin;
|
||||
|
||||
//printf("Open GUI Cheat Window\n");
|
||||
|
||||
cheatWin = new GuiCheatsDialog_t(this);
|
||||
|
||||
cheatWin->show();
|
||||
openCheatDialog(this);
|
||||
}
|
||||
|
||||
void consoleWin_t::openRamWatch(void)
|
||||
|
|
|
@ -242,7 +242,7 @@ RamSearchDialog_t::RamSearchDialog_t(QWidget *parent)
|
|||
|
||||
addCheatButton = new QPushButton( tr("Add Cheat") );
|
||||
vbox->addWidget( addCheatButton );
|
||||
//connect( addCheatButton, SIGNAL(clicked(void)), this, SLOT(sepWatchClicked(void)));
|
||||
connect( addCheatButton, SIGNAL(clicked(void)), this, SLOT(addCheatClicked(void)));
|
||||
addCheatButton->setEnabled(false);
|
||||
|
||||
hexEditButton = new QPushButton( tr("Hex Editor") );
|
||||
|
@ -1155,6 +1155,22 @@ void RamSearchDialog_t::eliminateSelAddr(void)
|
|||
vbar->setMaximum( actvSrchList.size() );
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void RamSearchDialog_t::addCheatClicked(void)
|
||||
{
|
||||
int addr = ramView->getSelAddr();
|
||||
char desc[128];
|
||||
|
||||
if ( addr < 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
strcpy( desc, "Quick Cheat Add");
|
||||
|
||||
FCEUI_AddCheat( desc, addr, GetMem(addr), -1, 1 );
|
||||
|
||||
updateCheatDialog();
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void RamSearchDialog_t::hexEditSelAddr(void)
|
||||
{
|
||||
int addr = ramView->getSelAddr();
|
||||
|
|
|
@ -139,6 +139,7 @@ class RamSearchDialog_t : public QDialog
|
|||
void clearChangeCounts(void);
|
||||
void eliminateSelAddr(void);
|
||||
void hexEditSelAddr(void);
|
||||
void addCheatClicked(void);
|
||||
void periodicUpdate(void);
|
||||
void hbarChanged(int val);
|
||||
void vbarChanged(int val);
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "Qt/keyscan.h"
|
||||
#include "Qt/fceuWrapper.h"
|
||||
#include "Qt/RamWatch.h"
|
||||
#include "Qt/CheatsConf.h"
|
||||
#include "Qt/ConsoleUtilities.h"
|
||||
|
||||
ramWatchList_t ramWatchList;
|
||||
|
@ -898,6 +899,8 @@ void RamWatchDialog_t::addCheatClicked(void)
|
|||
if ( rw != NULL )
|
||||
{
|
||||
FCEUI_AddCheat( rw->name.c_str(), rw->addr, GetMem(rw->addr), -1, 1 );
|
||||
|
||||
updateCheatDialog();
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue