The forum

Far Cry (GoG)

Author Replies
petch Tuesday 20 December 2011 at 1:46
petch

Bonsoir tout le monde,
J'ai écris un script pour installer Far Cry (version GoG).
Il fonctionne plutôt pas mal tel-quel, les deux problèmes que j'ai rencontrés sont:
* FarCryConfigurator.exe, qui doit être un ajout récent au jeu, génère des configurations qui sont incompatibles avec Wine; Je l'ai renommé, le jeu contient déjà des écrans de configuration qui marchent bien.
* Les effets d'eau ont un aspect bizarre, avec ou sans D3D9 natif... Alors j'ai ajouté la possibilité de passer en OpenGL dans le configurateur, même si ce n'est pas officiellement supporté.
Bon jeu !

https://raw.github.com/petchema/playonlinux/master/farcry-gog
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#!/bin/bash
# Date : (2011-12-18 11-39)
# Last revision : (2011-12-20 00-41)
# Wine version used : 1.3.35
# Distribution used to test : Debian Sid (Unstable)
# Author : Pierre Etchemaite petchema@concept-micro.com
# Script licence : GPL v.2
# Program licence : Retail
# Depend :
 
[ -z "$PLAYONLINUX" ] && exit 0
source "$PLAYONLINUX/lib/sources"
 
check_install_archive () {
    FILE="$1"
    EXPECTED_NAME="$2"
    EXPECTED_SIZE="$3"
    EXPECTED_MD5="$4"
 
    POL_SetupWindow_wait "$(eval_gettext 'Checking install archive...')" "$TITLE"
    # Temporarily prevent word splitting
    OLDIFS="$IFS"
    IFS=''
    NAME="$(basename $FILE)"
    SIZE="$(stat -c%s $FILE)"
    MD5="$(POL_MD5_file $FILE)"
    IFS="$OLDIFS"
 
    if [ $SIZE -ne $EXPECTED_SIZE -o "$MD5" != "$EXPECTED_MD5" ]; then
        POL_Debug_Error "$(eval_gettext 'Install archive mismatch.\\nEither your install archive is corrupted, or is not the expected version.\\nThis script cannot guarantee that installation will work correctly. Please report success or failure to PlayOnLinux forums.')\\n$(eval_gettext 'Name:') $NAME ($(eval_gettext 'expected') $EXPECTED_NAME)\\n$(eval_gettext 'Size:') $SIZE ($(eval_gettext 'expected') $EXPECTED_SIZE)\\n$(eval_gettext 'MD5:') $MD5\\n     ($(eval_gettext 'expected') $EXPECTED_MD5)"
        POL_SetupWindow_question "$(eval_gettext 'Continue?')" "$TITLE"
        [ "$APP_ANSWER" != "TRUE" ] && POL_Debug_Fatal "$(eval_gettext 'Not the expected archive')"
    fi
}
 
 
PREFIX="FarCry_gog"
WORKING_WINE_VERSION="1.3.35"
 
TITLE="$(eval_gettext 'Far Cry (GoG release)')"
SHORTCUT_NAME="Far Cry"
SHORTCUT_DOC="$SHORTCUT_NAME - $(eval_gettext 'Manual')"
SHORTCUT_DOC14="$SHORTCUT_NAME - $(eval_gettext 'Manual') 1.4"
SHORTCUT_README="$SHORTCUT_NAME - $(eval_gettext 'Readme')"
 
SHORTCUT_EDITOR="$SHORTCUT_NAME - $(eval_gettext 'CryEngine Sandbox')"
SHORTCUT_EDITOR_DOC="$SHORTCUT_NAME - $(eval_gettext 'Editor Manual')"
 
SHORTCUT_DS_GUIDE="$SHORTCUT_NAME - $(eval_gettext 'Dedicated server guide')"
SHORTCUT_DS_MAN="$SHORTCUT_NAME - $(eval_gettext 'Using the FarCry dedicated server')"
SHORTCUT_DS_RC="$SHORTCUT_NAME - $(eval_gettext 'Server Command Table')"
 
POL_SetupWindow_Init
POL_Debug_Init
 
