Forums

[Script] Close Combat: A Bridge Too Far

Auteur Réponses
mark7 Dimanche 24 Mai 2015 à 9:58
mark7Anonymous

A 1997 real-time-tactics game covering Operation Market Garden in World War II.

#!/bin/bash
# Date : (2015-05-23 10-32)
# Last revision : (2015-05-23 10-32)
# Wine version used : 1.6.2
# Distribution used to test : Debian Jessie (Testing)
# Author : Mark Schreiber mark7@alumni.cmu.edu
# Script licence : GPL v.3
# Program licence : Retail
# Depend :

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

TITLE="Close Combat: A Bridge Too Far"
PREFIX="CloseCombatABridgeTooFar"
WINEVERSION="1.6.2"

POL_SetupWindow_Init
POL_Debug_Init

POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom "windows/cc2.exe"

POL_Wine_SelectPrefix "$PREFIX"

POL_Wine_PrefixCreate "$WINEVERSION"

POL_System_TmpCreate "$PREFIX"

# CC:ABTF requires the install CD be present as a WINE drive emulating
# a CD when running, but does not mandate an actual CD.  Copy the CD
# contents to a local directory, add a drive mapping for it as drive
# y:, and identify it as a CD drive.
mkdir "$PREFIX/drive_y"

cp -r "$CDROM" "$WINEPREFIX/drive_y"
# If all these files are not made writeable, PlayOnLinux will not
# cleanly uninstall the virtual drive
chmod -R +w "$WINEPREFIX/drive_y"
ln -s "../drive_y" "$WINEPREFIX/dosdevices/y:"

# CC:ABTF's installer bails out if run under newer Windows versions.
# Emulate WinME.
pushd "$POL_System_TmpDir"

cat >"$POL_System_TmpDir/cc2installer-settings.reg" <<'EOF'
[HKEY_CURRENT_USER\Software\Wine\AppDefaults\cc2.exe]
"Version"="winme"
[HKEY_LOCAL_MACHINE\Software\Wine\Drives]
"y:"="cdrom"
EOF

POL_Wine regedit "cc2installer-settings.reg"

rm cc2installer-settings.reg

popd

POL_Wine "$CDROM/windows/setup.exe"

POL_Wine_WaitExit "$TITLE"

# Wine currently can't play CC:ABTF videos.  The game will terminate
# if it tries.  Disable videos.

pushd "$POL_System_TmpDir"

cat >"$POL_System_TmpDir/cc2settings.reg" <<'EOF'
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games\Close Combat\2.00]
"PlayVideos"=hex:00,00,00,00
"InstalledFrom"="Y:\\"
EOF

POL_Wine regedit "cc2settings.reg"

rm cc2settings.reg

popd

# CC:ABTF currently crashes at at launch at any other resolutions.
Set_Desktop "On" "800" "600"

POL_System_TmpDelete

POL_Shortcut 'CC2.exe' "$TITLE"

POL_SetupWindow_Close
exit 0

 

petch Dimanche 24 Mai 2015 à 10:17
petch

Hi,

Your script looks ok to me;

Maybe you could use POL_System_CopyDirectory instead of plain cp, so that PlayOnLinux displays some progress bar during the copy? I don't think it has been documented, but it has been around since 4.0.18 so it can probably be a given now.