Add basic Wine install and launch helpers
This commit is contained in:
@@ -125,3 +125,104 @@ get_installer() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
install_with_progress() {
|
||||||
|
local operation="$1"
|
||||||
|
local message="$2"
|
||||||
|
shift 2
|
||||||
|
|
||||||
|
case "$operation" in
|
||||||
|
unzip)
|
||||||
|
unzip -o "$@" | ui_progressbox "Game Installation" "$message"
|
||||||
|
;;
|
||||||
|
7z)
|
||||||
|
7z -y "$@" | ui_progressbox "Game Installation" "$message"
|
||||||
|
;;
|
||||||
|
cp|copy)
|
||||||
|
cp -fv "$@" | ui_progressbox "Game Installation" "$message"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
"$operation" "$@" | ui_progressbox "Game Installation" "$message"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
install_wine_bottle() {
|
||||||
|
local dep
|
||||||
|
local depsToInstall=()
|
||||||
|
|
||||||
|
check_dependencies wine wineserver winepath winetricks
|
||||||
|
|
||||||
|
if [[ -z "${WINEARCH:-}" ]]; then
|
||||||
|
export WINEARCH="win64"
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$WINEARCH" in
|
||||||
|
win64) export WINEPREFIX="${HOME}/.local/wine64" ;;
|
||||||
|
*)
|
||||||
|
ui_msgbox "Game Installer" "Game Installer" "Unsupported Wine architecture: ${WINEARCH}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
mkdir -p "$WINEPREFIX"
|
||||||
|
if [[ ! -f "${WINEPREFIX}/system.reg" ]]; then
|
||||||
|
ui_progressbox "Wine Setup" "Initializing Wine bottle" < /dev/null
|
||||||
|
DISPLAY="${DISPLAY:-}" wine wineboot -u
|
||||||
|
fi
|
||||||
|
|
||||||
|
for dep in "$@"; do
|
||||||
|
case "$dep" in
|
||||||
|
sapi|speechsdk)
|
||||||
|
depsToInstall+=(speechsdk)
|
||||||
|
;;
|
||||||
|
win7|win8|win10|corefonts|vcrun2019|isolate_home)
|
||||||
|
depsToInstall+=("$dep")
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ "${#depsToInstall[@]}" -gt 0 ]]; then
|
||||||
|
env DISPLAY="${DISPLAY:-:0}" WINETRICKS_FORCE=1 winetricks -q "${depsToInstall[@]}" \
|
||||||
|
| ui_progressbox "Wine Setup" "Installing Wine dependencies"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "${winVer:-}" ]]; then
|
||||||
|
export gameWinVer="$winVer"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
set_app_winver() {
|
||||||
|
local exePath="$1"
|
||||||
|
local winVersion="$2"
|
||||||
|
local exeName="${exePath##*\\}"
|
||||||
|
local regFile
|
||||||
|
|
||||||
|
[[ -n "$exePath" && -n "$winVersion" ]] || return 0
|
||||||
|
|
||||||
|
regFile="$(mktemp)"
|
||||||
|
cat > "$regFile" <<REGEDIT
|
||||||
|
REGEDIT4
|
||||||
|
|
||||||
|
[HKEY_CURRENT_USER\\Software\\Wine\\AppDefaults\\${exeName}]
|
||||||
|
"Version"="${winVersion}"
|
||||||
|
REGEDIT
|
||||||
|
wine regedit "$regFile"
|
||||||
|
rm -f "$regFile"
|
||||||
|
}
|
||||||
|
|
||||||
|
add_launcher() {
|
||||||
|
local wineTarget="$1"
|
||||||
|
local launcherRecipe="${launchRoot}/${gameName}.game"
|
||||||
|
|
||||||
|
[[ -n "$wineTarget" ]] || return 1
|
||||||
|
if [[ -n "${gameWinVer:-}" ]]; then
|
||||||
|
set_app_winver "$wineTarget" "$gameWinVer"
|
||||||
|
unset gameWinVer
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat > "$launcherRecipe" <<LAUNCHER
|
||||||
|
run_wine_path '${wineTarget}'
|
||||||
|
LAUNCHER
|
||||||
|
chmod 755 "$launcherRecipe"
|
||||||
|
}
|
||||||
|
|||||||
@@ -63,6 +63,20 @@ run_wine() {
|
|||||||
popd > /dev/null || return 1
|
popd > /dev/null || return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
run_wine_path() {
|
||||||
|
local wineTarget="$1"
|
||||||
|
local wineDir
|
||||||
|
local wineExec
|
||||||
|
|
||||||
|
export WINEPREFIX="${WINEPREFIX:-${HOME}/.local/wine64}"
|
||||||
|
wineserver -k 2> /dev/null || true
|
||||||
|
wineDir="$(winepath "${wineTarget%\\*}")" || return 1
|
||||||
|
wineExec="${wineTarget##*\\}"
|
||||||
|
pushd "$wineDir" > /dev/null || return 1
|
||||||
|
wine "$wineExec"
|
||||||
|
popd > /dev/null || return 1
|
||||||
|
}
|
||||||
|
|
||||||
run_native() {
|
run_native() {
|
||||||
local gameDir="$1"
|
local gameDir="$1"
|
||||||
local exeName="$2"
|
local exeName="$2"
|
||||||
|
|||||||
Reference in New Issue
Block a user