From 62e47a41ae65d68077afac2219933c21c6b69d50 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Mon, 19 Oct 2026 15:21:04 -0400 Subject: [PATCH] Better error messages if something like prism support needs a tool. --- .includes/prism-wine.sh | 70 +++++++++++++++++++++++++++++++---------- audiogame-manager.sh | 8 ++--- 2 files changed, 58 insertions(+), 20 deletions(-) diff --git a/.includes/prism-wine.sh b/.includes/prism-wine.sh index 10f8f42..9324def 100644 --- a/.includes/prism-wine.sh +++ b/.includes/prism-wine.sh @@ -1,5 +1,30 @@ #!/usr/bin/env bash +# Run setup in this shell so WINEDLLPATH remains available to the launcher. +prepare_prism_speech() { + local title="$1" + shift + local logDir="${XDG_CACHE_HOME:-$HOME/.cache}/audiogame-manager/prism-wine" + local logFile details + if ! mkdir -p "$logDir" || ! logFile="$(mktemp "${logDir}/setup.XXXXXX.log")"; then + agm_msgbox "$title" "$title" "Could not prepare Prism Wine speech support: unable to create a diagnostic log in ${logDir}. Check directory permissions and free disk space." + return 1 + fi + if "$@" > "$logFile" 2>&1; then + cat "$logFile" + rm -f "$logFile" + return 0 + fi + cat "$logFile" >&2 + details="$(tail -n 15 "$logFile")" + agm_msgbox "$title" "$title" "Could not prepare Prism Wine speech support. + +${details} + +Full diagnostic log: ${logFile}" + return 1 +} + # Build the host bridge from the same release as the application's Prism DLL. # Wine does not implement RpcMgmtInqIfIds, which Prism uses to detect NVDA. build_prism_speech_bridge() ( @@ -12,35 +37,45 @@ build_prism_speech_bridge() ( command -v "$tool" >/dev/null || missingTools+=("$tool") done if [[ ${#missingTools[@]} -gt 0 ]]; then - echo "Prism Wine speech requires: ${missingTools[*]}" >&2 + echo "Missing Prism Wine speech build tools: ${missingTools[*]}. Install these tools using your distribution's package manager, then launch the game again." >&2 return 1 fi if ! pkg-config --exists speech-dispatcher; then - echo "Prism Wine speech requires the Speech Dispatcher development files (libspeechd)." >&2 + echo "Missing Speech Dispatcher development files (libspeechd). Install your distribution's Speech Dispatcher development package, then launch the game again." >&2 + return 1 + fi + if ! mkdir -p "${bridgeDir%/*}" || ! buildRoot="$(mktemp -d "${bridgeDir%/*}/.build.XXXXXX")"; then + echo "Could not create the Prism build directory. Check cache directory permissions and free disk space." >&2 return 1 fi - mkdir -p "${bridgeDir%/*}" || return 1 - buildRoot="$(mktemp -d "${bridgeDir%/*}/.build.XXXXXX")" || return 1 trap 'rm -rf "$buildRoot"' EXIT echo "Preparing Prism ${prismVersion} Wine speech support..." - if ! curl -fsSL --retry 3 "https://codeload.github.com/ethindp/prism/tar.gz/refs/tags/v${prismVersion}" -o "${buildRoot}/source.tar.gz" || - ! tar -xzf "${buildRoot}/source.tar.gz" -C "$buildRoot"; then - echo "Could not download or extract Prism ${prismVersion}." >&2 + if ! curl -fsSL --retry 3 "https://codeload.github.com/ethindp/prism/tar.gz/refs/tags/v${prismVersion}" -o "${buildRoot}/source.tar.gz"; then + echo "Could not download Prism ${prismVersion}. Check your internet connection and whether this Prism release is available, then try again." >&2 + return 1 + fi + if ! tar -xzf "${buildRoot}/source.tar.gz" -C "$buildRoot"; then + echo "Could not extract Prism ${prismVersion}. Check free disk space and the archive error above." >&2 return 1 fi sourceRoot="${buildRoot}/prism-${prismVersion}" if ! cmake -S "${sourceRoot}/winelibs" -B "${buildRoot}/build" \ -DCMAKE_TOOLCHAIN_FILE="${sourceRoot}/cmake/winelib-toolchain.cmake" \ - -DCMAKE_BUILD_TYPE=Release || - ! cmake --build "${buildRoot}/build" --target \ - prism_speech_dispatcher_bridge prism_speech_dispatcher_bridge_placeholder -j2; then - echo "Could not build Prism ${prismVersion} Wine speech support." >&2 + -DCMAKE_BUILD_TYPE=Release; then + echo "Could not configure Prism ${prismVersion} Wine speech support. See the CMake error above." >&2 return 1 fi - mkdir -p "$bridgeDir" || return 1 - cp "${buildRoot}/build/speechd/prism_speech_dispatcher_bridge.dll.so" \ + if ! cmake --build "${buildRoot}/build" --target \ + prism_speech_dispatcher_bridge prism_speech_dispatcher_bridge_placeholder -j2; then + echo "Could not compile Prism ${prismVersion} Wine speech support. See the compiler error above." >&2 + return 1 + fi + if ! mkdir -p "$bridgeDir" || ! cp "${buildRoot}/build/speechd/prism_speech_dispatcher_bridge.dll.so" \ "${buildRoot}/build/speechd/placeholder/prism_speech_dispatcher_bridge.dll" \ - "$bridgeDir/" || return 1 + "$bridgeDir/"; then + echo "Could not save the Prism speech bridge to the cache. Check directory permissions and free disk space." >&2 + return 1 + fi ) prepare_arcadelux_prism_bridge() { @@ -48,7 +83,7 @@ prepare_arcadelux_prism_bridge() { local prismVersion local -a metadataFiles=("${gameDir}"/_internal/prismatoid-*.dist-info/METADATA) if [[ ${#metadataFiles[@]} -ne 1 || ! -f "${metadataFiles[0]}" ]]; then - echo "Could not identify Arcadelux's bundled Prism version." >&2 + echo "Could not identify Arcadelux's bundled Prism version: expected one _internal/prismatoid-*.dist-info/METADATA file. Update or reinstall Arcadelux, then try again." >&2 return 1 fi prismVersion="$(sed -n 's/^Version: //p' "${metadataFiles[0]}" | tr -d '\r')" @@ -79,7 +114,10 @@ prepare_prism_bridge() { build_prism_speech_bridge "$prismVersion" "$bridgeDir" || return 1 fi # Updates replace the game directory, so restore the placeholder each launch. - cp "${bridgeDir}/prism_speech_dispatcher_bridge.dll" "$gameDir/" || return 1 + if ! cp "${bridgeDir}/prism_speech_dispatcher_bridge.dll" "$gameDir/"; then + echo "Could not copy the Prism speech bridge into the game directory. Check directory permissions and free disk space." >&2 + return 1 + fi export WINEDLLPATH="${bridgeDir}${WINEDLLPATH:+:$WINEDLLPATH}" } diff --git a/audiogame-manager.sh b/audiogame-manager.sh index c36bec9..3002c8b 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -471,6 +471,8 @@ game_removal() { if [[ ${#game[@]} -gt 0 ]]; then process_launcher_flags if [[ "${game[0]}" == "umu" ]]; then + # process_launcher_flags populates umuGameId from launcher settings. + # shellcheck disable=SC2154 get_umu_bottle "$umuGameId" else # Set up wine environment for this game @@ -866,16 +868,14 @@ game_launcher() { if [[ "${wineExec,,}" == "arcadelux.exe" ]]; then # shellcheck source=.includes/prism-wine.sh source "${scriptDir}/.includes/prism-wine.sh" - if ! prepare_arcadelux_prism_bridge "$PWD"; then - agm_msgbox "Arcadelux Speech" "Arcadelux Speech" "Could not prepare Prism Wine speech support. Check the terminal output for missing build tools or Speech Dispatcher development files." + if ! prepare_prism_speech "Arcadelux Speech" prepare_arcadelux_prism_bridge "$PWD"; then exit 1 fi fi if [[ "${wineExec,,}" == "play tekken 3 access.exe" ]]; then # shellcheck source=.includes/prism-wine.sh source "${scriptDir}/.includes/prism-wine.sh" - if ! prepare_tekken3_prism_bridge "$PWD"; then - agm_msgbox "Tekken 3 Access Speech" "Tekken 3 Access Speech" "Could not prepare Prism Wine speech support. Check the terminal output for missing build tools, Speech Dispatcher development files, or an unrecognized mod version." + if ! prepare_prism_speech "Tekken 3 Access Speech" prepare_tekken3_prism_bridge "$PWD"; then exit 1 fi fi