Thursday, December 5, 2019

Getting SimCity 3000 for Linux run on modern systems

SimCity 3000 was originally ported by Loki Games to Linux, but over time the original binaries became incompatible with modern systems. For that purpose the Loki Compatibility Libraries were introduced, the linked site also contains tons of information to get other Loki to run again. Another option are the Linux Installers for Linux Gamers, which provide updated installers for a lot of old games, and - like in the case of SimCity 3000 - include all the necessary compatibility libraries already.

With SimCity I had one problem additional though. It still wouldn’t start with the following message:

Graphic System: Could not init SDL: No available video device

The problem

After some debugging with strace I noticed that the old version of SDL tries to connect to the local X server via TCP, a feature that was disabled on most distributions in the last few years; if you type ps aux | grep Xorg you will most likely see -nolisten tcp somewhere in the options, which will prevent opening that TCP port.

The solution

If you are using the LIFLG installer from above you can find a very useful helper script that allows you to play the game in a separate X server instead. Just open the file sc3u.sh in your installation directory and uncomment all the XSERVER, XSERVER_OPTIONS and XSERVER_DISPLAY lines, and in the XSERVER_OPTIONS line change -nolisten tcp to -listen tcp. You will probably also have to create a file called /etc/X11/Xwrapper.config with a line allowed_users = anybody to be able to start the X server as a user (see man Xwrapper.config for details).

Otherwise you could explicitly start your X server with -listen tcp instead. How that is done depends on your display manager. For KDM for example you can find the X options in /etc/kde/kdm/kdmrc[X-:*-Core]ServerArgsLocal, other display managers should have similar configuration files. This may not be the best option for security reasons though.

Sunday, April 19, 2015

Problembehebung Unity-Engine und Linuxspiele

English version

Problem: Maus zieht nach oben / Spiel friert nach ein paar Sekunden ein

In manchen Spielen, die die Unity-4-Engine nutzen, gibt es Probleme mit der Maus: typisch sind ein ständig nach oben flüchtender Mauszeiger und ein nach wenigen Sekunden einfrierendes Bild. Wenn man mit Alt + Tab aus dem Spiel heraus- und wieder hineinwechselt (in machen Umgebungen genügt es auch schon, im Spiel eine Maustaste zu drücken), dann funktionieren Bild / Maus wieder für wenige Sekunden. Betroffen sind davon besonders Spiele, die aus der Egoperspektive gespielt werden.

Bekannte Workarounds

Workaround Option 1
Spiele das Spiel im Fenstermodus und setze eine Auflösung, die der Auflösung des Desktops minus der Breite der Fensterdekoration entspricht (z.B. 1912×1072 statt 1920×1080) - weniger geht natürlich auch. Die Konfigurationdatei des Spiels, in der diese Einstellungen angepasst werden können, findet sich in einer Datei namens ~/.config/unity3d/<Entwicklername>/<Spielename>/prefs.

Workaround Option 2
Verwende einen anderen Fenstermanger (z.B. openbox, fluxbox, blackbox, wmaker, fvwm2, twm).

Weitere Workarounds
KDE-Nutzer können auch folgendes versuchen: http://steamcommunit … #c846965882766096888

Betroffene Spiele

Folgende noch betroffene Spiele sind mir derzeit bekannt, die Liste ist aber ziemlich sicher nicht vollständig. Ob das Problem tatsächlich auftritt hängt wohl auch von der Abtastrate der Maus und dem verwendeten Fenstermanager ab - nur weil ein Spiel in dieser Liste auftaucht heißt nicht unbedingt, dass das Problem auch überall auftritt.

  • Doorways
  • Surgeon Simulator 2013
  • Gone Home
  • Ravensword
  • MirrorMoon EP
  • Jazzpunk
  • Galak-Z
  • Nimble Quest

Problem: Im Spiel passieren seltsame Dinge

Manche Unity-4-Spiele kommen nicht mit nicht-englischen Spracheinstellungen zurecht. Typische Symptome sind Ereignisse, die nicht oder erst nach sehr langer Verzögerung ausgelöst werden, sich überlagernde Grafiken in der Benutzeroberfläche oder ein schwarzer Bildschirm nach dem Laden.

Oder in anderen Worten: Wenn ein Unity-Spiel nicht wie erwartet funktioniert, dann versuch’s einfach mal mit diesem Workaround :-)

Workaround

Starte das Spiel z.B. von der Kommandozeile mit den Variablen LC_ALL=C LANG=C, für Ravensword beispielsweise mit

LC_ALL=C LANG=C ./rs2.x86

Troubleshooting Unity engine games on Linux

Deutsche Version

Problem: Mouse constantly moving to the top / game freezes after a few seconds

Some games using the Unity 4 engine seem to be affected by a problem using the mouse: Typically the mouse is constantly moving up to the top of the screen and the picture is freezing after a few seconds. If you change to another application via Alt + Tab and change back to the game again (in some environments clicking a mouse button in the game is also sufficient), picture and mouse will move for a few seconds again. Especially games played from a first person perspective are affected.

Known workarounds

