Blzut3's Weblog

Weblog ECWolf ECWolf Wiki

Running Heretic II on Linux using a Windows CD

For some reason there does not seem to exist a patch for the Windows version of Heretic II to run it on Linux. I have, however, found a way to use the data from the Windows Heretic II CD with the Linux Heretic II demo to run Heretic II natively on Linux.


Extracting the Demo

First prep the downloaded installer for running.

$ chmod +x ./
$ mkdir -p demos/heretic2

To extract the Heretic II demo use one of the following commands based on if you're running 32 or 64-bit Linux. If 64-bit then you should use the "linux32" variant.

$ _POSIX2_VERSION=199209 ./
$ _POSIX2_VERSION=199209 linux32 ./

For completeness I will mention that the tar archive can be extracted from installer manually with "tail -n +175 | tar xvzf -" however all files within are gzip compressed making manual extraction a pain. Thanks to Stephan Sokolow for the tip!

Fetching the Full Version Data

Mount your CD drive and copy "/media/cdrom/Setup/zip/" to your Heretic II demo directory. Rename your "base" directory to "base_demo" and extract the "base" directory in the zip.If you are using 7-zip this process would be as follows:

$ mount /media/cdrom/
$ cp /media/cdrom/Setup/zip/ ./
$ mv base base-demo
$ 7za x base

Now for some strange reason the Linux version of Heretic II will not read from the pak files. Because of this we will need to extract them. I have written a small program to do this. You will need CMake and G++ to compile.

$ wget
$ tar -xvf unpak.tar.gz
$ cd unpak-src
$ cmake .
$ make
$ cp unpak ../unpak
$ cd ..
$ ./unpak base base/Htic2-0.pak base/Htic2-1.pak

Converting the Videos

In addition to being unable to read the pak files, the video format used by Heretic II can not be read. They can easily be converted by ffmpeg. The videos are located in "base/video". You can grab the bumper.mpg from the demo if you want, as far as I can tell it's the same video.

$ cd base/video
$ ffmpeg -i Bumper.smk -b 104857k -ab 192k -aspect 5:3 -ar 44100 -r 30 -bt 7000k bumper.mpg
$ ffmpeg -i Intro.smk -b 104857k -ab 192k -aspect 5:3 -ar 44100 -r 30 -bt 7000k intro.mpg
$ ffmpeg -i Outro.smk -b 104857k -ab 192k -aspect 5:3 -ar 44100 -r 30 -bt 7000k outro.mpg
$ cd ../

From the "base" directory, open "Default.cfg" and replace any occurance of "smk" with "mpg". They are on lines 236, 242, 245, and 248. When you are done, save and go back to the Heretic II directory.

Running Heretic II

Before running it may be wise to edit "Default.cfg" and set "always_grab" and "vid_fullscreen" to 0. One of the weak spots on Linux is the way desktop environments handle when a fullscreen application crashes, so I recommend starting windowed and going from there. Note that fullscreen is forced if always_grab is on so that's why both need to be changed.

You can now run the "heretic2_demo.x86" binary with the OSS compatibility wrapper. For 32-bit machines this is straight forward.

$ padsp ./heretic2_demo.x86

For 64-bit machines using the padsp script won't work directly since it will try to load the 64-bit library. Instead we will do what padsp does manually but point it to the 32-bit library.

$ LD_PRELOAD=/usr/lib/i386-linux-gnu/pulseaudio/ ./heretic2_demo.x86

Update 2016/01/23: I have no idea how I ended up with a different version of heretic2_demo.x86 than what the installer produces, but as of this update, the resulting binary will crash due to an X11 error. Simply replace that binary with the version I have and it will work. All evidence I can find suggests that the installer didn't change.

Fixing GL Renderer Crash

If you are experiencing a crash at start up with the GL renderer then open in a hex editor (I recommend okteta) and locate the following string: "GL_EXTENSIONS: %s" Change the %s to some two characters which don't contain a '%' and save. (Reference)


© 2004-2016 Braden "Blzut3" Obrzut