Add frameskip

This commit is contained in:
Jeffrey Pfau 2014-10-24 21:45:50 -07:00
parent dcbfba03c3
commit bd74fa1fbc
3 changed files with 19 additions and 4 deletions

View File

@ -289,6 +289,10 @@ void GameController::setAudioSync(bool set) {
}
}
void GameController::setFrameskip(int skip) {
m_threadContext.frameskip = skip;
}
void GameController::setTurbo(bool set, bool forced) {
if (m_turboForced && !forced) {
return;

View File

@ -71,6 +71,7 @@ public slots:
void saveState(int slot);
void setVideoSync(bool);
void setAudioSync(bool);
void setFrameskip(int);
void setTurbo(bool, bool forced = true);
#ifdef BUILD_SDL

View File

@ -101,6 +101,10 @@ void Window::optionsPassed(StartupOptions* opts) {
m_logView->setLevels(opts->logLevel);
}
if (opts->frameskip) {
m_controller->setFrameskip(opts->frameskip);
}
if (opts->bios) {
m_controller->loadBIOS(opts->bios);
}
@ -112,9 +116,6 @@ void Window::optionsPassed(StartupOptions* opts) {
if (opts->fname) {
m_controller->loadGame(opts->fname, opts->dirmode);
}
// TODO:
// - frameskip
}
void Window::selectROM() {
@ -385,7 +386,7 @@ void Window::setupMenu(QMenuBar* menubar) {
emulationMenu->addAction(audioSync);
QMenu* videoMenu = menubar->addMenu(tr("&Video"));
QMenu* frameMenu = videoMenu->addMenu(tr("Frame &size"));
QMenu* frameMenu = videoMenu->addMenu(tr("Frame size"));
QAction* setSize = new QAction(tr("1x"), videoMenu);
connect(setSize, &QAction::triggered, [this]() {
showNormal();
@ -412,6 +413,15 @@ void Window::setupMenu(QMenuBar* menubar) {
frameMenu->addAction(setSize);
frameMenu->addAction(tr("Fullscreen"), this, SLOT(toggleFullScreen()), QKeySequence("Ctrl+F"));
QMenu* skipMenu = videoMenu->addMenu(tr("Frame&skip"));
for (int i = 0; i <= 10; ++i) {
QAction* setSkip = new QAction(QString::number(i), skipMenu);
connect(setSkip, &QAction::triggered, [this, i]() {
m_controller->setFrameskip(i);
});
skipMenu->addAction(setSkip);
}
QMenu* soundMenu = menubar->addMenu(tr("&Sound"));
QMenu* buffersMenu = soundMenu->addMenu(tr("Buffer &size"));
QAction* setBuffer = new QAction(tr("512"), buffersMenu);