Add SelectedProfile to [renodx] section in reshade.ini#530
Add SelectedProfile to [renodx] section in reshade.ini#530martham9 wants to merge 3 commits intoclshortfuse:mainfrom
Conversation
|
afaik it's by design, preset 1 is your definitive preset, and the others are just there for you to toggle between them to compare. |
It's a simple and easy to add feature that is useful for people who keep separate profiles for different monitor modes. Shortfuse was notified about the PR in the discord server. |
There was a problem hiding this comment.
Pull request overview
Adds persistence for the currently selected preset/profile by storing/loading a SelectedProfile integer in the ReShade config section used by RenoDX settings, so the chosen preset is restored on the next launch.
Changes:
- Read
SelectedProfilefromreshade.iniduring overlay registration and apply the corresponding preset on startup. - Write
SelectedProfiletoreshade.iniwhenever the preset slider selection changes.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/utils/settings.hpp
Outdated
| // Load last selected profile from reshade.ini (section [renodx], key SelectedProfile). | ||
| // If the key is present, apply that preset on startup. | ||
| { | ||
| int stored_profile = preset_index; | ||
| if (reshade::get_config_value(nullptr, global_name.c_str(), "SelectedProfile", stored_profile)) { | ||
| if (stored_profile < 0) { | ||
| stored_profile = 0; | ||
| } else if (stored_profile >= static_cast<int>(preset_strings.size())) { | ||
| stored_profile = static_cast<int>(preset_strings.size() - 1); | ||
| } | ||
| preset_index = stored_profile; | ||
| if (preset_index != 0) { | ||
| LoadSettings(GetCurrentPresetName()); | ||
| } | ||
| } |
There was a problem hiding this comment.
When SelectedProfile is stored as 0 (Off), this block sets preset_index = 0 but does not undo the earlier LoadSettings(global_name + "-preset1") that runs during Use() on DLL attach. As a result, “Off” won’t actually be applied on startup (and on_preset_off_callbacks won’t run), so the prior preset values can remain active.
Suggested fix: move SelectedProfile loading (and the initial preset selection/application) into Use() before the initial LoadSettings(...), or, if keeping it here, call on_preset_off_callbacks and/or explicitly reset settings when the stored profile is 0 (and avoid preloading preset1 when a different profile is selected).
src/utils/settings.hpp
Outdated
| // Load last selected profile from reshade.ini (section [renodx], key SelectedProfile). | ||
| // If the key is present, apply that preset on startup. | ||
| { | ||
| int stored_profile = preset_index; | ||
| if (reshade::get_config_value(nullptr, global_name.c_str(), "SelectedProfile", stored_profile)) { | ||
| if (stored_profile < 0) { | ||
| stored_profile = 0; | ||
| } else if (stored_profile >= static_cast<int>(preset_strings.size())) { | ||
| stored_profile = static_cast<int>(preset_strings.size() - 1); | ||
| } | ||
| preset_index = stored_profile; | ||
| if (preset_index != 0) { | ||
| LoadSettings(GetCurrentPresetName()); | ||
| } | ||
| } |
There was a problem hiding this comment.
This loads SelectedProfile unconditionally. Several add-ons set use_presets = false (and some keep global_name == "renodx"), so a pre-existing SelectedProfile value in reshade.ini could unexpectedly change which preset section gets loaded even though presets are disabled in the UI.
To preserve existing behavior when presets are disabled, gate the SelectedProfile read/apply logic behind if (use_presets) (or otherwise ignore the key when presets are not in use).
There was a problem hiding this comment.
Thanks for the informative comments,
Regarding loading profile 0 (“Off”):
Previously I skipped LoadSettings when preset_index == 0 because index 0 represents “Off”, there’s no renodx-preset0 section, and LoadSettings can’t be used. But it's correct, it can be handled through on_preset_off_callbacks, so I’ve added that.
Writing SelectedProfile in OnRegisterOverlay() makes sense, but loading it there was a dumb idea. The stored profile should be applied once when the addon starts. I’ve moved the loading logic from OnRegisterOverlay() to Use(), and I also added logging when the stored SelectedProfile is applied.
Regarding the second comment about use_presets, I wasn’t aware of that, but it's correct, some addons don’t use presets. I’ve wrapped the profile‑loading logic inside if (use_presets).
I’ve pushed the updated changes. Let me know if anything else needs adjusting.
7dd3a5f to
f4f46f9
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Thanks! I’ve applied the suggested change, so the call to on_preset_changed_callbacks after loading the stored preset has been added. The stored preset loading during startup now matches the normal preset‑change behavior. |
|
Thanks, I have to make some change to some games because they might crash if the game is closed with Preset Off. |
This PR adds support for storing and loading
SelectedProfilein the[renodx]section ofreshade.ini.Tested locally and works as expected.