Showing posts with label source. Show all posts
Showing posts with label source. Show all posts

Sunday, March 24, 2013

Play Freespace 2 natively on Fedora

Was sitting here this snowy Sunday afternoon craving for a bit of good ole space sim action. After a brief flurry of searching the web for something free, recent enough to look cool and immersive and would run under Linux or Wine I was pretty disappointed to find.. not much. (Yes there's Vendetta Online but that's only free for so long). Unfortunately the epic space sim genre is not the vibrant part of the game industry it once was.

I decided to embrace the old school and dig out my copy of Freespace 2 which is meant to run perfectly under Wine according to the Wine AppDB and I remember it very fondly, well after a straight forward Wine install it didn't work on my Fedora 18 installation currently running Wine 1.5.24.
Rather than shuffling towards the drudgery of trying to get FS2 working under Wine or the even worse experience of having to exit what I had running in the background, rebooting into Windows 7 (ugh) and trying to get it working there, I noticed during my search-fest that there's a FreeSpace Source Code Project (FCSP) that is actively developing the open source, multi-platform version of the Freespace 2 binaries called FS2Open! Sometimes life just throws you a bone.

Now it should really end there, I installed the thing, used the old disks to grab the content, had a wail of a time, went and did something else. Erm... no.
As with some open-saucy type projects, the only set of end to end instructions that seems to exist for Linux is a mighty wall of links & text. Their guide is comprehensive but many links and pages are involved and so it becomes a bit of a slog.


Therefore if you're running Fedora and want to begin playing the latest open-source, upgraded FreeSpace 2 the straight forward way then I've documented my simplified, start to finish guide for Fedora 18 for you.

What's required?

To get FS2Open going you need;

The FS2Open engine

This is the open-source Freespace 2 core engine.
Project contributor 'niffiwan' has published some pre-compiled Linux binaries for a range of distros, these are available for download HERE.
You can go ahead and download the appropriate binary for you distro but if you want the latest version of FS2Open you're best just compiling from source as covered in this walkthrough.

A launcher

Launcher software is used to configure and run FS2Open.
The FCSP project's launcher download page gives the option of 3 launcher projects. The official launcher software is called wxLauncher and appears to be the most complete.
For Linux, compilation of wxLauncher from the source code is required. The source comes with build instructions but the Linux section only covers Ubuntu. This gives you little idea of what packages you need to install on Fedora to compile the sofware.

The original game media

Your 3 original Freespace 2 CDs or ISO images.

The FS2Open media enhancements

A lot of work has been done to enhance the original game's content to bring FS2 more up to date. The extra content comes in the form of game mods packaged up in additional VP files
The official download page for the latest MediaVPs is a forum post HERE.
Rather than manually download each file in the browser we'll make things a bit more straight forward later using the command-line.

Let's go..

Firstly open a new terminal.

Install the Fedora packages you'll need

 sudo yum install SDL SDL-devel python python-markdown wxGTK wxGTK-devel openal-soft openal-soft-devel cmake gcc gcc-c++ unshield subversion libvorbis-devel automake autoconf libtheora-devel readline-devel lua-devel libpng-devel libjpeg-devel  

Create game directories under your home directory

 mkdir -p ~/Games/freespace2/temp/mvp  
 mkdir ~/Games/freespace2/temp/src  
 mkdir ~/Games/freespace2/mediavps_3612  

Get the FS2Open source code

 cd ~/Games/freespace2/temp/src  
 svn checkout svn://svn.icculus.org/fs2open/trunk/fs2_open  

Compile & install the FS2Open binaries

Note: we're not doing any optimization here, just the quick and easy get-it-going approach. The full mega-guide is HERE.
 cd fs2_open  
 ./autogen.sh  
 make  
Assuming the compilation went OK copy the binary to your freespace2 directory;
 cp code/fs2_open_* ~/Games/freespace2  


Compile & install wxLauncher

Download

Download the latest source code tarball from the wxLauncher downloads page HERE. Save the file to your Downloads directory.

Unpack

 cd ~/Downloads  
 mkdir -p wxlauncher/build  
 tar -C wxlauncher -xzf wxLauncher-*.tar.gz  

Build

 cd wxlauncher/build  
 cmake -DUSE_OPENAL=1 -DCMAKE_INSTALL_PREFIX=/usr/local ../  

You should see messages confirming a successful build which looks like this;
-- Configuring done
-- Generating done
-- Build files have been written to: /home/yourname/Downloads/wxLauncher-0.9.1/build

Compile

 make  

Install

 sudo make install  


Get the game content.

The next step is to copy the original game content from the FreeSpace 2 CDs (or ISO images if you have them) to the freespace2 directory you created earlier.

Mount the game media

Clearly there are many ways to mount disk and iso images but here's the easy to describe, simple way of doing this. It assumes as you're running Fedora then you'll be running a Gnome 3 desktop, it is the best DE after all.

