User Tools

Site Tools


planetforeveronlinuxusingwine

This is an old revision of the document!


Planet Forever on Linux using Wine

The subject of the Earth Eternal on Linux came up in chat last night, so as promised here is what you need to get up and running the client using Wine.

At the peak of its popularity, there were a 200-300 downloads of the PlayOnLinux script that eventually evolved. So while nowhere near the Windows total, there were still a few of us out there :)

The patches required are same as always needed, but this time I have combined them into a single patch. Underneath, it's still the same my “inet-address” patch that fixes the logon, and the “d3d9-hack” patch provided by PsyQ which (mostly) fixes crashes when resizing the window from its default 800×600. The latter patch was described by the author as, “The single most evil thing done to wine, ever!”. For this reason, it's best not to use Wine patched for Earth Eternal with any other applications or games.

I used Ubuntu 12.04 for this, you may have to adjust some commands for other distributions, particularly installing packages.

If there is sufficient demand, I can resurrect the old script that used to do most of this for you.

A note about Ubuntu 64 bit installations. If you are using 64bit Ubuntu 12.04, maybe 11.10 as well (which has a thing called “multi-arch”), getting Wine to compile as 32 bit is a total nightmare. The easiest option is to install a 32 bit Ubuntu 12.04 virtual machine, compile wine on that, and copy the result back your 64 bit host in the same location. Alternatively, on request I can provide a pre-compiled patched wine for most distributions (not always quickly though).

