mandag den 16. november 2009

Sid Meier's Alpha Centauri on Linux

I own Sid Meier's Alpha Centauri Planetary Pack in the Linux edition from Loki. However, it unfortunately does not seem to run on a modern Linux distribution.

So I decided to make a virtual machine image of an old Linux distribution to make it work. That way I will never have to reinstall it, as long as I save the virtualized image.

So the procedure is:
1) Download Red Hat 8 (in 2 disks): ftp://ftp.gmd.de/archive.download.redhat.com/redhat/linux/8.0/en/iso/i386/psyche-i386-disc1.iso and ftp://ftp.gmd.de/archive.download.redhat.com/redhat/linux/8.0/en/iso/i386/psyche-i386-disc2.iso.

2) Create a virtual disk image:
emu-img create -f qcow2 smac_redhat8.img 5G

3) Optionally install kqemu kernel module to accelerate qemu (Red Hat 8 didn't work with kvm,presumably because my CPU is not known by Red Hat 8).

3) Install Red Hat 8 in virtual image:
qemu -cpu pentium2 -hda smac_redhat8.img -m 1024 -soundhw ac97 -cdrom psyche-i386-disc1.iso
(You change cdrom in qemu by CTRL-ALT-2 and then "change ide1-cdrom psyche-i386-disc2.iso")
Inside the redhat install just selected a generic monitor, which happened to have a default resolution of 1024x768, which happened to be the max resolution of SMAC.
Inside the finished installation you need to add "options i810_audio clocking=48000" to /etc/modules.conf , otherwise the sound will play too slowly, and in a very low pitch.

4) I think you need to tell qemu to use ALSA instead of OSS:
export QEMU_AUDIO_DRV=alsa
export QEMU_AUDIO_DAC_FIXED_FREQ=48000
export QEMU_AUDIO_ADC_FIXED_FREQ=48000


5) Install SMAC inside the virtual machine by putting my SMAC cd in the cd drive, and booting qemu with "-cdrom /dev/cdrom". I just installed SMAC as root inside the virtual machine, as the default install settings expected that. SMAC will be in the main menu under extras->games->smac.

6) Update SMAC. Since none of the mirrors the loki update tool knew worked (and I did not want to set up virtual networking), I manually fetched http://lokifiles.tuxgames.com/updates/smac/smac-6.0a-x86.run , made it into an iso image ("genisoimage -o smac_patch.iso dir_with_smac-6.0a-x86.run"), and mounted smac_patch.iso as a cdrom in qemu. You can then run smac-6.0a-x86.run (as root) to patch the SMAC installation.

7) You can the virtual machine in full screen mode by hitting CTRL-ALT-f