SHARE
TWEET

swtor_fix_awesomelauncher

TamusJRoyce Mar 2nd, 2014 443 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /bin/bash
  2.  
  3. # All cudo's goes towards the original script! The added script below is purely cosmetic in comparison (in that the new part only automates a previously manual step).
  4.  
  5. unset OPTIMUS_PREFIX
  6. # In case of an optimus-enabled laptop, the use of primusrun is recommended over    optirun.
  7. # Don't uncomment this line in any other case.
  8. # OPTIMUS_PREFIX="                              primusrun"
  9.  
  10. ### BELOW HAS BEEN ADDED TO TURN OFF BIT RUNNER AND SUPPORT PLAYONLINUX ###
  11.  
  12. #Regardless of where our launcher is located, lets automatically find it and use it!  Even if this script is in a parent directory.
  13. settingslocation=`echo \'``find . -name "launcher.settings" | grep "Star Wars - The Old Republic/launcher.settings"``echo \'`
  14. launcherlocation=`echo \'``find . -name "launcher.exe" | grep "Star Wars - The Old Republic/launcher.exe"``echo \'`
  15.  
  16. if [ -z "$settingslocation" ]; then
  17.     settingslocation=`echo \'``find . -name "launcher.settings" | grep "./launcher.settings"``echo \'`
  18. fi
  19.  
  20. if [ -z "$launcherlocation" ]; then
  21.     launcherlocation=`echo \'``find . -name "launcher.exe" | grep "./launcher.exe"``echo \'`
  22. fi
  23.  
  24. #This is our main command!
  25. LAUNCHER_COMMAND="wine $launcherlocation"
  26.  
  27. #The text to replace in order to turn off bit runner!
  28. sourcetext=`echo \'`'"PatchingMode": "{ \\"swtor\\": \\"BR\\" }"'`echo \'`
  29. replacetext=`echo \'`'"PatchingMode": "{ \\"swtor\\": \\"SSN\\" }"'`echo \'`
  30.  
  31. #Is launcher.settings setup for running bit runner?
  32. cmd="grep -i $sourcetext $settingslocation"
  33. istextfound=`eval $cmd`
  34.  
  35. if [ -n "$istextfound" ]; then
  36.     echo "This will update the launcher.settings file so that bitraider is disabled!"
  37.     echo
  38.     echo "Replacing: $sourcetext"
  39.     echo "with:      $replacetext"
  40.     echo
  41.  
  42.     islaunchersettingsfixed=n
  43. fi
  44.  
  45. #Has launcher.settings had  bit runner turned off?
  46. cmd="grep -i $replacetext $settingslocation"
  47. istextfound=`eval $cmd`
  48.  
  49. if [ -n "$istextfound" ]; then
  50.     echo "This file has been updated so bitraider is disabled."
  51.     echo
  52.     echo "Ready to install!"
  53.     echo
  54.  
  55.     islaunchersettingsfixed=y
  56. fi
  57.  
  58. #If launcher.settings doesn't even have bit runner turned on or off, assume this is the first run of the launcher!
  59. #  If it runs flawlessly, there will be no need to turn off bit runner.  This script will not need to be ran again!
  60. if [ -z "$islaunchersettingsfixed" ]; then
  61.     echo "The launcher has never been ran.  Please run the launcher for the first time."
  62.     echo "Login using your user name and password.  Then run the launcher."
  63.     echo
  64.     echo "1.  If the launcher fails:  This is good! Please re-run this script. It will turn off bitraider the second time around."
  65.     echo "2.  If the launcher succeeds:  The first time, there is no need to run this script again.  Please run the installer directly next time!"
  66.     echo
  67. fi
  68.  
  69. echo "Would you like to Continue? [y/n]"
  70. read input
  71.  
  72. if [ ! $input = y ]; then
  73.     echo
  74.     echo "Thank you for using this script.  You have choosen $input which is not lower case y.  Exiting..."
  75.     echo
  76.  
  77.     exit
  78. fi
  79.  
  80. #Only backup launcher.settings and turn off bit runner in launcher.settings when bit runner is enabled.
  81. if [ $islaunchersettingsfixed = n ]; then
  82.     echo "Backing up launcher.settings to launcher.settings`date +%y%m%d_%H%M`.bak"
  83.     settingsbackuplocation="$settingslocation`date +%y%m%d_%H%M`.bak"
  84.  
  85.     #Makes a backup of launcher.settings! This only gets done when launcher.settings does not have Bit Runner disabled.
  86.     cmd="cp $settingslocation $settingsbackuplocation"
  87.     eval $cmd
  88.  
  89.     echo
  90.     echo "Making changes to launcher.settings..."
  91.  
  92.     #Removes ' from around these statements.  Sed will have its own ' around both statements.
  93.     sourcetextstring=`echo $sourcetext | sed "s|'||g"`
  94.     replacetextstring=`echo $replacetext | sed "s|'||g"`
  95.  
  96.     #Replaces the desired text in launcher.settings
  97.     cmd="sed 's|$sourcetextstring|$replacetextstring|g' $settingsbackuplocation > $settingslocation"
  98.     eval $cmd
  99.  
  100.     echo "Finished updating launcher.settings! You will now be able to use the installer to download swtor!"
  101.  
  102.     #Cleanup our local variables
  103.     unset replacetextstring
  104.     unset sourcetextstring
  105.     unset settingsbackuplocation
  106. fi
  107.  
  108. echo
  109. echo "Is your wine environment in 64 bit mode? (Choose y if unsure. If running this on playonlinux 'in 32 bit mode', choose n) [Y/n]"
  110. read specifyarch
  111.  
  112. echo
  113. echo "Would you like to configure wine to use a custom prefix? (Choose y if unsure. If running this on playonlinux, choose n) [Y/n]"
  114. read specifyprefix
  115.  
  116. # Set up a new wineprefix in the game directory, and reduce debugging to improve performance.
  117. # If you don't like it there, or running the script from somewhere else, change it.
  118. # Please note that WINEARCH=win32 is REQUIRED.
  119. if [ $specifyarch = y -o $specifyarch = Y -o $specifyarch = yes -o $specifyarch = Yes -o $specifyarch = YES ]; then
  120.     export WINEARCH=win32
  121.     export WINEDEBUG=-all
  122. fi
  123.  
  124. if [ $specifyprefix = y -o $specifyprefix = Y -o $specifyprefix = yes -o $specifyprefix = Yes -o $specifyprefix = YES ]; then
  125.     export WINEPREFIX="$( pwd )/wineprefix"
  126. fi
  127.  
  128. # Clean up after ourselves.
  129. unset settingslocation
  130. unset launcherlocation
  131.  
  132. unset islauchersettingsfixed
  133. unset specifyarch
  134. unset specifyprefix
  135. unset istextfound
  136. unset input
  137. unset cmd
  138.  
  139. ### FROM HERE ON OUT IS THE ORIGINAL SCRIPT  ###
  140.  
  141. # Check if we have swtor_fix.exe, and download it if we don't.
  142. # This can be placed anywhere on the system, and must be run parallel to the game.
  143.  
  144. if [ ! -f swtor_fix.exe ]; then
  145.     wget -O swtor_fix.exe https://github.com/aljen/swtor_fix/raw/master/swtor_fix.exe
  146. fi
  147.  
  148. # Start it parallely.
  149. wine swtor_fix.exe &
  150.  
  151. # Give it a sec to fire up.
  152. sleep 1
  153.  
  154. # Install and set up components in wineprefix.
  155. # Since that command does nothing if already ran, we need no checks there.
  156. winetricks msvcp90=native d3dx9_36 vcrun2008 msls31 winhttp
  157.  
  158. # Here we come!
  159. eval $OPTIMUS_PREFIX $LAUNCHER_COMMAND
  160.  
  161. # Since wait for swtor_fix.exe to finish.
  162. wait $!
  163.  
  164. # Clean up after ourselves.
  165. unset WINEARCH
  166. unset WINEPREFIX
  167. unset WINEDEBUG
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top