Added game genie enable menu logic.
This commit is contained in:
parent
74afb50949
commit
c41cd863c6
|
@ -329,6 +329,19 @@ void consoleWin_t::createMainMenu(void)
|
||||||
|
|
||||||
emuMenu->addAction(pauseAct);
|
emuMenu->addAction(pauseAct);
|
||||||
|
|
||||||
|
emuMenu->addSeparator();
|
||||||
|
|
||||||
|
// Options -> Full Screen
|
||||||
|
gameGenieAct = new QAction(tr("Enable Game Genie"), this);
|
||||||
|
//gameGenieAct->setShortcut( QKeySequence(tr("Ctrl+G")));
|
||||||
|
gameGenieAct->setCheckable(true);
|
||||||
|
gameGenieAct->setStatusTip(tr("Enable Game Genie"));
|
||||||
|
connect(gameGenieAct, SIGNAL(triggered(bool)), this, SLOT(toggleGameGenie(bool)) );
|
||||||
|
|
||||||
|
syncActionConfig( gameGenieAct, "SDL.GameGenie" );
|
||||||
|
|
||||||
|
emuMenu->addAction(gameGenieAct);
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// Help
|
// Help
|
||||||
helpMenu = menuBar()->addMenu(tr("Help"));
|
helpMenu = menuBar()->addMenu(tr("Help"));
|
||||||
|
@ -829,12 +842,36 @@ void consoleWin_t::consolePause(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void consoleWin_t::toggleGameGenie(bool checked)
|
||||||
|
{
|
||||||
|
int gg_enabled;
|
||||||
|
|
||||||
|
fceuWrapperLock();
|
||||||
|
g_config->getOption ("SDL.GameGenie", &gg_enabled);
|
||||||
|
g_config->setOption ("SDL.GameGenie", !gg_enabled);
|
||||||
|
g_config->save ();
|
||||||
|
FCEUI_SetGameGenie (gg_enabled);
|
||||||
|
fceuWrapperUnLock();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
void consoleWin_t::aboutFCEUX(void)
|
void consoleWin_t::aboutFCEUX(void)
|
||||||
{
|
{
|
||||||
printf("About FCEUX\n");
|
printf("About FCEUX\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void consoleWin_t::syncActionConfig( QAction *act, const char *property )
|
||||||
|
{
|
||||||
|
if ( act->isCheckable() )
|
||||||
|
{
|
||||||
|
int enable;
|
||||||
|
g_config->getOption ( property, &enable);
|
||||||
|
|
||||||
|
act->setChecked( enable ? true : false );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void consoleWin_t::updatePeriodic(void)
|
void consoleWin_t::updatePeriodic(void)
|
||||||
{
|
{
|
||||||
//struct timespec ts;
|
//struct timespec ts;
|
||||||
|
|
|
@ -74,6 +74,7 @@ class consoleWin_t : public QMainWindow
|
||||||
QAction *resetAct;
|
QAction *resetAct;
|
||||||
QAction *sresetAct;
|
QAction *sresetAct;
|
||||||
QAction *pauseAct;
|
QAction *pauseAct;
|
||||||
|
QAction *gameGenieAct;
|
||||||
|
|
||||||
QTimer *gameTimer;
|
QTimer *gameTimer;
|
||||||
emulatorThread_t *emulatorThread;
|
emulatorThread_t *emulatorThread;
|
||||||
|
@ -84,6 +85,7 @@ class consoleWin_t : public QMainWindow
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent *event);
|
||||||
void keyPressEvent(QKeyEvent *event);
|
void keyPressEvent(QKeyEvent *event);
|
||||||
void keyReleaseEvent(QKeyEvent *event);
|
void keyReleaseEvent(QKeyEvent *event);
|
||||||
|
void syncActionConfig( QAction *act, const char *property );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createMainMenu(void);
|
void createMainMenu(void);
|
||||||
|
@ -121,6 +123,7 @@ class consoleWin_t : public QMainWindow
|
||||||
void consoleHardReset(void);
|
void consoleHardReset(void);
|
||||||
void consoleSoftReset(void);
|
void consoleSoftReset(void);
|
||||||
void consolePause(void);
|
void consolePause(void);
|
||||||
|
void toggleGameGenie(bool checked);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -203,9 +203,19 @@ DriverKill()
|
||||||
*/
|
*/
|
||||||
int LoadGame(const char *path)
|
int LoadGame(const char *path)
|
||||||
{
|
{
|
||||||
|
int gg_enabled;
|
||||||
|
|
||||||
if (isloaded){
|
if (isloaded){
|
||||||
CloseGame();
|
CloseGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For some reason, the core of the emulator clears the state of
|
||||||
|
// the game genie option selection. So check the config each time
|
||||||
|
// and re-enable the core game genie state if needed.
|
||||||
|
g_config->getOption ("SDL.GameGenie", &gg_enabled);
|
||||||
|
|
||||||
|
FCEUI_SetGameGenie (gg_enabled);
|
||||||
|
|
||||||
if(!FCEUI_LoadGame(path, 1)) {
|
if(!FCEUI_LoadGame(path, 1)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue