Saturday, August 28, 2021

Recover boot sector from floppy disks with Parity Boot Virus

I recently found some old floppies, back from the times when I was young, was using Microsoft DOS and didn’t have any real clue about computers. As a result, almost all of my floppy disks were infected with the Parity Boot Virus.

The Parity Boot Virus had the habit of overwriting the complete boot sector, i.e. the first sector of the floppy disk (if it wasn’t write protected at least). BUT it was also fair enough to create a backup copy of the boot sector and - on 3,5′’ floppy disks - put it into sector 32. See the Parity Boot Virus page on the Malware Wiki for more information.

25 years later I wanted to mount one of my floppy disk images I had backed up back then on my Linux machine and was surprised to see a lot garbage files like |úI|ë?K|.╕ - certainly not a valid file name. It turned out that sector 32 is the last sector to contain the root directory¹. And it also turned out that Linux reads all clusters and scans them for directory entries, while Windows seems to stop earlier, probably as soon as it encounters an empty file entry.

So how can you restore the original boot sector and get a clean root directory again? Simple, just call

file=myfloppy
dd if=$file count=1 skip=31 of=$file conv=notrunc seek=0
dd if=/dev/zero count=1 of=$file conv=notrunc seek=31

myfloppy can either be a physical floppy drive (e.g. /dev/fd0) or the file name of an image.

Please just make sure that sector 32 really does contain a valid boot sector - you can view the disk’s contents with hexdump -C myfloppy, check the contents between 00003e00 - 00004000. It should at least contain the label and the file system (e.g. NO NAME FAT12 in lines 3 and 4.


¹ usually, on a 3,5′’ HD floppy disk at least - see this website for an excellent disassembly of the FAT12 file system (German) and this Wikipedia article about the actual default sector size for the directory on a given floppy type if you want to know more.

Thursday, December 10, 2020

Konverting Kopete chat history to libpurple (Pidgin)

When I recently migrated from KDE4 to KDE5 (yes, Slackware did that update just a few days ago ;-)) I had to discover that no migration was done for my Kopete profile. And not only that, I suddenly had to suffer from various display errors - which had happened a few years ago already, but I forgot the solution to fix this. To make things short: I decided to finally migrate to Pidgin.

Now of course I didn’t want to loose all my chat history, but import it into Pidgin.

Fortunately Kopete is storing the log files as plain XML files, though very strange ones - who thought it was a good idea to safe something like “11 9:5:0” as a time field? Also guessing what that is supposed to say? That’s nine o’ clock and five minutes on the eleventh day of a month. Which month you ask? That’s stored in a dedicated field of course ;-)
Anyway: I’ve just written an XSLT converter again. This time it will also include a small Bash script wrapper for creating the correct directories.

Note that it will only convert Jabber and ICQ out of the box - those were the only protocols I’ve been using with Kopete. It should be trivial to add other protocols though - basically you’ll just have to find out the correct source and target directory names.

The script including a small README file can be found on https://gitlab.com/laenion/kopete2purplelog.

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

Problem: Das Spiel startet nicht mit xxx is corrupted

Falls das Spiel nicht startet (typischerweise stürzt es einfach ab oder es wird nur ein Mauszeiger auf einem schwarzen Bildschirm angezeigt) und in der Logdatei unter ~/.config/unity3d/<Entwicklername>/<Spielename>/Player.log Einträge der Art

Error (8/12/2017 6:10:57 PM) - The file '<Installationsverzeichnis>/<Spielename>/<Spielename>_Data/resources.assets' is corrupted! Remove it and launch unity again!
[Position out of bounds! 875850853 > 69016]

zu finden sind, dann muss lsb_release installiert werden, um das Programm zum Laufen zu bewegen.

Bekannte betroffene Spiele

  • Caravan
  • The Raven: Legacy of a Master Thief

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

Problem: The game doesn’t start, xxx is corrupted

If the game doesn’t start (i.e. it just crashes or only shows a cursor on a black screen) and the log file in ~/.config/unity3d/<Developer name>/<Game name>/Player.log contains messages such as

Error (8/12/2017 6:10:57 PM) - The file '<installation directory>/<Game name>/<Game name>_Data/resources.assets' is corrupted! Remove it and launch unity again!
[Position out of bounds! 875850853 > 69016]

then you will need to install lsb_release to get the game working.

Known affected games

  • Caravan
  • The Raven: Legacy of a Master Thief