You are here    Forums    Your creations.    MotoRacer (GoG) nl sv ru pl es fr

The forum

MotoRacer (GoG)

Author Replies
petch Sunday 11 March 2012 at 21:27

Hi all,
Here's a script to run MotoRacer from GoG. The main issue with this early 3D game is that it requires a 16bpp display (65536 colors), a setup that is now uncommon.
Under X, you need to restart the server to change bpp, but the script below can also use Xephyr to emulate a 16bpp display (with software rendering, but that should not be an issue with a modern CPU).

# Date : (2012-03-01 20-38)
# Last revision : (2012-03-11 18-55)
# Wine version used : 1.3.23
# Distribution used to test : Debian Sid (Unstable)
# Author : Pierre Etchemaite
# Script licence : GPL v.2
# Program licence : Retail
# Depend :

# Tested with install archives:
# setup_moto_racer.exe 343243943 "39ffda45ac7504064cb9bd8ca193861e"

# 1.2.3 => game crash
# 1.4 => look for OpenGL even if -NoD3D is specified
#        that's a problem when using Xephyr

[ -z "$PLAYONLINUX" ] && exit 0
source "$PLAYONLINUX/lib/sources"


TITLE="Moto Racer (GoG release)"


# 4.0.15 needed for complex POL_Shortcut_InsertBeforeWine
POL_RequiredVersion "4.0.15"

POL_SetupWindow_presentation "$TITLE" "Delphine Software / Anuman Interactive" "$URL" "Pierre Etchemaite" "$PREFIX"

POL_SetupWindow_question "$(eval_gettext 'Do you want to download $TITLE from')" "$TITLE"
[ "$APP_ANSWER" = "TRUE" ] && POL_Browser "$URL"

POL_Wine_SelectPrefix "$PREFIX"

cd $HOME
POL_SetupWindow_browse "$(eval_gettext 'Please select the setup file to run.')" "$TITLE" "$INSTALLBIN"

POL_SetupWindow_wait "$(eval_gettext 'Please wait while $TITLE is installed.')" "$TITLE"

# Prevent GoG installer from installing Acrobat Reader or Foxit in each prefix
POL_Call POL_Function_SetNativeExtension "pdf"

POL_Wine start /unix "$ARCHIVE" || POL_Debug_Fatal "$(eval_gettext 'Error while installing archive')"

POL_Wine_WaitExit "$TITLE"

# GoG work!
Set_OS winxp

POL_SetupWindow_VMS "2" # 640 x 480 x 16

# So that it doesn't ask for an audio CD
ln -sf / "$WINEPREFIX/dosdevices/d:"
cat <<_EOFINI_ > "$POL_USER_ROOT/tmp/cdrom.reg"

POL_Wine regedit.exe "$POL_USER_ROOT/tmp/cdrom.reg"
rm "$POL_USER_ROOT/tmp/cdrom.reg"

# Doesn't hurt ;)

POL_Shortcut "MotoRacer.exe" "$SHORTCUT_NAME"
POL_Shortcut_Document "$SHORTCUT_NAME" "$WINEPREFIX/drive_c/$PROGRAMFILES/ Racer/faq_uk.txt"
# Use Xephyr to emulate 16bpp display
POL_Shortcut_InsertBeforeWine "$SHORTCUT_NAME" 'TITLE="'"$TITLE"'"'
POL_Shortcut_InsertBeforeWine "$SHORTCUT_NAME" 'POL_Debug_Init'
POL_Shortcut_InsertBeforeWine "$SHORTCUT_NAME" '[ -z "$PLAYONMAC" ] && BPP="$(xdpyinfo|sed '"'"'s/^ *depth of root window: *\\([0-9]\\+\\).*$/\\1/p; d'"'"')" || BPP=16'
POL_Shortcut_InsertBeforeWine "$SHORTCUT_NAME" 'if [ $BPP != 16 ]; then'
POL_Shortcut_InsertBeforeWine "$SHORTCUT_NAME" '  [ -z "$(command -v Xephyr)" ] && POL_Debug_Fatal "$(eval_gettext '"'"'This game requires a 16bpp display (65536 colors)\\nIf you dont want to change your display setup each time,\\nyou can install Xephyr to emulate a 16bpp X server.'"'"')"'
POL_Shortcut_InsertBeforeWine "$SHORTCUT_NAME" '  POL_Debug_Message "Using Xephyr to emulate 16bit display"'
POL_Shortcut_InsertBeforeWine "$SHORTCUT_NAME" '  Xephyr :1 -screen 640x480x16 &'
POL_Shortcut_InsertBeforeWine "$SHORTCUT_NAME" '  XEPHYR_PID=$!'
POL_Shortcut_InsertBeforeWine "$SHORTCUT_NAME" '  sleep 1'
POL_Shortcut_InsertBeforeWine "$SHORTCUT_NAME" '  DISPLAY=:1'
POL_Shortcut_InsertBeforeWine "$SHORTCUT_NAME" '  trap '"'"'kill $XEPHYR_PID'"'"' EXIT'
POL_Shortcut_InsertBeforeWine "$SHORTCUT_NAME" '  cp motoracer.ini motoracer.bak'
POL_Shortcut_InsertBeforeWine "$SHORTCUT_NAME" '  sed "s/^D3D=true/D3D=false/" motoracer.bak > motoracer.ini'
POL_Shortcut_InsertBeforeWine "$SHORTCUT_NAME" 'fi'

POL_SetupWindow_message "$(eval_gettext 'MotoRacer needs a 16bpp (65536 colors) display to run.\\nUnder Linux, this script can make use of Xephyr\\nto make it run without modifying your screen configuration.\\n\\nOn first run, if you experience no sound in game go to\\nthe Options menu and increase volume.')" "$TITLE"



Edited by petch