The forum

Shadowgrounds (GoG) [WIP]

Author Replies
petch Tuesday 27 December 2011 at 2:26
petch
Developer

Bonsoir à tous,
J'ai passé du temps à écrire un script POL pour installer ShadowGrounds. La mauvaise nouvelle c'est que quelle que soit la version de Wine que j'essaye (qu'elle soit récente, stable ou ancienne, incluant des versions "connues pour marcher" d'après l'AppDB de WineHQ), j'ai toujours observé une certaine probabilité (disons 1/10 ?) de crash en affichant le panneau carte et objectifs (touche Tab par défaut). Il devrait cependant être possible de terminer le jeu en n'utilisant ce panneau qu'à bon escient.
J'ai aussi découvert que Linuxgamepublishing avait fait un port de ce jeu sous Linux, et la démo au moins ne présente pas ce souci (par contre les graphismes sont un peu moins beaux, et le jeu vient avec un DRM). C'est vous qui voyez.
Bon jeu !

https://raw.github.com/petchema/playonlinux/master/wip/shadowgrounds-gog
#!/bin/bash
# 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 petchema@concept-micro.com
# 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 () {
    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="ShadowGrounds_gog"
WORKING_WINE_VERSION="1.3.30"

TITLE="$(eval_gettext 'ShadowGrounds (GoG release)')"
SHORTCUT_NAME="ShadowGrounds"
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_Init
POL_Debug_Init

POL_SetupWindow_presentation "$TITLE" "Frozenbyte / Meridian4" "http://www.gog.com/en/gamecard/shadowgrounds" "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"
POL_Wine_PrefixCreate "$WORKING_WINE_VERSION"

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

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

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 ;)
POL_Wine_reboot

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}" "~"
SHORTCUTS="$APP_ANSWER"


POL_Shortcut "Shadowgrounds Launcher.exe" "$SHORTCUT_NAME"
# Restore resolution after game leaves fullscreen
# http://wiki.winehq.org/FAQ#head-acb200594b5bcd19722faf6fd34b60cc9c2f237b
# 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/GOG.com/Shadowgrounds/Manual.pdf'"
    POL_Shortcut "start.exe" "$SHORTCUT_README" "" "'C:/$PROGRAMFILES/GOG.com/Shadowgrounds/Readme.txt'"
    POL_Shortcut "start.exe" "$SHORTCUT_WEAPONS" "" "'C:/$PROGRAMFILES/GOG.com/Shadowgrounds/weapon_chart.pdf'"
fi

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

POL_SetupWindow_Close

exit

Edited by petch