Gamemode support added. Will automatically use gamemode if installed, so be sure it is properly configured /etc/gamemode.ini.

This commit is contained in:
Storm Dragon
2026-08-23 21:18:07 -04:00
parent 4b312099b4
commit eee7b7e7c8
5 changed files with 36 additions and 10 deletions
+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
run_with_optional_gamemode() {
if command -v gamemoderun &> /dev/null; then
gamemoderun "$@"
else
"$@"
fi
}
+4
View File
@@ -0,0 +1,4 @@
# Replacement map for scripts/check-ipfs-links.sh --fix.
# Format: MATCH<TAB>REPLACEMENT
# MATCH can be the ipfs array key, such as BG 15 Puzzle, or the old CID.
# REPLACEMENT can be a bare CID or a full /ipfs/ URL. Bare CIDs keep the existing query string.
1 # Replacement map for scripts/check-ipfs-links.sh --fix.
2 # Format: MATCH<TAB>REPLACEMENT
3 # MATCH can be the ipfs array key, such as BG 15 Puzzle, or the old CID.
4 # REPLACEMENT can be a bare CID or a full /ipfs/ URL. Bare CIDs keep the existing query string.
+1 -1
View File
@@ -97,7 +97,7 @@ run_umu_game() {
return 1 return 1
fi fi
pushd "${exePath%/*}" > /dev/null || return 1 pushd "${exePath%/*}" > /dev/null || return 1
umu-run "$exePath" run_with_optional_gamemode umu-run "$exePath"
popd > /dev/null || return 1 popd > /dev/null || return 1
} }
+11 -9
View File
@@ -570,14 +570,14 @@ custom_launch_parameters() {
fi fi
start_nvda2speechd start_nvda2speechd
pushd "$(winepath "$winePath")" || exit 1 pushd "$(winepath "$winePath")" || exit 1
wine "$wineExec" run_with_optional_gamemode wine "$wineExec"
popd || exit 1 popd || exit 1
customLaunchHandled="true" customLaunchHandled="true"
return 0 return 0
fi fi
if [[ "${game[2]}" == "Dreamland" ]]; then if [[ "${game[2]}" == "Dreamland" ]]; then
start_nvda2speechd start_nvda2speechd
"$WINE" "${game[1]}" &> /dev/null run_with_optional_gamemode "$WINE" "${game[1]}" &> /dev/null
customLaunchHandled="true" customLaunchHandled="true"
return 0 return 0
fi fi
@@ -637,20 +637,20 @@ custom_launch_parameters() {
# sketchbook: DLL replacement now handled by update_nvda_dlls() # sketchbook: DLL replacement now handled by update_nvda_dlls()
if [[ "${game[2]}" == "Audiodisc" ]]; then if [[ "${game[2]}" == "Audiodisc" ]]; then
start_nvda2speechd start_nvda2speechd
wine "$winePath\\$wineExec" run_with_optional_gamemode wine "$winePath\\$wineExec"
customLaunchHandled="true" customLaunchHandled="true"
return 0 return 0
fi fi
if [[ "${game[2]}" == "Audioquake" ]]; then if [[ "${game[2]}" == "Audioquake" ]]; then
start_nvda2speechd start_nvda2speechd
wine "$winePath\\$wineExec" run_with_optional_gamemode wine "$winePath\\$wineExec"
customLaunchHandled="true" customLaunchHandled="true"
return 0 return 0
fi fi
if [[ "${game[2]}" == "Screaming Strike 2" ]]; then if [[ "${game[2]}" == "Screaming Strike 2" ]]; then
start_nvda2speechd start_nvda2speechd
pushd "$(winepath "$winePath")" || exit 1 pushd "$(winepath "$winePath")" || exit 1
wine "$wineExec" run_with_optional_gamemode wine "$wineExec"
popd || exit 1 popd || exit 1
customLaunchHandled="true" customLaunchHandled="true"
return 0 return 0
@@ -658,7 +658,7 @@ custom_launch_parameters() {
if [[ "${game[2]}" == "Warsim" ]]; then if [[ "${game[2]}" == "Warsim" ]]; then
start_nvda2speechd start_nvda2speechd
pushd "$(winepath "${game[1]%\\*}")" || exit 1 pushd "$(winepath "${game[1]%\\*}")" || exit 1
wine "${game[1]##*\\}" run_with_optional_gamemode wine "${game[1]##*\\}"
popd || exit 1 popd || exit 1
customLaunchHandled="true" customLaunchHandled="true"
return 0 return 0
@@ -666,7 +666,7 @@ custom_launch_parameters() {
if [[ "${game[2]}" == "Interceptor" ]]; then if [[ "${game[2]}" == "Interceptor" ]]; then
start_nvda2speechd start_nvda2speechd
pushd "$(winepath "$winePath")" || exit 1 pushd "$(winepath "$winePath")" || exit 1
wine "$wineExec" run_with_optional_gamemode wine "$wineExec"
popd || exit 1 popd || exit 1
customLaunchHandled="true" customLaunchHandled="true"
return 0 return 0
@@ -849,11 +849,11 @@ game_launcher() {
# Change to game directory before launching (required for proper game operation) # Change to game directory before launching (required for proper game operation)
pushd "$(winepath "${game[1]%\\*}")" > /dev/null || exit 1 pushd "$(winepath "${game[1]%\\*}")" > /dev/null || exit 1
if [[ "$debugGdb" == "1" ]]; then if [[ "$debugGdb" == "1" ]]; then
winedbg --gdb "${game[1]##*\\}" run_with_optional_gamemode winedbg --gdb "${game[1]##*\\}"
else else
# Use direct wine execution instead of 'wine start' to ensure clipboard works # Use direct wine execution instead of 'wine start' to ensure clipboard works
# See: https://bugs.winehq.org/show_bug.cgi?id=50598 # See: https://bugs.winehq.org/show_bug.cgi?id=50598
wine "${game[1]##*\\}" run_with_optional_gamemode wine "${game[1]##*\\}"
fi fi
popd > /dev/null || exit 1 popd > /dev/null || exit 1
restore_executioners_rage_focus_workaround restore_executioners_rage_focus_workaround
@@ -926,6 +926,8 @@ export ipfsGateway="${ipfsGateway:-https://ipfs.stormux.org}"
# Source helper functions # Source helper functions
# shellcheck source=.includes/bottle.sh # shellcheck source=.includes/bottle.sh
source "${scriptDir}/.includes/bottle.sh" # Also sourced in functions that need it source "${scriptDir}/.includes/bottle.sh" # Also sourced in functions that need it
# shellcheck source=.includes/gamemode.sh
source "${scriptDir}/.includes/gamemode.sh"
# shellcheck source=.includes/proton.sh # shellcheck source=.includes/proton.sh
source "${scriptDir}/.includes/proton.sh" source "${scriptDir}/.includes/proton.sh"
# shellcheck source=.includes/desktop.sh # shellcheck source=.includes/desktop.sh
+11
View File
@@ -30,6 +30,13 @@ fi
STUB STUB
chmod +x "${testRoot}/bin/umu-run" chmod +x "${testRoot}/bin/umu-run"
cat > "${testRoot}/bin/gamemoderun" <<'STUB'
#!/usr/bin/env bash
printf '%s\n' "$*" >> "$GAMEMODE_STUB_LOG"
exec "$@"
STUB
chmod +x "${testRoot}/bin/gamemoderun"
cat > "${testRoot}/bin/wine" <<'STUB' cat > "${testRoot}/bin/wine" <<'STUB'
#!/usr/bin/env bash #!/usr/bin/env bash
if [[ "${1:-}" == "winepath" || "${1:-}" == "winepath.exe" ]]; then if [[ "${1:-}" == "winepath" || "${1:-}" == "winepath.exe" ]]; then
@@ -55,7 +62,10 @@ chmod +x "${testRoot}/bin/wineserver"
export PATH="${testRoot}/bin:$PATH" export PATH="${testRoot}/bin:$PATH"
export UMU_STUB_LOG="${testRoot}/umu.log" export UMU_STUB_LOG="${testRoot}/umu.log"
export WINE_STUB_LOG="${testRoot}/wine.log" export WINE_STUB_LOG="${testRoot}/wine.log"
export GAMEMODE_STUB_LOG="${testRoot}/gamemode.log"
# shellcheck source=.includes/gamemode.sh
source "${repoRoot}/.includes/gamemode.sh"
# shellcheck source=.includes/proton.sh # shellcheck source=.includes/proton.sh
source "${repoRoot}/.includes/proton.sh" source "${repoRoot}/.includes/proton.sh"
@@ -106,6 +116,7 @@ test_run_umu_game_uses_converted_path() {
mkdir -p "${WINEPREFIX}/drive_c/Program Files (x86)/GalaxyLaboratory/ShadowRine_FullVoice" mkdir -p "${WINEPREFIX}/drive_c/Program Files (x86)/GalaxyLaboratory/ShadowRine_FullVoice"
touch "${WINEPREFIX}/drive_c/Program Files (x86)/GalaxyLaboratory/ShadowRine_FullVoice/play_sr.exe" touch "${WINEPREFIX}/drive_c/Program Files (x86)/GalaxyLaboratory/ShadowRine_FullVoice/play_sr.exe"
run_umu_game 'c:\Program Files (x86)\GalaxyLaboratory\ShadowRine_FullVoice\play_sr.exe' run_umu_game 'c:\Program Files (x86)\GalaxyLaboratory\ShadowRine_FullVoice\play_sr.exe'
assert_file_contains "$GAMEMODE_STUB_LOG" "umu-run ${WINEPREFIX}/drive_c/Program Files (x86)/GalaxyLaboratory/ShadowRine_FullVoice/play_sr.exe" "UMU launches through GameMode"
assert_file_contains "$UMU_STUB_LOG" "${WINEPREFIX}|shadow-line|none|${WINEPREFIX}/drive_c/Program Files (x86)/GalaxyLaboratory/ShadowRine_FullVoice/play_sr.exe" "UMU launches converted exe path" assert_file_contains "$UMU_STUB_LOG" "${WINEPREFIX}|shadow-line|none|${WINEPREFIX}/drive_c/Program Files (x86)/GalaxyLaboratory/ShadowRine_FullVoice/play_sr.exe" "UMU launches converted exe path"
} }