Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #!/bin/bash
  2. #
  3. APPROOT="${0%/*}"
  4. if [ ! -d "$APPROOT" ]  ; then
  5.     echo "Use open /PATH/Diablo2.app or double click the icon in Finder"
  6.     exit 0
  7. fi
  8.  
  9. WINEROOT="$(find ${APPROOT} -type f -iname 'wine')"
  10. WINEROOT="${WINEROOT%/bin/*}" #the distribution from wine which contains the bin and lib folders
  11.  
  12. WINEPREFIX="${APPROOT}/prefix" #this is where all .wine stuff will go instead of dirtying ${HOME}
  13. DIABLODIR="$(find ${APPROOT} -iname 'Diablo II.exe' | tail -n 1)"
  14. DIABLOEXE="$(echo ${DIABLODIR} | rev | cut -f1 -d'/' | rev)"
  15. DIABLODIR="${DIABLODIR%/*}"
  16.  
  17. PATH="${PATH}:${WINEROOT}/bin/" #put wine in the path, so we dont have to invoke it absolutely
  18. DYLD_FALLBACK_LIBRARY_PATH="/usr/X11/lib:${WINEROOT}/lib"  #make sure wine is happy
  19.  
  20. export WINEPREFIX PATH DYLD_FALLBACK_LIBRARY_PATH #instead of using env, exporting variables
  21. export WINEDLLOVERRIDES="mshtml=" #diablo2 doesn't need wine gecko, so supress it:
  22.  
  23. cd "${DIABLODIR}"
  24. if [ -z "${DIABLODIR}" ] ; then
  25.     say "Diablo folder not found!  Please copy Diablo 2 folder into the Contents/MacOS"
  26. else
  27.     if [ ! -d "${WINEPREFIX}" ] ; then
  28.         say "Configuring wine... please wait."
  29.         regedit - <<END
  30. REGEDIT4
  31.  
  32. [HKEY_CURRENT_USER\Software\Wine\Explorer]
  33. "Desktop"="Default"
  34.  
  35. [HKEY_CURRENT_USER\Software\Wine\Explorer\Desktops]
  36. "Default"="800x600"
  37. END
  38.         say "Wine configured.  Don't forget to modify in-game video settings"
  39.     fi
  40. wine "${DIABLOEXE}"
  41. fi