Setting Up Wine

  1. Install Wine build dependencies. On Ubuntu, this is easy :-
    sudo apt-get build-dep wine1.5
  2. Download the latest wine from http://sourceforge.net/projects/wine/files/Source/. At the time of writing this is 1.5.10, although the patch should work on most versions since 1.1.39, sometimes with tiny bits of tweaking. Grab the file named wine-1.5.10.tar.bz2
  3. Copy and paste the following into a file on your desktop called ee.patch.
    gedit ~/Desktop/ee.patch

    And now the content of this file ..

    diff -ru wine-1.5.10.orig/dlls/d3d9/tests/buffer.c wine-1.5.10/dlls/d3d9/tests/buffer.c
    --- wine-1.5.10.orig/dlls/d3d9/tests/buffer.c	2012-07-31 20:08:12.000000000 +0100
    +++ wine-1.5.10/dlls/d3d9/tests/buffer.c	2012-08-08 18:29:29.410660651 +0100
    @@ -120,10 +120,9 @@
     {
         switch(pool)
         {
    -        case D3DPOOL_DEFAULT: return "D3DPOOL_DEFAULT";
             case D3DPOOL_SYSTEMMEM: return "D3DPOOL_SYSTEMMEM";
             case D3DPOOL_SCRATCH: return "D3DPOOL_SCRATCH";
    -        case D3DPOOL_MANAGED: return "D3DPOOL_MANAGED";
    +        case ( D3DPOOL_MANAGED || D3DPOOL_DEFAULT) : return "D3DPOOL_MANAGED";
             default:
             return "unknown pool";
         }
    diff -ru wine-1.5.10.orig/dlls/ws2_32/socket.c wine-1.5.10/dlls/ws2_32/socket.c
    --- wine-1.5.10.orig/dlls/ws2_32/socket.c	2012-07-31 20:08:12.000000000 +0100
    +++ wine-1.5.10/dlls/ws2_32/socket.c	2012-08-08 18:29:29.410660651 +0100
    @@ -2976,11 +2976,22 @@
      */
     WS_u_long WINAPI WS_inet_addr(const char *cp)
     {
    -    if (!cp) return INADDR_NONE;
    -    return inet_addr(cp);
    +    unsigned long ulAddr = INADDR_NONE;
    +    if (cp) {
    +        ulAddr = inet_addr(cp);
    +    }
    +    /* Try and resolve by name (although the docs say the argument should
    +be an IP address) */
    +    if(cp && ulAddr == INADDR_NONE) {
    +        struct hostent *remoteHost;
    +        remoteHost = gethostbyname(cp);
    +        if (remoteHost != NULL) {
    +            return *(u_long *) remoteHost->h_addr_list[0];
    +        }
    +    }
    +    return ulAddr;
     }
     
    -
     /***********************************************************************
      *		ntohl			(WS2_32.14)
      */
    diff -ru wine-1.5.10.orig/include/d3d9types.h wine-1.5.10/include/d3d9types.h
    --- wine-1.5.10.orig/include/d3d9types.h	2012-07-31 20:08:12.000000000 +0100
    +++ wine-1.5.10/include/d3d9types.h	2012-08-08 18:29:29.414660470 +0100
    @@ -890,7 +890,7 @@
     } D3DPATCHEDGESTYLE;
     
     typedef enum _D3DPOOL {
    -    D3DPOOL_DEFAULT                 = 0,
    +    D3DPOOL_DEFAULT                 = 1,
         D3DPOOL_MANAGED                 = 1,
         D3DPOOL_SYSTEMMEM               = 2,
         D3DPOOL_SCRATCH                 = 3,
  4. Open a terminal to extract the wine source and patch it (change paths as appropriate)
    cd ~/Desktop
    tar xjf ~/Downloads/wine-1.5.10.tar.bz2
    cd wine-1.5.10
    patch -p1 < ~/Desktop/ee.patch
  5. Now build Wine. Note the use of “prefix”. You are installing a completely separate version of Wine. You can change this location, but be sure to adjust the locations in the script described later on in these instructions.
    ./configure --prefix=/opt/games/wine-ee
    make

    This will take a while. If you have a multicore machine, you can speed it up considerably by using “make -j 8” for example to use 8 threads.

  6. Now install Wine. This will install to /opt/games/wine-ee.
    sudo make install
  7. If you are building on a 32 bit VM for a 64 bit host as described above, then this is the point you want to copy all of /opt/games/wine-ee from the VM to your bit 64 bit, otherwise, skip to step 7.
    tar czf ~/wine-ee-32bit.tgz /opt/games/wine-ee

    Copy this file from the VM to the target and extract it in the root of your file system so all the files end up in the same place (/opt/games/wine-ee).

  8. Make sure “winetricks” is installed. You can get it from here - http://wiki.winehq.org/winetricks/ - or just install the one provided with your distributions if available :-
    sudo apt-get install winetricks
  9. Now you need to set up a new WINEPREFIX. Rather than interfere with the default $HOME/.wine prefix, we will create a fresh one.
    # NOTE - You will have to run these 2 commands again if you open a new terminal
    export PATH="/opt/games/wine-ee/bin:$PATH"
    export WINEPREFIX="$HOME/.ee"
    
    winetricks winxp corefonts vcrun2005 fontfix d3dx9

    Winetricks will take a short while to download install. You can cancel the “Mono” and “Gecko” dialog boxes that might pop up, you don't need them.

Setting Up The Client

  1. Download the client found elsewhere on this forum and unzip it into the new prefix.
    cd $HOME/.ee/drive_c/Program\ Files
    unzip ~/Downloads/EEClient86.zip
  2. Now create a script file in the client directory and edit it.
    cd EEClient86
    touch planetforever.sh
    chmod a+rx planetforever.sh
    gedit planetforever.sh
  3. Place the following in the script file
    #!/bin/bash
    
    if [ -L "${0}" ] ; then
        dir=$(dirname "$(readlink -f "${0}")")
    else
        dir=$(dirname "${0}")
    fi 
    cd "${dir}"
    export PATH="/opt/games/wine-ee/bin:$PATH"
    export WINEPREFIX="$HOME/.ee" 
    wine Spark.exe http://planetforevergame.com/Release/Current/EarthEternal.car
  4. Create a nice link to this script.
    sudo ln -sf ~/.ee/drive_c/Program\ Files/EEClient86/planetforever.sh /usr/local/bin/ee
  5. Start the game!
    ee

What Works

Once in game, just about everything works perfectly. Any bugs you find are likely bugs that Windows user get as well.

Known problems

  1. Window resizing. Without the patch, it will crash immediately. With the patch, it only crashes sometimes. Try to resize the window before logging in. Also, some window managers are worse than others.
  2. You will eventually be affected by a memory leak. Don't worry, it's not personal, I believe Windows users get it too.
  3. Changing some video options may crash. Not seen this for a while, but it used to happen a lot.

Enjoy

RR

planetforeveronlinuxusingwine.1345674857.txt.gz · Last modified: 2012/08/22 23:34 by rockfire