POL_SetupWindow_presentation "$TITLE" "Crytek Studios / Ubisoft" "http://www.gog.com/en/gamecard/far_cry" "Pierre Etchemaite" "$PREFIX"
 
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"
ARCHIVE="$APP_ANSWER"
 
# Hopefully checking first part is enough to identify uniquely the archive
check_install_archive "$ARCHIVE" setup_far_cry.exe 2607407 "964f27d319571bd614db5d1df08e1912"
#check_install_archive "${ARCHIVE%.exe}-1.bin" setup_far_cry-1.bin 2097392384 "77a792e45ba865d6bbd0ca4e5a39a2a7"
#check_install_archive "${ARCHIVE%.exe}-2.bin" setup_far_cry-2.bin 437651497 "d6c8edb29a4a1cce4e9f46774bf47eb0"
 
 
POL_SetupWindow_wait "$(eval_gettext 'Please wait while $TITLE is installed.')" "$TITLE"
 
# Associate .PDF & .RTF with native app
# http://wiki.winehq.org/FAQ#head-91bf3f0a8ccbfab8dee96f82fae2f1a489e0d243
# Do it before installing the game, so you have the possibility to open
# PDFs with Win32 reader if you choose to install it
cat <<'_EOF_' > "$REPERTOIRE/tmp/pdfrtfnativereader.reg"
[HKEY_CLASSES_ROOT\\.pdf]
@="PDFfile"
"Content Type"="application/pdf"
[HKEY_CLASSES_ROOT\\.rtf]
@="rtffile"
"Content Type"="application/rtf"
[HKEY_CLASSES_ROOT\\PDFfile\\Shell\\Open\\command]
@="winebrowser \\"%1\\""
[HKEY_CLASSES_ROOT\\rtffile\\Shell\\Open\\command]
@="winebrowser \\"%1\\""
_EOF_
POL_Wine regedit "$REPERTOIRE/tmp/pdfrtfnativereader.reg"
rm "$REPERTOIRE/tmp/pdfrtfnativereader.reg"
 
POL_Wine start /unix "$ARCHIVE" || POL_Debug_Fatal "$(eval_gettext 'Error while installing archive')"
 
POL_Wine_WaitExit "$TITLE"
 
cd "$WINEPREFIX/drive_c/$PROGRAMFILES/GOG.com/Far Cry/"
if [ $? -eq 0 ]; then
    # Disable new external configurator, as it generates setups that are
    # not compatible with Wine...
    mv "Bin32/FarCryConfigurator.exe" "Bin32/FarCryConfigurator.exe.disabled"
else
  POL_Debug_Error "$(eval_gettext 'Could not find program directory')"
fi
 
# GoG work!
Set_OS winxp
 
POL_SetupWindow_VMS "64"
  
## PlayOnMac Section
[ -n "$PLAYONMAC" ] && Set_SoundDriver "alsa"
[ -n "$PLAYONMAC" ] || Set_Managed "Off"
## End Section
 
# Doesn't hurt ;)
POL_Wine_reboot
 
LNG_DOC="$(eval_gettext 'Documentation about the game itself') (3)"
LNG_EDITOR="$(eval_gettext 'The level editor and its documentation') (2)"
LNG_DS="$(eval_gettext 'Documentation about dedicated server') (3)"
POL_SetupWindow_checkbox_list "$(eval_gettext 'What extra shortcuts should be created?')" "$TITLE" "${LNG_DOC}~${LNG_EDITOR}~${LNG_DS}" "~"
SHORTCUTS="$APP_ANSWER"
 
POL_Shortcut "FarCry.exe" "$SHORTCUT_NAME"
if echo "$SHORTCUTS" | grep -q "$LNG_DOC"; then
    POL_Shortcut "start.exe" "$SHORTCUT_README" "" "'C:/$PROGRAMFILES/GOG.com/Far Cry/Readme.txt'"
    POL_Shortcut "start.exe" "$SHORTCUT_DOC" "" "'C:/$PROGRAMFILES/GOG.com/Far Cry/Manual.pdf'"
    POL_Shortcut "start.exe" "$SHORTCUT_DOC14" "" "'C:/$PROGRAMFILES/GOG.com/Far Cry/Manual_1_4.pdf'"
