Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[util] Add DXVK_CONFIG to define additional options #3581

Merged
merged 2 commits into from
Aug 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions src/util/config/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1090,30 +1090,42 @@ 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";

// 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;
}

Expand Down