From f33a970304f0fb9e2ee852b3973bf07d8d45f441 Mon Sep 17 00:00:00 2001
From: Vicki Pfau <vi@endrift.com>
Date: Sun, 26 May 2019 21:37:18 -0700
Subject: [PATCH] Qt: Fix FPS target maxing out at 59.727 (fixes #1421)

---
 CHANGES                          | 1 +
 src/platform/qt/SettingsView.cpp | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/CHANGES b/CHANGES
index 965aa411c..38fb49076 100644
--- a/CHANGES
+++ b/CHANGES
@@ -21,6 +21,7 @@ Other fixes:
  - Qt: Fix some Qt display driver race conditions
  - Core: Improved lockstep driver reliability (Le Hoang Quyen)
  - Switch: Fix threading-related crash on second launch
+ - Qt: Fix FPS target maxing out at 59.727 (fixes mgba.io/i/1421)
 Misc:
  - GBA Savedata: EEPROM performance fixes
  - GBA Savedata: Automatically map 1Mbit Flash files as 1Mbit Flash
diff --git a/src/platform/qt/SettingsView.cpp b/src/platform/qt/SettingsView.cpp
index d8bb7e3e7..2739f589a 100644
--- a/src/platform/qt/SettingsView.cpp
+++ b/src/platform/qt/SettingsView.cpp
@@ -413,7 +413,7 @@ void SettingsView::updateConfig() {
 	}
 
 	double nativeFps = double(GBA_ARM7TDMI_FREQUENCY) / double(VIDEO_TOTAL_LENGTH);
-	if (nativeFps - m_ui.fpsTarget->value() < 0.0001) {
+	if (fabs(nativeFps - m_ui.fpsTarget->value()) < 0.0001) {
 		m_controller->setOption("fpsTarget", QVariant(nativeFps));
 	} else {
 		saveSetting("fpsTarget", m_ui.fpsTarget);