From 668b28f63201d3a6225f4f0bfc04cf487d9f1e77 Mon Sep 17 00:00:00 2001 From: Benau Date: Wed, 22 Mar 2017 07:43:00 +0800 Subject: [PATCH] Allow to config whether to limit game framerate with recordings --- src/config/user_config.hpp | 5 +++++ src/graphics/irr_driver.cpp | 2 +- src/main_loop.cpp | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/config/user_config.hpp b/src/config/user_config.hpp index d56faab76..28798d8c4 100644 --- a/src/config/user_config.hpp +++ b/src/config/user_config.hpp @@ -563,6 +563,11 @@ namespace UserConfigParams &m_video_group, "Record video using uncompressed bitmap, notice: this " "will require a lot of space and fast disk access.")); + PARAM_PREFIX BoolUserConfigParam m_limit_game_fps + PARAM_DEFAULT(BoolUserConfigParam(true, "limit_game_fps", + &m_video_group, "Limit game framerate not beyond the fps of recording " + "video.")); + PARAM_PREFIX IntUserConfigParam m_record_compression PARAM_DEFAULT(IntUserConfigParam(90, "record_compression", &m_video_group, "Specify the compression level of recording video")); diff --git a/src/graphics/irr_driver.cpp b/src/graphics/irr_driver.cpp index 40dcddfc4..18ca543b4 100644 --- a/src/graphics/irr_driver.cpp +++ b/src/graphics/irr_driver.cpp @@ -1908,7 +1908,7 @@ void IrrDriver::setRecording(bool val) if (m_recording == val) return; m_recording = val; - if (val == true) + if (m_recording == true) { std::string track_name = World::getWorld() != NULL ? race_manager->getTrackName() : "menu"; diff --git a/src/main_loop.cpp b/src/main_loop.cpp index 80b1aec28..70fcef956 100644 --- a/src/main_loop.cpp +++ b/src/main_loop.cpp @@ -117,7 +117,9 @@ float MainLoop::getLimitedDt() // Throttle fps if more than maximum, which can reduce // the noise the fan on a graphics card makes. // When in menus, reduce FPS much, it's not necessary to push to the maximum for plain menus - const int max_fps = (StateManager::get()->throttleFPS() ? 30 : UserConfigParams::m_max_fps); + const int max_fps = (irr_driver->isRecording() && + UserConfigParams::m_limit_game_fps ? UserConfigParams::m_record_fps : + StateManager::get()->throttleFPS() ? 30 : UserConfigParams::m_max_fps); if (dt > 0) { const int current_fps = (int)(1000.0f / dt);