Merge pull request #189 from mjbudd77/master
Added emulation speed control main menu functionality to Qt GUI.
This commit is contained in:
commit
07cef83c3f
2
TODO-SDL
2
TODO-SDL
|
@ -29,7 +29,7 @@ OpenGL graphics | YES | YES
|
||||||
Hot key config window | YES | YES |
|
Hot key config window | YES | YES |
|
||||||
Palette config window | YES | YES |
|
Palette config window | YES | YES |
|
||||||
Multi-thread (GUI and emulation on separate threads) | YES | NO |
|
Multi-thread (GUI and emulation on separate threads) | YES | NO |
|
||||||
Emulation speed control via menu | NO | NO |
|
Emulation speed control via menu | YES | NO |
|
||||||
Emulation speed control via hotkeys | YES | YES |
|
Emulation speed control via hotkeys | YES | YES |
|
||||||
Fullscreen functionality | YES | YES |
|
Fullscreen functionality | YES | YES |
|
||||||
AVI Record Functionality | NO | NO |
|
AVI Record Functionality | NO | NO |
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QInputDialog>
|
||||||
|
|
||||||
#include "../../fceu.h"
|
#include "../../fceu.h"
|
||||||
#include "../../fds.h"
|
#include "../../fds.h"
|
||||||
|
@ -175,6 +176,7 @@ void consoleWin_t::keyReleaseEvent(QKeyEvent *event)
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void consoleWin_t::createMainMenu(void)
|
void consoleWin_t::createMainMenu(void)
|
||||||
{
|
{
|
||||||
|
QAction *act;
|
||||||
QMenu *subMenu;
|
QMenu *subMenu;
|
||||||
QActionGroup *group;
|
QActionGroup *group;
|
||||||
int useNativeMenuBar;
|
int useNativeMenuBar;
|
||||||
|
@ -479,6 +481,71 @@ void consoleWin_t::createMainMenu(void)
|
||||||
|
|
||||||
subMenu->addAction(fdsLoadBiosAct);
|
subMenu->addAction(fdsLoadBiosAct);
|
||||||
|
|
||||||
|
emuMenu->addSeparator();
|
||||||
|
|
||||||
|
// Emulation -> Speed
|
||||||
|
subMenu = emuMenu->addMenu(tr("Speed"));
|
||||||
|
|
||||||
|
// Emulation -> Speed -> Speed Up
|
||||||
|
act = new QAction(tr("Speed Up"), this);
|
||||||
|
act->setShortcut( QKeySequence(tr("=")));
|
||||||
|
act->setStatusTip(tr("Speed Up"));
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(emuSpeedUp(void)) );
|
||||||
|
|
||||||
|
subMenu->addAction(act);
|
||||||
|
|
||||||
|
// Emulation -> Speed -> Slow Down
|
||||||
|
act = new QAction(tr("Slow Down"), this);
|
||||||
|
act->setShortcut( QKeySequence(tr("-")));
|
||||||
|
act->setStatusTip(tr("Slow Down"));
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(emuSlowDown(void)) );
|
||||||
|
|
||||||
|
subMenu->addAction(act);
|
||||||
|
|
||||||
|
subMenu->addSeparator();
|
||||||
|
|
||||||
|
// Emulation -> Speed -> Slowest Speed
|
||||||
|
act = new QAction(tr("Slowest"), this);
|
||||||
|
//act->setShortcut( QKeySequence(tr("-")));
|
||||||
|
act->setStatusTip(tr("Slowest"));
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(emuSlowestSpd(void)) );
|
||||||
|
|
||||||
|
subMenu->addAction(act);
|
||||||
|
|
||||||
|
// Emulation -> Speed -> Normal Speed
|
||||||
|
act = new QAction(tr("Normal"), this);
|
||||||
|
//act->setShortcut( QKeySequence(tr("-")));
|
||||||
|
act->setStatusTip(tr("Normal"));
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(emuNormalSpd(void)) );
|
||||||
|
|
||||||
|
subMenu->addAction(act);
|
||||||
|
|
||||||
|
// Emulation -> Speed -> Fastest Speed
|
||||||
|
act = new QAction(tr("Turbo"), this);
|
||||||
|
//act->setShortcut( QKeySequence(tr("-")));
|
||||||
|
act->setStatusTip(tr("Turbo (Fastest)"));
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(emuFastestSpd(void)) );
|
||||||
|
|
||||||
|
subMenu->addAction(act);
|
||||||
|
|
||||||
|
// Emulation -> Speed -> Custom Speed
|
||||||
|
act = new QAction(tr("Custom"), this);
|
||||||
|
//act->setShortcut( QKeySequence(tr("-")));
|
||||||
|
act->setStatusTip(tr("Custom"));
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(emuCustomSpd(void)) );
|
||||||
|
|
||||||
|
subMenu->addAction(act);
|
||||||
|
|
||||||
|
subMenu->addSeparator();
|
||||||
|
|
||||||
|
// Emulation -> Speed -> Set Frame Advance Delay
|
||||||
|
act = new QAction(tr("Set Frame Advance Delay"), this);
|
||||||
|
//act->setShortcut( QKeySequence(tr("-")));
|
||||||
|
act->setStatusTip(tr("Set Frame Advance Delay"));
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(emuSetFrameAdvDelay(void)) );
|
||||||
|
|
||||||
|
subMenu->addAction(act);
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// Tools
|
// Tools
|
||||||
toolsMenu = menuBar()->addMenu(tr("Tools"));
|
toolsMenu = menuBar()->addMenu(tr("Tools"));
|
||||||
|
@ -1322,6 +1389,77 @@ void consoleWin_t::fdsLoadBiosFile(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void consoleWin_t::emuSpeedUp(void)
|
||||||
|
{
|
||||||
|
IncreaseEmulationSpeed();
|
||||||
|
}
|
||||||
|
|
||||||
|
void consoleWin_t::emuSlowDown(void)
|
||||||
|
{
|
||||||
|
DecreaseEmulationSpeed();
|
||||||
|
}
|
||||||
|
|
||||||
|
void consoleWin_t::emuSlowestSpd(void)
|
||||||
|
{
|
||||||
|
FCEUD_SetEmulationSpeed( EMUSPEED_SLOWEST );
|
||||||
|
}
|
||||||
|
|
||||||
|
void consoleWin_t::emuNormalSpd(void)
|
||||||
|
{
|
||||||
|
FCEUD_SetEmulationSpeed( EMUSPEED_NORMAL );
|
||||||
|
}
|
||||||
|
|
||||||
|
void consoleWin_t::emuFastestSpd(void)
|
||||||
|
{
|
||||||
|
FCEUD_SetEmulationSpeed( EMUSPEED_FASTEST );
|
||||||
|
}
|
||||||
|
|
||||||
|
void consoleWin_t::emuCustomSpd(void)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
QInputDialog dialog(this);
|
||||||
|
|
||||||
|
dialog.setWindowTitle( tr("Emulation Speed") );
|
||||||
|
dialog.setLabelText( tr("Enter a percentage from 1 to 1000.") );
|
||||||
|
dialog.setOkButtonText( tr("Ok") );
|
||||||
|
dialog.setInputMode( QInputDialog::IntInput );
|
||||||
|
dialog.setIntRange( 1, 1000 );
|
||||||
|
dialog.setIntValue( 100 );
|
||||||
|
|
||||||
|
dialog.show();
|
||||||
|
ret = dialog.exec();
|
||||||
|
|
||||||
|
if ( QDialog::Accepted == ret )
|
||||||
|
{
|
||||||
|
int spdPercent;
|
||||||
|
|
||||||
|
spdPercent = dialog.intValue();
|
||||||
|
|
||||||
|
CustomEmulationSpeed( spdPercent );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void consoleWin_t::emuSetFrameAdvDelay(void)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
QInputDialog dialog(this);
|
||||||
|
|
||||||
|
dialog.setWindowTitle( tr("Frame Advance Delay") );
|
||||||
|
dialog.setLabelText( tr("How much time should elapse before holding the frame advance unpauses the simulation?") );
|
||||||
|
dialog.setOkButtonText( tr("Ok") );
|
||||||
|
dialog.setInputMode( QInputDialog::IntInput );
|
||||||
|
dialog.setIntRange( 0, 1000 );
|
||||||
|
dialog.setIntValue( frameAdvance_Delay );
|
||||||
|
|
||||||
|
dialog.show();
|
||||||
|
ret = dialog.exec();
|
||||||
|
|
||||||
|
if ( QDialog::Accepted == ret )
|
||||||
|
{
|
||||||
|
frameAdvance_Delay = dialog.intValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void consoleWin_t::openMovie(void)
|
void consoleWin_t::openMovie(void)
|
||||||
{
|
{
|
||||||
int ret, useNativeFileDialogVal;
|
int ret, useNativeFileDialogVal;
|
||||||
|
|
|
@ -166,6 +166,13 @@ class consoleWin_t : public QMainWindow
|
||||||
void fdsSwitchDisk(void);
|
void fdsSwitchDisk(void);
|
||||||
void fdsEjectDisk(void);
|
void fdsEjectDisk(void);
|
||||||
void fdsLoadBiosFile(void);
|
void fdsLoadBiosFile(void);
|
||||||
|
void emuSpeedUp(void);
|
||||||
|
void emuSlowDown(void);
|
||||||
|
void emuSlowestSpd(void);
|
||||||
|
void emuNormalSpd(void);
|
||||||
|
void emuFastestSpd(void);
|
||||||
|
void emuCustomSpd(void);
|
||||||
|
void emuSetFrameAdvDelay(void);
|
||||||
void openPPUViewer(void);
|
void openPPUViewer(void);
|
||||||
void openNTViewer(void);
|
void openNTViewer(void);
|
||||||
void openCheats(void);
|
void openCheats(void);
|
||||||
|
|
|
@ -53,6 +53,7 @@ extern bool replaceP2StartWithMicrophone;
|
||||||
|
|
||||||
void IncreaseEmulationSpeed(void);
|
void IncreaseEmulationSpeed(void);
|
||||||
void DecreaseEmulationSpeed(void);
|
void DecreaseEmulationSpeed(void);
|
||||||
|
int CustomEmulationSpeed(int spdPercent);
|
||||||
|
|
||||||
int DTestButtonJoy(ButtConfig *bc);
|
int DTestButtonJoy(ButtConfig *bc);
|
||||||
|
|
||||||
|
|
|
@ -134,6 +134,31 @@ void DecreaseEmulationSpeed(void)
|
||||||
FCEU_DispMessage("Emulation speed %.1f%%",0, g_fpsScale*100.0);
|
FCEU_DispMessage("Emulation speed %.1f%%",0, g_fpsScale*100.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CustomEmulationSpeed(int spdPercent)
|
||||||
|
{
|
||||||
|
if ( spdPercent < 1 )
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
g_fpsScale = ((double)spdPercent) / 100.0f;
|
||||||
|
|
||||||
|
if (g_fpsScale < Slowest)
|
||||||
|
{
|
||||||
|
g_fpsScale = Slowest;
|
||||||
|
}
|
||||||
|
else if (g_fpsScale > Fastest)
|
||||||
|
{
|
||||||
|
g_fpsScale = Fastest;
|
||||||
|
}
|
||||||
|
|
||||||
|
RefreshThrottleFPS();
|
||||||
|
|
||||||
|
FCEU_DispMessage("Emulation speed %.1f%%",0, g_fpsScale*100.0);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the emulation speed throttling to a specific value.
|
* Set the emulation speed throttling to a specific value.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -69,6 +69,7 @@ extern uint8 qtaintramreg;
|
||||||
|
|
||||||
extern uint8 *RAM; //shared memory modifications
|
extern uint8 *RAM; //shared memory modifications
|
||||||
extern int EmulationPaused;
|
extern int EmulationPaused;
|
||||||
|
extern int frameAdvance_Delay;
|
||||||
|
|
||||||
uint8 FCEU_ReadRomByte(uint32 i);
|
uint8 FCEU_ReadRomByte(uint32 i);
|
||||||
void FCEU_WriteRomByte(uint32 i, uint8 value);
|
void FCEU_WriteRomByte(uint32 i, uint8 value);
|
||||||
|
|
Loading…
Reference in New Issue