Forums

Ground Control 2 (GoG)

Auteur Réponses
petch Dimanche 4 Décembre 2011 à 21:56
petch
Développeur

Hi,
I wrote a script for Ground Control 2, since I have it but it's only working under Wine since 1.3.23...
And even then... It's marked "Gold" on WineHQ, but it could crash it with middle-click + drap (change view angle) with 1.3.23, 1.3.27, and 1.3.33.
It seems stable with 1.3.34, so that's what I picked for the script.
Enjoy.
https://raw.github.com/petchema/playonlinux/master/groundcontrol2-gog
#!/bin/bash
# Date : (2012-12-03 20-32)
# Last revision : (2011-12-04 21-35)
# Wine version used : 1.3.34
# Distribution used to test : Debian Sid (Unstable)
# Author : Pierre Etchemaite <petchema@concept-micro.com>
# Script licence : GPL v.2
# Program licence : Retail
# Depend :

# Supposed to be "Gold" on WineHQ with 1.3.23, but I crash it with middle-click + drag
# Same for 1.3.27-rawinput2, 
# very easily with 1.3.33
# couldn't crash it with 1.3.34-rawinput2
# 1.3.34 ok?

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

check_install_archive () {
    POL_SetupWindow_wait "$(eval_gettext 'Checking install archive...')" "$TITLE"

    EXPECTED_NAME='setup_ground_control_2.exe'
    EXPECTED_SIZE=641603732
    EXPECTED_MD5="dd1ae6e7ae1420bc52dc5327e974ea9e"

    # Temporarily prevent word splitting
    OLDIFS="$IFS"
    IFS=''
    NAME="$(basename $ARCHIVE)"
    SIZE="$(stat -c%s $ARCHIVE)"
    MD5="$(POL_MD5_file $ARCHIVE)"
    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="GrndCtrl2_gog"
WORKING_WINE_VERSION="1.3.34"

TITLE="$(eval_gettext 'Ground Control 2 (GoG release)')"
SHORTCUT_NAME="Ground Control 2"
SHORTCUT_DOC="$SHORTCUT_NAME - $(eval_gettext 'User manual')"

POL_SetupWindow_Init
POL_Debug_Init

POL_SetupWindow_presentation "$TITLE" "Massive Entertainment / Rebellion" "http://www.gog.com/en/gamecard/ground_control_2_operation_exodus" "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"

check_install_archive


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

# Associate .PDF 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/pdfnativereader.reg
[HKEY_CLASSES_ROOT\\.pdf]
@="PDFfile"
"Content Type"="application/pdf"
[HKEY_CLASSES_ROOT\\PDFfile\\Shell\\Open\\command]
@="winebrowser \\"%1\\""
EOF
POL_Wine regedit $REPERTOIRE/tmp/pdfnativereader.reg

POL_Wine_InstallFonts

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

POL_Wine_WaitExit "$TITLE"


# GoG work!
Set_OS winxp

POL_SetupWindow_VMS "32"
 
## PlayOnMac Section
[ -n "$PLAYONMAC" ] && Set_SoundDriver "alsa"
[ -n "$PLAYONMAC" ] || Set_Managed "Off"
## End Section

# Doesn't hurt ;)
POL_Wine_reboot

POL_Shortcut "gcii.exe" "$SHORTCUT_NAME"
POL_Shortcut "start.exe" "$SHORTCUT_DOC" "" "'C:/$PROGRAMFILES/GOG.com/Ground Control II/Manual.pdf'"

POL_SetupWindow_Close
exit