Playing StarCraft on Ubuntu 14.04 and X230

I recently got a used X230 tablet and tried to have some fun on it. StarCraft runs well with wine but cannot run on full screen. One possible solution is to open another X server following this post. But I need some tweaks for 14.04 and for touch and stylus to work.

First, one needs to add

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

to /etc/X11/xorg.conf. However, xorg.conf is no longer there by default. One can generate one following this.

One would also need to modify the line

allowed_users=console

in /etc/X11/Xwrapper.config to

allowed_users=anybody

For audio to work, one need to add current user to the audio group. Run

sudo usermod -a -G audio $USER

Some posts mentioned that one needs to reboot. But I am not certain it is a must.

Finally, create the following script and run it.

#!/bin/sh
X :1 -layout SCLayout -ac &
XPID=$!
sleep 2
xbindkeys --display :1 -f $HOME/.scbind
#pax11publish -D :1 -e
DISPLAY=:1 xsetwacom --set 10 area "3454 -41 24103 15420"
DISPLAY=:1 xsetwacom --set 11 area "348 0 2432 1569"
DISPLAY=:1 xsetwacom --set 15 area "3454 -41 24103 15420"
DISPLAY=:1 xsetwacom --set 10 TabletPCButton "off"
DISPLAY=:1 wine $HOME/tmp/StarCraft/StarCraft.exe -- /usr/bin/X :1 -layout SCLayout 
sleep 1
kill $XPID

I assume StarCraft folder is under $HOME/tmp. Modify it accordingly.

The xsetwacom lines attempt to “calibrate” the touch screen and stylus accordingly. These numbers should work well for X230. For other tablet, You may obtain this number by first changing the resolution to 800×600. Then run “Wacom Tablet”->”Calibrate…” and extract the number by typing

xsetwacom --get 10 area

Note that device “11” is the “finger touch” and ubuntu’s calibration function will only work for the stylus. But one can get the number easily by scaling the number obtained above. For example, dividing each number for devices 10 and 15 by 10 probably will work well for 11 (finger touch). But I didn’t try any other tablet pc other than X230.

Leave a Reply

Your email address will not be published. Required fields are marked *