Workaround option 1
Play the game in window mode and set the resolution to your native resolution minus the width of your window decoration (e.g. 1912×1072 instead of 1920×1080) or lower. The game’s configuration file where you can adjust those settings can be found in ~/.config/unity3d/<Developer name>/<Game name>/prefs

Workaround option 2
Use another window manager (e.g. openbox, fluxbox, blackbox, wmaker, fvwm2, twm are known to work).

Other workarounds
KDE users may also try the following: http://steamcommunit … #c846965882766096888

Affected games

I’m currently aware of the following games still affected, which is almost certainly not a complete list. Whether the problem occurs or not seems to be dependent on the mouse polling rate and window manager, so just because those games are listed here doesn’t necessarily mean you will also get this problem.

  • Doorways
  • Surgeon Simulator 2013
  • Gone Home
  • Ravensword
  • MirrorMoon EP
  • Jazzpunk
  • Galak-Z
  • Nimble Quest

Problem: Strange things are happening in the game

Some Unity 4 games don’t like non english locales. Typical symptoms when this happens are events that won’t be triggered or will be triggered only after a long delay, overlapping graphical elements in the user interface or a black screen after loading the main game.

Or in other words: If a Unity based game doesn’t work as expected just try this workaround :-)

Workaround

Start the game e.g. on the command line with the variables LC_ALL=C LANG=C; for example Ravensword would be started with

LC_ALL=C LANG=C ./rs2.x86

Wednesday, February 20, 2013

Setting the default wallpaper and theme in KDE4

Google didn’t know the answer, so here’s the solution:

Edit

/usr/share/kde4/apps/desktoptheme/default/metadata.desktop

and set the appropriate entries.

You can also put this file into your Kiosk profile, the location would be

<path to your Kiosk profile>/share/apps/desktoptheme/default/metadata.desktop

then.

Thursday, November 17, 2011

Backing up your physical media (like CDs / DVDs) including copy protection

When my first floppy discs slowly went unreadable I finally decided to create images of all of my physical media. However this is not as trivial as one would think: A lot of discs (especially games) have copy protections included, so you have to plan what you want to do. My goal is always to create 1:1 copies of the original discs. Please also note that the following information is to the best of my knowledge and / or future hardware may be able to circumvent some of today’s limits (though I doubt that’s too likely).

Without copy protection

ISO / disc dumps

Both terms are equivalent - a file used for optical media (CD, DVD, BlueRay) is usually called an ISO image, while images of other media (floppies, hard discs) often have the ending .img.

These images can be easily created with the UNIX command ‘dd’:

dd if=/dev/<device_you_want_to_make_the_image_from> of=<filename_of_the_image>

Note: While various forum entries praise these commands as the panacea of all copying needs, dd is in fact quite limited or even useless when dealing with copy protections. As dd operates on the UNIX file system, it can only copy the data section of any media - additional information like subchannel data is not visible on this layer and thus cannot be saved. Additionally dd will abort at any read error (or alternatively it will write zeros or skip those sectors completely) - even the most simple protections will check if the error is still there, which wouldn’t be the case any more. And dd will only save the first track of a disc, making it worthless to create copies of Mixed Mode or Audio CDs.

BIN / CUE (/ TOC)

This format has a lot of similarities to the ISO format - in fact, if the media has only a single session the resulting .bin file is exactly the same as the ISO file from above. The difference is that it is possible to store several tracks at once: The .bin file contains the binary data, the .cue file tells where and how to split the file for the individual tracks.

While the format is not an official standard it is easy to understand and has broad support among programs (e.g. almost every burning software and DOSBox, which will also play the audio tracks; notable exceptions are Virtual Machines (VMWare, VirtualBox) which are usually limited to ISO images / disc dumps).

The following commands will create the files:

cdrdao read-cd --datafile <filename>.bin --driver generic-mmc:0x00020000 --device /dev/<CD_DEV> <filename>.toc
toc2cue <filename>.toc <filename>.cue

This first command will create this .bin file and a .toc file (instead of expected .cue file). cdrdao is using the toc files internally, but it offers the converter toc2cue to generate the more common CUE file from that. Another thing to note is the option “–driver generic-mmc:0×00020000”: Most modern CD drives will return audio data in little endian order, however most programs expect the data in big endian order. You can also switch the order later, you can find a handly little program on http://www.ssokolow.com/scripts/index.html#swab.py

Note: I couldn’t get cdrdao to create usable images of copy protected discs, though the options “–read-raw” and “–read-subchan=rw_raw” sounded like they could do so (though the later option will create BIN/CUE files which are not compatible with other programs).

Copy protected discs

Old protection systems (- ~2002)

Old protection systems are based on defect sectors and / or subchannel data. Both of them can be stored with cdrecord:

readcd dev="/dev/<CD_DEV>" -clone -nocorr retries=0 f="<filename>.raw"

New protection systems

… will not work. The reason is simple: The current hardware is not able to create images that are exactly like the original - some programs check for physical properties of the disc, others will create unreachable sectors etc.

While workarounds DO exist it, they require emulation, modified binaries or additional data on the discs. The manufacturers of copy protection mechanisms finally seem to have found a way to really prevent to be able to copy a CD…

Even if the hardware should support all those techniques one day, you still have to invent a new image format to be able to store that information in Linux and extend the burning software to use it.