Skip to content
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 Additions #722

Merged
merged 33 commits into from Jan 18, 2023
Merged

Major GameScope Additions #722

merged 33 commits into from Jan 18, 2023

Conversation

sonic2kk
Copy link
Owner

@sonic2kk sonic2kk commented Jan 14, 2023

Adds a lot of new options to the GameScope menu, so many that it's now split up by headings and has a scrollable dialog.

Mainly adds the new HDR and VR options available in newer GameScope builds, as well as a few potentially useful debug options. A couple of new general options have also been added, such as a feature I now find very useful, --force-grab-cursor, which locks the cursor to the GameScope window.

A couple of options for "embedded mode" have also been added. This is when GameScope is ran from a TTY instead of nested as a compositor inside of the Desktop Environment's compositor e.g., KWin. This is how Game Mode on Steam Deck works, but it is also useful to do this for performance reasons on the desktop if you're running games at very high resolutions and framerates. Therefore adding these options could be beneficial for users.

Ever since initial support was added and even in the ~10 months ago that I added a bunch more options to GameScope, it has gotten really big and has a lot of neat options. A refactor of the menu was going to have to happen at some point in the future anyway.

image

There are a couple of pending changes I have to make before this is ready for merging:

  • Add checkboxes to enable/disable some features like custom cursor and custom SteamVR icon
  • Fix paths for cursor image/SteamVR icon not working when there's a path with spaces (if possible)
  • Test "backwards compatibility" with previous GameScope menu more thoroughly (only did a brief test and it seemed to work fine)
  • Get an updated wiki page ready, as these are significant changes.
  • Update langfiles

Should hopefully be merged soon.

GameScope Dialog UI is very much subject to reorganization, but this is an initial draft to add HDR features
Currently breaks the internal resolution dropdown value when HDR is enabled for some reason
Use '-qw' flags for grep so that '--hdr-enabled' doesn't match '-e' for Steam integration, etc.
Currently if HDR on its own is selected, the entire GameScope menu breaks. Seems fine if something else is selected with HDR.
Still doesn't seem to like paths with spaces.
Still needs organized, but the headings are taking shape.
Headings and general reorganization
More VR options to come.
Also slightly reorganizses how the GameScope string is built.
Locks the mouse cursor to the GameScope window, pretty useful
There are some more VR flags we could pass but they may not be very useful, so leaving them out for now.
The touch mode option doesn't properly re-fetch the value when going back into the GameScope menu yet, because of how we pass it.
Plus some other minor fixes
@sonic2kk sonic2kk marked this pull request as ready for review January 14, 2023 19:46
Adds checkboxes to enable/disable custom cursor image, SteamVR icon and custom statistics path
@sonic2kk
Copy link
Owner Author

Checkboxes added for custom cursor image, SteamVR icon and custom stats path. Untested for now.

@sonic2kk
Copy link
Owner Author

Backwards compatibility works fine, tried enabling and disabling various options and switching between this branch and master.

@sonic2kk
Copy link
Owner Author

sonic2kk commented Jan 14, 2023

Langfiles updated.

The only real pending work now is for the filepaths, which seem to break whenever there is a path with a space. Will investigate.

Insertion of GameScope launch options also needs some refinement for the newer options like --default-touch-mode, seems they are sometimes inserted incorrectly

@sonic2kk
Copy link
Owner Author

sonic2kk commented Jan 15, 2023

Fixed the issue with some of the new GameScope arguments being incorrectly appended.

From further investigation, it seems like the file pickers aren't working when you go out and back into the GameScope menu, regardless of the paths having spaces. More work is needed on this at least (I could live with the path spacing problem if push came to shove).

Also a tooltip is missing for the custom cursor checkbox, GUI_GSENABLECUSTCUR has no corresponding DESC_GSENABLECUSTCUR (though one is probably not needed, could probably just re-use this text as a tooltip). Done.

Finally, some minor code cleanup is needed. There is some commented code that can be removed now. Done.

Once I can address these points, the code should be ready for merge.

@sonic2kk
Copy link
Owner Author

Hardcoding the path to a file makes the file picker widgets work as expected, f.e.:

--field="$GUI_GSCURSOR!$DESC_GSCURSOR ('GSCURSOR')":FL "/home/gaben/Documents/hl3_cursor.png" \

Will correctly point to that file.

So the issue is likely with however parameters like GSCURSOR are being passed to the widget. For some reason it isn't able to correctly read it, even in a file path without spaces.

I did a test and outputted what GSCURSOR is being set to on menu load, and it looks valid (unless the path has spaces):

# Custom cursor image (--cursor) -- File picker
if [ -z "$GSCURSOR" ]; then
	if ! grep -qw "\-\-cursor" <<< "$GAMESCOPE_ARGS"; then
		GSCURSOR=""
		GSENABLECUSTCUR="0"
	else
		GSCURSOR="$(tr ' ' '\n' <<< "$GAMESCOPE_ARGS" | grep -A1 "\-\-cursor" | tail -n1 | sed -r -e "s/\s/\\\ /g")" 
		GSENABLECUSTCUR="1"

		echo "Loaded cursor path is '$GSCURSOR'"
	fi
fi

The paths look correct here on the GameScope menu load.

Even hardcoding the GSCURSOR value in the conditional above doesn't get the file picker to see the cursor path correctly. It still shows up as (none).

In the Main Menu under the gamescope arguments, the path is correctly passed as far as I can tell. I have only tested a couple of files but the file paths I did test are valid, and yet the file picker widget won't display the selection correctly.

They're still broken when the paths have spaces for some reason.
@sonic2kk
Copy link
Owner Author

Fixed one issue with the icons not loading, though they still won't load if the path has spaces.

I feel like that's going to be quite a problem regardless, because the gamescope arguments textbox in the Game Menu doesn't preserve backslashes or double quotes if you enter them and save them. So I'm not sure how a user is meant to enter a path with spaces.

@sonic2kk
Copy link
Owner Author

If I cannot find a fix in the next few days I may just add a temporary note to the tooltip about the paths and merge this, I don't want to hold back the GameScope improvements for too long.

I did a quick test with a "regular" yad script and it kept the quotes, so I think this is not any kind of Yad limitation but an issue that I will have to track down separately :-)

@sonic2kk
Copy link
Owner Author

Figured out the problem, working on a (slightly hacky) solution.

The problem boils down to the tr ' ' '\n' logic for splitting the flags, which has issues when a flag has a path argument with a space.

Will need to be applied to other paths, but this is a start
This should be the last major change needed.
@sonic2kk
Copy link
Owner Author

sonic2kk commented Jan 18, 2023

Okay, all cursor paths should work now.

They should get parsed correctly when the GameScope config is saved and loaded, as well as when passed as an option directly in the GameScope args line.

I fixed the quotes not displaying on the paths in the Game Menu GameScope args box by using single quotes, so now the args will look like --cursor '/home/gaben/half life 3/cursor.png'.

If a path is entered manually in the GameScope using double quotes, it could cause problems. However, I don't see this as a particularly common case and it may be more effort than it is worth to fix. So for now I will leave it.

Shellcheck also has no further complaints so I think this is ready for a merge :-) Docs will be updated overtime.

@sonic2kk sonic2kk merged commit 67ae1ab into master Jan 18, 2023
@sonic2kk sonic2kk deleted the gamescope-updates branch January 18, 2023 19:13
@sonic2kk sonic2kk mentioned this pull request Feb 15, 2023
5 tasks
@sonic2kk sonic2kk mentioned this pull request May 15, 2023
6 tasks
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.

None yet

1 participant