Skip to content

Commit 7c255e8

Browse files
Tau5flightlessmango
authored andcommitted
params: add fps limit from MANGOHUD_FPS_LIMIT to front of limits list
This will allow to use MANGOHUD_FPS_LIMIT even if fps_limit is defined in Mangohud.conf. It will also allow the use of the toggle fps limit to use the other limits instead of overwriting them Fixes #1962
1 parent 9f32375 commit 7c255e8

1 file changed

Lines changed: 7 additions & 13 deletions

File tree

src/overlay_params.cpp

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,20 +1121,14 @@ parse_overlay_config(struct overlay_params *params,
11211121
);
11221122

11231123
// check if user specified an env for fps limiter instead
1124-
if (params->fps_limit.size() == 0 ||
1125-
(params->fps_limit.size() == 1 && params->fps_limit[0] == 0))
1124+
const char *fps_limit_env = getenv("MANGOHUD_FPS_LIMIT");
1125+
if (fps_limit_env)
11261126
{
1127-
const char *env = getenv("MANGOHUD_FPS_LIMIT");
1128-
if (env)
1129-
{
1130-
try {
1131-
int fps = std::stof(env);
1132-
if (params->fps_limit.size() == 0)
1133-
params->fps_limit.push_back(fps);
1134-
else
1135-
params->fps_limit[0] = fps;
1136-
} catch(...) {}
1137-
}
1127+
try {
1128+
int fps = std::stof(fps_limit_env);
1129+
auto front = params->fps_limit.begin();
1130+
params->fps_limit.insert(front, fps);
1131+
} catch(...) {}
11381132
}
11391133

11401134
#ifdef HAVE_DBUS

0 commit comments

Comments
 (0)