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).

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 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 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 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:



#!/bin/sh XEPHYR_BIN=/usr/bin/Xephyr

WINE_BIN=/usr/bin/wine

WINPROG_BIN=/path/to/windows/program.exe

X11VNC_BIN=/usr/bin/x11vnc

VNCVIEWER_BIN=/usr/bin/vncviewer

XDISPLAY=:5 # start Xephyr in background

# note: *with* GLX extension wine crashs sometimes

${XEPHYR_BIN} -once -screen 640x480 -extension GLX ${XDISPLAY} &

XEPHYR_PID=$!

sleep 2 # start wine

DISPLAY=${XDISPLAY} ${WINE_BIN} "${WINPROG_BIN}" &

WINE_PID=$! # start VNC server

${X11VNC_BIN} -localhost -scale 2:nb -display :5 &

VNCSERVER_PID=$!

sleep 3 # RealVNC

## ${VNCVIEWER_BIN} -FullColor -ZlibLevel 0 localhost &

# TightVNC

${VNCVIEWER_BIN} -compresslevel 0 -nojpeg localhost &

# keep for both RealVNC and TightVNC

VNCVIEWER_PID=$! wait ${WINE_PID}

sleep 1

kill ${VNCVIEWER_PID}

sleep 1

kill ${VNCSERVER_PID}

sleep 1

kill ${XEPHYR_PID}

