Magic number : 79
#!/bin/bash
# Date : (2009-05-23 14-30)
# Last revision : (2009-07-19 11-00)
# Wine version used : N/A
# Distribution used to test : N/A
# Author : NSLW
# Licence : Retail
#Translated from V2 to V3
[ "$PLAYONLINUX" = "" ] && exit 0
#Charger les librairies
source "$PLAYONLINUX/lib/sources"
TITLE="Grand Theft Auto : San Andreas"
PREFIX="GTASA"
#procedure for patching GTA SA
patch_gtasa()
{
POL_SetupWindow_browse "Select patch file" "$TITLE" ""
POL_SetupWindow_wait_next_signal "Installation in progress..." "$TITLE"
wine "$APP_ANSWER"
cd "$REPERTOIRE/configurations/installed"
mv -f "$TITLE" "GTASA"
cat "GTASA" | sed -e 's/gta-sa.exe/gta_sa.exe/' > "$TITLE"
rm -f "GTASA"
POL_SetupWindow_detect_exit
POL_SetupWindow_message "Patch for $TITLE has been installed successfully" "$TITLE"
}
Get_Latest_Wine_Version()
{
wget http://mulx.playonlinux.com/wine/linux-i386/LIST --output-document="$REPERTOIRE/tmp/LIST"
xyz=`cat "$REPERTOIRE/tmp/LIST" | sed -e 's/\.//g' | cut -d';' -f2 | sort -n | tail -n1`
echo "$(echo $xyz | cut -c1-1).$(echo $xyz | cut -c2-2).$(echo $xyz | cut -c3-4)"
}
wget http://upload.wikimedia.org/wikipedia/en/c/c4/GTASABOX.jpg --output-document="$REPERTOIRE/tmp/leftnotscaled.jpeg"
convert "$REPERTOIRE/tmp/leftnotscaled.jpeg" -scale 150x356\! "$REPERTOIRE/tmp/left.jpeg"
POL_SetupWindow_Init "" "$REPERTOIRE/tmp/left.jpeg"
POL_SetupWindow_presentation "$TITLE" "Rockstar Game" "http://www.rockstargames.com/grandtheftauto/" "Tr4sK and NSLW" "$PREFIX"
LATESTVERSION=$(Get_Latest_Wine_Version)
POL_SetupWindow_install_wine "$LATESTVERSION"
CHOSENWINEVERSION="$LATESTVERSION"
Use_WineVersion "$CHOSENWINEVERSION"
select_prefix "$REPERTOIRE/wineprefix/$PREFIX"
#asking about patching or updating Wine version
if [ -e "$REPERTOIRE/configurations/installed/$TITLE" ]; then
POL_SetupWindow_menu "What do you want to do?" "Actions" "Patch game" "~"
if [ "$APP_ANSWER" == "Patch game" ]; then
patch_gtasa
fi
POL_SetupWindow_Close
exit
fi
POL_SetupWindow_message "Please insert $TITLE media into your disk drive."
POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom "setup.exe"
POL_SetupWindow_prefixcreate
#fetching PROGRAMFILES environmental variable
PROGRAMFILES=`wine cmd /c echo "%ProgramFiles%"`
PROGRAMFILES=${PROGRAMFILES:3}
cd "$WINEPREFIX/dosdevices"
ln -s "$CDROM" d:
cd "$WINEPREFIX/drive_c/windows/temp/"
echo "[HKEY_LOCAL_MACHINE\\Software\\Wine\\Drives]" > cdrom.reg
echo "\"d:\"=\"cdrom\"" >> cdrom.reg
regedit cdrom.reg
sleep 5
cp "$CDROM/Bin/Autorun.ico" "$REPERTOIRE/icones/32/$TITLE"
POL_SetupWindow_wait_next_signal "Installation in progress..." "$TITLE"
cd "$CDROM"
wine "setup.exe"
POL_SetupWindow_detect_exit
#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-890-1024-2048" "-" "256"
VMS="$APP_ANSWER"
cd "$WINEPREFIX/drive_c/windows/temp/"
echo "[HKEY_CURRENT_USER\\Software\\Wine\\Direct3D]" > vms.reg
echo "\"VideoMemorySize\"=\"$VMS\"" >> vms.reg
regedit vms.reg
#setting multisample to enabled
echo "[HKEY_CURRENT_USER\\Software\\Wine\\Direct3D]" > multisampling.reg
echo "\"Multisampling\"=\"enabled\"" >> multisampling.reg
regedit multisampling.reg
POL_SetupWindow_make_shortcut "$PREFIX" "$PROGRAMFILES/Rockstar Games/GTA San Andreas" "gta-sa.exe" "" "$TITLE" "" ""
Set_WineVersion_Assign "$CHOSENWINEVERSION" "$TITLE"
POL_SetupWindow_message "$TITLE has been installed successfully" "$TITLE"
#asking about patching
POL_SetupWindow_question "Do you want to patch your game?" "$TITLE"
if [ "$APP_ANSWER" == "TRUE" ] ;then
patch_gtasa
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" "$PLAYONLINUX/themes/tango/warning.png"
POL_SetupWindow_Close
exit