Skip to content

Commit

Permalink
GameScope: Add support for GameScope --backend option
Browse files Browse the repository at this point in the history
  • Loading branch information
sonic2kk committed Sep 3, 2024
1 parent 70d9fea commit 4f2f3c9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
2 changes: 2 additions & 0 deletions lang/english.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1290,3 +1290,5 @@ GUI_CUSTOMCMD_USESLR="Use Steam Linux Runtime with Custom Command"
DESC_CUSTOMCMD_USESLR="runs Custom Commands in the Steam Linux Runtime container that games use to improve compatibility, particularly for commands running via Proton (but it works for native commands as well). This option might get in the way of inter-process communication (i.e. an app that looks for a game process) and may be unnecessary for Linux shell scripts"
GUI_MO2SILENTMODEEXEOVERRIDE="Override ModOrganizer 2 Silent Mode Executable Configuration"
DESC_MO2SILENTMODEEXEOVERRIDE="use a different executable configuration in Silent Mode (i.e. launch 'SKSE64' instead of 'Skyrim Special Edition') -- When 'none' by default, ModOrganizer 2 will launch the configuation matching the name of the INI (i.e. Skyrim Special Edition)"
GUI_GSBACKEND="rendering backend"
DESC_GSBACKEND="rendering backend for GameScope to use -- Defaults to 'auto' which selects based on environment (e.g., 'sdl' on X11, 'wayland' on Wayland)"
31 changes: 19 additions & 12 deletions steamtinkerlaunch
Original file line number Diff line number Diff line change
Expand Up @@ -11581,6 +11581,9 @@ function setGameScopeVars {
GSSTATSPATH="$( getGameScopeArg "$GAMESCOPE_ARGS" "--stats-path" "$GSSTATSPATH" "" "" "path" )"
if [ -n "$GSSTATSPATH" ]; then GSSTATSPATHENABLE="1"; fi

# Backend for GameScope to use (--backend) -- Dropdown
GSBACKEND="$( getGameScopeArg "$GAMESCOPE_ARGS" "--backend" "$GSBACKEND" "${GSBACKENDOPTS[0]}" "" )"

# Amount of time in milliseconds to wait before hiding the cursor (-C) -- Spinner
GSHIDECURSORDELAY="$( getGameScopeArg "$GAMESCOPE_ARGS" "-C" "$GSHIDECURSORDELAY" "" "0" "num" )"

Expand Down Expand Up @@ -11625,6 +11628,7 @@ function setGameScopeVars {
GSTOUCHMODES="${GSDEF}!${GSHOVER}!${GSLEFTCLICK}!${GSRIGHTCLICK}!${GSMIDDLECLICK}!${GSPASSTHRU}" # Corresponds to 0,1,2,3,4 respectively internally by GameScope -- Default is ingored and the flag is not passed to GameScope
GSDRMMODES="${GSDEF}!cvt!fixed"
GSNEWFILTERMODE=0 # Whether gamescope uses -U/-Y/-n/-i (legacy) or -F/-S (new)
GSBACKENDOPTS="auto!sdl!wayland!drm!headless!openvr"

# Get values for UI elements based on existing GameScope args
getGameScopeGeneralOpts
Expand Down Expand Up @@ -11708,6 +11712,7 @@ function GameScopeGui {
--field="$GUI_GSPREFOUT!$DESC_GSPREFOUT ('GSPREFOUT')" "" \
--field="$GUI_GSDRMMODE!$DESC_GSDRMMODE ('GSDRMMODE')":CB "$(cleanDropDown "${GSDRMMODE}" "${GSDRMMODES}")" \
--field="$(spanFont "$GUI_GSADVOPTIONS" "H")":LBL "SKIP" \
--field="$GUI_GSBACKEND!$DESC_GSBACKEND ('GSBACKEND')":CBE "$(cleanDropDown "${GSBACKEND}" "${GSBACKENDOPTS}")" \
--field="$GUI_GSSTATSPATHENABLE!$DESC_GSSTATSPATHENABLE ('GSSTATSPATHENABLE')":CHK "$GSSTATSPATHENABLE" \
--field="$GUI_GSSTATSPATH!$DESC_GSSTATSPATH ('GSSTATSPATH')":DIR "${GSSTATSPATH//\"}" \
--field="$GUI_GSHIDECURSORDELAY!$DESC_GSHIDECURSORDELAY ('GSHIDECURSORDELAY')":NUM "${GSHIDECURSORDELAY/#-/ -}" \
Expand Down Expand Up @@ -11810,18 +11815,19 @@ function GameScopeGui {
GSPREFOUT="${GSARR[$GSEMBEDDEDHEADING + 4]}"
GSDRMMODE="${GSARR[$GSEMBEDDEDHEADING + 5]}"
# GSARR[49] is the Advanced heading
GSSTATSPATHENABLE="${GSARR[$GSADVANCEDHEADING + 1]}"
GSSTATSPATH="${GSARR[$GSADVANCEDHEADING + 2]}"
GSHIDECURSORDELAY="${GSARR[$GSADVANCEDHEADING + 3]}"
GSFORCECOMP="${GSARR[$GSADVANCEDHEADING + 4]}"
GSDEBUGHUD="${GSARR[$GSADVANCEDHEADING + 5]}"
GSFORCEHDRSUPPORT="${GSARR[$GSADVANCEDHEADING + 6]}"
GSFORCEHDROUTPUT="${GSARR[$GSADVANCEDHEADING + 7]}"
GSPREFERVKDEVICE="${GSARR[$GSADVANCEDHEADING + 8]}"
GSWAYLAND="${GSARR[$GSADVANCEDHEADING + 9]}"
GSRT="${GSARR[$GSADVANCEDHEADING + 10]}"
GSHDLS="${GSARR[$GSADVANCEDHEADING + 11]}"
USEGAMESCOPEWSI="${GSARR[$GSADVANCEDHEADING + 12]}"
GSBACKEND="${GSARR[$GSADVANCEDHEADING + 1]}"
GSSTATSPATHENABLE="${GSARR[$GSADVANCEDHEADING + 2]}"
GSSTATSPATH="${GSARR[$GSADVANCEDHEADING + 3]}"
GSHIDECURSORDELAY="${GSARR[$GSADVANCEDHEADING + 4]}"
GSFORCECOMP="${GSARR[$GSADVANCEDHEADING + 5]}"
GSDEBUGHUD="${GSARR[$GSADVANCEDHEADING + 6]}"
GSFORCEHDRSUPPORT="${GSARR[$GSADVANCEDHEADING + 7]}"
GSFORCEHDROUTPUT="${GSARR[$GSADVANCEDHEADING + 8]}"
GSPREFERVKDEVICE="${GSARR[$GSADVANCEDHEADING + 9]}"
GSWAYLAND="${GSARR[$GSADVANCEDHEADING + 10]}"
GSRT="${GSARR[$GSADVANCEDHEADING + 11]}"
GSHDLS="${GSARR[$GSADVANCEDHEADING + 12]}"
USEGAMESCOPEWSI="${GSARR[$GSADVANCEDHEADING + 13]}"

# Build the GameScope arguments string
unset GAMESCOPE_ARGS
Expand Down Expand Up @@ -11972,6 +11978,7 @@ function GameScopeGui {
# EMBEDDED OPTIONS END

## ADVANCED OPTIONS ###
if [ ! "$GSBACKEND" == "auto" ] ; then GAMESCOPE_ARGS="${GAMESCOPE_ARGS} --backend ${GSBACKEND}"
if [ ! "$GSDRMMODE" == "${GSDEF}" ] && [ -n "$GSDRMMODE" ] ; then GAMESCOPE_ARGS="${GAMESCOPE_ARGS} --generate-drm-mode ${GSDRMMODE}"; fi # Don't pass DRM mode if "default"
if [ -d "$GSSTATSPATH" ] && [ "$GSSTATSPATHENABLE" == "TRUE" ] ; then GAMESCOPE_ARGS="${GAMESCOPE_ARGS} --stats-path '${GSSTATSPATH}'"; fi
if [ ! "$GSHIDECURSORDELAY" == "0" ] ; then GAMESCOPE_ARGS="${GAMESCOPE_ARGS} -C ${GSHIDECURSORDELAY}"; fi # Ignore cursor delay if it's 0
Expand Down

0 comments on commit 4f2f3c9

Please sign in to comment.