|
#!/usr/bin/env bash
|
|
# Taken directly from https://gist.githubusercontent.com/TeknoHamster/d8b2f90a1cd618074aa1e35c81e7bc4b/raw/972832a3e37ef32d255804d19aae99550ec9fb26/captureage from https://gist.github.com/TeknoHamster/d8b2f90a1cd618074aa1e35c81e7bc4b
|
|
|
|
APPID=813780
|
|
STEAM_PATH="${STEAM_PATH:-$HOME/.local/share/Steam}"
|
|
PROTON_NAME="${PROTON_NAME:-Proton - Experimental}"
|
|
|
|
export PROTON_LOG=1
|
|
export STEAMAPPS="$STEAM_PATH/steamapps"
|
|
export STEAM_COMPAT_DATA_PATH="$STEAMAPPS/compatdata/$APPID"
|
|
export STEAM_COMPAT_CLIENT_INSTALL_PATH="$STEAM_PATH"
|
|
export WINEPREFIX="$STEAM_COMPAT_DATA_PATH/pfx"
|
|
export GAME_DIR="$STEAMAPPS/common/AoE2DE"
|
|
export GAME_DIR_WIN='S:\common\AoE2DE'
|
|
export CAPTUREAGE_STATE="$WINEPREFIX/drive_c/users/steamuser/AppData/Roaming/CaptureAge/persistedState_prod.json"
|
|
export CAPTUREAGE_EXE_WIN='C:\users\steamuser\AppData\Local\Programs\CaptureAge\CaptureAge.exe'
|
|
export CAPTUREAGE_DIR_WIN='C:\users\steamuser\AppData\Local\Programs\CaptureAge'
|
|
export STEAM_COMPAT_INSTALL_PATH="$GAME_DIR"
|
|
export STEAM_COMPAT_LIBRARY_PATHS="$STEAMAPPS"
|
|
export PROTON_SET_GAME_DRIVE=1
|
|
# Adjust the path to the proton executable used by Age of Empires II
|
|
export PROTON_EXEC="${PROTON_EXEC:-$STEAMAPPS/common/$PROTON_NAME/proton}"
|
|
# export WINEDEBUG=warn+all # This is for debug logs
|
|
# export OBS_VKCAPTURE=1 # Enable this for OBS Videogame capture
|
|
|
|
prepare_prefix() {
|
|
local game_dir_win
|
|
local game_dir_escaped
|
|
|
|
game_dir_win="$GAME_DIR_WIN"
|
|
game_dir_escaped="${game_dir_win//\\/\\\\}"
|
|
|
|
mkdir -p "$WINEPREFIX/dosdevices"
|
|
ln -sfn "$STEAMAPPS" "$WINEPREFIX/dosdevices/s:"
|
|
|
|
if [ -f "$WINEPREFIX/user.reg" ]; then
|
|
GAME_DIR_ESCAPED="$game_dir_escaped" perl -0pi -e 'BEGIN{$r=$ENV{GAME_DIR_ESCAPED}} s#"Install Location"="[^"]*"#"Install Location"="$r"#g' "$WINEPREFIX/user.reg"
|
|
fi
|
|
|
|
if [ -f "$CAPTUREAGE_STATE" ]; then
|
|
tmp_state="$(mktemp)"
|
|
jq --arg dir "$game_dir_win" '.lastUsedGameDirectory = $dir' "$CAPTUREAGE_STATE" > "$tmp_state" && mv "$tmp_state" "$CAPTUREAGE_STATE"
|
|
fi
|
|
}
|
|
|
|
reg_add() {
|
|
"$PROTON_EXEC" run reg add "$@"
|
|
}
|
|
#This creates Windows registries to make the Spectate with CA button work
|
|
register_captureage() {
|
|
local protocol_command
|
|
|
|
protocol_command="\"$CAPTUREAGE_EXE_WIN\" \"%1\""
|
|
|
|
for root in HKCU\\Software\\Classes HKLM\\Software\\Classes; do
|
|
reg_add "$root\\captureage" /ve /d "URL:captureage" /f
|
|
reg_add "$root\\captureage" /v "URL Protocol" /d "" /f
|
|
reg_add "$root\\captureage\\shell\\open\\command" /ve /d "$protocol_command" /f
|
|
done
|
|
|
|
for root in HKCU HKLM; do
|
|
reg_add "$root\\Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\CaptureAge.exe" /ve /d "$CAPTUREAGE_EXE_WIN" /f
|
|
reg_add "$root\\Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\CaptureAge.exe" /v "Path" /d "$CAPTUREAGE_DIR_WIN" /f
|
|
done
|
|
}
|
|
|
|
#install capture age (only needed once). Adjust the location to point to the installer you downloaded.
|
|
#"$PROTON_EXEC" run "$PWD/CaptureAgeSetup.exe"
|
|
|
|
# run capture age
|
|
# Older version of CA:DE were installed in AppData/Local/Programs/CaptureAge . If it doesn't launch for you, check this path
|
|
prepare_prefix
|
|
register_captureage
|
|
"$PROTON_EXEC" run "C:/users/steamuser/AppData/Local/Programs/CaptureAge/CaptureAge.exe"
|
Comments