-
Notifications
You must be signed in to change notification settings - Fork 72
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
Major GameScope Refactor #744
Conversation
Order now matches the UI more closely
Now the argument parsing is separated into functions for each GameScope 'category' on the UI, it was getting to be a bit of a pain to manage all of these arguments.
Adds ITM (Inverse Tone Mapping) options to the HDR section. These were added semi-recently to GameScope. Also fixes a bug where one of the already-existing arguments was not properly escaped.
Adds '--expose-wayland' option as checkbox. Adds the three new GameScope HDR options to UI. Minor code refactor.
We now have a general function to do the grepping for GameScope args. This is still WIP but has massively reduced the repeated logic for some checkboxes. This will be experimented with and expanded for other checkboxes, but this should significantly simplify the GameScope argument logic.
Also has some other refactoring.
Also fixes a bug where max scale factor was using the wrong flag check.
Also improve getGameScopeArg to use Bash parameter expansion instead of sed.
no idea what this was or when it appeared...
Created setGameScopeVars to help trim down GameScopeGui.
25c545d
to
5948c4a
Compare
a93540a
to
a85fdcb
Compare
This wasn't working before, but seems to be working now? I have no idea.
Side note: I am hoping to bring down the amount of code in STL overtime, it's getting so big that it's kind of a problem. It's not going to happen all at once and this is my current compromise with breaking down STL into separate files; instead I'll try to make the code more managable, remove duplication where I find it and overall give more consideration to this when creating new features. |
Passing a cursor image doesn't seem to work in this PR, will investigate before merging (stats path works, not sure about VR icon). The cursor path appears in the GameScope arguments but it isn't read correctly when going back into the GameScope GUI. Games also don't seem to load when selecting a custom cursor. This is currently present on master from what I can see. I recall issues surrounding this before but I thought they were fixed by adding the single quotes around the path. Odd. I will investigate and fix this in this PR. Cursor works fine with args like But fails with args like This is because it incorrectly picks up any following single-dash args (like |
…ctly If there was a single-dash flag after a double-dash flag, for example '--cursor /path/to/cursor.png -U --sharpness-value 5', then the cursor path would contain the following single-dash flag(s) up until the next double dash flag, meaning the path would be read as invalid. This fixes the issue. It was not introduced in this PR but has been fixed!
Custom cursor paths without spaces don't crash games anymore and are correctly parsed, however GameScope does not set the custom cursor for some reason, even though the launch command looks valid... The paths with spaces not working is probably an issue to do with how we use We'll need to find another way of splitting the arguments, as a space delimiter won't work when we're dealing with paths. |
Update: the custom cursor seems to not be set for Steam either, but it works outside of Steam. How strange! I tested this by passing this as a launch argument to a game (Cookie Clicker), and launching it with Proton 7.0-6: However, from the command line I tried I also discovered an issue related to cursor paths as well:
That is probably going to be a nasty bug to try and fix as I suspect it's related to how the GameScope options are written out to the file again, and I would guess it just generically parses GameScope options and values without considering that they may be wrapped in quotes. Very annoying. We can't use backslashes either, as they won't show up in the first place on the Game Menu textbox, so they have no effect. Double quotes also have the same problem. So the current priority is fixing custom cursor paths with spaces. Once that is fixed, I will look into the quotes issue, but I don't have high hopes of fixing it yet. |
Previously we used 'mapfile', which we can't use now because some arguments may have spaces in their path. We use new logic now using readarray and some sed magic to break up the gamescope arguments and build each argument and its value separately.
This reverts commit eb897a4.
I tried a solution with eb897a4, but this meant that regular gamescope argument values (e.g. I don't know of a good way to solve this. I guess we'll just note that you shouldn't use a path with spaces? |
We use some fancy sed and grep commands to do this. ChatGPT actually generated the sed command to surround unquoted paths with quotes.
Phew, jeez. After a lot of fiddling I managed to resolve the two remaining issues:
I actually ended up using ChatGPT to generate the I am a little unhappy about the file paths not being able to use single quotes, but it's a trade-off and I don't feel like spending more time on this. I think it's better to allow spaces but not single quotes in the end, and we probably would've had to have disallowed single quotes anyway if we didn't allow for paths with spaces. The English langfile has been updated to note that paths should not contain special characters, and it's an edge case anyway imo. Great progress was made today at the cost of a lot of sanity :-) I will continue to test over the weekend to ensure various cases work. The code I wrote to allow for this is not the cleanest, I may revisit and try to clean it up before I consider merging. There are some repeated checks that could be cleaned up at the very least, and I am not the most pleased with having to change the What an adventure this has been :-) |
I want to try and update the logic for making GameScope calls to make it less redundant, it seems like we make a lot of calls out to |
After some investigation, it seems like this is called twice because of how we call I will do some final testing before merging. |
I noticed Terraria does not exit cleanly with GameScope enabled, but that happens here and on master so it likely isn't a regression caused by this PR. I will still investigate though. EDIT: Tested Hammerwatch (another native game) and To the Moon (a native game that relies on the SLR to work) and both exit cleanly without STL, with STL master, and with this PR. So I think Terraria was just an edge case :-) |
Just pushed a commit that updates all the langfiles. It also notes in the tooltip concisely enough that GameScope may not use the custom cursor for all games, which should eliminate the need to document this on the wiki. This seems ready to merge :-) I would've liked a better way to refactor the |
This PR does three things:
grep
checks for arguments, as well as thegetGameScopePathArg
function, with a single function that manages almost all of the GameScope argument checking/value fetching.--expose-wayland
option as checkbox under Advanced Settings--rt
(realtime scheduling) option as checkbox under Advanced Settingsitm
(Inverse Tone Mapping) options under HDR settings--vr-overlay-explicit-name
was being mapped incorrectly-m
(max scale factor) was being mapped incorrectly--hdr-wide-gammut-for-sdr
was not escaped and not being mapped correctlyAside from the four or so new options, this PR does not have a big user-facing impact. There should be virtually no user-facing impact from this, it started out as cleanup and I decided to add the new GameScope options in this PR.
TODO:
" "
delimiter ingameScopeArgs
-- We need a different way of parsing the GameScope arguments)