Because now everything is more centralized in only a couple wine bottles, make sure nvda2speechd dll files are downloaded and update them when AGM starts. This should prevent loss of speech after game updates.

This commit is contained in:
Storm Dragon
2025-08-05 02:20:11 -04:00
parent eb9ad3e38d
commit 1b50ac66c1

View File

@@ -281,11 +281,58 @@ create_game_array() {
done done
} }
# Update NVDA controller client DLLs in wine bottles
update_nvda_dlls() {
# Ensure we have the replacement DLLs
source .includes/functions.sh
download "https://github.com/RastislavKish/nvda2speechd/releases/download/v0.1/nvda2speechd32.dll" \
"https://github.com/RastislavKish/nvda2speechd/releases/download/v0.1/nvda2speechd64.dll"
# Update wine64 bottle (most common)
if [[ -d "$HOME/.local/wine64" ]]; then
find "$HOME/.local/wine64" -type f \( -iname "nvdaControllerClient*.dll" \) -print0 | while IFS= read -r -d '' dllFile; do
local basename="${dllFile##*/}"
local replacement=""
case "${basename,,}" in
"nvdacontrollerclient32.dll")
replacement="${cache}/nvda2speechd32.dll"
;;
"nvdacontrollerclient64.dll")
replacement="${cache}/nvda2speechd64.dll"
;;
"nvdacontrollerclient.dll")
# Use file command to detect architecture
if file "$dllFile" | grep -q "PE32+"; then
replacement="${cache}/nvda2speechd64.dll"
elif file "$dllFile" | grep -q "PE32"; then
replacement="${cache}/nvda2speechd32.dll"
fi
;;
esac
if [[ -n "$replacement" ]] && [[ -f "$replacement" ]]; then
echo "Updating $dllFile with nvda2speechd"
cp "$replacement" "$dllFile"
fi
done
fi
# Also update wine32 bottle if it exists
if [[ -d "$HOME/.local/wine32" ]]; then
find "$HOME/.local/wine32" -type f \( -iname "nvdaControllerClient*.dll" \) -print0 | while IFS= read -r -d '' dllFile; do
echo "Updating $dllFile with nvda2speechd32"
cp "${cache}/nvda2speechd32.dll" "$dllFile"
done
fi
}
# launch games that are installed # launch games that are installed
game_launcher() { game_launcher() {
# For use by update scripts that want to source functions in this file. # For use by update scripts that want to source functions in this file.
[[ "$agmNoLaunch" == "true" ]] && return [[ "$agmNoLaunch" == "true" ]] && return
source .includes/bottle.sh source .includes/bottle.sh
# Start nvda2speechd if available # Start nvda2speechd if available
if [[ -x ${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd ]]; then if [[ -x ${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd ]]; then
if command -v FEXLoader &> /dev/null ; then if command -v FEXLoader &> /dev/null ; then
@@ -294,6 +341,9 @@ game_launcher() {
${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd &> /dev/null & ${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd &> /dev/null &
fi fi
fi fi
# Replace NVDA controller client DLLs in wine64 bottle
update_nvda_dlls
mapfile -t lines < <(sed -e '/^$/d' -e '/^ *#/d' "${configFile}" 2> /dev/null) mapfile -t lines < <(sed -e '/^$/d' -e '/^ *#/d' "${configFile}" 2> /dev/null)
if [[ ${#lines} -eq 0 ]]; then if [[ ${#lines} -eq 0 ]]; then
echo "Install some games first." echo "Install some games first."