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.

Saturday, January 5, 2019

Importing Android SMS on your Jolla / Sailfish device

Short version:
Just visit the project’s website and follow the 5 simple instructions (sounds like clickbait, doesn’t it? ;-)) in the file README.md.

Motivation

When I accidentally messed up my installation of Sailfish OS on my Gemini phone I had to use Android as a backup until I found the time to fix the issue. In the meantime several SMS arrived, which I obviously also wanted to see in Sailfish OS. So I started to investigate the possible options.

Development

My naive attempts to just export the database from the Android partition failed miserably due to Android’s security mechanisms. In the end I settled by using SMS Backup & Restore to get a backup of my messages. Not only does this app seem to be the de-facto standard for SMS backups, but it also provides good documentation on the format of the generated XML file.

I already used commhistory-tool to import my SMS history from Firefox OS, so commhistory-tool’s JSON format was set as the target format. And with an XML file as the source: What would be suited better for conversion than an XSL Transformations (XSLT)?

Already preinstalled on my (Linux) system is one of the most commonly used XSLT processors - xsltproc, so I decided to use that one. Unfortunately I had to find out this processor only supports XSLT 1.0, so is missing a lot of convenience functions. On the positive side it supports several EXSLT commands instead, e.g. for dates, strings and functions, which are used extensively.

I later found out that using xsltproc also has another advantage: It is also preinstalled on Sailfish OS! This completely eliminates the need for a separate PC to convert the files - you can do that directly on your Jolla / Sailfish OS phone. In the case of the Gemini I was able to just export the file to the memory card in Android, reboot into Sailfish, generate the JSON file and import it. Could this be any easier?

The XSLT file can be found on https://gitlab.com/laenion/android-sms-backup-restore-2-jolla-commhistory-tool/blob/master/android-sms-backuprestore-2-jolla-commhistory-tool.xsl, the project’s README.md file contains detailed instructions on how to use this file.