Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/doitsujin/dxvk.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpchome <pchome@users.noreply.github.com>2023-08-01 23:09:29 +0300
committerGitHub <noreply@github.com>2023-08-01 23:09:29 +0300
commite598dcd77ecc854ae2681b0e7860651e6313d768 (patch)
tree3348a982156e186d649b916a9b142c963e5e7f4f
parent09857dcaa997c7f51cd56c8fdb330774a1be779d (diff)
[util] Add DXVK_CONFIG to define additional options
-rw-r--r--src/util/config/config.cpp32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/util/config/config.cpp b/src/util/config/config.cpp
index f97a2608..81b70ae2 100644
--- a/src/util/config/config.cpp
+++ b/src/util/config/config.cpp
@@ -1090,6 +1090,7 @@ namespace dxvk {
// Load either $DXVK_CONFIG_FILE or $PWD/dxvk.conf
std::string filePath = env::getEnvVar("DXVK_CONFIG_FILE");
+ std::string confLine = env::getEnvVar("DXVK_CONFIG");
if (filePath == "")
filePath = "dxvk.conf";
@@ -1097,23 +1098,34 @@ namespace dxvk {
// Open the file if it exists
std::ifstream stream(str::topath(filePath.c_str()).c_str());
- if (!stream)
+ if (!stream && confLine.empty())
return config;
-
- // Inform the user that we loaded a file, might
- // help when debugging configuration issues
- Logger::info(str::format("Found config file: ", filePath));
// Initialize parser context
ConfigContext ctx;
ctx.active = true;
- // Parse the file line by line
- std::string line;
+ if (stream) {
+ // Inform the user that we loaded a file, might
+ // help when debugging configuration issues
+ Logger::info(str::format("Found config file: ", filePath));
+
+ // Parse the file line by line
+ std::string line;
+
+ while (std::getline(stream, line))
+ parseUserConfigLine(config, ctx, line);
+ }
+
+ if (!confLine.empty()) {
+ // Inform the user that we parsing config from environment, might
+ // help when debugging configuration issues
+ Logger::info(str::format("Found config env: ", confLine));
+
+ for(auto l : str::split(confLine, ";"))
+ parseUserConfigLine(config, ctx, std::string(l.data(), l.size()));
+ }
- while (std::getline(stream, line))
- parseUserConfigLine(config, ctx, line);
-
return config;
}