diff --git a/.includes/gamemode.sh b/.includes/gamemode.sh new file mode 100644 index 0000000..c305776 --- /dev/null +++ b/.includes/gamemode.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +run_with_optional_gamemode() { + if command -v gamemoderun &> /dev/null; then + gamemoderun "$@" + else + "$@" + fi +} diff --git a/.includes/ipfs-replacements.tsv b/.includes/ipfs-replacements.tsv new file mode 100644 index 0000000..db1eade --- /dev/null +++ b/.includes/ipfs-replacements.tsv @@ -0,0 +1,4 @@ +# Replacement map for scripts/check-ipfs-links.sh --fix. +# Format: MATCHREPLACEMENT +# 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. diff --git a/.includes/proton.sh b/.includes/proton.sh index 9e53d2b..582c5ff 100644 --- a/.includes/proton.sh +++ b/.includes/proton.sh @@ -97,7 +97,7 @@ run_umu_game() { return 1 fi pushd "${exePath%/*}" > /dev/null || return 1 - umu-run "$exePath" + run_with_optional_gamemode umu-run "$exePath" popd > /dev/null || return 1 } diff --git a/audiogame-manager.sh b/audiogame-manager.sh index bd9c014..569f262 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -570,14 +570,14 @@ custom_launch_parameters() { fi start_nvda2speechd pushd "$(winepath "$winePath")" || exit 1 - wine "$wineExec" + run_with_optional_gamemode wine "$wineExec" popd || exit 1 customLaunchHandled="true" return 0 fi if [[ "${game[2]}" == "Dreamland" ]]; then start_nvda2speechd - "$WINE" "${game[1]}" &> /dev/null + run_with_optional_gamemode "$WINE" "${game[1]}" &> /dev/null customLaunchHandled="true" return 0 fi @@ -637,20 +637,20 @@ custom_launch_parameters() { # sketchbook: DLL replacement now handled by update_nvda_dlls() if [[ "${game[2]}" == "Audiodisc" ]]; then start_nvda2speechd - wine "$winePath\\$wineExec" + run_with_optional_gamemode wine "$winePath\\$wineExec" customLaunchHandled="true" return 0 fi if [[ "${game[2]}" == "Audioquake" ]]; then start_nvda2speechd - wine "$winePath\\$wineExec" + run_with_optional_gamemode wine "$winePath\\$wineExec" customLaunchHandled="true" return 0 fi if [[ "${game[2]}" == "Screaming Strike 2" ]]; then start_nvda2speechd pushd "$(winepath "$winePath")" || exit 1 - wine "$wineExec" + run_with_optional_gamemode wine "$wineExec" popd || exit 1 customLaunchHandled="true" return 0 @@ -658,7 +658,7 @@ custom_launch_parameters() { if [[ "${game[2]}" == "Warsim" ]]; then start_nvda2speechd pushd "$(winepath "${game[1]%\\*}")" || exit 1 - wine "${game[1]##*\\}" + run_with_optional_gamemode wine "${game[1]##*\\}" popd || exit 1 customLaunchHandled="true" return 0 @@ -666,7 +666,7 @@ custom_launch_parameters() { if [[ "${game[2]}" == "Interceptor" ]]; then start_nvda2speechd pushd "$(winepath "$winePath")" || exit 1 - wine "$wineExec" + run_with_optional_gamemode wine "$wineExec" popd || exit 1 customLaunchHandled="true" return 0 @@ -849,11 +849,11 @@ game_launcher() { # Change to game directory before launching (required for proper game operation) pushd "$(winepath "${game[1]%\\*}")" > /dev/null || exit 1 if [[ "$debugGdb" == "1" ]]; then - winedbg --gdb "${game[1]##*\\}" + run_with_optional_gamemode winedbg --gdb "${game[1]##*\\}" else # Use direct wine execution instead of 'wine start' to ensure clipboard works # See: https://bugs.winehq.org/show_bug.cgi?id=50598 - wine "${game[1]##*\\}" + run_with_optional_gamemode wine "${game[1]##*\\}" fi popd > /dev/null || exit 1 restore_executioners_rage_focus_workaround @@ -926,6 +926,8 @@ export ipfsGateway="${ipfsGateway:-https://ipfs.stormux.org}" # Source helper functions # shellcheck source=.includes/bottle.sh 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 source "${scriptDir}/.includes/proton.sh" # shellcheck source=.includes/desktop.sh diff --git a/tests/umu_backend_tests.sh b/tests/umu_backend_tests.sh index 09b41b4..ab721cc 100644 --- a/tests/umu_backend_tests.sh +++ b/tests/umu_backend_tests.sh @@ -30,6 +30,13 @@ fi STUB 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' #!/usr/bin/env bash if [[ "${1:-}" == "winepath" || "${1:-}" == "winepath.exe" ]]; then @@ -55,7 +62,10 @@ chmod +x "${testRoot}/bin/wineserver" export PATH="${testRoot}/bin:$PATH" export UMU_STUB_LOG="${testRoot}/umu.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 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" 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' + 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" }