diff --git a/src/drivers/Qt/CheatsConf.cpp b/src/drivers/Qt/CheatsConf.cpp index 74c0a41a..74f61a15 100644 --- a/src/drivers/Qt/CheatsConf.cpp +++ b/src/drivers/Qt/CheatsConf.cpp @@ -86,6 +86,19 @@ GuiCheatsDialog_t::GuiCheatsDialog_t(QWidget *parent) connect( actvCheatList, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(actvCheatItemClicked( QTreeWidgetItem*, int)) ); + hbox = new QHBoxLayout(); + + enaCheats = new QCheckBox( tr("Enable Cheats") ); + autoSave = new QCheckBox( tr("Auto Load / Save with Game") ); + + enaCheats->setChecked( !globalCheatDisabled ); + autoSave->setChecked( !disableAutoLSCheats ); + + hbox->addWidget( enaCheats ); + hbox->addWidget( autoSave ); + + vbox1->addLayout( hbox ); + vbox1->addWidget( actvCheatList ); hbox = new QHBoxLayout(); @@ -366,6 +379,9 @@ GuiCheatsDialog_t::GuiCheatsDialog_t(QWidget *parent) connect( delCheatBtn , SIGNAL(clicked(void)), this, SLOT(deleteActvCheat(void)) ); connect( modCheatBtn , SIGNAL(clicked(void)), this, SLOT(updateCheatParameters(void)) ); + connect( enaCheats, SIGNAL(stateChanged(int)), this, SLOT(globalEnableCheats(int)) ); + connect( autoSave , SIGNAL(stateChanged(int)), this, SLOT(autoLoadSaveCheats(int)) ); + connect( importCheatFileBtn, SIGNAL(clicked(void)), this, SLOT(openCheatFile(void)) ); showActiveCheatList(true); @@ -845,3 +861,23 @@ void GuiCheatsDialog_t::actvCheatItemClicked( QTreeWidgetItem *item, int column } } //---------------------------------------------------------------------------- +void GuiCheatsDialog_t::globalEnableCheats(int state) +{ + fceuWrapperLock(); + FCEUI_GlobalToggleCheat( state != Qt::Unchecked ); + fceuWrapperUnLock(); +} +//---------------------------------------------------------------------------- +void GuiCheatsDialog_t::autoLoadSaveCheats(int state) +{ + if ( state == Qt::Unchecked ) + { + printf("If this option is unchecked, you must manually save the cheats by yourself, or all the changes you made to the cheat list would be discarded silently without any asking once you close the game!\nDo you really want to do it in this way?"); + disableAutoLSCheats = 2; + } + else + { + disableAutoLSCheats = 0; + } +} +//---------------------------------------------------------------------------- diff --git a/src/drivers/Qt/CheatsConf.h b/src/drivers/Qt/CheatsConf.h index 43dc8da7..35d1bc48 100644 --- a/src/drivers/Qt/CheatsConf.h +++ b/src/drivers/Qt/CheatsConf.h @@ -51,6 +51,8 @@ class GuiCheatsDialog_t : public QDialog QCheckBox *useNeVal; QCheckBox *useGrVal; QCheckBox *useLtVal; + QCheckBox *enaCheats; + QCheckBox *autoSave; QTreeWidget *actvCheatList; QTreeWidget *srchResults; QLineEdit *cheatNameEntry; @@ -84,6 +86,8 @@ class GuiCheatsDialog_t : public QDialog void addActvCheat(void); void deleteActvCheat(void); void updateCheatParameters(void); + void autoLoadSaveCheats(int state); + void globalEnableCheats(int state); void actvCheatItemClicked( QTreeWidgetItem *item, int column); };