Oops forgot to include a file for Tekken installations.
This commit is contained in:
1 parent
105672be13
commit
4886578fc5
1 file changed
+96
@@ -0,0 +1,96 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 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() (
|
||||
local prismVersion="$1"
|
||||
local bridgeDir="$2"
|
||||
local buildRoot sourceRoot tool
|
||||
local -a missingTools=()
|
||||
|
||||
for tool in curl tar cmake make winegcc wineg++ winebuild pkg-config; do
|
||||
command -v "$tool" >/dev/null || missingTools+=("$tool")
|
||||
done
|
||||
if [[ ${#missingTools[@]} -gt 0 ]]; then
|
||||
echo "Prism Wine speech requires: ${missingTools[*]}" >&2
|
||||
return 1
|
||||
fi
|
||||
if ! pkg-config --exists speech-dispatcher; then
|
||||
echo "Prism Wine speech requires the Speech Dispatcher development files (libspeechd)." >&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
|
||||
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
|
||||
return 1
|
||||
fi
|
||||
mkdir -p "$bridgeDir" || return 1
|
||||
cp "${buildRoot}/build/speechd/prism_speech_dispatcher_bridge.dll.so" \
|
||||
"${buildRoot}/build/speechd/placeholder/prism_speech_dispatcher_bridge.dll" \
|
||||
"$bridgeDir/" || return 1
|
||||
)
|
||||
|
||||
prepare_arcadelux_prism_bridge() {
|
||||
local gameDir="$1"
|
||||
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
|
||||
return 1
|
||||
fi
|
||||
prismVersion="$(sed -n 's/^Version: //p' "${metadataFiles[0]}" | tr -d '\r')"
|
||||
if [[ ! "$prismVersion" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "Unsupported Prism version: ${prismVersion}" >&2
|
||||
return 1
|
||||
fi
|
||||
prepare_prism_bridge "$gameDir" "$prismVersion" "Arcadelux.exe"
|
||||
}
|
||||
|
||||
# App wrappers identify their bundled Prism release before sharing bridge setup.
|
||||
prepare_prism_bridge() {
|
||||
local gameDir="$1"
|
||||
local prismVersion="$2"
|
||||
local gameExecutable="$3"
|
||||
local bridgeDir
|
||||
if [[ ! "$prismVersion" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "Unsupported Prism version: ${prismVersion}" >&2
|
||||
return 1
|
||||
fi
|
||||
if [[ "$(uname -m)" != "x86_64" ]] || ! file -b "${gameDir}/${gameExecutable}" | grep -q 'PE32+'; then
|
||||
echo "Prism Wine speech requires an x86_64 host and 64-bit game." >&2
|
||||
return 1
|
||||
fi
|
||||
bridgeDir="${XDG_CACHE_HOME:-$HOME/.cache}/audiogame-manager/prism-wine/${prismVersion}-x86_64"
|
||||
if [[ ! -f "${bridgeDir}/prism_speech_dispatcher_bridge.dll" ||
|
||||
! -f "${bridgeDir}/prism_speech_dispatcher_bridge.dll.so" ]]; then
|
||||
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
|
||||
export WINEDLLPATH="${bridgeDir}${WINEDLLPATH:+:$WINEDLLPATH}"
|
||||
}
|
||||
|
||||
prepare_tekken3_prism_bridge() {
|
||||
local gameDir="$1"
|
||||
local prismHash
|
||||
# Access 1.0 ships this exact Prism 0.18.3 DLL. Refuse an unverified update.
|
||||
prismHash="$(sha256sum "${gameDir}/T3Access/prism.dll")" || return 1
|
||||
if [[ "${prismHash%% *}" != "7c7d09c8c7306e8e1a0c46d603ccb2a391c194c77843400c11b746e7dd56a467" ]]; then
|
||||
echo "Tekken 3 Access has an unrecognized Prism DLL; update its AGM integration before launching." >&2
|
||||
return 1
|
||||
fi
|
||||
prepare_prism_bridge "$gameDir" "0.18.3" "Tekken3.exe"
|
||||
}
|
||||
Reference in new issue
Block a user