Thomas Fischer's Weblog

Life, Linux, LaTeX

Archive for February 2009

Enlarge Fullscreen Programs in Wine

with 8 comments

Back in the good old days, PC games used a resolution of 320×200, 640×480, or maybe 800×600 for the game play. This was even true for Windows games. Then it was common to have a 15″ CRT monitor which could display a large number of different resolutions with only little loss in quality.

Today, we have nice and shiny LCD displays, which are perfect for common office tasks. But with a horizontal resolution of e.g. 1600 pixel, you have a problem when playing these old games. Basically, you have two options when running your games with Wine: Scale the game’s small resolution to your display’s physical resolution (which looks ugly depending on the interpolation and the display’s aspect ration, e.g. widescreen displays) or run the game in a small window which makes a game designed for fullscreen displaying as large as your palm. No fun playing games here…

As far as I know, there is no possibility to scale a Windows program in Wine to make it more readable for high-resolution displays. However, I was able to create an ugly hack which allows us to “zoom” into these programs. The basic idea is to set up a dedicated X server with a fixed resolution for the Windows program and use a VNC connection (which can scale images) to get an enlarged view on this program.

If you like to follow the examples below, you will need to have the following programs installed:

  • Xephyr, which is part of your X server installation
  • Wine, installed and configured to run programs fullscreen (deselect “Emulate a virtual desktop” in winecfg)
  • x11vnc
  • RealVNC, TightVNC, or any other VNC client (server component not required here)

Most distributions such as Gentoo Linux provide packages for above programs.

Getting started

To run Windows programs within a scaled VNC session, the following four easy steps are neccessary. You can start each program in the background by appending an ampersand (&) or opening a terminal (simplifies debugging if something doesn’t work).

  1. Start Xephyr to initiate a nested X server session. Set the resolution to match the requirements of your game (here, it is set to 640×480). I observed that some programs crash if the GLX extension is activated, so I disabled it here. The display number is set to 5 (arbitrarily).
    Xephyr -once -screen 640x480 -extension GLX :5
  2. Start Wine and your Windows program. Take care to use the display provided by the new Xephyr instance.
    DISPLAY=:5 wine path/to/your/windows/program
  3. Start the VNC server which attachs to Xephyr’s display. Only connections from localhost will be accepted (for security purposes) and the scaling factor will be set to 2 (change to other factor to match your requirements). Option “:nb” speeds up the scaling.
    x11vnc -localhost -scale 2:nb -display :5
  4. Start the VNC client which connects to the server (the following example is for RealVNC).
    vncviewer -FullColor -ZlibLevel 0 localhost

Well, this is rather cumbersome, but it works 🙂

Shell script

Here is a shell script which performs above operations:



# start Xephyr in background
# note: *with* GLX extension wine crashs sometimes
${XEPHYR_BIN} -once -screen 640x480 -extension GLX ${XDISPLAY} &
sleep 2

# start wine

# start VNC server
${X11VNC_BIN} -localhost -scale 2:nb -display :5 &
sleep 3

# RealVNC
## ${VNCVIEWER_BIN} -FullColor -ZlibLevel 0 localhost &
# TightVNC
${VNCVIEWER_BIN} -compresslevel 0 -nojpeg localhost &
# keep for both RealVNC and TightVNC

wait ${WINE_PID}
sleep 1
sleep 1
sleep 1
kill ${XEPHYR_PID}

Written by Thomas Fischer

February 14, 2009 at 14:50

Posted in Linux

Tagged with ,