game_launcher
1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
Loading...
Searching...
No Matches
env_var_mapping.cpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: MIT
2
// ==============================================================================
3
// env_var_mapping.cpp
4
// ==============================================================================
5
// Centralized environment variable mapping implementation
6
// ==============================================================================
7
8
#include "
env_var_mapping.h
"
9
10
#include <algorithm>
11
12
// ==============================================================================
13
// EnvVarMappingRegistry Implementation
14
// ==============================================================================
15
16
const
std::vector<EnvVarMapping>&
EnvVarMappingRegistry::getBaseMappings
()
17
{
18
// Note: This returns mappings with null checkbox pointers
19
// The dialog must populate these after creating widgets
20
// For now, we just provide the key list - the dialog uses its own mappings
21
// Function-local static so initialization is deferred to first use; a
22
// file-scope static with a non-trivial constructor is bugprone-throwing-
23
// static-initialization (an init-time exception isn't catchable).
24
static
const
std::vector<EnvVarMapping> emptyMappings;
25
return
emptyMappings;
26
}
27
28
const
std::vector<QString>&
EnvVarMappingRegistry::getHandledEnvVarKeys
()
29
{
30
// Function-local static (Meyer's singleton) defers initialization to
31
// first call. A file-scope `static const std::vector<QString>` would
32
// construct at program start where any allocation/QString-init failure
33
// is uncatchable (bugprone-throwing-static-initialization, CERT
34
// ERR58-CPP). Initialization is thread-safe per [stmt.dcl]/4.
35
static
const
std::vector<QString> keys = {
36
// Performance/Synchronization
37
"PROTON_USE_NTSYNC"
,
"WINEFSYNC"
,
"WINEESYNC"
,
38
39
// Shader compilation
40
"__GL_SHADER_DISK_CACHE"
,
"__GL_SHADER_DISK_CACHE_SKIP_CLEANUP"
,
"DXVK_ASYNC"
,
41
42
// Performance wrappers (env var form)
43
"MANGOHUD"
,
"ENABLE_VKBASALT"
,
44
45
// Debug/monitoring
46
"PROTON_LOG"
,
"DXVK_HUD"
,
47
48
// NVIDIA options
49
"PROTON_FORCE_NVAPI"
,
"DXVK_ENABLE_NVAPI"
,
"PROTON_DLSS_UPGRADE"
,
"PROTON_DLSS_INDICATOR"
,
50
"PROTON_NVIDIA_LIBS"
,
"PROTON_NVIDIA_LIBS_NO_32BIT"
,
51
52
// AMD options
53
"PROTON_FSR4_UPGRADE"
,
"PROTON_FSR4_RDNA3_UPGRADE"
,
"WINE_FULLSCREEN_FSR"
,
54
"ENABLE_LAYER_MESA_ANTI_LAG"
,
55
56
// Intel options
57
"PROTON_XESS_UPGRADE"
,
58
59
// Display options
60
"PROTON_ENABLE_HDR"
,
"DXVK_HDR"
,
"PROTON_ENABLE_WAYLAND"
,
61
62
// Proton compatibility options (set by game_process.cpp during launch)
63
"PROTON_FORCE_LARGE_ADDRESS_AWARE"
,
"PROTON_USE_WINED3D"
,
"PROTON_NO_ESYNC"
,
64
"PROTON_NO_FSYNC"
,
"PROTON_NO_NTSYNC"
,
65
// Additional Proton knobs surfaced for per-game tuning. Sources: Valve
66
// Proton bleeding-edge `proton` script / GE-Proton README.
67
"PROTON_USE_WOW64"
,
// Enable new WoW64 mode (32-bit compat path)
68
"PROTON_HIDE_NVIDIA_GPU"
,
// Fixes engines/audio that sniff vendor ID
69
"PROTON_NO_WRITE_WATCH"
,
// GE-Proton: suppress write-watch for some titles
70
"PROTON_USE_XALIA"
,
// Controller-as-kbd/mouse shim; set =0 for flight sims
71
"PROTON_DXVK_LLASYNC"
,
// proton-cachyos async shader compile (modern DXVK_ASYNC)
72
73
// Internal markers (not actual env vars, but used as flags)
74
"GAME_PERFORMANCE"
,
"USE_GAME_PERFORMANCE"
};
75
return
keys;
76
}
77
78
bool
EnvVarMappingRegistry::isHandledEnvVar
(
const
QString& key)
79
{
80
const
auto
& handled =
getHandledEnvVarKeys
();
81
return
std::find(handled.begin(), handled.end(), key) != handled.end();
82
}
83
84
bool
EnvVarMappingRegistry::isHandledEnvVar
(
const
std::string& key)
85
{
86
return
isHandledEnvVar
(QString::fromStdString(key));
87
}
EnvVarMappingRegistry::isHandledEnvVar
static bool isHandledEnvVar(const QString &key)
Definition
env_var_mapping.cpp:78
EnvVarMappingRegistry::getBaseMappings
static const std::vector< EnvVarMapping > & getBaseMappings()
Definition
env_var_mapping.cpp:16
EnvVarMappingRegistry::getHandledEnvVarKeys
static const std::vector< QString > & getHandledEnvVarKeys()
Definition
env_var_mapping.cpp:28
env_var_mapping.h
ui
qt
env_var_mapping.cpp
Generated by
1.16.1