Add Ambush installer and Wine timer compatibility

Install the current lowercase archive layout, preserve the game speech client, and load a game-local winmm proxy for Wine timer compatibility. Stop on installation or DLL setup failures and initialize the launcher title for CLI installation.

Validation: Bash syntax checks and ShellCheck; 13 isolated Ambush checks including failure handling, repeat installation, ZIP extraction, and CLI title; RS Games and action menu tests. Live Wine gameplay and speech remain unverified.
This commit is contained in:
Chase Cichorz authored and Storm Dragon committed 2026-11-24 11:36:30 -05:00
1 parent 9856d42376
commit 428dfbe99a
7 files changed
+421

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
# shellcheck shell=bash disable=SC2154 # installer is sourced by audiogame-manager with shared globals
export WINEARCH=win64
export winVer="win10"
install_wine_bottle || exit 1
download "https://altaistudiogames.com/ambush.zip" || exit 1
# Preserve extraction failures through the progress dialog's pipeline.
if ! (
set -o pipefail
install_with_progress unzip "Extracting game files..." -d "$WINEPREFIX/drive_c/Program Files" "${cache}/ambush.zip"
); then
agm_msgbox "Ambush" "Ambush" "Could not extract Ambush. No launcher was added."
exit 1
fi
ambushDir="$WINEPREFIX/drive_c/Program Files/ambush"
if [[ ! -f "${ambushDir}/Ambush.exe" ]]; then
agm_msgbox "Ambush" "Ambush" "Ambush did not install to the expected location: ${ambushDir}"
exit 1
fi
# Wine's timeGetTime trips Ambush's speed hack detection. See game-scripts/ambush-winmm/README.md.
if [[ ! -f "${WINEPREFIX}/drive_c/windows/system32/winmm.dll" ]] ||
! cp -f "${scriptDir}/game-scripts/ambush-winmm/winmm.dll" "${ambushDir}/winmm.dll" ||
! ln -sfn "../../windows/system32/winmm.dll" "${ambushDir}/winmm_wine.dll"; then
agm_msgbox "Ambush" "Ambush" "Could not install Ambush's Wine timer support. No launcher was added."
exit 1
fi
# Audiogame Manager replaces regular nvdaControllerClient*.dll files at launch, and the
# replacement makes Ambush's login() throw. Keep the game's own client behind a symlink,
# which the replacement skips.
if [[ -f "${ambushDir}/nvdaControllerClient64.dll" && ! -L "${ambushDir}/nvdaControllerClient64.dll" ]]; then
if ! mv -f "${ambushDir}/nvdaControllerClient64.dll" "${ambushDir}/ambush-nvda-client64.orig"; then
agm_msgbox "Ambush" "Ambush" "Could not preserve Ambush's speech DLL. No launcher was added."
exit 1
fi
if ! ln -sfn "ambush-nvda-client64.orig" "${ambushDir}/nvdaControllerClient64.dll"; then
agm_msgbox "Ambush" "Ambush" "Could not link Ambush's speech DLL. The original is saved as ambush-nvda-client64.orig. No launcher was added."
exit 1
fi
fi
add_launcher 'c:\Program Files\ambush\Ambush.exe' 'export WINEDLLOVERRIDES=winmm=n,b'
+3
View File
@@ -1145,6 +1145,9 @@ if [[ "$noninteractiveInstall" == "true" ]]; then
# Install the specified game noninteractively
if [[ -f "${scriptDir}/.install/${selectedGameName}.sh" ]]; then
export LANG="en_US.UTF-8"
# Installers and add_launcher use game as the launcher title.
# shellcheck disable=SC2178 # In this install path, game is a scalar title, not a parsed launcher record.
game="${selectedGameName}"
# shellcheck disable=SC1090
. "${scriptDir}/.install/${selectedGameName}.sh"
# Show success message
+45
View File
@@ -0,0 +1,45 @@
# Ambush winmm proxy
Ambush's anti-cheat checks whether `timeGetTime`, `QueryPerformanceCounter`,
`GetTickCount` and `GetTickCount64` start with a jump instruction, which is how
speed hack tools hook them. Wine's `winmm.timeGetTime` is a one-instruction
`jmp` thunk, so under Wine the game reports "Security Alert. Tamper Reason:
Speed Hack" about 20 to 35 seconds after starting.
`winmm.dll` here implements `timeGetTime` with real code and forwards every
other export to `winmm_wine.dll`. The installer makes `winmm_wine.dll` a
symlink to the bottle's own `system32/winmm.dll`, so it stays in step with
the installed Wine. The launcher sets `WINEDLLOVERRIDES=winmm=n,b`, so only
Ambush loads the proxy. The game executable is not modified.
Rebuild with mingw-w64:
x86_64-w64-mingw32-gcc -O2 -shared -nostartfiles -e DllMain -o winmm.dll winmm.c winmm.def -lkernel32
`winmm.def` lists the exports of Wine's x86_64 `winmm.dll`; regenerate it if
Wine adds exports.
## Speech DLL
Audiogame Manager's `update_nvda_dlls` replaces every regular
`nvdaControllerClient*.dll` file in the bottle at launch. With the replacement,
Ambush's `login()` fails with "Caught an exception from the application"
about 40 seconds after start. The installer moves the game's own client to
`ambush-nvda-client64.orig` and links `nvdaControllerClient64.dll` to it; the
replacement uses `find -type f`, so it skips the symlink. If an Ambush update
puts back a regular file, run the installer again.
## Installer checks
The upstream archive extracts into lowercase `ambush/`, installed under the
bottle's `Program Files` directory. The installer stops without adding a
launcher if bottle setup, downloading, extraction, or DLL setup fails. If the
speech DLL cannot be linked after backup, its original remains in
`ambush-nvda-client64.orig`.
Run `bash tests/ambush_installer_tests.sh` from the repository root for isolated
failure, repeat-installation, archive-layout and CLI launcher-title checks.
These checks do not run Wine or prove game speech. For live acceptance, install
and launch Ambush from both console and graphical menus, check login and speech,
play beyond the reported security-alert interval, then quit and relaunch.
Also confirm another game in the shared bottle still launches and speaks.
+10
View File
@@ -0,0 +1,10 @@
/* Proxy winmm for Ambush under Wine: real-code timeGetTime (no jmp thunk), everything else forwarded. */
#include <windows.h>
static volatile LONGLONG freq;
DWORD WINAPI my_timeGetTime(void){
LARGE_INTEGER c; LONGLONG f=freq;
if(!f){LARGE_INTEGER q; QueryPerformanceFrequency(&q); f=freq=q.QuadPart;}
QueryPerformanceCounter(&c);
return (DWORD)(c.QuadPart/(f/1000));
}
BOOL WINAPI DllMain(HINSTANCE h, DWORD r, LPVOID p){ if(r==DLL_PROCESS_ATTACH) DisableThreadLibraryCalls(h); return TRUE; }
+188
View File
@@ -0,0 +1,188 @@
LIBRARY winmm.dll
EXPORTS
CloseDriver=winmm_wine.CloseDriver @5
DefDriverProc=winmm_wine.DefDriverProc @6
DriverCallback=winmm_wine.DriverCallback @7
DrvClose=winmm_wine.DrvClose @8
DrvDefDriverProc=winmm_wine.DrvDefDriverProc @9
DrvGetModuleHandle=winmm_wine.DrvGetModuleHandle @10
DrvOpen=winmm_wine.DrvOpen @11
DrvOpenA=winmm_wine.DrvOpenA @12
DrvSendMessage=winmm_wine.DrvSendMessage @13
GetDriverFlags=winmm_wine.GetDriverFlags @14
GetDriverModuleHandle=winmm_wine.GetDriverModuleHandle @15
OpenDriver=winmm_wine.OpenDriver @16
OpenDriverA=winmm_wine.OpenDriverA @17
PlaySound=winmm_wine.PlaySound @18
PlaySoundA=winmm_wine.PlaySoundA @19
PlaySoundW=winmm_wine.PlaySoundW @20
SendDriverMessage=winmm_wine.SendDriverMessage @21
auxGetDevCapsA=winmm_wine.auxGetDevCapsA @22
auxGetDevCapsW=winmm_wine.auxGetDevCapsW @23
auxGetNumDevs=winmm_wine.auxGetNumDevs @24
auxGetVolume=winmm_wine.auxGetVolume @25
auxOutMessage=winmm_wine.auxOutMessage @26
auxSetVolume=winmm_wine.auxSetVolume @27
joyConfigChanged=winmm_wine.joyConfigChanged @28
joyGetDevCapsA=winmm_wine.joyGetDevCapsA @29
joyGetDevCapsW=winmm_wine.joyGetDevCapsW @30
joyGetNumDevs=winmm_wine.joyGetNumDevs @31
joyGetPos=winmm_wine.joyGetPos @32
joyGetPosEx=winmm_wine.joyGetPosEx @33
joyGetThreshold=winmm_wine.joyGetThreshold @34
joyReleaseCapture=winmm_wine.joyReleaseCapture @35
joySetCapture=winmm_wine.joySetCapture @36
joySetThreshold=winmm_wine.joySetThreshold @37
mciDriverNotify=winmm_wine.mciDriverNotify @38
mciDriverYield=winmm_wine.mciDriverYield @39
mciExecute=winmm_wine.mciExecute @40
mciFreeCommandResource=winmm_wine.mciFreeCommandResource @41
mciGetCreatorTask=winmm_wine.mciGetCreatorTask @42
mciGetDeviceIDA=winmm_wine.mciGetDeviceIDA @43
mciGetDeviceIDFromElementIDA=winmm_wine.mciGetDeviceIDFromElementIDA @44
mciGetDeviceIDFromElementIDW=winmm_wine.mciGetDeviceIDFromElementIDW @45
mciGetDeviceIDW=winmm_wine.mciGetDeviceIDW @46
mciGetDriverData=winmm_wine.mciGetDriverData @47
mciGetErrorStringA=winmm_wine.mciGetErrorStringA @48
mciGetErrorStringW=winmm_wine.mciGetErrorStringW @49
mciGetYieldProc=winmm_wine.mciGetYieldProc @50
mciLoadCommandResource=winmm_wine.mciLoadCommandResource @51
mciSendCommandA=winmm_wine.mciSendCommandA @52
mciSendCommandW=winmm_wine.mciSendCommandW @53
mciSendStringA=winmm_wine.mciSendStringA @54
mciSendStringW=winmm_wine.mciSendStringW @55
mciSetDriverData=winmm_wine.mciSetDriverData @56
mciSetYieldProc=winmm_wine.mciSetYieldProc @57
midiConnect=winmm_wine.midiConnect @58
midiDisconnect=winmm_wine.midiDisconnect @59
midiInAddBuffer=winmm_wine.midiInAddBuffer @60
midiInClose=winmm_wine.midiInClose @61
midiInGetDevCapsA=winmm_wine.midiInGetDevCapsA @62
midiInGetDevCapsW=winmm_wine.midiInGetDevCapsW @63
midiInGetErrorTextA=winmm_wine.midiInGetErrorTextA @64
midiInGetErrorTextW=winmm_wine.midiInGetErrorTextW @65
midiInGetID=winmm_wine.midiInGetID @66
midiInGetNumDevs=winmm_wine.midiInGetNumDevs @67
midiInMessage=winmm_wine.midiInMessage @68
midiInOpen=winmm_wine.midiInOpen @69
midiInPrepareHeader=winmm_wine.midiInPrepareHeader @70
midiInReset=winmm_wine.midiInReset @71
midiInStart=winmm_wine.midiInStart @72
midiInStop=winmm_wine.midiInStop @73
midiInUnprepareHeader=winmm_wine.midiInUnprepareHeader @74
midiOutCacheDrumPatches=winmm_wine.midiOutCacheDrumPatches @75
midiOutCachePatches=winmm_wine.midiOutCachePatches @76
midiOutClose=winmm_wine.midiOutClose @77
midiOutGetDevCapsA=winmm_wine.midiOutGetDevCapsA @78
midiOutGetDevCapsW=winmm_wine.midiOutGetDevCapsW @79
midiOutGetErrorTextA=winmm_wine.midiOutGetErrorTextA @80
midiOutGetErrorTextW=winmm_wine.midiOutGetErrorTextW @81
midiOutGetID=winmm_wine.midiOutGetID @82
midiOutGetNumDevs=winmm_wine.midiOutGetNumDevs @83
midiOutGetVolume=winmm_wine.midiOutGetVolume @84
midiOutLongMsg=winmm_wine.midiOutLongMsg @85
midiOutMessage=winmm_wine.midiOutMessage @86
midiOutOpen=winmm_wine.midiOutOpen @87
midiOutPrepareHeader=winmm_wine.midiOutPrepareHeader @88
midiOutReset=winmm_wine.midiOutReset @89
midiOutSetVolume=winmm_wine.midiOutSetVolume @90
midiOutShortMsg=winmm_wine.midiOutShortMsg @91
midiOutUnprepareHeader=winmm_wine.midiOutUnprepareHeader @92
midiStreamClose=winmm_wine.midiStreamClose @93
midiStreamOpen=winmm_wine.midiStreamOpen @94
midiStreamOut=winmm_wine.midiStreamOut @95
midiStreamPause=winmm_wine.midiStreamPause @96
midiStreamPosition=winmm_wine.midiStreamPosition @97
midiStreamProperty=winmm_wine.midiStreamProperty @98
midiStreamRestart=winmm_wine.midiStreamRestart @99
midiStreamStop=winmm_wine.midiStreamStop @100
mixerClose=winmm_wine.mixerClose @101
mixerGetControlDetailsA=winmm_wine.mixerGetControlDetailsA @102
mixerGetControlDetailsW=winmm_wine.mixerGetControlDetailsW @103
mixerGetDevCapsA=winmm_wine.mixerGetDevCapsA @104
mixerGetDevCapsW=winmm_wine.mixerGetDevCapsW @105
mixerGetID=winmm_wine.mixerGetID @106
mixerGetLineControlsA=winmm_wine.mixerGetLineControlsA @107
mixerGetLineControlsW=winmm_wine.mixerGetLineControlsW @108
mixerGetLineInfoA=winmm_wine.mixerGetLineInfoA @109
mixerGetLineInfoW=winmm_wine.mixerGetLineInfoW @110
mixerGetNumDevs=winmm_wine.mixerGetNumDevs @111
mixerMessage=winmm_wine.mixerMessage @112
mixerOpen=winmm_wine.mixerOpen @113
mixerSetControlDetails=winmm_wine.mixerSetControlDetails @114
mmGetCurrentTask=winmm_wine.mmGetCurrentTask @115
mmTaskBlock=winmm_wine.mmTaskBlock @116
mmTaskCreate=winmm_wine.mmTaskCreate @117
mmTaskSignal=winmm_wine.mmTaskSignal @118
mmTaskYield=winmm_wine.mmTaskYield @119
mmioAdvance=winmm_wine.mmioAdvance @120
mmioAscend=winmm_wine.mmioAscend @121
mmioClose=winmm_wine.mmioClose @122
mmioCreateChunk=winmm_wine.mmioCreateChunk @123
mmioDescend=winmm_wine.mmioDescend @124
mmioFlush=winmm_wine.mmioFlush @125
mmioGetInfo=winmm_wine.mmioGetInfo @126
mmioInstallIOProc16=winmm_wine.mmioInstallIOProc16 @127
mmioInstallIOProcA=winmm_wine.mmioInstallIOProcA @128
mmioInstallIOProcW=winmm_wine.mmioInstallIOProcW @129
mmioOpenA=winmm_wine.mmioOpenA @130
mmioOpenW=winmm_wine.mmioOpenW @131
mmioRead=winmm_wine.mmioRead @132
mmioRenameA=winmm_wine.mmioRenameA @133
mmioRenameW=winmm_wine.mmioRenameW @134
mmioSeek=winmm_wine.mmioSeek @135
mmioSendMessage=winmm_wine.mmioSendMessage @136
mmioSetBuffer=winmm_wine.mmioSetBuffer @137
mmioSetInfo=winmm_wine.mmioSetInfo @138
mmioStringToFOURCCA=winmm_wine.mmioStringToFOURCCA @139
mmioStringToFOURCCW=winmm_wine.mmioStringToFOURCCW @140
mmioWrite=winmm_wine.mmioWrite @141
mmsystemGetVersion=winmm_wine.mmsystemGetVersion @142
sndPlaySoundA=winmm_wine.sndPlaySoundA @143
sndPlaySoundW=winmm_wine.sndPlaySoundW @144
timeBeginPeriod=winmm_wine.timeBeginPeriod @145
timeEndPeriod=winmm_wine.timeEndPeriod @146
timeGetDevCaps=winmm_wine.timeGetDevCaps @147
timeGetSystemTime=winmm_wine.timeGetSystemTime @148
timeGetTime=my_timeGetTime @149
timeKillEvent=winmm_wine.timeKillEvent @150
timeSetEvent=winmm_wine.timeSetEvent @151
waveInAddBuffer=winmm_wine.waveInAddBuffer @152
waveInClose=winmm_wine.waveInClose @153
waveInGetDevCapsA=winmm_wine.waveInGetDevCapsA @154
waveInGetDevCapsW=winmm_wine.waveInGetDevCapsW @155
waveInGetErrorTextA=winmm_wine.waveInGetErrorTextA @156
waveInGetErrorTextW=winmm_wine.waveInGetErrorTextW @157
waveInGetID=winmm_wine.waveInGetID @158
waveInGetNumDevs=winmm_wine.waveInGetNumDevs @159
waveInGetPosition=winmm_wine.waveInGetPosition @160
waveInMessage=winmm_wine.waveInMessage @161
waveInOpen=winmm_wine.waveInOpen @162
waveInPrepareHeader=winmm_wine.waveInPrepareHeader @163
waveInReset=winmm_wine.waveInReset @164
waveInStart=winmm_wine.waveInStart @165
waveInStop=winmm_wine.waveInStop @166
waveInUnprepareHeader=winmm_wine.waveInUnprepareHeader @167
waveOutBreakLoop=winmm_wine.waveOutBreakLoop @168
waveOutClose=winmm_wine.waveOutClose @169
waveOutGetDevCapsA=winmm_wine.waveOutGetDevCapsA @170
waveOutGetDevCapsW=winmm_wine.waveOutGetDevCapsW @171
waveOutGetErrorTextA=winmm_wine.waveOutGetErrorTextA @172
waveOutGetErrorTextW=winmm_wine.waveOutGetErrorTextW @173
waveOutGetID=winmm_wine.waveOutGetID @174
waveOutGetNumDevs=winmm_wine.waveOutGetNumDevs @175
waveOutGetPitch=winmm_wine.waveOutGetPitch @176
waveOutGetPlaybackRate=winmm_wine.waveOutGetPlaybackRate @177
waveOutGetPosition=winmm_wine.waveOutGetPosition @178
waveOutGetVolume=winmm_wine.waveOutGetVolume @179
waveOutMessage=winmm_wine.waveOutMessage @180
waveOutOpen=winmm_wine.waveOutOpen @181
waveOutPause=winmm_wine.waveOutPause @182
waveOutPrepareHeader=winmm_wine.waveOutPrepareHeader @183
waveOutReset=winmm_wine.waveOutReset @184
waveOutRestart=winmm_wine.waveOutRestart @185
waveOutSetPitch=winmm_wine.waveOutSetPitch @186
waveOutSetPlaybackRate=winmm_wine.waveOutSetPlaybackRate @187
waveOutSetVolume=winmm_wine.waveOutSetVolume @188
waveOutUnprepareHeader=winmm_wine.waveOutUnprepareHeader @189
waveOutWrite=winmm_wine.waveOutWrite @190
Binary file not shown.
+136
View File
@@ -0,0 +1,136 @@
#!/usr/bin/env bash
set -euo pipefail
scriptDir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
testRoot="$(mktemp -d)"
trap 'rm -rf "$testRoot"' EXIT
run_installer() (
export WINEPREFIX="${caseRoot}/prefix" cache="${caseRoot}/cache"
game=Ambush
mkdir -p "$cache"
install_wine_bottle() { [[ "$caseName" != bottle-failure ]]; }
download() {
[[ "$1" == https://altaistudiogames.com/ambush.zip ]] || return 2
[[ "$caseName" != download-failure ]]
}
# shellcheck disable=SC2329 # Invoked by the extracted production progress helper.
unzip() {
[[ "$*" == "-o -d $WINEPREFIX/drive_c/Program Files $cache/ambush.zip" ]] || return 2
if [[ "$caseName" == archive-extraction ]]; then
command unzip "$@"
return
fi
[[ "$caseName" != extraction-failure ]]
}
# Keep the real pipeline: a successful dialog must not mask unzip failure.
# shellcheck disable=SC2329 # Invoked by the extracted production progress helper.
agm_progressbox() { cat > /dev/null; }
# shellcheck disable=SC1090 # Extract only the helper, avoiding AGM startup.
source <(sed -n '/^install_with_progress() {/,/^}/p' "$scriptDir/.includes/functions.sh")
cp() {
[[ "$caseName" != copy-failure ]] || return 1
command cp "$@"
}
mv() {
[[ "$caseName" != backup-failure ]] || return 1
command mv "$@"
}
ln() {
if [[ "$caseName" == timer-link-failure && "${*: -1}" == */winmm_wine.dll ]] ||
[[ "$caseName" == speech-link-failure && "${*: -1}" == */nvdaControllerClient64.dll ]]; then
return 1
fi
command ln "$@"
}
agm_msgbox() { echo "$*" >> "${caseRoot}/messages"; }
add_launcher() {
[[ "$WINEARCH" == win64 && "$winVer" == win10 && "$game" == Ambush ]] || return 2
[[ "$1" == 'c:\Program Files\ambush\Ambush.exe' && "$2" == 'export WINEDLLOVERRIDES=winmm=n,b' ]] || return 2
echo launcher >> "${caseRoot}/launchers"
}
# shellcheck source=.install/Ambush.sh
source "$scriptDir/.install/Ambush.sh"
)
check_case() {
local caseName="$1" expectedStatus="$2" expectedLaunchers="$3"
local caseRoot ambushDir actualStatus=0 actualLaunchers=0
caseRoot="$(mktemp -d "${testRoot}/case.XXXXXX")"
ambushDir="${caseRoot}/prefix/drive_c/Program Files/ambush"
mkdir -p "$ambushDir" "${caseRoot}/prefix/drive_c/windows/system32"
# An existing executable must not hide a failed reinstallation.
if [[ "$caseName" == archive-extraction ]]; then
mkdir -p "${caseRoot}/cache"
# Match the paths in the current upstream ZIP, including lowercase ambush/.
python3 - "${caseRoot}/cache/ambush.zip" <<'PY'
import sys
import zipfile
with zipfile.ZipFile(sys.argv[1], 'w') as archive:
archive.writestr('ambush/Ambush.exe', 'executable')
archive.writestr('ambush/nvdaControllerClient64.dll', 'original-client\n')
PY
else
echo executable > "$ambushDir/Ambush.exe"
echo original-client > "$ambushDir/nvdaControllerClient64.dll"
fi
echo wine-timer > "${caseRoot}/prefix/drive_c/windows/system32/winmm.dll"
case "$caseName" in
missing-executable) rm "$ambushDir/Ambush.exe" ;;
missing-wine-timer) rm "${caseRoot}/prefix/drive_c/windows/system32/winmm.dll" ;;
esac
run_installer || actualStatus=$?
if [[ "$caseName" == repeat-installation && "$actualStatus" == 0 ]]; then
run_installer || actualStatus=$?
fi
if [[ -f "${caseRoot}/launchers" ]]; then
actualLaunchers="$(wc -l < "${caseRoot}/launchers")"
fi
[[ "$actualStatus" == "$expectedStatus" && "$actualLaunchers" == "$expectedLaunchers" ]] || {
echo "FAIL: $caseName (status $actualStatus, launchers $actualLaunchers)" >&2
exit 1
}
if [[ "$expectedStatus" == 0 ]]; then
cmp "$ambushDir/winmm.dll" "$scriptDir/game-scripts/ambush-winmm/winmm.dll"
[[ -L "$ambushDir/winmm_wine.dll" && -f "$ambushDir/winmm_wine.dll" ]]
[[ -L "$ambushDir/nvdaControllerClient64.dll" ]]
[[ "$(cat "$ambushDir/nvdaControllerClient64.dll")" == original-client ]]
elif [[ "$caseName" == speech-link-failure ]]; then
[[ "$(cat "$ambushDir/ambush-nvda-client64.orig")" == original-client ]]
else
[[ ! -L "$ambushDir/nvdaControllerClient64.dll" ]]
[[ "$(cat "$ambushDir/nvdaControllerClient64.dll")" == original-client ]]
fi
echo "PASS: $caseName"
}
for caseName in bottle-failure download-failure extraction-failure missing-executable \
missing-wine-timer copy-failure timer-link-failure backup-failure speech-link-failure; do
check_case "$caseName" 1 0
done
check_case successful-installation 0 1
check_case repeat-installation 0 2
check_case archive-extraction 0 1
# Exercise only the CLI install dispatch, without running startup or Wine.
dispatchFile="${testRoot}/install-dispatch.sh"
sed -n '/^if \[\[ "$noninteractiveInstall" == "true" \]\]; then/,$p' \
"$scriptDir/audiogame-manager.sh" > "$dispatchFile"
mkdir -p "${testRoot}/dispatch/.install"
cat > "${testRoot}/dispatch/.install/Example Game.sh" <<'EOF'
[[ "$game" == 'Example Game' ]] || exit 1
echo "$game" > "$dispatchResult"
EOF
(
scriptDir="${testRoot}/dispatch"
export noninteractiveInstall=true
export selectedGameName='Example Game'
export dispatchResult="${testRoot}/title"
# shellcheck disable=SC2329 # Invoked by the extracted CLI dispatch.
agm_msgbox() { :; }
# shellcheck disable=SC1090 # Only the production CLI dispatch, extracted above.
source "$dispatchFile"
)
[[ "$(cat "${testRoot}/title")" == 'Example Game' ]]
echo 'PASS: CLI installer receives the launcher title'