Thomas Fischer's Weblog

Life, Linux, LaTeX

Enlarge Fullscreen Programs in Wine

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


#!/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}

About these ads

Written by Thomas Fischer

February 14, 2009 at 14:50

Posted in Linux

Tagged with ,

4 Responses

Subscribe to comments with RSS.

  1. Are you using the non-proprietary drivers when doing this? I tried with the nvidia binary driver and GLX is shown to be missing on the respective display (per wine and glxinfo).

    I’m using whatever version of Xephyr that comes with Ubuntu Intrepid 64bit.

    Richie

    April 14, 2009 at 22:00

  2. I’m not an X expert to answer your this question. You can do two things to find out more on why it does not work. First, try to run winecfg with my script. If it gets magnified, the whole Xephyr/VNC stuff works in general. Second, try to run your Windows program in plain Wine, i.e. without any of the tips shown above. Depending on the output of these tests you know where to search for your problem’s origin.

    Thomas Fischer

    May 4, 2009 at 20:17

  3. Wow, guys, don’t jump through hoops here. Just get Compiz working and play around with the “Enhanced Zoom Desktop” plugin. Set the plugin to restrain your mouse to the zoomed area.

    Daniel

    July 7, 2009 at 10:14

  4. 4 years later, your post is still relevant. Works great for me. The only change is that I use ‘vinagre –fullscreen’ for the VNC client. One might also want to use ‘–scale 1080/480′ (depending on your screen resolution) to maximize the window size.

    Udi

    October 9, 2013 at 1:58


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: