User Tools

Site Tools


planetforeveronlinuxusingwinemanual

This is an old revision of the document!


Planet Forever On Linux Using Wine - Manual Patch Method

This patch has recently been improved. After spending months living with 3 or 4 warps in one session causing the client to crash due to a memory leak, I decided to sit down and try and find an alternative. I am pleased to say I have. A nice side effect is that the window resizing issue appears to have completely gone away :) However, you will still have the same eventual memory issue that Windows users have.

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

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.17, 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.17.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 -crB wine-1.5.17.orig/dlls/wined3d/device.c wine-1.5.17/dlls/wined3d/device.c
    *** wine-1.5.17.orig/dlls/wined3d/device.c	2012-10-26 19:12:40.000000000 +0100
    --- wine-1.5.17/dlls/wined3d/device.c	2012-11-04 14:17:29.457321843 +0000
    ***************
    *** 4990,4997 ****
          LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry)
          {
              TRACE("Enumerating resource %p.\n", resource);
    !         if (FAILED(hr = callback(resource)))
    !             return hr;
          }
      
          /* Is it necessary to recreate the gl context? Actually every setting can be changed
    --- 4990,4999 ----
          LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry)
          {
              TRACE("Enumerating resource %p.\n", resource);
    !         if (FAILED(hr = callback(resource))) {
    ! 	    ERR("Failed resource %p.\n", resource);
    !             //return hr;
    ! 	}
          }
      
          /* Is it necessary to recreate the gl context? Actually every setting can be changed
    diff -crB wine-1.5.16.orig/dlls/ws2_32/socket.c wine-1.5.16/dlls/ws2_32/socket.c
    *** wine-1.5.16.orig/dlls/ws2_32/socket.c	2012-10-26 19:12:40.000000000 +0100
    --- wine-1.5.16/dlls/ws2_32/socket.c	2012-11-04 14:17:13.613520668 +0000
    ***************
    *** 3079,3089 ****
       */
      WS_u_long WINAPI WS_inet_addr(const char *cp)
      {
    !     if (!cp) return INADDR_NONE;
    !     return inet_addr(cp);
      }
      
    - 
      /***********************************************************************
       *		ntohl			(WS2_32.14)
       */
    --- 3079,3100 ----
       */
      WS_u_long WINAPI WS_inet_addr(const char *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)
       */
    Only in wine-1.5.16/dlls/ws2_32: socket.c.orig
  4. Open a terminal to extract the wine source and patch it (change paths as appropriate)
    cd ~/Desktop
    tar xjf ~/Downloads/wine-1.5.16.tar.bz2
    cd wine-1.5.16
    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. You will eventually be affected by a memory leak. Don't worry, it's not personal, Windows users get it too.
  2. Changing some video options may crash. Not seen this for a while, but it used to happen a lot.
planetforeveronlinuxusingwinemanual.1354378195.txt.gz · Last modified: 2012/12/01 16:09 by rockfire