fi
 
if echo "$SHORTCUTS" | grep -q "$LNG_EDITOR"; then
    POL_Shortcut "Editor.exe" "$SHORTCUT_EDITOR"
    # For some reason, association doesn't work with this space
    mv "$WINEPREFIX/drive_c/$PROGRAMFILES/GOG.com/Far Cry/Editor Manual.pdf" "$WINEPREFIX/drive_c/$PROGRAMFILES/GOG.com/Far Cry/Editor_Manual.pdf"
    POL_Shortcut "start.exe" "$SHORTCUT_EDITOR_DOC" "" "'C:/$PROGRAMFILES/GOG.com/Far Cry/Editor_Manual.pdf'"
fi
 
if echo "$SHORTCUTS" | grep -q "$LNG_DS"; then
    POL_Shortcut "start.exe" "$SHORTCUT_DS_GUIDE" "" "'C:/$PROGRAMFILES/GOG.com/Far Cry/Dedicated server guide.rtf'"
    POL_Shortcut "start.exe" "$SHORTCUT_DS_MAN" "" "'C:/$PROGRAMFILES/GOG.com/Far Cry/Using the FarCry dedicated server.rtf'"
    POL_Shortcut "start.exe" "$SHORTCUT_DS_RC" "" "'C:/$PROGRAMFILES/GOG.com/Far Cry/Server_Command_Table.pdf'"
fi
 
POL_SetupWindow_message "$(eval_gettext 'Default video settings are a bit low for modern computers,\\nremember to click on "Auto-detect" in advanced video settings;\\nIf water looks weird, lower water effect quality.')" "$TITLE"
 
POL_SetupWindow_Close
 
cat <<_EOF_ > "$REPERTOIRE/configurations/configurators/$SHORTCUT_NAME"
#!/bin/bash
[ -z "\\$PLAYONLINUX" ] && exit 0
source "\\$PLAYONLINUX/lib/sources"
export WINEPREFIX="\\$REPERTOIRE/wineprefix/$PREFIX"
export WINEDEBUG=""
 
POL_LoadVar_PROGRAMFILES
 
cd "\\$WINEPREFIX/drive_c/\\$PROGRAMFILES/GOG.com/Far Cry/" || exit 1
 
TITLE="$TITLE"
 
POL_SetupWindow_Init
POL_Debug_Init
 
[ -f system.cfg ] || POL_Debug_Fatal "\\$(eval_gettext 'Run the game once to create the configuration file!')"
 
DRIVER="\\$(sed -e 's/^r_Driver = \\"\\(.*\\)\\".*/\\1/p; d' system.cfg)"
VERBOSITY="\\$(sed -e 's/^log_Verbosity = \\"\\(.*\\)\\".*/\\1/p; d' system.cfg)"
 
POL_SetupWindow_menu_list "\\$(eval_gettext 'Pick video driver to use [experimental]:')" "\\$TITLE" "Direct3D9~OpenGL" "~" "\\$DRIVER"
NEW_DRIVER="\\$APP_ANSWER"
 
POL_SetupWindow_menu_list "\\$(eval_gettext 'Verbosity while loading maps:')" "\\$TITLE" "0~1~2~3~4~5~6~7~8" "~" "\\$VERBOSITY"
NEW_VERBOSITY="\\$APP_ANSWER"
 
if [ "\\$NEW_DRIVER" != "\\$DRIVER" -o "\\$NEW_VERBOSITY" != "\\$VERBOSITY" ]; then
    sed -i.bak -e 's/^r_Driver = ".*"/r_Driver = "'"\\$NEW_DRIVER"'"/' \\
               -e 's/^log_Verbosity = ".*"/log_Verbosity = "'"\\$NEW_VERBOSITY"'"/' \\
      system.cfg
fi
 
POL_SetupWindow_Close
exit
_EOF_
 
exit
petch Saturday 31 December 2011 at 11:24
petch

La bonne nouvelle c'est qu'il semble que les effets d'eau ont été corrigés dans Wine 1.3.36 :)

This site allows content generated by members, and we promptly remove any content that infringes copyright according to our Terms of Service. To report copyright infringement, please send a notice to dmca@playonlinux.com