From 7c9f4859620fa8619800031b800de8260ea22320 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Wed, 22 Apr 2026 12:06:02 -0400 Subject: [PATCH] Add basic Wine install and launch helpers --- .../.functions/game_install_functions.sh | 101 ++++++++++++++++++ .../.local/bin/stormux_launch_helpers.sh | 14 +++ 2 files changed, 115 insertions(+) diff --git a/home/stormux/.local/.functions/game_install_functions.sh b/home/stormux/.local/.functions/game_install_functions.sh index 974eb85..5361110 100755 --- a/home/stormux/.local/.functions/game_install_functions.sh +++ b/home/stormux/.local/.functions/game_install_functions.sh @@ -125,3 +125,104 @@ get_installer() { exit 1 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" < "$launcherRecipe" < /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() { local gameDir="$1" local exeName="$2"