-
Notifications
You must be signed in to change notification settings - Fork 30
Allow to edit the OptiScaler.ini config using environment variables #175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Allow to edit the OptiScaler.ini config using environment variables #175
Conversation
|
Here's a build based on the v0.13.0 tag that contains the feature if you wish to test quickly: https://github.com/Wurielle/Decky-Framegen/releases/tag/v0.13.0-next.1 |
|
This is great! I'd like to propose revising the keys to be shorter given we are on devices with touchscreen keyboards. So no need to prepend with OptiScaler, and do we need to prepend section name too? I think we could get away with just the pure keys as they exist in the ini |
| updated_key = False | ||
|
|
||
| # Regex to match [Section] and Key=Value | ||
| section_pattern = re.compile(rf'^\s*\[{re.escape(section_target)}\]\s*') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to be concerned about section, only relevant key. Unless there's matching key names under diff sections which I doubt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are indeed duplicate keys between sections in the OptiScaler.ini config file which is why I decided to search by section to stay compliant. Enabled and LibraryPath are in multiple sections for example. There are also some properties that are too ambiguous and could potentially be picked up by other processes like LogLevel in the Log section.
I agree however that properties like Dx11Upscaler are very specific and shouldn't collide with any other process. They are also hard enough to type that it would be worth it to not have to type more than what's necessary. There's also a hyphenated section called "V-Sync" that I noticed today, I should investigate how to support that one properly.
So just to summerize:
- Properties that appear multiple times should be prefixed with their section name to target them properly
- Some properties do not need to be prefixed with either OptiScaler or their section name
- Everything should work without the OptiScaler prefix
I'll try to use configparser to get a list of all properties in OptiScaler.ini and match them with available env variables and skip properties that appear multiple times as they will need to be prefixed with their section name to be targeted properly. I'll still support env variables prefixed with secntion names for all properties anyway and for those who desire to avoid collision with other processes entirely I'll keep the support for the OptiScaler prefix if it doesn't slow down the script too much. If you want me to not keep it at all I'll just remove it, it's just to make sure all edge cases are covered. 🙂
I agree the variable names were too long for my taste as well, I have an idea to make them as close as possible to the length of keys defined in the OptiScaler.ini config file but there are limitation that I'll detail in the comment above 🙂 |
|
Now the script supports optional prefixes but be aware that case sensitivity is important so that PATH and Path don't match. The user will have multiple ways to provide env variables:
I would recommend to encourage the user to at least provide I have a little bit of difficulty to support the Thank you again for letting me look into this feature 🙂 |
|
Added support for section names containing I'm gonna do more extensive testing on my steam deck tonight to verify any side effect. ✌️ |
Closes #174
Here's my proposed implementation to allow the edition of the OptiScaler.ini config file using environment variables as described in #174
I propose that environment variables follow the naming convention of sections, keys and values in the OptiScaler.ini file provided by the OptiScaler team so that an environment variable is constructed like the following:
OptiScaler_Section_Key=ValueFor example, in order to set the following in the OptiScaler.ini config file:
You would provide the following launch options:
OptiScaler_Upscalers_Dx11Upscaler=fsr31_12 OptiScaler_Upscalers_Dx12Upscaler=fsr31 ~/fgmod/fgmod %command%This has been tested on the v0.13.0 tag as there are some issues with OptiScaler in more recent commits, see #162