Added basic functions of emulation menu
This commit is contained in:
parent
b830e0aae5
commit
74afb50949
|
@ -293,13 +293,49 @@ void consoleWin_t::createMainMenu(void)
|
|||
|
||||
optMenu->addAction(fullscreen);
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// Emulation
|
||||
emuMenu = menuBar()->addMenu(tr("Emulation"));
|
||||
|
||||
// Emulation -> Power
|
||||
powerAct = new QAction(tr("Power"), this);
|
||||
//powerAct->setShortcut( QKeySequence(tr("Ctrl+P")));
|
||||
powerAct->setStatusTip(tr("Power On Console"));
|
||||
connect(powerAct, SIGNAL(triggered()), this, SLOT(powerConsoleCB(void)) );
|
||||
|
||||
emuMenu->addAction(powerAct);
|
||||
|
||||
// Emulation -> Reset
|
||||
resetAct = new QAction(tr("Reset"), this);
|
||||
//resetAct->setShortcut( QKeySequence(tr("Ctrl+R")));
|
||||
resetAct->setStatusTip(tr("Reset Console"));
|
||||
connect(resetAct, SIGNAL(triggered()), this, SLOT(consoleHardReset(void)) );
|
||||
|
||||
emuMenu->addAction(resetAct);
|
||||
|
||||
// Emulation -> Soft Reset
|
||||
sresetAct = new QAction(tr("Soft Reset"), this);
|
||||
//sresetAct->setShortcut( QKeySequence(tr("Ctrl+R")));
|
||||
sresetAct->setStatusTip(tr("Soft Reset of Console"));
|
||||
connect(sresetAct, SIGNAL(triggered()), this, SLOT(consoleSoftReset(void)) );
|
||||
|
||||
emuMenu->addAction(sresetAct);
|
||||
|
||||
// Emulation -> Pause
|
||||
pauseAct = new QAction(tr("Pause"), this);
|
||||
pauseAct->setShortcut( QKeySequence(tr("Pause")));
|
||||
pauseAct->setStatusTip(tr("Pause Console"));
|
||||
connect(pauseAct, SIGNAL(triggered()), this, SLOT(consolePause(void)) );
|
||||
|
||||
emuMenu->addAction(pauseAct);
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// Help
|
||||
helpMenu = menuBar()->addMenu(tr("Help"));
|
||||
|
||||
aboutAct = new QAction(tr("About"), this);
|
||||
aboutAct->setStatusTip(tr("About Qplot"));
|
||||
connect(aboutAct, SIGNAL(triggered()), this, SLOT(aboutQPlot(void)) );
|
||||
aboutAct->setStatusTip(tr("About FCEUX"));
|
||||
connect(aboutAct, SIGNAL(triggered()), this, SLOT(aboutFCEUX(void)) );
|
||||
|
||||
helpMenu->addAction(aboutAct);
|
||||
};
|
||||
|
@ -761,9 +797,41 @@ void consoleWin_t::toggleFullscreen(void)
|
|||
}
|
||||
}
|
||||
|
||||
void consoleWin_t::aboutQPlot(void)
|
||||
void consoleWin_t::powerConsoleCB(void)
|
||||
{
|
||||
printf("About QPlot\n");
|
||||
fceuWrapperLock();
|
||||
FCEUI_PowerNES();
|
||||
fceuWrapperUnLock();
|
||||
return;
|
||||
}
|
||||
|
||||
void consoleWin_t::consoleHardReset(void)
|
||||
{
|
||||
fceuWrapperLock();
|
||||
fceuWrapperHardReset();
|
||||
fceuWrapperUnLock();
|
||||
return;
|
||||
}
|
||||
|
||||
void consoleWin_t::consoleSoftReset(void)
|
||||
{
|
||||
fceuWrapperLock();
|
||||
fceuWrapperSoftReset();
|
||||
fceuWrapperUnLock();
|
||||
return;
|
||||
}
|
||||
|
||||
void consoleWin_t::consolePause(void)
|
||||
{
|
||||
fceuWrapperLock();
|
||||
fceuWrapperTogglePause();
|
||||
fceuWrapperUnLock();
|
||||
return;
|
||||
}
|
||||
|
||||
void consoleWin_t::aboutFCEUX(void)
|
||||
{
|
||||
printf("About FCEUX\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ class consoleWin_t : public QMainWindow
|
|||
protected:
|
||||
QMenu *fileMenu;
|
||||
QMenu *optMenu;
|
||||
QMenu *emuMenu;
|
||||
QMenu *helpMenu;
|
||||
|
||||
QAction *openROM;
|
||||
|
@ -69,6 +70,10 @@ class consoleWin_t : public QMainWindow
|
|||
QAction *fullscreen;
|
||||
QAction *aboutAct;
|
||||
QAction *state[10];
|
||||
QAction *powerAct;
|
||||
QAction *resetAct;
|
||||
QAction *sresetAct;
|
||||
QAction *pauseAct;
|
||||
|
||||
QTimer *gameTimer;
|
||||
emulatorThread_t *emulatorThread;
|
||||
|
@ -92,7 +97,7 @@ class consoleWin_t : public QMainWindow
|
|||
void quickLoad(void);
|
||||
void quickSave(void);
|
||||
void closeROMCB(void);
|
||||
void aboutQPlot(void);
|
||||
void aboutFCEUX(void);
|
||||
void openGamePadConfWin(void);
|
||||
void openGameSndConfWin(void);
|
||||
void openGameVideoConfWin(void);
|
||||
|
@ -112,6 +117,10 @@ class consoleWin_t : public QMainWindow
|
|||
void changeState9(void);
|
||||
void loadLua(void);
|
||||
void takeScreenShot(void);
|
||||
void powerConsoleCB(void);
|
||||
void consoleHardReset(void);
|
||||
void consoleSoftReset(void);
|
||||
void consolePause(void);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -285,8 +285,6 @@ InitConfig()
|
|||
//TODO implement this
|
||||
config->addOption("periodicsaves", "SDL.PeriodicSaves", 0);
|
||||
|
||||
|
||||
#ifdef _GTK
|
||||
char* home_dir = getenv("HOME");
|
||||
// prefixed with _ because they are internal (not cli options)
|
||||
config->addOption("_lastopenfile", "SDL.LastOpenFile", home_dir);
|
||||
|
@ -294,7 +292,6 @@ InitConfig()
|
|||
config->addOption("_lastopennsf", "SDL.LastOpenNSF", home_dir);
|
||||
config->addOption("_lastsavestateas", "SDL.LastSaveStateAs", home_dir);
|
||||
config->addOption("_lastloadlua", "SDL.LastLoadLua", "");
|
||||
#endif
|
||||
|
||||
// fcm -> fm2 conversion
|
||||
config->addOption("fcmconvert", "SDL.FCMConvert", "");
|
||||
|
|
|
@ -278,6 +278,36 @@ CloseGame(void)
|
|||
return(1);
|
||||
}
|
||||
|
||||
int fceuWrapperSoftReset(void)
|
||||
{
|
||||
if ( isloaded )
|
||||
{
|
||||
ResetNES();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fceuWrapperHardReset(void)
|
||||
{
|
||||
if ( isloaded )
|
||||
{
|
||||
std::string lastFile;
|
||||
CloseGame();
|
||||
g_config->getOption ("SDL.LastOpenFile", &lastFile);
|
||||
LoadGame (lastFile.c_str());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fceuWrapperTogglePause(void)
|
||||
{
|
||||
if ( isloaded )
|
||||
{
|
||||
FCEUI_ToggleEmulationPause();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fceuWrapperInit( int argc, char *argv[] )
|
||||
{
|
||||
int error;
|
||||
|
@ -745,7 +775,7 @@ static void DoFun(int frameskip, int periodic_saves)
|
|||
int32 *sound;
|
||||
int32 ssize;
|
||||
static int fskipc = 0;
|
||||
static int opause = 0;
|
||||
//static int opause = 0;
|
||||
|
||||
//TODO peroidic saves, working on it right now
|
||||
if (periodic_saves && FCEUD_GetTime() % PERIODIC_SAVE_INTERVAL < 30){
|
||||
|
@ -762,11 +792,11 @@ static void DoFun(int frameskip, int periodic_saves)
|
|||
FCEUI_Emulate(&gfx, &sound, &ssize, fskipc);
|
||||
FCEUD_Update(gfx, sound, ssize);
|
||||
|
||||
if(opause!=FCEUI_EmulationPaused())
|
||||
{
|
||||
opause=FCEUI_EmulationPaused();
|
||||
SilenceSound(opause);
|
||||
}
|
||||
//if(opause!=FCEUI_EmulationPaused())
|
||||
//{
|
||||
// opause=FCEUI_EmulationPaused();
|
||||
// SilenceSound(opause);
|
||||
//}
|
||||
}
|
||||
|
||||
void fceuWrapperLock(void)
|
||||
|
@ -810,7 +840,7 @@ int fceuWrapperUpdate( void )
|
|||
{
|
||||
fceuWrapperLock();
|
||||
|
||||
if (GameInfo)
|
||||
if ( GameInfo && !FCEUI_EmulationPaused() )
|
||||
{
|
||||
DoFun(frameskip, periodic_saves);
|
||||
|
||||
|
|
|
@ -29,4 +29,7 @@ void fceuWrapperLock(void);
|
|||
bool fceuWrapperTryLock(int timeout);
|
||||
bool fceuWrapperIsLocked(void);
|
||||
void fceuWrapperUnLock(void);
|
||||
int fceuWrapperSoftReset(void);
|
||||
int fceuWrapperHardReset(void);
|
||||
int fceuWrapperTogglePause(void);
|
||||
|
||||
|
|
|
@ -248,29 +248,11 @@ void ToggleFS(void)
|
|||
if(!paused)
|
||||
FCEUI_ToggleEmulationPause();
|
||||
|
||||
int error, fullscreen = s_fullscreen;
|
||||
|
||||
// shut down the current video system
|
||||
KillVideo();
|
||||
|
||||
// flip the fullscreen flag
|
||||
g_config->setOption("SDL.Fullscreen", !fullscreen);
|
||||
#ifdef _GTK
|
||||
if(noGui == 0)
|
||||
{
|
||||
if(!fullscreen)
|
||||
showGui(0);
|
||||
else
|
||||
showGui(1);
|
||||
}
|
||||
#endif
|
||||
// try to initialize the video
|
||||
error = InitVideo(GameInfo);
|
||||
if(error) {
|
||||
// if we fail, just continue with what worked before
|
||||
g_config->setOption("SDL.Fullscreen", fullscreen);
|
||||
InitVideo(GameInfo);
|
||||
}
|
||||
g_config->setOption("SDL.Fullscreen", !s_fullscreen);
|
||||
|
||||
// TODO Call method to make full Screen
|
||||
|
||||
// if we paused to make the switch; unpause
|
||||
if(!paused)
|
||||
FCEUI_ToggleEmulationPause();
|
||||
|
|
Loading…
Reference in New Issue