diff --git a/src/drivers/Qt/CheatsConf.cpp b/src/drivers/Qt/CheatsConf.cpp index 56a226fe..a594eac9 100644 --- a/src/drivers/Qt/CheatsConf.cpp +++ b/src/drivers/Qt/CheatsConf.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include "../../types.h" @@ -96,6 +97,8 @@ GuiCheatsDialog_t::GuiCheatsDialog_t(QWidget *parent) pauseWhileActive = false; wasPausedByCheats = false; + g_config->getOption("SDL.CheatsWindowPause", &pauseWhileActive); + //resize( 512, 512 ); // Window Layout Box @@ -418,6 +421,7 @@ GuiCheatsDialog_t::GuiCheatsDialog_t(QWidget *parent) hbox = new QHBoxLayout(); pauseBox = new QCheckBox(tr("Pause emulation when this window is active")); + pauseBox->setChecked(pauseWhileActive); closeButton = new QPushButton( tr("Close") ); closeButton->setIcon(style()->standardIcon(QStyle::SP_DialogCloseButton)); @@ -1029,8 +1033,13 @@ void GuiCheatsDialog_t::actvCheatItemClicked(QTreeWidgetItem *item, int column) //---------------------------------------------------------------------------- void GuiCheatsDialog_t::globalEnableCheats(int state) { + int val = state != Qt::Unchecked; + + g_config->setOption("SDL.CheatsDisabled", !val); + g_config->save(); + fceuWrapperLock(); - FCEUI_GlobalToggleCheat(state != Qt::Unchecked); + FCEUI_GlobalToggleCheat(val); fceuWrapperUnLock(); } //---------------------------------------------------------------------------- @@ -1038,19 +1047,36 @@ 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; + int ret; + const char *msg = "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?"; + + ret = QMessageBox::warning( this, QObject::tr("Cheat Manual Save Warning"), + QString::fromStdString(msg), QMessageBox::Yes | QMessageBox::No ); + + if ( ret == QMessageBox::Yes ) + { + disableAutoLSCheats = 2; + } + else + { + autoSave->setCheckState( Qt::Checked ); + } } else { disableAutoLSCheats = 0; } + g_config->setOption("SDL.CheatsDisableAutoLS", disableAutoLSCheats); + g_config->save(); } //---------------------------------------------------------------------------- void GuiCheatsDialog_t::pauseWindowState(int state) { pauseWhileActive = (state != Qt::Unchecked); + g_config->setOption("SDL.CheatsWindowPause", pauseWhileActive); + g_config->save(); + if (pauseWhileActive) { if (EmulationPaused == 0) diff --git a/src/drivers/Qt/config.cpp b/src/drivers/Qt/config.cpp index bbb882f3..84a22732 100644 --- a/src/drivers/Qt/config.cpp +++ b/src/drivers/Qt/config.cpp @@ -603,9 +603,14 @@ InitConfig() config->addOption("SDL.AviVideoFormat", AVI_RGB24); #endif + // Cheat Options + config->addOption("SDL.CheatsDisabled", 0); + config->addOption("SDL.CheatsDisableAutoLS", 0); + config->addOption("SDL.CheatsWindowPause", 0); + // Hex Editor Options - config->addOption("hexEditBgColor", "SDL.HexEditBgColor", "#000000"); - config->addOption("hexEditFgColor", "SDL.HexEditFgColor", "#FFFFFF"); + config->addOption("SDL.HexEditBgColor", "#000000"); + config->addOption("SDL.HexEditFgColor", "#FFFFFF"); config->addOption("SDL.HexEditCursorColorRC", "#000080"); config->addOption("SDL.HexEditAltColColor" , "#545454"); config->addOption("SDL.HexEditFont" , ""); diff --git a/src/drivers/Qt/fceuWrapper.cpp b/src/drivers/Qt/fceuWrapper.cpp index 4c3cd2ce..9526380f 100644 --- a/src/drivers/Qt/fceuWrapper.cpp +++ b/src/drivers/Qt/fceuWrapper.cpp @@ -47,6 +47,7 @@ #include "common/cheat.h" #include "../../fceu.h" +#include "../../cheat.h" #include "../../movie.h" #include "../../version.h" @@ -744,6 +745,10 @@ int fceuWrapperInit( int argc, char *argv[] ) AutoResumePlay = false; } + // Cheats + g_config->getOption ("SDL.CheatsDisabled" , &globalCheatDisabled); + g_config->getOption ("SDL.CheatsDisableAutoLS", &disableAutoLSCheats); + g_config->getOption ("SDL.DrawInputAids", &drawInputAidsEnable); // Initialize Autofire Pattern