Skip to content

Add SelectedProfile to [renodx] section in reshade.ini#530

Open
martham9 wants to merge 3 commits intoclshortfuse:mainfrom
martham9:feature/add-selected-profile-to-ini
Open

Add SelectedProfile to [renodx] section in reshade.ini#530
martham9 wants to merge 3 commits intoclshortfuse:mainfrom
martham9:feature/add-selected-profile-to-ini

Conversation

@martham9
Copy link
Copy Markdown

This PR adds support for storing and loading SelectedProfile in the [renodx] section of reshade.ini.

  • Updated settings.hpp to read/write SelectedProfile
  • Ensures the selected profile persists between launches
  • No changes to existing behavior for other settings

Tested locally and works as expected.

@Heliumrich
Copy link
Copy Markdown
Contributor

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.

@martham9
Copy link
Copy Markdown
Author

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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 SelectedProfile from reshade.ini during overlay registration and apply the corresponding preset on startup.
  • Write SelectedProfile to reshade.ini whenever the preset slider selection changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +367 to +381
// 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());
}
}
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
Comment on lines +367 to +381
// 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());
}
}
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@martham9 martham9 force-pushed the feature/add-selected-profile-to-ini branch from 7dd3a5f to f4f46f9 Compare April 5, 2026 22:12
@clshortfuse clshortfuse requested a review from Copilot April 6, 2026 13:09
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@martham9
Copy link
Copy Markdown
Author

martham9 commented Apr 6, 2026

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.
Let me know if anything else should be aligned.

@clshortfuse
Copy link
Copy Markdown
Owner

Thanks, I have to make some change to some games because they might crash if the game is closed with Preset Off.

@clshortfuse clshortfuse self-assigned this Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants