mirror of https://github.com/mgba-emu/mgba.git
Add frameskip
This commit is contained in:
parent
dcbfba03c3
commit
bd74fa1fbc
|
@ -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) {
|
void GameController::setTurbo(bool set, bool forced) {
|
||||||
if (m_turboForced && !forced) {
|
if (m_turboForced && !forced) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -71,6 +71,7 @@ public slots:
|
||||||
void saveState(int slot);
|
void saveState(int slot);
|
||||||
void setVideoSync(bool);
|
void setVideoSync(bool);
|
||||||
void setAudioSync(bool);
|
void setAudioSync(bool);
|
||||||
|
void setFrameskip(int);
|
||||||
void setTurbo(bool, bool forced = true);
|
void setTurbo(bool, bool forced = true);
|
||||||
|
|
||||||
#ifdef BUILD_SDL
|
#ifdef BUILD_SDL
|
||||||
|
|
|
@ -101,6 +101,10 @@ void Window::optionsPassed(StartupOptions* opts) {
|
||||||
m_logView->setLevels(opts->logLevel);
|
m_logView->setLevels(opts->logLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (opts->frameskip) {
|
||||||
|
m_controller->setFrameskip(opts->frameskip);
|
||||||
|
}
|
||||||
|
|
||||||
if (opts->bios) {
|
if (opts->bios) {
|
||||||
m_controller->loadBIOS(opts->bios);
|
m_controller->loadBIOS(opts->bios);
|
||||||
}
|
}
|
||||||
|
@ -112,9 +116,6 @@ void Window::optionsPassed(StartupOptions* opts) {
|
||||||
if (opts->fname) {
|
if (opts->fname) {
|
||||||
m_controller->loadGame(opts->fname, opts->dirmode);
|
m_controller->loadGame(opts->fname, opts->dirmode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO:
|
|
||||||
// - frameskip
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::selectROM() {
|
void Window::selectROM() {
|
||||||
|
@ -385,7 +386,7 @@ void Window::setupMenu(QMenuBar* menubar) {
|
||||||
emulationMenu->addAction(audioSync);
|
emulationMenu->addAction(audioSync);
|
||||||
|
|
||||||
QMenu* videoMenu = menubar->addMenu(tr("&Video"));
|
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);
|
QAction* setSize = new QAction(tr("1x"), videoMenu);
|
||||||
connect(setSize, &QAction::triggered, [this]() {
|
connect(setSize, &QAction::triggered, [this]() {
|
||||||
showNormal();
|
showNormal();
|
||||||
|
@ -412,6 +413,15 @@ void Window::setupMenu(QMenuBar* menubar) {
|
||||||
frameMenu->addAction(setSize);
|
frameMenu->addAction(setSize);
|
||||||
frameMenu->addAction(tr("Fullscreen"), this, SLOT(toggleFullScreen()), QKeySequence("Ctrl+F"));
|
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* soundMenu = menubar->addMenu(tr("&Sound"));
|
||||||
QMenu* buffersMenu = soundMenu->addMenu(tr("Buffer &size"));
|
QMenu* buffersMenu = soundMenu->addMenu(tr("Buffer &size"));
|
||||||
QAction* setBuffer = new QAction(tr("512"), buffersMenu);
|
QAction* setBuffer = new QAction(tr("512"), buffersMenu);
|
||||||
|
|
Loading…
Reference in New Issue