If you're using CDs, insert the first disk and open it in Gnome 3's file manager 'Files' when prompted.
Alternatively if you have ISO images of the CDs it is just as easy to mount them in Gnome 3, just double-click the ISO file in 'Files' and it will be automatically mounted and appear as a device. You could mount all 3 ISOs at once this way if you wish.

Whether you're using a CD or an ISO file, just hover your mouse cursor over the device to see it's path, this example shows the path of a mounted ISO file;

These paths will be the source of your data extractions.

Extract the data to your game directory

The tool 'unshield' you installed earlier is a tool for extracting files from Microsoft CAB files with InstallShield headers.
With the first disk/ISO mounted unpack data1.cab and put all '.vp' files in your game directory as follows (substituting /path/to/your/cdoriso for the actual mounted disk/ISO path);
 cd /path/to/your/cdoriso  
 unshield -j -d ~/Games/freespace2/temp x data1.cab  
 mv ~/Games/freespace2/temp/*vp ~/Games/freespace2  
For disk/ISO 2 the required vp files are just in the root of the disk, so mount disk/ISO 2 and copy them directly;
 cd /path/to/your/cdoriso  
 cp *vp ~/Games/freespace2  
... and lastly mount CD/ISO 3, like you did with disk 2 copy the vp files directly from it's path to the game directory;
 cd /path/to/your/cdoriso  
 cp *vp ~/Games/freespace2  


Implementing the game enhancements (MediaVPs)

Download the files

The available MediaVPs are packaged up in a number of separate ZIP files.
Download them to your ~/Games/freespace2/temp/mvp directory and unpack them. All together this is a 1.2GB download.
There are cleverer ways to process this list of downloads but the following list of commands requires less explanation here. You can just copy the list of commands and paste into your terminal to perform them in a batch.
 cd ~/Games/freespace2/temp/mvp  
 wget http://mvp.fsmods.net/3612/MediaVPs_3612.zip  
 wget http://mvp.fsmods.net/3612/MV_Root_3612.zip  
 wget http://mvp.fsmods.net/3612/MV_Root_Update.zip  
 wget http://mvp.fsmods.net/3612/MV_Music_3612.zip  
 wget http://mvp.fsmods.net/3612/MV_Assets_3612.zip  
 wget http://mvp.fsmods.net/3612/MV_Assets_Update.zip  
 wget http://mvp.fsmods.net/3612/MV_Effects_3612.zip  
 wget http://mvp.fsmods.net/3612/MV_Effects_Update.zip  
 wget http://mvp.fsmods.net/3612/MV_Advanced_3612.zip  
 wget http://mvp.fsmods.net/3612/MV_AnimGlows_3612.zip  
 wget http://mvp.fsmods.net/3612/MV_RadarIcons_3612.zip  
 wget http://mvp.fsmods.net/3612/MV_CB_ANI_1.zip  
 wget http://mvp.fsmods.net/3612/MV_CB_ANI_2.zip  
A few of these file are optional but we're going full fat here.

Unzip the files

 unzip '*.zip'  

Place the VP files in their own subdirectory which you created earlier.

 mv *vp ~/Games/freespace2/mediavps_3612/  
 mv mediavps_3612/* ~/Games/freespace2/mediavps_3612  
 mv MediaVPS_3612/* ~/Games/freespace2/mediavps_3612  


Running and setting up FS2Open

Now, still in the terminal run wxlauncher;
 wxlauncher  
You'll be presented with something like this;

Nice!

Mods

Select the 'Mods' tab.
Select the MediaVps mod and select the [Activate] button.

Basic Settings

Select the 'Basic Settings' tab.
Select the browse button to set the Game Root Folder to /home/yourname/Games/freespace2.
Select the Refresh button and pick the available FS2 Open executable option.
Once you've picked the executable the video and audio settings should be picked up automatically.
If you have your joystick or gamepad plugged in, select it in the Joystick drop-down.

Advanced Settings

Select the 'Advanced Settings' tab, here's where you can experiment with the many settings available with FS2 Open.
As a starter set the Lighting Presets to 'Baseline Recommended' and the Flag Sets to 'High Memory usage features on'.

Then select/enable the following options;
Graphics section
  • Apply Lighting to Missiles
  • Enable 3D shockwaves
  • Enable Post-processing
  • Enable soft particles
  • Enable FXAA anti-aliasing
HUD section
  • Enable 3D radar
Gameplay section
  • Enable 3D warp
  • Enable flash upon warp
  • Enable 3D models for ship selection
  • Enable 3D models for weapons selection
Audio section
  • Preload mission game sounds






Finally...

There are many user-made mods available that continue the Freespace saga as well as introduce additional stories & universes including Babylon 5 and BSG. Check out the highlights panel on wxlauncher's Welcome tab, the Freespace Wiki and the project's list of user-made campaigns and total conversions list for more details on what's available.

Before you do, don't forget your joystick, hit the Play button and get stuck in...


This should at least see me through until the release of Star Citizen.

Saturday, January 10, 2009

Truecrypt 6/7 on CentOS 5

Truecrypt is available as a Red Hat/CentOS package on RPMForge, however I found that it's problematic and only supports FAT disks. I needed to use Truecrypt to encrypt a USB drive that is going to store files larger than 4GB so FAT isn't an option.
There's many conflicting accounts on various forums on how to compile Truecrypt on CentOS 5 however the most helpful was still the README provided in the source package which still required a bit of trial and error to get a working binary at the end.
Therefore here's my walkthrough on the quickest, simplest way to get Truecrypt 6.1 compiled and working on a vanilla CentOS 5 installation.
Switch user to root.
 su -  

** UPDATE - RPMForge was merged into RPMFusion which also requires the EPEL repo on RHEL/CentOS** 
Firstly setup access to the EPEL repositories, download the latest EL5 RPM from their repo. This package just installs the EL5 repo file and the required GPG keys, install it with;
 rpm -i /pathtoyour/epel-release-5??.noarch.rpm  

The RPMFusion repository provides decent packages for fuse and wxwidgets which are required by Truecrypt, this really simplifies the process as I found setting up wxwidgets & fuse from source to be a chore.
Upto date instructions for enabling this repo is at rpmfusion.org/Configuration, the correct command-line for downloading & installing free & nonfree RPMFusion repos at time of writing is;
 rpm -Uvh http://download1.rpmfusion.org/free/el/updates/5/i386/rpmfusion-free-release-5-1.noarch.rpm http://download1.rpmfusion.org/nonfree/el/updates/5/i386/rpmfusion-nonfree-release-5-1.noarch.rpm  

Once RPMFusion is setup then install the following packages and their dependencies;
 yum install gcc gcc-c++ gnome-keyring-devel kernel-devel kernel-headers wxGTK wxGTK-devel fuse fuse-devel fuse-ntfs-3g  

Next download the Mac OSX/Linux source package from the Truecrypt website at http://www.truecrypt.org/downloads2.php and save it somewhere. In this example I've saved it to /tmp.
Now in a terminal goto the location of the archive and unpack it.
 cd /tmp  
 tar xvfz “TrueCrypt 7.1a Source.tar.gz”  

... cd to the new directory containing the extracted source code
 cd truecrypt-7.1a-source  


Download the RSA Cryptoki 2.20 header files required by Truecrypt into the source directory.
 wget ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-11/v2-20/*.h   

Compile Truecrypt.
*UPDATE:  Include the NOASM flag to prevent assembly with nasm*
 make NOASM=1

The compilation process should now breeze through with no errors.
Now copy the compiled binary to /usr/bin
 cp -p Main/truecrypt /usr/bin/  
 chmod +x /usr/bin/truecrypt  

You can now start Truecypt from a root terminal.
 truecrypt  




Swapping encrypted disks between Linux & Windows systems
My requirement for Truecrypt on CentOS was for transporting sensitive data on an encrypted USB hard disk to one of our software suppliers. The guys receiving the data run Windows on their systems whereas we run HP-UX, RHEL & CentOS on our systems, Truecrypt was the only decent open-source cross-platform solution that would enable us to securely transport the encrypted data without it being too technical for the guys receiving it.
However I was a bit disappointed with how different the Windows version was to the Linux version and it became apparent that the project still needs some direction in terms of enhancing the cross-platform nature of Truecrypt.

One area where this was apparent was the filesystem options available in the GUI, the Windows version only had options to create or mount FAT32 & NTFS encrypted filesystems whereas the Linux version only had options for FAT32, Ext3 & Ext2 filesystems.
If you intend to swap an encypted disk with large file support between Linux & Windows platforms, it is not possible to do this by using the Truecrypt GUIs alone.
After some time testing the best solution for this was to use a NTFS filesystem on the USB disk and encrypt the whole filesystem on a Windows platform using the GUI.
When it comes to using the encrypted disk on the Linux platform you have to mount and dismount it with Truecrypt's command-line options as the GUI does not support this.

Examples
To mount the encrypted NTFS volume on Linux;
As root substituting the 'correctpassword', the device path & the mountpoint as appropriate...
 truecrypt -t --filesystem=ntfs-3g -k "" --protect-hidden=no --fs-options=user,users,gid-users,umask=0002 -p correctpassword /dev/sdx1 /pathto/mountpoint  

To unmount the encrypted volume;
As root...
 truecrypt -t -d /dev/sdx1  
or...
 truecrypt -d /pathto/mountpoint  

What doesn't work?
  • Truecrypt on Windows will not mount an encrypted Ext2 or Ext3 filesystem, even with an appropriate Ext filesystem driver installed.
  • Truecrypt on Linux will not mount an encrypted file container, mounting a file residing on an already mounted filesystem seems to be the problem.
  • The Linux Truecrypt GUI cannot gain elevated privileges after entering your sudo password, even if sudo/sudoers is setup correctly, therefore su to root before executing the GUI from a terminal.
  • The Truecrypt GUI on Linux cannot mount encrypted NTFS filesystems