Add games/sse-nxmhandler-wrapper.sh

This commit is contained in:
Alexander Rosenberg 2024-11-14 23:19:25 -08:00
parent 2dcc8b409f
commit 342dd058ee
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730

View File

@ -0,0 +1,35 @@
#!/usr/bin/env zsh
# WARNING!! This file is not well written. It probably only works on my setup,
# with Lutris thinking it's running Skyrim from GOG, but really running MO2
local conf_file="${HOME}/.config/lutris/games/the_elder_scrolls_v_skyrim_special_edition-1703312623.yml"
local wine_ver="$(cat "${conf_file}" | yq -r ".wine.version")"
local wine_bin
if [[ -d "${HOME}/.local/share/Steam/compatibilitytools.d/${wine_ver}" ]]; then
wine_bin="${HOME}/.local/share/Steam/compatibilitytools.d/${wine_ver}/files/bin"
elif [[ -d "${HOME}/.local/share/lutris/runners/wine/${wine_ver}" ]]; then
wine_bin="${HOME}/.local/share/lutris/runners/wine/${wine_ver}/bin"
fi
local wine="${wine_bin}/wine"
local wineserver="${wine_bin}/wineserver"
let server_pid="$(pgrep -xf "${wineserver}" | head -n1)"
local server_env_arr=(${(0)"$(</proc/${server_pid}/environ)"})
typeset -A server_env
for entry in ${server_env_arr}; do
local parts=(${(ps:=:)entry})
eval "server_env[${(q)parts[1]}]=${(q)${(j:=:)${parts:1}}}"
done
for var in DISPLAY WINEPREFIX WINEFSYNC; do
export "${var}=${server_env[$var]}"
done
"${wine}" "C:\\Modding\\MO2\\nxmhandler.exe" "${@}"