Rob_H
March 3rd, 2013, 04:45 AM
Here's how I got StarCraft II running under Kubuntu 12.04 with Wine 1.5 and Bumblebee (for NVIDIA Optimus laptops). Hopefully, someone else will find it useful. I will assume you've already installed Wine 1.5 (http://www.winehq.org/download/ubuntu) and Bumblebee (http://bumblebee-project.org/install.html). Make sure Bumblebee is working correctly for Linux apps before tackling Wine with it.
First, install Visual C++ runtimes:
winetricks vcrun2005 vcrun2008
Run winecfg. Go to the Libraries tab and add a new override for "msvcp90" (without the quotes). Then edit the override and select Native (Windows). The dialog should now resemble the screenshot below. Click OK to save and exit.
239666
Open a terminal and spawn a bash process under optirun. Then start the StarCraft II downloadable installer (https://us.battle.net/account/download) under Wine. The executable name might vary.
optirun bash
wine <path_to_installer>/StarCraft-II-Setup-enUS.exe
At this point, the game should install and run correctly. Note that you cannot specify the wine command as an argument to optirun because StarCraft II spawns child processes and terminates the parent process. However, it's a pain to spawn a bash process every time we want to run StarCraft, so we'll solve that problem next.
Launching StarCraft II after installation: You can't use the shortcut that the installer creates to launch StarCraft II because it won't run under Bumblebee that way. Starting it directly under optirun doesn't work either because StarCraft II's launcher spawns several child processes and terminates the launcher process, which terminates optirun, too. Instead, you need to make sure optirun is started and stays running until all the child processes have exited. I've written a little Python script that handles this.
#!/usr/bin/env python
# Run StarCraft II via Optirun. Requires jumping through hoops because
# the first executable launches a couple of subprocesses so we need to
# keep Optirun alive for those.
import sys
import subprocess
import time
import os
if 'RUNNING_WITH_OPTIRUN' in sys.argv:
home_dir = os.environ['HOME']
subprocess.check_call(['wine', home_dir + '/.wine/drive_c/Program Files (x86)/StarCraft II/StarCraft II.exe'])
# Wait for initial launcher subprocess to be called. It handles patch updates and such.
time.sleep(10)
# Keep alive until the launcher terminates.
while subprocess.Popen(['pidof', 'Blizzard Launcher.exe'], stdout=subprocess.PIPE).communicate()[0]:
time.sleep(5)
# Wait for game executable to be called.
time.sleep(5)
# Keep alive until the game executable terminates.
while subprocess.Popen(['pidof', 'SC2.exe', 'Agent.exe'], stdout=subprocess.PIPE).communicate()[0]:
time.sleep(5)
else:
# Call myself with optirun.
subprocess.check_call(['optirun', sys.argv[0], 'RUNNING_WITH_OPTIRUN'])
Save the above script as /usr/local/bin/starcraft2 (or whatever you prefer) and make it executable by running:
sudo chmod +x /usr/local/bin/starcraft2
Now you can launch StarCraft II by running:
starcraft2
Create a menu item for the script if you like. Enjoy!
First, install Visual C++ runtimes:
winetricks vcrun2005 vcrun2008
Run winecfg. Go to the Libraries tab and add a new override for "msvcp90" (without the quotes). Then edit the override and select Native (Windows). The dialog should now resemble the screenshot below. Click OK to save and exit.
239666
Open a terminal and spawn a bash process under optirun. Then start the StarCraft II downloadable installer (https://us.battle.net/account/download) under Wine. The executable name might vary.
optirun bash
wine <path_to_installer>/StarCraft-II-Setup-enUS.exe
At this point, the game should install and run correctly. Note that you cannot specify the wine command as an argument to optirun because StarCraft II spawns child processes and terminates the parent process. However, it's a pain to spawn a bash process every time we want to run StarCraft, so we'll solve that problem next.
Launching StarCraft II after installation: You can't use the shortcut that the installer creates to launch StarCraft II because it won't run under Bumblebee that way. Starting it directly under optirun doesn't work either because StarCraft II's launcher spawns several child processes and terminates the launcher process, which terminates optirun, too. Instead, you need to make sure optirun is started and stays running until all the child processes have exited. I've written a little Python script that handles this.
#!/usr/bin/env python
# Run StarCraft II via Optirun. Requires jumping through hoops because
# the first executable launches a couple of subprocesses so we need to
# keep Optirun alive for those.
import sys
import subprocess
import time
import os
if 'RUNNING_WITH_OPTIRUN' in sys.argv:
home_dir = os.environ['HOME']
subprocess.check_call(['wine', home_dir + '/.wine/drive_c/Program Files (x86)/StarCraft II/StarCraft II.exe'])
# Wait for initial launcher subprocess to be called. It handles patch updates and such.
time.sleep(10)
# Keep alive until the launcher terminates.
while subprocess.Popen(['pidof', 'Blizzard Launcher.exe'], stdout=subprocess.PIPE).communicate()[0]:
time.sleep(5)
# Wait for game executable to be called.
time.sleep(5)
# Keep alive until the game executable terminates.
while subprocess.Popen(['pidof', 'SC2.exe', 'Agent.exe'], stdout=subprocess.PIPE).communicate()[0]:
time.sleep(5)
else:
# Call myself with optirun.
subprocess.check_call(['optirun', sys.argv[0], 'RUNNING_WITH_OPTIRUN'])
Save the above script as /usr/local/bin/starcraft2 (or whatever you prefer) and make it executable by running:
sudo chmod +x /usr/local/bin/starcraft2
Now you can launch StarCraft II by running:
starcraft2
Create a menu item for the script if you like. Enjoy!