From 6a86107abab417269df200c49f11ddad287136db Mon Sep 17 00:00:00 2001 From: PancakeTAS Date: Sat, 19 Jul 2025 14:41:43 +0200 Subject: [PATCH] remove broken environment variables --- include/config/config.hpp | 7 ----- include/config/default_conf.hpp | 4 +-- src/config/config.cpp | 48 --------------------------------- src/main.cpp | 9 +------ 4 files changed, 2 insertions(+), 66 deletions(-) diff --git a/include/config/config.hpp b/include/config/config.hpp index 92057b2..eef37da 100644 --- a/include/config/config.hpp +++ b/include/config/config.hpp @@ -5,9 +5,6 @@ #include #include #include -#include -#include -#include #include namespace Config { @@ -18,8 +15,6 @@ namespace Config { bool enable{false}; /// Path to Lossless.dll. std::string dll; - /// Additional environment variables to set. - std::vector> env; /// The frame generation muliplier size_t multiplier{2}; @@ -32,8 +27,6 @@ namespace Config { /// Experimental flag for overriding the synchronization method. VkPresentModeKHR e_present; - /// Experimental flag for limiting the framerate of DXVK games. - uint32_t e_fps_limit; /// Path to the configuration file. std::filesystem::path config_file; diff --git a/include/config/default_conf.hpp b/include/config/default_conf.hpp index 2ae5456..d6facc6 100644 --- a/include/config/default_conf.hpp +++ b/include/config/default_conf.hpp @@ -5,11 +5,10 @@ const std::string DEFAULT_CONFIG = R"(version = 1 [global] # override the location of Lossless Scaling -# dll = "/games/Lossless Scaling" +# dll = "/games/Lossless Scaling/Lossless.dll" # [[game]] # example entry # exe = "Game.exe" -# env = "SteamDeck=0" # # multiplier = 3 # flow_scale = 0.7 @@ -17,7 +16,6 @@ const std::string DEFAULT_CONFIG = R"(version = 1 # hdr_mode = false # # experimental_present_mode = "fifo" -# experimental_fps_limit = 48 [[game]] # default vkcube entry exe = "vkcube" diff --git a/src/config/config.cpp b/src/config/config.cpp index 659b71a..ea98a81 100644 --- a/src/config/config.cpp +++ b/src/config/config.cpp @@ -16,10 +16,8 @@ #include #include #include -#include #include #include -#include #include using namespace Config; @@ -42,46 +40,6 @@ namespace { return VkPresentModeKHR::VK_PRESENT_MODE_IMMEDIATE_KHR; return VkPresentModeKHR::VK_PRESENT_MODE_FIFO_KHR; } - - /// Parse environment variables from a string. - std::vector> parse_env(const std::string& envs) { - std::vector> vars{}; - const std::string env_str = envs + ' '; - - std::string current{}; - bool escape{false}; - for (const char c : env_str) { - // toggle escape mode - if (c == '\'') { - escape = !escape; - continue; - } - - // parse variable - if (c == ' ' && !escape) { - if (current.empty()) - continue; - - auto eq_pos = current.find('='); - if (eq_pos == std::string::npos) - throw std::runtime_error("Invalid environment variable: " + current); - - std::string key = current.substr(0, eq_pos); - std::string value = current.substr(eq_pos + 1); - if (key.empty() || value.empty()) - throw std::runtime_error("Invalid environment variable: " + current); - - vars.emplace_back(std::move(key), std::move(value)); - - current.clear(); - continue; - } - - current += c; - } - - return vars; - } } void Config::updateConfig(const std::string& file) { @@ -139,13 +97,11 @@ void Config::updateConfig(const std::string& file) { Configuration game{ .enable = true, .dll = global.dll, - .env = parse_env(toml::find_or(gameTable, "env", std::string())), .multiplier = toml::find_or(gameTable, "multiplier", 2U), .flowScale = toml::find_or(gameTable, "flow_scale", 1.0F), .performance = toml::find_or(gameTable, "performance_mode", false), .hdr = toml::find_or(gameTable, "hdr_mode", false), .e_present = into_present(toml::find_or(gameTable, "experimental_present_mode", "")), - .e_fps_limit = toml::find_or(gameTable, "experimental_fps_limit", 0U), .config_file = file, .timestamp = global.timestamp }; @@ -185,10 +141,6 @@ Configuration Config::getConfig(const std::pair& name) if (hdr) conf.hdr = std::string(hdr) == "1"; const char* e_present = std::getenv("LSFG_EXPERIMENTAL_PRESENT_MODE"); if (e_present) conf.e_present = into_present(std::string(e_present)); - const char* e_fps_limit = std::getenv("LSFG_EXPERIMENTAL_FPS_LIMIT"); - if (e_fps_limit) conf.e_fps_limit = static_cast(std::stoul(e_fps_limit)); - const char* envs = std::getenv("LSFG_ENV"); - if (envs) conf.env = parse_env(std::string(envs)); return conf; } diff --git a/src/main.cpp b/src/main.cpp index 0e1543c..ec7916e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -46,21 +46,14 @@ namespace { // print config std::cerr << "lsfg-vk: Loaded configuration for " << name.second << ":\n"; if (!conf.dll.empty()) std::cerr << " Using DLL from: " << conf.dll << '\n'; - for (const auto& [key, value] : conf.env) - std::cerr << " Environment: " << key << "=" << value << '\n'; std::cerr << " Multiplier: " << conf.multiplier << '\n'; std::cerr << " Flow Scale: " << conf.flowScale << '\n'; std::cerr << " Performance Mode: " << (conf.performance ? "Enabled" : "Disabled") << '\n'; std::cerr << " HDR Mode: " << (conf.hdr ? "Enabled" : "Disabled") << '\n'; if (conf.e_present != 2) std::cerr << " ! Present Mode: " << conf.e_present << '\n'; - if (conf.e_fps_limit > 0) std::cerr << " ! FPS Limit: " << conf.e_fps_limit << '\n'; - // update environment variables + // remove mesa var in favor of config unsetenv("MESA_VK_WSI_PRESENT_MODE"); // NOLINT - for (const auto& [key, value] : conf.env) - setenv(key.c_str(), value.c_str(), 1); // NOLINT - if (conf.e_fps_limit > 0) - setenv("DXVK_FRAME_RATE", std::to_string(conf.e_fps_limit).c_str(), 1); // NOLINT // write latest file try {