Shadowgrounds (GoG) [WIP]

Auteur Réponses
petch Mardi 27 Décembre 2011 à 2:21

Hi there,
I spent some time writing some POL script to install ShadowGrounds. The bad news is that no matter what version of Wine I tried (being recent, stable or old, including versions "known to work" according to WineHQ's AppDB), there has always been some probability (1:10 maybe?) to crash the game when displaying the map/objectives 2D panel (Tab key by default). It should be possible to complete the game by only using this panel when strictly necessary, though.
I also discovered that Linuxgamepublishing has made a Linux port of the game, and at least the demo doesn't suffer from this problem (on the other hand graphics are a little less polished, and the game comes with DRM). So it's up to you.
# Date : (2011-12-25 01-41)
# Last revision : (2011-12-27 02-10)
# Wine version used : 1.3.30
# Distribution used to test : Debian Sid (Unstable)
# Author : Pierre Etchemaite
# Script licence : GPL v.2
# Program licence : Retail
# Depend :

# Lots of crashes with 1.3.35 - pattern in flashlight (intentional?
#   not exactly the one observed in native demo though), and
#   flashlight goes thru obstacles (probably not intentional)
# Crashes with 1.3.34-vertex-blending
# Still some crashes with 1.3.34
# Still some crashes with 1.3.33
# Still some crashes with 1.3.32 (mods, special keys?)
# Still some crashes with 1.3.31
# Still some crashes with 1.3.30 (tab key?)
# Still some crashes with 1.3.29 (tab key)
# No sound out of 1.3.28, and still some crashes
# Still some crashes with 1.3.27-rawinput2 (tab key)
# Crashes woth 1.2.3 (tab key)
# Crashes with 0.9.54 (tab key)

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

check_install_archive () {

    POL_SetupWindow_wait "$(eval_gettext 'Checking install archive...')" "$TITLE"
    # Temporarily prevent word splitting
    NAME="$(basename $FILE)"
    SIZE="$(stat -c%s $FILE)"
    MD5="$(POL_MD5_file $FILE)"

    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')"


TITLE="$(eval_gettext 'ShadowGrounds (GoG release)')"
SHORTCUT_EDITOR="$SHORTCUT_NAME - $(eval_gettext 'Editor')"
SHORTCUT_DOC="$SHORTCUT_NAME - $(eval_gettext 'User manual')"
SHORTCUT_EDITOR_DOC="$SHORTCUT_NAME - $(eval_gettext 'Editor user manual')"
SHORTCUT_README="$SHORTCUT_NAME - $(eval_gettext 'Readme')"
SHORTCUT_WEAPONS="$SHORTCUT_NAME - $(eval_gettext 'Weapon chart')"


POL_SetupWindow_presentation "$TITLE" "Frozenbyte / Meridian4" "" "Pierre Etchemaite" "$PREFIX"

POL_SetupWindow_message "$(eval_gettext 'Now, the bad news. No matter what version of Wine I tried, the game\\nshowed some probability of crashing when displaying\\nthe map/objectives 2D panel. Only use it when necessary and\\nyou should be able to complete the game.\\n(If that really bothers you, the Linux version of ShadowGrounds does\\nnot have this problem).')" "$TITLE"

POL_Wine_SelectPrefix "$PREFIX"

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

check_install_archive "$ARCHIVE" setup_shadowgrounds.exe 832844096 "398af39f2b133fde083897c6c6a1c2f6"

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

# Associate .PDF & .RTF with native app
# 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"
"Content Type"="application/pdf"
"Content Type"="application/rtf"
@="winebrowser \\"%1\\""
@="winebrowser \\"%1\\""
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"

Set_OS winxp

POL_SetupWindow_VMS "128"

POL_Call POL_Install_wmp10
POL_Wine_X11Drv "GrabFullScreen" "Y"
## PlayOnMac Section
[ -n "$PLAYONMAC" ] && Set_SoundDriver "alsa"
[ -n "$PLAYONMAC" ] || Set_Managed "Off"
## End Section

# Doesn't hurt ;)

LNG_DOC="$(eval_gettext 'Documentation about the game itself') (3)"
LNG_EDITOR="$(eval_gettext 'The level editor and its documentation') (2)"
POL_SetupWindow_checkbox_list "$(eval_gettext 'What extra shortcuts should be created?')" "$TITLE" "${LNG_DOC}~${LNG_EDITOR}" "~"

POL_Shortcut "Shadowgrounds Launcher.exe" "$SHORTCUT_NAME"
# Restore resolution after game leaves fullscreen
# Any drawbacks?
POL_Shortcut_InsertBeforeWine "$SHORTCUT_NAME" 'trap "xrandr -s 0" EXIT'
# I would have liked:
#POL_Shortcut_InsertBeforeWine "$SHORTCUT_NAME" 'RESOLUTION=`xrandr --current|sed -e "s/^.*current \\([0-9]\\+\\) x \\([0-9]\\+\\).*$/\\1x\\2/p; d"`'
#POL_Shortcut_InsertBeforeWine "$SHORTCUT_NAME" 'trap "xrandr -s $RESOLUTION" EXIT'
# ... but POL_Shortcut_InsertBeforeWine overinterprets way too many things (bug #602)

if echo "$SHORTCUTS" | grep -q "$LNG_DOC"; then
    POL_Shortcut "start.exe" "$SHORTCUT_DOC" "" "'C:/$PROGRAMFILES/'"
    POL_Shortcut "start.exe" "$SHORTCUT_README" "" "'C:/$PROGRAMFILES/'"
    POL_Shortcut "start.exe" "$SHORTCUT_WEAPONS" "" "'C:/$PROGRAMFILES/'"

if echo "$SHORTCUTS" | grep -q "$LNG_EDITOR"; then
    POL_Shortcut "Shadowgrounds Editor.exe" "$SHORTCUT_EDITOR"
    POL_Shortcut "start.exe" "$SHORTCUT_EDITOR_DOC" "" "'C:/$PROGRAMFILES/'"



Edité par petch