You are here > Les forums > Your creations. > [script] Stronghold 2
| New topic - Reply |
| Author | Replies |
| NSLW | Friday 19 June 2009 at 21:16 - [Quote] |
Membre![]() ![]() |
Hello,
I wrote script which installs Stronghold 2. It also can patch the game after it's been installed Wine version : 1.1.23 Distribution : Fedora Distribution Version : 11 (32 bit) Graphics card : Nvidia, GeForce 9xxx Drivers of the graphics card : 185.18.14 Comments 185.18.14 -game patched to 1.4 hasn't got proper graphic -game patched to 1.2 hasn't got any sound Icon for the game:
#!/bin/bash
# Date : (2009-06-19 09-00)
# Last revision : (2009-06-19 09-00)
# Wine version used : 1.1.23
# Distribution used to test : Fedora 11
# Author : NSLW
# Licence : Retail
# Depend : unzip, ImageMagick, icoutils
[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"
#fetching PROGRAMFILES environmental variable
PROGRAMFILES=`wine cmd /c echo "%ProgramFiles%"`
PROGRAMFILES=${PROGRAMFILES:3}
TYTUL="Stronghold 2"
PREFIX="Stronghold2"
#procedure for patching stronghold2
patch_stronghold2()
{
POL_SetupWindow_browse "Select patch file" "$TYTUL" ""
wine "$APP_ANSWER"
POL_SetupWindow_message "Patch for $TYTUL has been installed successfully" "$TYTUL"
}
POL_SetupWindow_Init
POL_SetupWindow_presentation "$TYTUL" "Firefly" "www.stronghold2.com" "NSLW" "$PREFIX"
select_prefix "$REPERTOIRE/wineprefix/$PREFIX"
#asking about patching or updating Wine version
if [ -e "$REPERTOIRE/configurations/installed/$TYTUL" ]; then
POL_SetupWindow_menu "What do you want to do?" "Actions" "Patch game" "~"
if [ "$APP_ANSWER" == "Patch game" ]; then
patch_stronghold2
fi
POL_SetupWindow_Close
exit
fi
POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom "Autorun.exe"
POL_SetupWindow_message_image "Please install icoutils\nif you wan't to have nice icon for the game in PlayOnLinux main menu" "Note about resolution" "/usr/share/playonlinux/themes/tango/info.png"
POL_SetupWindow_prefixcreate
#adding CD-ROM as drive d: to winecfg
CDROM2=${CDROM//"1"/"2"} #Stronghold_DISC2
cd "$WINEPREFIX/dosdevices"
ln -s $CDROM d:
ln -s $CDROM2 e:
cd "$WINEPREFIX/drive_c/windows/temp/"
echo "[HKEY_LOCAL_MACHINE\\Software\\Wine\\Drives]" > cdrom.reg
echo "\"d:\"=\"cdrom\"" >> cdrom.reg
echo "\"e:\"=\"cdrom\"" >> cdrom.reg
regedit cdrom.reg
sleep 5
#starting installation
cd $CDROM
wine "Autorun.exe"
POL_SetupWindow_message "Click \"Next\" when installation will finish." "$TYTUL"
cd "$WINEPREFIX/drive_c/windows/temp/"
#setting Multisampling to enabled and OffscreenRenderingMode to fbo
echo "[HKEY_CURRENT_USER\\Software\\Wine\\Direct3D]" > multisampling.reg
echo "\"Multisampling\"=\"enabled\"" >> multisampling.reg
echo "\"OffscreenRenderingMode\"=\"fbo\"" >> multisampling.reg
regedit multisampling.reg
#asking about memory size
POL_SetupWindow_menu_list "How much memory do your graphic card have got?" "$TYTUL" "32-64-128-256-384-512-768-1024-2048" "-" "256"
VMS="$APP_ANSWER"
echo "[HKEY_CURRENT_USER\\Software\\Wine\\Direct3D]" > vms.reg
echo "\"VideoMemorySize\"=\"$VMS\"" >> vms.reg
regedit vms.reg
#asking about StrongholdVersion
POL_SetupWindow_question "Is this Stronghold 2 Deluxe?" "$TYTUL"
if [ "$APP_ANSWER" == "TRUE" ] ;then
STRONGHOLD2ROOTDIRECTORY="Stronghold 2 Deluxe"
else
STRONGHOLD2ROOTDIRECTORY="Stronghold 2"
fi
cd "$REPERTOIRE/ressources"
#downloading d3dx9_27.dll
if [ ! -e "D3DX9_XX_dll_(32Bit_All).zip" ]; then
POL_SetupWindow_download "Downloading DirectX 9.0c libraries" "$TYTUL" "http://mulx.playonlinux.com/file_pol/D3DX9_XX_dll_(32Bit_All).zip"
fi
#unpacking what has been downloaded
cd "$WINEPREFIX/drive_c/windows/temp"
unzip "$REPERTOIRE/ressources/D3DX9_XX_dll_(32Bit_All).zip"
cabextract "D3DX9_XX_dll_(32Bit_All)/Install/Aug2005_d3dx9_27_x86.cab"
#coping what has been downloaded
cd "$WINEPREFIX/drive_c/$PROGRAMFILES/Firefly Studios/$STRONGHOLD2ROOTDIRECTORY"
cp "$WINEPREFIX/drive_c/windows/temp/d3dx9_27.dll" d3dx9_27.dll
cd "$WINEPREFIX/drive_c/windows/temp/"
#overriding d3dx9_27.dll
echo "[HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides]" > override.reg
echo "\"d3dx9_27.dll\"=\"native\"" >> override.reg
regedit override.reg
#disabling sound
echo "[HKEY_CURRENT_USER\\Software\\Wine\\Drivers]" > noaudio.reg
echo "\"Audio\"=\"\"" >> noaudio.reg
regedit noaudio.reg
#making shortcut
cd "$WINEPREFIX/drive_c/windows/temp/"
wrestool -x -n 106 "$WINEPREFIX/drive_c/$PROGRAMFILES/Firefly Studios/$STRONGHOLD2ROOTDIRECTORY/Stronghold2.exe" > SH.ico #no wrestool no icon
convert "SH.ico" -geometry 32X32 "SH.png"
cp "SH-8.png" "$REPERTOIRE/icones/32/$TYTUL"
POL_SetupWindow_make_shortcut "$PREFIX" "$PROGRAMFILES/Firefly Studios/$STRONGHOLD2ROOTDIRECTORY" "Stronghold2.exe" "" "$TYTUL" "" ""
POL_SetupWindow_message "$TYTUL has been installed successfully" "$TYTUL"
cleaning temp
cd "$WINEPREFIX/drive_c/windows/temp/"
rm -rf *
#asking about patching
POL_SetupWindow_question "Do you want to patch your game?" "$TYTUL"
if [ "$APP_ANSWER" == "TRUE" ]; then
POL_SetupWindow_menu "What installer should do?" "Actions" "Let me choose patch manually~Download patch automatically (not recommended)" "~"
if [ "$APP_ANSWER" == "Let me choose patch manually" ]; then
patch_stronghold2
elif [ "$APP_ANSWER" == "Download patch automatically (not recommended)" ]
then
cd "$REPERTOIRE/ressources"
#downloading patch
if [ "`sha1sum < "${STRONGHOLD2PATHFILE}.zip" | sed 's/ .*//'`" != "e731316b5f576baa8645207ec5670baed2b608e3" ]; then
POL_SetupWindow_download "PlayOnLinux is downloading stronghold2_v1_4_update" "Downloading patch" "http://downloads.2kgames.com/stronghold2/stronghold2_v1_4_update.zip"
fi
cd "$WINEPREFIX/drive_c/windows/temp/"
unzip "$REPERTOIRE/ressources/stronghold2_v1_4_update.zip"
POL_SetupWindow_wait_next_signal "Installing first patch in progress..." "$TYTUL"
wine "stronghold2_v1_4_update.exe"
POL_SetupWindow_detect_exit
#downloading second patch
cd "$REPERTOIRE/ressources"
if [ "`sha1sum < stronghold2_v1_41_update.exe | sed 's/ .*//'`" != "6739cd534b5f443a7cdffa9f2c4b25b983bbcdbd" ]; then
POL_SetupWindow_download "PlayOnLinux is downloading stronghold2_v1_41_update" "Downloading patch" "ftp://pixelrage.ro/patches/stronghold2_v1_41_update.exe"
fi
POL_SetupWindow_wait_next_signal "Installing second patch in progress..." "$TYTUL"
wine "stronghold2_v1_41_update.exe"
POL_SetupWindow_detect_exit
Set_SoundDriver "alsa"
cleaning temp
cd "$WINEPREFIX/drive_c/windows/temp/"
rm -rf *
POL_SetupWindow_message "Patches for $TYTUL has been installed successfully" "$TYTUL"
fi
fi
POL_SetupWindow_message_image "Please note that this game has a copy protection system\nand sadly, it prevents Wine from running the game.\n\nPlayOnLinux will not provide any help concerning any illegal\nstuff." "Note about copy protection" "/usr/share/playonlinux/themes/tango/warning.png"
POL_SetupWindow_Close
exit |
191 people online


