perjantai 30. marraskuuta 2012

Running Windows games in MythTV

Second post coming, after a while! Nice.

This time it's about how to properly play Windows games under MythTV and wine. Or MythGame to be precise, but it's part of the system, so...

On the MythGame wiki page there was nothing about wine, but after reading the other topics and experimenting a bit, I ended up with following system:


  • I created a ~/Windows/ directory, and configured wine to use it as a D: drive. I will install all my Windows games there.
  • All launchers will be stored in a new directory, ~/Windows/conf
  • MythGame launcher for wine looks like this:
    - Player Name: Windows
    - Type: Other
    - Command: sh %s
    - ROM path: ~/Windows/conf
    - Working dir:
    - Extensions: sh
    - Uncheck the box about multiple ROMs
    
    
In the start, all launchers were just simple cd <gamedir>; wine <game.exe>, but I ended up with something better:

Often my windows games crashed, leaving the MythTV front-end broken, or had some problems with colors or resolutions. I crawled the web about launching another X session for wine games, because apparently there would be benefits:

  • If a game crashes, it doesn't screw up the front-end
  • Colors and resolution can be set independently of the front-end
  • No other programs (opengl?) running on the same X server -> better performance
  • The "Virtual desktop" in winecfg can be used (if game won't work without it) and it can be fullscreen, or if not, there is nothing on the backround anyways!
Of course it's not that easy. For some reason, launching X with only wine as a client didn't work, the new server just didn't work. But after few days of trying, I got it to work using a shell as the client.
At the same time, I figured I could use fuseiso to mount cd images automatically to ~/Windows/cdrom, which was configured as a cdrom drive in wine. This way: no hand mounting or inserting cds!
So here's an example of a working sh file to be put into ~/Windows/conf. It mounts the cd, set's resolution and launches the game. When the game ends, it
returns automatically to front-end! Neat!


#!/bin/sh

# Use FUSE to mount the cd image
fuseiso ~/Windows/Game_CD.iso ~/Windows/cdrom

# Launch new X server, with retro style (striped background, optional)
# and closing after the game is finished
# If not using NVidia gfx card, remove the & nvidia-settings ...
# And if you need to change color depth, use something like this:
# X :3 -retro -ac -terminate -depth 16
X :3 -retro -ac -terminate & nvidia-settings --load-config-only

# Forces the system to have a break for 2 seconds, X doesn't launch instantly
sleep 2

# Set correct resolution for this game, then
# launch the game on the new X display
cd ~/Windows/Game_dir/
DISPLAY=:3 WINEDEBUG=-all xterm -e "xrandr -s 800x600 && wine Game.exe"

# Unmount cdrom when done
fusermount -u ~/Windows/cdrom

Hopefully this helps others too, I think this is the only way to properly run Windows games (and why not other games too?) under Linux!

Ei kommentteja:

Lähetä kommentti