Hermes
0.7.0
Linux game streaming host
Toggle main menu visibility
Loading...
Searching...
No Matches
frame_limit_env.h
Go to the documentation of this file.
1
5
#pragma once
6
7
#include <string>
8
#include <string_view>
9
#include <utility>
10
#include <vector>
11
12
namespace
proc::frame_limit {
13
25
inline
std::string
mangohud_config
(std::string_view existing,
int
fps) {
26
std::string config;
27
if
(existing.empty()) {
28
config =
"read_cfg"
;
29
}
30
std::size_t start = 0;
31
while
(start <= existing.size() && !existing.empty()) {
32
const
auto
end = existing.find(
','
, start);
33
const
auto
option = existing.substr(start, end == std::string_view::npos ? std::string_view::npos : end - start);
34
if
(!option.empty() && !option.starts_with(
"fps_limit="
)) {
35
config += config.empty() ?
""
:
","
;
36
config += option;
37
}
38
if
(end == std::string_view::npos) {
39
break
;
40
}
41
start = end + 1;
42
}
43
config += config.empty() ?
""
:
","
;
44
config +=
"fps_limit="
+ std::to_string(fps);
45
return
config;
46
}
47
60
inline
std::vector<std::pair<std::string, std::string>>
environment
(
int
fps, std::string_view existing_mangohud_config) {
61
if
(fps <= 0) {
62
return
{};
63
}
64
const
auto
rate = std::to_string(fps);
65
return
{
66
{
"DXVK_FRAME_RATE"
, rate},
67
{
"VKD3D_FRAME_RATE"
, rate},
68
{
"MANGOHUD_CONFIG"
,
mangohud_config
(existing_mangohud_config, fps)},
69
};
70
}
71
72
}
// namespace proc::frame_limit
proc::frame_limit::environment
std::vector< std::pair< std::string, std::string > > environment(int fps, std::string_view existing_mangohud_config)
Definition
frame_limit_env.h:60
proc::frame_limit::mangohud_config
std::string mangohud_config(std::string_view existing, int fps)
Definition
frame_limit_env.h:25
src
frame_limit_env.h
Generated by
1.18.0