sse-nxmhandler-wrapper.sh 1.1 KB

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