Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Wine
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Wine
This is the place for questions about using Windows programs under Linux using Wine, including productivity software, games, and anything else.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old June 8th, 2008   #1
calcfreak83
First Cup of Ubuntu
 
Join Date: Jun 2008
Beans: 8
Smile Pimping StarCraft on a Widescreen Display

if any of you have ever tried running StarCraft on a widescreen display, you'll know what I'm talking about. Either you can run Starcraft in windowed mode, and be forced to squint at the 640x480 display, or you can try and play in fullscreen mode, without the bottom third of your screen.
Here I show the ordinary user how to play StarCraft the way it was meant to be played.

The secret to having StarCraft play in fullscreen mode, is X. If you start StarCraft in a custom XServer with its own resolution, you can get it to display the full screen.

Open /etc/X11/xorg.conf in your favorite editor, and add the follow lines:
Code:
Section "ServerLayout"
    Identifier     "SCLayout"
    Screen      0  "StarCraft Screen"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Section "Screen"
	Identifier     "StarCraft Screen"
	Device         "Device0"
    Monitor        "StarCraft Monitor"
    DefaultDepth    24
    SubSection     "Display"
        Virtual     640 480
        Depth       24
        Modes      "640x480@60" "1280x800@50"
    EndSubSection
EndSection

Section "Monitor"
    Identifier     "StarCraft Monitor"
    VendorName     "Plug 'n' Play"
    ModelName      "Plug 'n' Play"
    Gamma           1
    ModeLine       "640x480@60" 25.2 640 656 752 800 480 490 492 525  -hsync -vsync
EndSection
KeyBoard0 is your keyboard, Device0 is your graphics card, and Mouse0 is your mouse. You should replace these values with the actual values from your xorg.conf

Next, we must change a line of /etc/X11/Xwrapper.config:
change the line
Code:
allowed_users=console
to:
Code:
allowed_users=anybody
this allows anybody to start a new Xserver, even from within an xserver. This shouldn't be a security flaw, unless your running a mainframe with thinside clients, but then you probably wouldn't be try to play StarCraft, would you?
Next, create a text file called scstart. Paste the following in:
Code:
#!/bin/sh
X :1 -layout SCLayout -ac &
XPID=$!
sleep 2
DISPLAY=:1 wine $HOME/.wine/drive_c/\
Program/Files/Starcraft/StarCraft.exe -- /usr/bin/X :1 -layout SCLayout 
sleep 1
kill $XPID
This is the basic launcher for StarCraft. Later on, I'll show you how to pimp it for extra features, but this is the basic launcher.
If you want to switch back to your desktop in the midst of a zerg rush, you can press Ctrl + Alt + F7. To switch back, press Ctrl + Alt + F8.


This is a pretty basic launcher. You'll notice on glaring problem when using this, though. You can't change the volume. The program that handles you pushing the volume buttons is a part of Gnome, and we didn't launch that. Fortunately there is a way around the problem.
install the xbindkeys package:
Code:
sudo apt-get install xbindkeys
xbindkeys is a nifty little program. It binds specific keys or key codes to commands. I'll show you how to set it up.
Start by creating a default config file.
Code:
xbindkeys --defaults > .scbind
We are going to tell xbindkeys to use a custom config file, so if you ever decide to use xbindkeys for some other purpose, you can keep your StarCraft commands separate.
Now we have to determine what the key codes for the volume keys are. Gnome sometimes messes with the keycodes, especially for volume control, so to be extra safe, we are going to find our keycodes from a recovery console. Logout, change the session type to recovery console, and log back in. You will be presented with a console in the lower righthand corner. To type in it, your mouse must be over the terminal. Type in:
Code:
xbindkeys -f $HOME/.scbind -mk
Now press the key combos for volume up, volume down, and mute/unmute. xbindkeys should reply saying something like:
Code:
Press combination of keys or/and click under the window.
You can use one of the two lines after "NoCommand"
in $HOME/.xbindkeysrc to bind a key.

--- Press "q" to stop. ---
"(Scheme function)"
    m:0x0 + c:160
the last line is the important one. It is the keycode for whatever key you just pressed (In my case, mute/unmute). Open up .scbind, and add following lines:
Code:
"amixer set Master toggle"
(mute/unmute keycode)
"amixer set Master 6+"
(volume up keycode)
"amixer set Master 6-"
(volume down keycode)
where the stuff in the parentheses are the keycodes xbindkeys returned.
Now add the following line to scstart under "sleep 2":
Code:
xbindkeys --display :1 -f $HOME/.scbind
There you have it! Volume control for StarCraft. The xbindkeys program is extremely powerful. With a little extra effort, you could have media player controls in StarCraft, this is left as an excercise to the reader (Always wanted to say that! ), while the idea of launching a program in a separate X Server could be applied to any troublesome game.


So long and thanks for all the fish!
calcfreak83 is offline   Reply With Quote
 

Bookmarks

Tags
starcraft, wine

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:43 AM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry