summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/citra/config.cpp1
-rw-r--r--src/citra/default_ini.h4
-rw-r--r--src/citra/emu_window/emu_window_sdl2.cpp1
-rw-r--r--src/citra_qt/bootmanager.cpp1
-rw-r--r--src/citra_qt/config.cpp2
-rw-r--r--src/citra_qt/configure_graphics.cpp3
-rw-r--r--src/citra_qt/configure_graphics.ui7
-rw-r--r--src/core/settings.h1
-rw-r--r--src/video_core/video_core.cpp1
9 files changed, 20 insertions, 1 deletions
diff --git a/src/citra/config.cpp b/src/citra/config.cpp
index e832ec58d..d71045646 100644
--- a/src/citra/config.cpp
+++ b/src/citra/config.cpp
@@ -71,6 +71,7 @@ void Config::ReadValues() {
Settings::values.use_hw_renderer = sdl2_config->GetBoolean("Renderer", "use_hw_renderer", true);
Settings::values.use_shader_jit = sdl2_config->GetBoolean("Renderer", "use_shader_jit", true);
Settings::values.use_scaled_resolution = sdl2_config->GetBoolean("Renderer", "use_scaled_resolution", false);
+ Settings::values.use_vsync = sdl2_config->GetBoolean("Renderer", "use_vsync", false);
Settings::values.bg_red = (float)sdl2_config->GetReal("Renderer", "bg_red", 1.0);
Settings::values.bg_green = (float)sdl2_config->GetReal("Renderer", "bg_green", 1.0);
diff --git a/src/citra/default_ini.h b/src/citra/default_ini.h
index 6249ef9e2..b10700e62 100644
--- a/src/citra/default_ini.h
+++ b/src/citra/default_ini.h
@@ -55,6 +55,10 @@ use_shader_jit =
# 0 (default): Native, 1: Scaled
use_scaled_resolution =
+# Whether to enable V-Sync (caps the framerate at 60FPS) or not.
+# 0 (default): Off, 1: On
+use_vsync =
+
# The clear color for the renderer. What shows up on the sides of the bottom screen.
# Must be in range of 0.0-1.0. Defaults to 1.0 for all.
bg_red =
diff --git a/src/citra/emu_window/emu_window_sdl2.cpp b/src/citra/emu_window/emu_window_sdl2.cpp
index 591f68aa4..da12307b7 100644
--- a/src/citra/emu_window/emu_window_sdl2.cpp
+++ b/src/citra/emu_window/emu_window_sdl2.cpp
@@ -108,6 +108,7 @@ EmuWindow_SDL2::EmuWindow_SDL2() {
OnResize();
OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size);
SDL_PumpEvents();
+ SDL_GL_SetSwapInterval(Settings::values.use_vsync);
DoneCurrent();
}
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp
index 414b2f8af..a9669c559 100644
--- a/src/citra_qt/bootmanager.cpp
+++ b/src/citra_qt/bootmanager.cpp
@@ -119,6 +119,7 @@ GRenderWindow::GRenderWindow(QWidget* parent, EmuThread* emu_thread) :
QGLFormat fmt;
fmt.setVersion(3,3);
fmt.setProfile(QGLFormat::CoreProfile);
+ fmt.setSwapInterval(VideoCore::g_vsync_enabled);
// Requests a forward-compatible context, which is required to get a 3.2+ context on OS X
fmt.setOption(QGL::NoDeprecatedFunctions);
diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp
index 93c6a6e41..ff7af445e 100644
--- a/src/citra_qt/config.cpp
+++ b/src/citra_qt/config.cpp
@@ -48,6 +48,7 @@ void Config::ReadValues() {
Settings::values.use_hw_renderer = qt_config->value("use_hw_renderer", true).toBool();
Settings::values.use_shader_jit = qt_config->value("use_shader_jit", true).toBool();
Settings::values.use_scaled_resolution = qt_config->value("use_scaled_resolution", false).toBool();
+ Settings::values.use_vsync = qt_config->value("use_vsync", false).toBool();
Settings::values.bg_red = qt_config->value("bg_red", 1.0).toFloat();
Settings::values.bg_green = qt_config->value("bg_green", 1.0).toFloat();
@@ -139,6 +140,7 @@ void Config::SaveValues() {
qt_config->setValue("use_hw_renderer", Settings::values.use_hw_renderer);
qt_config->setValue("use_shader_jit", Settings::values.use_shader_jit);
qt_config->setValue("use_scaled_resolution", Settings::values.use_scaled_resolution);
+ qt_config->setValue("use_vsync", Settings::values.use_vsync);
// Cast to double because Qt's written float values are not human-readable
qt_config->setValue("bg_red", (double)Settings::values.bg_red);
diff --git a/src/citra_qt/configure_graphics.cpp b/src/citra_qt/configure_graphics.cpp
index 85a120686..22def58d4 100644
--- a/src/citra_qt/configure_graphics.cpp
+++ b/src/citra_qt/configure_graphics.cpp
@@ -22,11 +22,12 @@ void ConfigureGraphics::setConfiguration() {
ui->toogle_hw_renderer->setChecked(Settings::values.use_hw_renderer);
ui->toogle_shader_jit->setChecked(Settings::values.use_shader_jit);
ui->toogle_scaled_resolution->setChecked(Settings::values.use_scaled_resolution);
+ ui->toogle_vsync->setChecked(Settings::values.use_vsync);
}
void ConfigureGraphics::applyConfiguration() {
Settings::values.use_hw_renderer = ui->toogle_hw_renderer->isChecked();
Settings::values.use_shader_jit = ui->toogle_shader_jit->isChecked();
- Settings::values.use_scaled_resolution = ui->toogle_scaled_resolution->isChecked();
+ Settings::values.use_vsync = ui->toogle_vsync->isChecked();
Settings::Apply();
}
diff --git a/src/citra_qt/configure_graphics.ui b/src/citra_qt/configure_graphics.ui
index 336d49b19..e68d68c0e 100644
--- a/src/citra_qt/configure_graphics.ui
+++ b/src/citra_qt/configure_graphics.ui
@@ -43,6 +43,13 @@
</property>
</widget>
</item>
+ <item>
+ <widget class="QCheckBox" name="toogle_vsync">
+ <property name="text">
+ <string>Enable V-Sync</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
diff --git a/src/core/settings.h b/src/core/settings.h
index f95e62390..34ff22f3f 100644
--- a/src/core/settings.h
+++ b/src/core/settings.h
@@ -72,6 +72,7 @@ struct Values {
bool use_hw_renderer;
bool use_shader_jit;
bool use_scaled_resolution;
+ bool use_vsync;
float bg_red;
float bg_green;
diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp
index c9975876d..bd6e5eb6b 100644
--- a/src/video_core/video_core.cpp
+++ b/src/video_core/video_core.cpp
@@ -22,6 +22,7 @@ std::unique_ptr<RendererBase> g_renderer; ///< Renderer plugin
std::atomic<bool> g_hw_renderer_enabled;
std::atomic<bool> g_shader_jit_enabled;
std::atomic<bool> g_scaled_resolution_enabled;
+std::atomic<bool> g_vsync_enabled;
/// Initialize the video core
bool Init(EmuWindow* emu_window) {