Better error messages if something like prism support needs a tool.
This commit is contained in:
1 parent
8e33ef63d0
commit
62e47a41ae
2 files changed
+58
-20
No files matched your search
+54
-16
@@ -1,5 +1,30 @@
|
|||||||
#!/usr/bin/env bash
|
#!/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.
|
# 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.
|
# Wine does not implement RpcMgmtInqIfIds, which Prism uses to detect NVDA.
|
||||||
build_prism_speech_bridge() (
|
build_prism_speech_bridge() (
|
||||||
@@ -12,35 +37,45 @@ build_prism_speech_bridge() (
|
|||||||
command -v "$tool" >/dev/null || missingTools+=("$tool")
|
command -v "$tool" >/dev/null || missingTools+=("$tool")
|
||||||
done
|
done
|
||||||
if [[ ${#missingTools[@]} -gt 0 ]]; then
|
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
|
return 1
|
||||||
fi
|
fi
|
||||||
if ! pkg-config --exists speech-dispatcher; then
|
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
|
return 1
|
||||||
fi
|
fi
|
||||||
mkdir -p "${bridgeDir%/*}" || return 1
|
|
||||||
buildRoot="$(mktemp -d "${bridgeDir%/*}/.build.XXXXXX")" || return 1
|
|
||||||
trap 'rm -rf "$buildRoot"' EXIT
|
trap 'rm -rf "$buildRoot"' EXIT
|
||||||
echo "Preparing Prism ${prismVersion} Wine speech support..."
|
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" ||
|
if ! curl -fsSL --retry 3 "https://codeload.github.com/ethindp/prism/tar.gz/refs/tags/v${prismVersion}" -o "${buildRoot}/source.tar.gz"; then
|
||||||
! tar -xzf "${buildRoot}/source.tar.gz" -C "$buildRoot"; then
|
echo "Could not download Prism ${prismVersion}. Check your internet connection and whether this Prism release is available, then try again." >&2
|
||||||
echo "Could not download or extract Prism ${prismVersion}." >&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
|
return 1
|
||||||
fi
|
fi
|
||||||
sourceRoot="${buildRoot}/prism-${prismVersion}"
|
sourceRoot="${buildRoot}/prism-${prismVersion}"
|
||||||
if ! cmake -S "${sourceRoot}/winelibs" -B "${buildRoot}/build" \
|
if ! cmake -S "${sourceRoot}/winelibs" -B "${buildRoot}/build" \
|
||||||
-DCMAKE_TOOLCHAIN_FILE="${sourceRoot}/cmake/winelib-toolchain.cmake" \
|
-DCMAKE_TOOLCHAIN_FILE="${sourceRoot}/cmake/winelib-toolchain.cmake" \
|
||||||
-DCMAKE_BUILD_TYPE=Release ||
|
-DCMAKE_BUILD_TYPE=Release; then
|
||||||
! cmake --build "${buildRoot}/build" --target \
|
echo "Could not configure Prism ${prismVersion} Wine speech support. See the CMake error above." >&2
|
||||||
prism_speech_dispatcher_bridge prism_speech_dispatcher_bridge_placeholder -j2; then
|
|
||||||
echo "Could not build Prism ${prismVersion} Wine speech support." >&2
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
mkdir -p "$bridgeDir" || return 1
|
if ! cmake --build "${buildRoot}/build" --target \
|
||||||
cp "${buildRoot}/build/speechd/prism_speech_dispatcher_bridge.dll.so" \
|
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" \
|
"${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() {
|
prepare_arcadelux_prism_bridge() {
|
||||||
@@ -48,7 +83,7 @@ prepare_arcadelux_prism_bridge() {
|
|||||||
local prismVersion
|
local prismVersion
|
||||||
local -a metadataFiles=("${gameDir}"/_internal/prismatoid-*.dist-info/METADATA)
|
local -a metadataFiles=("${gameDir}"/_internal/prismatoid-*.dist-info/METADATA)
|
||||||
if [[ ${#metadataFiles[@]} -ne 1 || ! -f "${metadataFiles[0]}" ]]; then
|
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
|
return 1
|
||||||
fi
|
fi
|
||||||
prismVersion="$(sed -n 's/^Version: //p' "${metadataFiles[0]}" | tr -d '\r')"
|
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
|
build_prism_speech_bridge "$prismVersion" "$bridgeDir" || return 1
|
||||||
fi
|
fi
|
||||||
# Updates replace the game directory, so restore the placeholder each launch.
|
# 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}"
|
export WINEDLLPATH="${bridgeDir}${WINEDLLPATH:+:$WINEDLLPATH}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -471,6 +471,8 @@ game_removal() {
|
|||||||
if [[ ${#game[@]} -gt 0 ]]; then
|
if [[ ${#game[@]} -gt 0 ]]; then
|
||||||
process_launcher_flags
|
process_launcher_flags
|
||||||
if [[ "${game[0]}" == "umu" ]]; then
|
if [[ "${game[0]}" == "umu" ]]; then
|
||||||
|
# process_launcher_flags populates umuGameId from launcher settings.
|
||||||
|
# shellcheck disable=SC2154
|
||||||
get_umu_bottle "$umuGameId"
|
get_umu_bottle "$umuGameId"
|
||||||
else
|
else
|
||||||
# Set up wine environment for this game
|
# Set up wine environment for this game
|
||||||
@@ -866,16 +868,14 @@ game_launcher() {
|
|||||||
if [[ "${wineExec,,}" == "arcadelux.exe" ]]; then
|
if [[ "${wineExec,,}" == "arcadelux.exe" ]]; then
|
||||||
# shellcheck source=.includes/prism-wine.sh
|
# shellcheck source=.includes/prism-wine.sh
|
||||||
source "${scriptDir}/.includes/prism-wine.sh"
|
source "${scriptDir}/.includes/prism-wine.sh"
|
||||||
if ! prepare_arcadelux_prism_bridge "$PWD"; then
|
if ! prepare_prism_speech "Arcadelux Speech" 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."
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [[ "${wineExec,,}" == "play tekken 3 access.exe" ]]; then
|
if [[ "${wineExec,,}" == "play tekken 3 access.exe" ]]; then
|
||||||
# shellcheck source=.includes/prism-wine.sh
|
# shellcheck source=.includes/prism-wine.sh
|
||||||
source "${scriptDir}/.includes/prism-wine.sh"
|
source "${scriptDir}/.includes/prism-wine.sh"
|
||||||
if ! prepare_tekken3_prism_bridge "$PWD"; then
|
if ! prepare_prism_speech "Tekken 3 Access Speech" 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."
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in new issue
Block a user