dynamically unload layer and remove excess logging

This commit is contained in:
PancakeTAS 2025-07-16 22:14:13 +02:00 committed by Pancake
parent 7a460c7faf
commit cfdf4e1d1b
5 changed files with 418 additions and 594 deletions

View file

@ -11,9 +11,6 @@
"vkGetInstanceProcAddr": "layer_vkGetInstanceProcAddr",
"vkGetDeviceProcAddr": "layer_vkGetDeviceProcAddr"
},
"enable_environment": {
"ENABLE_LSFG": "1"
},
"disable_environment": {
"DISABLE_LSFG": "1"
}

View file

@ -28,6 +28,9 @@ namespace Config {
std::shared_ptr<std::atomic_bool> valid;
};
/// Active configuration. Must be set in main.cpp.
extern Configuration activeConf;
///
/// Load the config file and create a file watcher.
///

View file

@ -33,6 +33,8 @@ namespace {
std::optional<std::unordered_map<std::string, Configuration>> gameConfs;
}
Configuration Config::activeConf{};
bool Config::loadAndWatchConfig(const std::string& file) {
if (!std::filesystem::exists(file))
return false;

File diff suppressed because it is too large Load diff

View file

@ -73,9 +73,8 @@ namespace {
}
const std::string name = getProcessName();
Config::Configuration conf{};
try {
conf = Config::getConfig(name);
Config::activeConf = Config::getConfig(name);
} catch (const std::exception& e) {
std::cerr << "lsfg-vk: The configuration for " << name << " is invalid, exiting.\n";
std::cerr << e.what() << '\n';
@ -83,6 +82,7 @@ namespace {
}
// exit silently if not enabled
auto& conf = Config::activeConf;
if (!conf.enable)
return;