all repos — mgba @ bd74fa1fbcd810452602a03682a7677c2efb30d4

mGBA Game Boy Advance Emulator

Add frameskip
Jeffrey Pfau jeffrey@endrift.com
Fri, 24 Oct 2014 21:45:50 -0700
commit

bd74fa1fbcd810452602a03682a7677c2efb30d4

parent

dcbfba03c37b7be1b6db543ec4599447c70d3a90

3 files changed, 19 insertions(+), 4 deletions(-)

jump to
M src/platform/qt/GameController.cppsrc/platform/qt/GameController.cpp

@@ -289,6 +289,10 @@ GBAThreadContinue(&m_threadContext);

} } +void GameController::setFrameskip(int skip) { + m_threadContext.frameskip = skip; +} + void GameController::setTurbo(bool set, bool forced) { if (m_turboForced && !forced) { return;
M src/platform/qt/GameController.hsrc/platform/qt/GameController.h

@@ -71,6 +71,7 @@ void loadState(int slot);

void saveState(int slot); void setVideoSync(bool); void setAudioSync(bool); + void setFrameskip(int); void setTurbo(bool, bool forced = true); #ifdef BUILD_SDL
M src/platform/qt/Window.cppsrc/platform/qt/Window.cpp

@@ -101,6 +101,10 @@ if (opts->logLevel) {

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 @@

if (opts->fname) { m_controller->loadGame(opts->fname, opts->dirmode); } - - // TODO: - // - frameskip } void Window::selectROM() {

@@ -385,7 +386,7 @@ connect(audioSync, SIGNAL(triggered(bool)), m_controller, SLOT(setAudioSync(bool)));

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();

@@ -411,6 +412,15 @@ resize(VIDEO_HORIZONTAL_PIXELS * 4, VIDEO_VERTICAL_PIXELS * 4);

}); 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"));