…with an open minded approach

Posts tagged “bumblebee

Half life 2, wine and optirun (bumblebee)

UPDATE: Comments haver launcher-scripts for Starcraft2 made by arda7an

UPDATE2: If you dont care about the details, then just try a broad solution like: “optirun bash” and then launch your game

 

To run Half life 2, in a laptop with a Nvidia Optimus graphic card technology, under linux it’s necessary to use bumblebee.

Bumblebee, has a command “optirun <program>” which allows to run a <program> using the discrete nvidia card.

However, optirun will stop when <program> terminates.

That is ok with most programs, but when a game has a launcher, then “optirun <launcher>” will make the launcher program start, and in turn, the launcher program will call another child-program (which is normally the game itself), and after the child-program is started, the launcher program will terminate, leaving the child-program executing by itself.

When the launcher terminates, the optirun will  stop using the nvidia discrete card, and so, the child-program still running will crash with an error like:

  

    XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server “:8”
     after 7 requests (7 known processed) with 0 events remaining.

Half life 2, is one of such games, where you cannot call the games-executable directly, because you *have* to use a launcher.

So to fix-it, I made a script which will not terminate with the launcher, but will wait untill the child-program (“hl2.exe”  for Half Life 2) ends.

Using this script for optirun will then allow for optirun to remain executing all along while the child-program is running (even after the launcher ends).

The script basically:

– exec’utes itself using optirun $0

– calls “wine Launcher.exe”

(in the backstage, Launcher.exe will launch a child-process names “hl2.exe” and shortly after, “Launcher.exe” will terminate, leaving “hl2.exe” executing by itself)

– after the Launcher.exe process terminates, get the pid-of-hl2

– wait while “hl2.exe” is running (enjoy your game 🙂 )

– after “hl2.exe” terminates, exit

And here is the script

It took me some hours to get this polished, so I leave it here in case it helps someone 🙂  (if it does, leave a comment, it cheers up 🙂 )