From bdc17dfd365d3b539a27c028c6787e235419b213 Mon Sep 17 00:00:00 2001 From: Yukino Song Date: Wed, 22 Jan 2025 17:31:58 +0800 Subject: [PATCH] Remove display persistence file on bootup if it's set to disabled --- src/display_device.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/display_device.cpp b/src/display_device.cpp index 21c52647..f517fe3e 100644 --- a/src/display_device.cpp +++ b/src/display_device.cpp @@ -721,7 +721,13 @@ namespace display_device { init(const std::filesystem::path &persistence_filepath, const config::video_t &video_config) { std::lock_guard lock { DD_DATA.mutex }; // We can support re-init without any issues, however we should make sure to clean up first! - revert_configuration_unlocked(revert_option_e::try_once); + if (video_config.dd.configuration_option == config::video_t::dd_t::config_option_e::disabled) { + if (!persistence_filepath.empty() && std::filesystem::exists(persistence_filepath)) { + std::filesystem::remove(persistence_filepath); + } + } else { + revert_configuration_unlocked(revert_option_e::try_once); + } DD_DATA.config_revert_delay = video_config.dd.config_revert_delay; DD_DATA.sm_instance = nullptr;