Fora

MotoRacer (GoG)

Autor Odpowiedzi
petch Sunday 11 March 2012 at 21:27
petch

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).

Enjoy!
https://raw.github.com/petchema/playonlinux/dev/motoracer-gog
#!/bin/bash
# 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 petchema@concept-micro.com
# 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"

PREFIX="MotoRacer_gog"
WORKING_WINE_VERSION="1.3.23"
INSTALLBIN="setup_moto_racer.exe"

TITLE="Moto Racer (GoG release)"
URL="http://www.gog.com/en/gamecard/moto_racer"
SHORTCUT_NAME="Moto Racer"

POL_SetupWindow_Init
POL_Debug_Init

# 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 GOG.com?')" "$TITLE"
[ "$APP_ANSWER" = "TRUE" ] && POL_Browser "$URL"

POL_Wine_SelectPrefix "$PREFIX"
POL_Wine_PrefixCreate "$WORKING_WINE_VERSION"

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

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"
REGEDIT4

[HKEY_LOCAL_MACHINE\\Software\\Wine\\Drives]
"D:"="cdrom"
_EOFINI_
POL_Wine regedit.exe "$POL_USER_ROOT/tmp/cdrom.reg"
rm "$POL_USER_ROOT/tmp/cdrom.reg"

# Doesn't hurt ;)
POL_Wine_reboot

POL_Shortcut "MotoRacer.exe" "$SHORTCUT_NAME"
POL_Shortcut_Document "$SHORTCUT_NAME" "$WINEPREFIX/drive_c/$PROGRAMFILES/GOG.com/Moto 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"

POL_SetupWindow_Close

exit

Edytowane przez petch

legluondunet Friday 6 February 2015 at 14:12
legluondunet

Très intéressant ce script. Petite question: pourquoi le rendu des graphismes est-il si différent avec la version 1.3.23 de wine?

Edytowane przez legluondunet

petch Friday 6 February 2015 at 18:48
petch

Salut,

Je ne sais plus trop pourquoi j'ai pris spécifiquement cette version, alors qu'à priori la 1.3.37 était déjà sortie à l'époque, et mes notes ne le mentionnent pas non plus.

Peut-être que les versions ultérieures ont le même problème que les 1.4, ou bien il y avait une différence de performance, ou d'autres soucis... Si je me rappelle bien il y a eut des turbulences dans le support du son dans les dernières 1.3.x, j'étais peut-être simplement de mes résultats de tests avec la 1.3.23...

Ou alors tu as trouvé qu'effectivement ça marche très bien uniquement avec cette version, auquel cas la réponse doit être dans les sources de Wine ;)

legluondunet Friday 6 February 2015 at 22:16
legluondunet

Je viens de tester le script, il ne fonctionne pas sous Ubuntu. J'ai commencé à déboguer:

- la variable BPP n'est pas renseignée, la commande permettant d'obtenir le code bit des couleurs (ligne 81) ne fonctionne pas

- le jeu plante dès le démarrage dans Xephyr

Edytowane przez legluondunet