The forum

[script] Gothic 2

Author Replies
NSLW Monday 6 July 2009 at 16:37
NSLW

Hello,
I wrote script which installs Gothic 2 and Gothic 2 The Night Of The Raven. It also can patch the game after it's been installed
Wine version : 1.1.25
Distribution : Fedora
Distribution Version : 11 (32 bit)
Graphics card : Nvidia, GeForce 9xxx
Drivers of the graphics card : 185.18.14

Icon for the game:


#!/bin/bash
# Date : (2009-07-06 12-00)
# Last revision : (2009-07-06 12-00)
# Wine version used : 1.1.25
# Distribution used to test : Fedora 11
# Author : NSLW
# Licence : Retail
# Depend : ImageMagick, unzip

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

#fetching PROGRAMFILES environmental variable
PROGRAMFILES=`wine cmd /c echo "%ProgramFiles%"`
PROGRAMFILES=${PROGRAMFILES:3}

TYTUL="Gothic 2"
PREFIX="Gothic2"
WORKINGWINEVERSION="1.1.25"

#procedure for patching Gothic 2
patch_gothic2()
{
POL_SetupWindow_browse "Select patch file" "$TYTUL" ""
wine "$APP_ANSWER"
POL_SetupWindow_message "Patch for $TYTUL has been installed successfully" "$TYTUL"
}

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)"
}

Change_Resolution()
{

cd "$WINEPREFIX/drive_c/$PROGRAMFILES/JoWooD/Gothic II/System"
OLDX=`cat gothic.ini | grep "zVidResFullscreenX=" | cut -d"=" -f2`
OLDY=`cat gothic.ini | grep "zVidResFullscreenY=" | cut -d"=" -f2`
OLDBPP=`cat gothic.ini | grep "zVidResFullscreenBPP=" | cut -d"=" -f2`

POL_SetupWindow_menu_list "Choose display resolution" "Display resolution" "1024x768~800x600~640x480" "~"
RES="$APP_ANSWER"
POL_SetupWindow_menu_list "Choose color depth" "Color depth" "32~16" "~"
NEWBPP="$APP_ANSWER"

NEWX=`echo $RES | cut -d"x" -f1`
NEWY=`echo $RES | cut -d"x" -f2`
rm gothic.ini.bak
mv gothic.ini gothic.ini.bak

cat gothic.ini.bak | sed -e "s/zVidResFullscreenX=$OLDX/zVidResFullscreenX=$NEWX/g" | sed -e "s/zVidResFullscreenY=$OLDY/zVidResFullscreenY=$NEWY/g" | sed -e "s/zVidResFullscreenBPP=$OLDBPP/zVidResFullscreenBPP=$NEWBPP/g" > gothic.ini
}

download_pulseudio()
{
cd "$REPERTOIRE/ressources/"
if [ ! -e "$REPERTOIRE/ressources/$WORKINGWINEVERSION-mod.zip" ]; then
POL_SetupWindow_download "Downloading PulseAudio sound driver" "$TYTUL" "http://www.sigmirror.com/files/23682_vtvrr/$WORKINGWINEVERSION-mod.zip"
fi
cd "$WINEPREFIX/drive_c/windows/temp/"
unzip "$REPERTOIRE/ressources/$WORKINGWINEVERSION-mod.zip"
./$WORKINGWINEVERSION-mod -y
cp PulseAudio/* ./
}

prepare_patched_WineVesrsion()
{
POL_SetupWindow_install_wine "$1"
cd "$REPERTOIRE/WineVersions"
POL_SetupWindow_wait_next_signal "Removing old WineVersion" "$TYTUL"
rm -fr "$1-PA"
POL_SetupWindow_detect_exit
 
POL_SetupWindow_wait_next_signal "Copying WineVersion" "$TYTUL"
cp -r "$1" "$1-PA"
cp "$WINEPREFIX/drive_c/windows/temp/winepulse.drv.so" "$REPERTOIRE/WineVersions/$1-PA/usr/lib/wine/winepulse.drv.so"
POL_SetupWindow_detect_exit
}

POL_SetupWindow_Init
POL_SetupWindow_presentation "$TYTUL" "Piranha Bytes" "www.gothic2.com" "NSLW" "$PREFIX" 

select_prefix "$REPERTOIRE/wineprefix/$PREFIX"

LATESTVERSION=$(Get_Latest_Wine_Version)
CHOSENWINEVERSION="$LATESTVERSION"
Use_WineVersion "$CHOSENWINEVERSION"

#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~Change resolution~Update Wine version to $WORKINGWINEVERSION" "~"

if [ "$APP_ANSWER" == "Patch game" ]; then
	patch_gothic2
elif [ "$APP_ANSWER" == "Change resolution" ]
then
Change_Resolution
elif [ "$APP_ANSWER" == "Update Wine version to $WORKINGWINEVERSION" ]
then
	CHOSENWINEVERSION="$LATESTVERSION-PA"
	download_pulseudio
	prepare_patched_WineVesrsion "$LATESTVERSION"
	cd "$WINEPREFIX/drive_c/windows/temp/" 
	echo "[HKEY_CURRENT_USER\\\\Software\\\\Wine\\\\Drivers]" > pa.reg
	echo "\\"Audio\\"=\\"pulse\\"" >> pa.reg
	regedit pa.reg
	Set_WineVersion_Assign "$CHOSENWINEVERSION" "$TYTUL"
fi

POL_SetupWindow_Close
exit
fi

POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom "Setup.exe"

#taking icon from the game
convert "$CDROM/Gothic2.ico" -geometry 32X32 "$REPERTOIRE/icones/32/$TYTUL"

POL_SetupWindow_prefixcreate

#adding CD-ROM as drive d: e: f: to winecfg
CDROM2=${CDROM//"1"/"2"} #GOTHIC2_CD2
CDROM3=${CDROM//"1"/"3"} #GOTHIC2_CD3
cd "$WINEPREFIX/dosdevices"
ln -s "$CDROM" d:
ln -s "$CDROM2" e:
ln -s "$CDROM3" f:

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
echo "\\"f:\\"=\\"cdrom\\"" >> cdrom.reg
regedit cdrom.reg
sleep 5

cd "$REPERTOIRE/ressources/"
#downloading dlls required for music
POL_SetupWindow_wait_next_signal "PlayOnLinux is downloading DLLs required for displaying help" "$TYTUL"

#dmband.dll (size 28.0KB)
if [ "`sha1sum < dmband.dll | sed 's/ .*//'`" != "72d574b557865850247e58ee69af84e37ef75ac2" ]; then
wget --referer="http://www.dlldump.com" "http://www.dlldump.com/dllfiles/D/dmband.dll" --output-document=dmband.dll
fi

#dmcompos.dll (size 60.0KB)
if [ "`sha1sum < dmcompos.dll | sed 's/ .*//'`" != "bc775f826398e9c6a656acbd41808217c995781e" ]; then
wget --referer="http://www.dlldump.com" "http://www.dlldump.com/dllfiles/D/dmcompos.dll" --output-document=dmcompos.dll
fi

#dmime.dll (size 177.0KB)
if [ "`sha1sum < dmime.dll | sed 's/ .*//'`" != "4dd11c042fd420325044ea379935a10102b0cc00" ]; then
wget --referer="http://www.dlldump.com" "http://www.dlldump.com/dllfiles/D/dmime.dll" --output-document=dmime.dll
fi

#dmloader.dll (size 35.0KB)
if [ "`sha1sum < dmloader.dll | sed 's/ .*//'`" != "4250676edacc33c54c6db511c812ff71571c305a" ]; then
wget --referer="http://www.dlldump.com" "http://www.dlldump.com/dllfiles/D/dmloader.dll" --output-document=dmloader.dll
fi

#dmsynth.dll (size 101.0KB)
if [ "`sha1sum < dmsynth.dll | sed 's/ .*//'`" != "7a7843d5f385795d6cc18f86e78c191ecd524424" ]; then
wget --referer="http://www.dlldump.com" "http://www.dlldump.com/dllfiles/D/dmsynth.dll" --output-document=dmsynth.dll
fi

#dmusic.dll (size 102.0KB)
if [ "`sha1sum < dmusic.dll | sed 's/ .*//'`" != "4eb4aa8f545c0073d012bfc69ceb837098db4f2e" ]; then
wget --referer="http://www.dlldump.com" "http://www.dlldump.com/dllfiles/D/dmusic.dll" --output-document=dmusic.dll
fi

#dmstyle.dll (size 103.5KB)
if [ "`sha1sum < dmstyle.dll.zip | sed 's/ .*//'`" != "e860c26e23310a5765c2e2110e40c5c076503643" ]; then
wget "http://www.dllbank.com/zip/d/dmstyle.dll.zip" --output-document=dmstyle.dll.zip
fi
unzip dmstyle.dll.zip

POL_SetupWindow_detect_exit

#starting installation
POL_SetupWindow_wait_next_signal "Installation in progress..." "$TYTUL"
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"
 
echo "[HKEY_CURRENT_USER\\\\Software\\\\Wine\\\\Direct3D]" > vms.reg
echo "\\"VideoMemorySize\\"=\\"$VMS\\"" >> vms.reg
regedit vms.reg

#copying dlls required for music
cd "$WINEPREFIX/drive_c/windows/system32"
cp -f "$REPERTOIRE/ressources/dmband.dll" dmband.dll
cp -f "$REPERTOIRE/ressources/dmcompos.dll" dmcompos.dll
cp -f "$REPERTOIRE/ressources/dmime.dll" dmime.dll
cp -f "$REPERTOIRE/ressources/dmloader.dll" dmloader.dll
cp -f "$REPERTOIRE/ressources/dmsynth.dll" dmsynth.dll
cp -f "$REPERTOIRE/ressources/dmusic.dll" dmusic.dll
cp -f "$REPERTOIRE/ressources/dmstyle.dll" dmstyle.dll

#overriding dlls required for music
cd "$WINEPREFIX/drive_c/windows/temp"
echo "[HKEY_CURRENT_USER\\\\Software\\\\Wine\\\\DllOverrides]" > override.reg
echo "\\"dmband\\"=\\"native\\"" >> override.reg
echo "\\"dmcompos\\"=\\"native\\"" >> override.reg
echo "\\"dmime\\"=\\"native\\"" >> override.reg
echo "\\"dmloader\\"=\\"native\\"" >> override.reg
echo "\\"dmsynth\\"=\\"native\\"" >> override.reg
echo "\\"dmusic\\"=\\"native\\"" >> override.reg
echo "\\"dmstyle\\"=\\"native\\"" >> override.reg
regedit override.reg

#asking about Pulseaudio
POL_SetupWindow_question "Do you want to use PulseAudio sound driver?\\nMore about this sound driver at art.ified.ca/?page_id=40" "$TYTUL"
if [ "$APP_ANSWER" == "TRUE" ]; then
	CHOSENWINEVERSION="$LATESTVERSION-PA"
	download_pulseudio
	prepare_patched_WineVesrsion "$LATESTVERSION"
	cd "$WINEPREFIX/drive_c/windows/temp/" 
	echo "[HKEY_CURRENT_USER\\\\Software\\\\Wine\\\\Drivers]" > pa.reg
	echo "\\"Audio\\"=\\"pulse\\"" >> pa.reg
	regedit pa.reg
fi

#cleaning temp
#cd "$WINEPREFIX/drive_c/windows/temp/"
#rm -rf *

#making shortcut
POL_SetupWindow_make_shortcut "$PREFIX" "$PROGRAMFILES/JoWooD/Gothic II/System" "Gothic2.exe" "" "$TYTUL" "" ""
Set_WineVersion_Assign "$CHOSENWINEVERSION" "$TYTUL"
POL_SetupWindow_message "$TYTUL has been installed successfully" "$TYTUL"

#asking about patching
POL_SetupWindow_question "Do you want to patch your game?" "$TYTUL" 
if [ "$APP_ANSWER" == "TRUE" ] ;then
patch_gothic2
fi

#asking about resolution
POL_SetupWindow_question "Every time you want to change game resolution\\nyou'll have to run this script again\\nDo you want to change resolution right now?" "$TYTUL" 
if [ "$APP_ANSWER" == "TRUE" ] ;then
Change_Resolution
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


Icon for the game:


#!/bin/bash
# Date : (2009-07-06 12-00)
# Last revision : (2009-07-06 12-00)
# Wine version used : 1.1.25
# Distribution used to test : Fedora 11
# Author : NSLW
# Licence : Retail
# Depend : ImageMagick, unzip

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

#fetching PROGRAMFILES environmental variable
PROGRAMFILES=`wine cmd /c echo "%ProgramFiles%"`
PROGRAMFILES=${PROGRAMFILES:3}

if [ "$POL_LANG" == "de" ]; then
PODTYTUL="Die Nacht des Raben"

elif [ "$POL_LANG" == "pl" ]
then
PODTYTUL="Noc kruka"

else
PODTYTUL="The Night Of The Raven"
fi

TYTUL="Gothic 2 - $PODTYTUL"
PREFIX="Gothic2"
WORKINGWINEVERSION="1.1.25"

#procedure for patching Gothic 2
patch_gothic2()
{
POL_SetupWindow_browse "Select patch file" "$TYTUL" ""
wine "$APP_ANSWER"
POL_SetupWindow_message "Patch for $TYTUL has been installed successfully" "$TYTUL"
}

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)"
}

Change_Resolution()
{

cd "$WINEPREFIX/drive_c/$PROGRAMFILES/JoWooD/Gothic II/System"
OLDX=`cat gothic.ini | grep "zVidResFullscreenX=" | cut -d"=" -f2`
OLDY=`cat gothic.ini | grep "zVidResFullscreenY=" | cut -d"=" -f2`
OLDBPP=`cat gothic.ini | grep "zVidResFullscreenBPP=" | cut -d"=" -f2`

POL_SetupWindow_menu_list "Choose display resolution" "Display resolution" "1024x768~800x600~640x480" "~"
RES="$APP_ANSWER"
POL_SetupWindow_menu_list "Choose color depth" "Color depth" "32~16" "~"
NEWBPP="$APP_ANSWER"

NEWX=`echo $RES | cut -d"x" -f1`
NEWY=`echo $RES | cut -d"x" -f2`
rm gothic.ini.bak
mv gothic.ini gothic.ini.bak

cat gothic.ini.bak | sed -e "s/zVidResFullscreenX=$OLDX/zVidResFullscreenX=$NEWX/g" | sed -e "s/zVidResFullscreenY=$OLDY/zVidResFullscreenY=$NEWY/g" | sed -e "s/zVidResFullscreenBPP=$OLDBPP/zVidResFullscreenBPP=$NEWBPP/g" > gothic.ini
}

download_pulseudio()
{
cd "$REPERTOIRE/ressources/"
if [ ! -e "$REPERTOIRE/ressources/$WORKINGWINEVERSION-mod.zip" ]; then
POL_SetupWindow_download "Downloading PulseAudio sound driver" "$TYTUL" "http://www.sigmirror.com/files/23682_vtvrr/$WORKINGWINEVERSION-mod.zip"
fi
cd "$WINEPREFIX/drive_c/windows/temp/"
unzip "$REPERTOIRE/ressources/$WORKINGWINEVERSION-mod.zip"
./$WORKINGWINEVERSION-mod -y
cp -f PulseAudio/* ./
}

prepare_patched_WineVesrsion()
{
POL_SetupWindow_install_wine "$1"
cd "$REPERTOIRE/WineVersions"
POL_SetupWindow_wait_next_signal "Removing old WineVersion" "$TYTUL"
rm -fr "$1-PA"
POL_SetupWindow_detect_exit
 
POL_SetupWindow_wait_next_signal "Copying WineVersion" "$TYTUL"
cp -r "$1" "$1-PA"
cp "$WINEPREFIX/drive_c/windows/temp/winepulse.drv.so" "$REPERTOIRE/WineVersions/$1-PA/usr/lib/wine/winepulse.drv.so"
POL_SetupWindow_detect_exit
}

POL_SetupWindow_Init
POL_SetupWindow_presentation "$TYTUL" "Piranha Bytes" "www.gothic2.com" "NSLW" "$PREFIX" 

select_prefix "$REPERTOIRE/wineprefix/$PREFIX"

LATESTVERSION=$(Get_Latest_Wine_Version)
CHOSENWINEVERSION="$LATESTVERSION"
Use_WineVersion "$CHOSENWINEVERSION"

#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~Change resolution~Update Wine version to $WORKINGWINEVERSION" "~"

if [ "$APP_ANSWER" == "Patch game" ]; then
	patch_gothic2
elif [ "$APP_ANSWER" == "Change resolution" ]
then
Change_Resolution
elif [ "$APP_ANSWER" == "Update Wine version to $WORKINGWINEVERSION" ]
then
	CHOSENWINEVERSION="$LATESTVERSION-PA"
	download_pulseudio
	prepare_patched_WineVesrsion "$LATESTVERSION"
	cd "$WINEPREFIX/drive_c/windows/temp/" 
	echo "[HKEY_CURRENT_USER\\\\Software\\\\Wine\\\\Drivers]" > pa.reg
	echo "\\"Audio\\"=\\"pulse\\"" >> pa.reg
	regedit pa.reg
	Set_WineVersion_Assign "$CHOSENWINEVERSION" "$TYTUL"
fi

POL_SetupWindow_Close
exit
fi

if [ ! -e "$REPERTOIRE/configurations/installed/Gothic 2" ]
then
POL_SetupWindow_message "Install Gothic 2 first" "$TYTUL"
POL_SetupWindow_Close
fi

POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom "Setup.exe"

#taking icon from the game
convert "$CDROM/AutoRun.ico" -geometry 32X32 "$REPERTOIRE/icones/32/$TYTUL"

cd "$REPERTOIRE/ressources"
if [ ! -e "gothic2_vdfs-patch.zip" ]; then
POL_SetupWindow_wait_next_signal "Downloading VDFS patch..." "$TYTUL"
wget http://forum.jowood.de/attachment.php?attachmentid=25660 --output-document=gothic2_vdfs-patch.zip
POL_SetupWindow_detect_exit
fi

#adding CD-ROM as drive d: e: f: to winecfg
cd "$WINEPREFIX/dosdevices"
ln -s "$CDROM" g:

cd "$WINEPREFIX/drive_c/windows/temp/"
echo "[HKEY_LOCAL_MACHINE\\\\Software\\\\Wine\\\\Drives]" > cdrom.reg
echo "\\"g:\\"=\\"cdrom\\"" >> cdrom.reg
regedit cdrom.reg
sleep 5

#starting installation
POL_SetupWindow_wait_next_signal "Installation in progress..." "$TYTUL"
cd "$CDROM"
wine "Setup.exe"
POL_SetupWindow_detect_exit

#asking about Pulseaudio
POL_SetupWindow_question "Do you want to use PulseAudio sound driver?\\nMore about this sound driver at art.ified.ca/?page_id=40" "$TYTUL"
if [ "$APP_ANSWER" == "TRUE" ]; then
	CHOSENWINEVERSION="$LATESTVERSION-PA"
	download_pulseudio
	prepare_patched_WineVesrsion "$LATESTVERSION"
	cd "$WINEPREFIX/drive_c/windows/temp/" 
	echo "[HKEY_CURRENT_USER\\\\Software\\\\Wine\\\\Drivers]" > pa.reg
	echo "\\"Audio\\"=\\"pulse\\"" >> pa.reg
	regedit pa.reg
fi

#applying vdfs patch
POL_SetupWindow_wait_next_signal "Installing VDFS patch..." "$TYTUL"
cd "$WINEPREFIX/drive_c/windows/temp/"
unzip "$REPERTOIRE/ressources/gothic2_vdfs-patch.zip"
wine gothic2_vdfs-patch.exe
POL_SetupWindow_detect_exit

#cleaning temp
#cd "$WINEPREFIX/drive_c/windows/temp/"
#rm -rf *

#making shortcut
mv -f "$REPERTOIRE/configurations/installed/Gothic 2" "$REPERTOIRE/configurations/installed/$TYTUL"
Set_WineVersion_Assign "$CHOSENWINEVERSION" "$TYTUL"
POL_SetupWindow_message "$TYTUL has been installed successfully" "$TYTUL"

#asking about patching
POL_SetupWindow_question "Do you want to patch your game?" "$TYTUL" 
if [ "$APP_ANSWER" == "TRUE" ] ;then
patch_gothic2
fi

#asking about resolution
POL_SetupWindow_question "Every time you want to change game resolution\\nyou'll have to run this script again\\nDo you want to change resolution right now?" "$TYTUL" 
if [ "$APP_ANSWER" == "TRUE" ] ;then
Change_Resolution
fi

POL_SetupWindow_message_image "The game will show error about VDFS\\neverytime you'll try to run it\\nPlease don't be bothered by that and just hit OK\\nThe game will start after" "Note about resolution" "/usr/share/playonlinux/themes/tango/info.png"

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
coxtor Monday 9 January 2012 at 21:26
coxtorAnonymous

This script works well but needs tweaking for different gothic editions, like the gold edition (different exe names) but all in all works well giving the user to use the widescreenhack directly would be great too
verdan Monday 9 April 2012 at 12:38
verdanAnonymous

Hello!

I just adjusted your script for my gold edition (DVD). It's just a few changes, like where the .exe files are. Also I removed a lot of code that I didn't need (so as not to get confused, this being my first scripting). The change resolution also doesn't work for the gold edition. I believe the cause is the "different" file name (Gothic.ini vs. gothic.ini).

Since I don't know how to implement variable .exe calls (for the different names) I can't write one encompassing script, if anybody could point me in the right direction that would be great :D

Anyway, here my two greatly reduced scripts:

Gothic 2:
#!/bin/bash
# Date : (2009-07-06 12-00)
# Last revision : (2012-04-09 12-00)
# Wine version used : 1.1.25
# Distribution used to test : Fedora 11, Archlinux
# Author : NSLW (edited by Verdan)
# Licence : Retail
# Depend : ImageMagick, unzip

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

#fetching PROGRAMFILES environmental variable
PROGRAMFILES=`wine cmd /c echo "%ProgramFiles%"`
PROGRAMFILES=${PROGRAMFILES:3}

TYTUL="Gothic 2"
PREFIX="Gothic2"
WORKINGWINEVERSION="1.1.25"

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)"
}

#Changing resolution doesn't work for the gold edition, probably because its case sensitive. (Gothic.ini for my gold edition instead of gothic.ini)
Change_Resolution()
{

cd "$WINEPREFIX/drive_c/$PROGRAMFILES/JoWooD/Gothic II/System"
OLDX=`cat gothic.ini | grep "zVidResFullscreenX=" | cut -d"=" -f2`
OLDY=`cat gothic.ini | grep "zVidResFullscreenY=" | cut -d"=" -f2`
OLDBPP=`cat gothic.ini | grep "zVidResFullscreenBPP=" | cut -d"=" -f2`

POL_SetupWindow_menu_list "Choose display resolution" "Display resolution" "1024x768~800x600~640x480" "~"
RES="$APP_ANSWER"
POL_SetupWindow_menu_list "Choose color depth" "Color depth" "32~16" "~"
NEWBPP="$APP_ANSWER"

NEWX=`echo $RES | cut -d"x" -f1`
NEWY=`echo $RES | cut -d"x" -f2`
rm gothic.ini.bak
mv gothic.ini gothic.ini.bak

cat gothic.ini.bak | sed -e "s/zVidResFullscreenX=$OLDX/zVidResFullscreenX=$NEWX/g" | sed -e "s/zVidResFullscreenY=$OLDY/zVidResFullscreenY=$NEWY/g" | sed -e "s/zVidResFullscreenBPP=$OLDBPP/zVidResFullscreenBPP=$NEWBPP/g" > gothic.ini
}

prepare_patched_WineVesrsion()
{
POL_SetupWindow_install_wine "$1"
cd "$REPERTOIRE/WineVersions"
POL_SetupWindow_wait_next_signal "Removing old WineVersion" "$TYTUL"
rm -fr "$1-PA"
POL_SetupWindow_detect_exit

POL_SetupWindow_wait_next_signal "Copying WineVersion" "$TYTUL"
cp -r "$1" "$1-PA"
cp "$WINEPREFIX/drive_c/windows/temp/winepulse.drv.so" "$REPERTOIRE/WineVersions/$1-PA/usr/lib/wine/winepulse.drv.so"
POL_SetupWindow_detect_exit
}

POL_SetupWindow_Init
POL_SetupWindow_presentation "$TYTUL" "Piranha Bytes" "www.gothic2.com" "NSLW" "$PREFIX"

select_prefix "$REPERTOIRE/wineprefix/$PREFIX"

LATESTVERSION=$(Get_Latest_Wine_Version)
CHOSENWINEVERSION="$LATESTVERSION"
Use_WineVersion "$CHOSENWINEVERSION"

#asking about patching or updating Wine version
if [ -e "$REPERTOIRE/configurations/installed/$TYTUL" ]; then
POL_SetupWindow_menu "What do you want to do?" "Actions" "Change resolution~Update Wine version to $WORKINGWINEVERSION" "~"

if [ "$APP_ANSWER" == "Change resolution" ]then
Change_Resolution
elif [ "$APP_ANSWER" == "Update Wine version to $WORKINGWINEVERSION" ]
then
   CHOSENWINEVERSION="$LATESTVERSION-PA"
   download_pulseudio
   prepare_patched_WineVesrsion "$LATESTVERSION"
   cd "$WINEPREFIX/drive_c/windows/temp/"
   echo "[HKEY_CURRENT_USER\\\\Software\\\\Wine\\\\Drivers]" > pa.reg
   echo "\\"Audio\\"=\\"pulse\\"" >> pa.reg
   regedit pa.reg
   Set_WineVersion_Assign "$CHOSENWINEVERSION" "$TYTUL"
fi

POL_SetupWindow_Close
exit
fi

#the Gothic 2 exe for the gold edition
POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom "Gothic2-Setup.exe"

#taking icon from the game
convert "$CDROM/AutoRun.ico" -geometry 32X32 "$REPERTOIRE/icones/32/$TYTUL"

POL_SetupWindow_prefixcreate

cd "$REPERTOIRE/ressources/"
#downloading dlls required for music
POL_SetupWindow_wait_next_signal "PlayOnLinux is downloading DLLs required for displaying help" "$TYTUL"

#dmband.dll (size 28.0KB)
if [ "`sha1sum < dmband.dll | sed 's/ .*//'`" != "72d574b557865850247e58ee69af84e37ef75ac2" ]; then
wget --referer="http://www.dlldump.com" "http://www.dlldump.com/dllfiles/D/dmband.dll" --output-document=dmband.dll
fi

#dmcompos.dll (size 60.0KB)
if [ "`sha1sum < dmcompos.dll | sed 's/ .*//'`" != "bc775f826398e9c6a656acbd41808217c995781e" ]; then
wget --referer="http://www.dlldump.com" "http://www.dlldump.com/dllfiles/D/dmcompos.dll" --output-document=dmcompos.dll
fi

#dmime.dll (size 177.0KB)
if [ "`sha1sum < dmime.dll | sed 's/ .*//'`" != "4dd11c042fd420325044ea379935a10102b0cc00" ]; then
wget --referer="http://www.dlldump.com" "http://www.dlldump.com/dllfiles/D/dmime.dll" --output-document=dmime.dll
fi

#dmloader.dll (size 35.0KB)
if [ "`sha1sum < dmloader.dll | sed 's/ .*//'`" != "4250676edacc33c54c6db511c812ff71571c305a" ]; then
wget --referer="http://www.dlldump.com" "http://www.dlldump.com/dllfiles/D/dmloader.dll" --output-document=dmloader.dll
fi

#dmsynth.dll (size 101.0KB)
if [ "`sha1sum < dmsynth.dll | sed 's/ .*//'`" != "7a7843d5f385795d6cc18f86e78c191ecd524424" ]; then
wget --referer="http://www.dlldump.com" "http://www.dlldump.com/dllfiles/D/dmsynth.dll" --output-document=dmsynth.dll
fi

#dmusic.dll (size 102.0KB)
if [ "`sha1sum < dmusic.dll | sed 's/ .*//'`" != "4eb4aa8f545c0073d012bfc69ceb837098db4f2e" ]; then
wget --referer="http://www.dlldump.com" "http://www.dlldump.com/dllfiles/D/dmusic.dll" --output-document=dmusic.dll
fi

#dmstyle.dll (size 103.5KB)
if [ "`sha1sum < dmstyle.dll.zip | sed 's/ .*//'`" != "e860c26e23310a5765c2e2110e40c5c076503643" ]; then
wget "http://www.dllbank.com/zip/d/dmstyle.dll.zip" --output-document=dmstyle.dll.zip
fi
unzip dmstyle.dll.zip

POL_SetupWindow_detect_exit

#starting installation with the different exe
POL_SetupWindow_wait_next_signal "Installation in progress..." "$TYTUL"
cd "$CDROM"
wine "Gothic2-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"

echo "[HKEY_CURRENT_USER\\\\Software\\\\Wine\\\\Direct3D]" > vms.reg
echo "\\"VideoMemorySize\\"=\\"$VMS\\"" >> vms.reg
regedit vms.reg

#copying dlls required for music
cd "$WINEPREFIX/drive_c/windows/system32"
cp -f "$REPERTOIRE/ressources/dmband.dll" dmband.dll
cp -f "$REPERTOIRE/ressources/dmcompos.dll" dmcompos.dll
cp -f "$REPERTOIRE/ressources/dmime.dll" dmime.dll
cp -f "$REPERTOIRE/ressources/dmloader.dll" dmloader.dll
cp -f "$REPERTOIRE/ressources/dmsynth.dll" dmsynth.dll
cp -f "$REPERTOIRE/ressources/dmusic.dll" dmusic.dll
cp -f "$REPERTOIRE/ressources/dmstyle.dll" dmstyle.dll

#overriding dlls required for music
cd "$WINEPREFIX/drive_c/windows/temp"
echo "[HKEY_CURRENT_USER\\\\Software\\\\Wine\\\\DllOverrides]" > override.reg
echo "\\"dmband\\"=\\"native\\"" >> override.reg
echo "\\"dmcompos\\"=\\"native\\"" >> override.reg
echo "\\"dmime\\"=\\"native\\"" >> override.reg
echo "\\"dmloader\\"=\\"native\\"" >> override.reg
echo "\\"dmsynth\\"=\\"native\\"" >> override.reg
echo "\\"dmusic\\"=\\"native\\"" >> override.reg
echo "\\"dmstyle\\"=\\"native\\"" >> override.reg
regedit override.reg

#cleaning temp
#cd "$WINEPREFIX/drive_c/windows/temp/"
#rm -rf *

#making shortcut
POL_SetupWindow_make_shortcut "$PREFIX" "$PROGRAMFILES/JoWooD/Gothic II/System" "Gothic2.exe" "" "$TYTUL" "" ""
Set_WineVersion_Assign "$CHOSENWINEVERSION" "$TYTUL"
POL_SetupWindow_message "$TYTUL has been installed successfully" "$TYTUL"

#asking about resolution
POL_SetupWindow_question "Every time you want to change game resolution\\nyou'll have to run this script again\\nDo you want to change resolution right now?" "$TYTUL"
if [ "$APP_ANSWER" == "TRUE" ] ;then
Change_Resolution
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


The Night Of the Raven:
#!/bin/bash
# Date : (2009-07-06 12-00)
# Last revision : (2012-04-09 12-00)
# Wine version used : 1.1.25
# Distribution used to test : Fedora 11, Archlinux
# Author : NSLW (edited by Verdan)
# Licence : Retail
# Depend : ImageMagick, unzip

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

#fetching PROGRAMFILES environmental variable
PROGRAMFILES=`wine cmd /c echo "%ProgramFiles%"`
PROGRAMFILES=${PROGRAMFILES:3}

if [ "$POL_LANG" == "de" ]; then
PODTYTUL="Die Nacht des Raben"

else
PODTYTUL="The Night Of The Raven"
fi

TYTUL="Gothic 2 - $PODTYTUL"
PREFIX="Gothic2"
WORKINGWINEVERSION="1.1.25"

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)"
}

#Changing resolution doesn't work for the gold edition, probably because its case sensitive. (Gothic.ini for my gold edition instead of gothic.ini)
Change_Resolution()
{

cd "$WINEPREFIX/drive_c/$PROGRAMFILES/JoWooD/Gothic II/System"
OLDX=`cat gothic.ini | grep "zVidResFullscreenX=" | cut -d"=" -f2`
OLDY=`cat gothic.ini | grep "zVidResFullscreenY=" | cut -d"=" -f2`
OLDBPP=`cat gothic.ini | grep "zVidResFullscreenBPP=" | cut -d"=" -f2`

POL_SetupWindow_menu_list "Choose display resolution" "Display resolution" "1024x768~800x600~640x480" "~"
RES="$APP_ANSWER"
POL_SetupWindow_menu_list "Choose color depth" "Color depth" "32~16" "~"
NEWBPP="$APP_ANSWER"

NEWX=`echo $RES | cut -d"x" -f1`
NEWY=`echo $RES | cut -d"x" -f2`
rm gothic.ini.bak
mv gothic.ini gothic.ini.bak

cat gothic.ini.bak | sed -e "s/zVidResFullscreenX=$OLDX/zVidResFullscreenX=$NEWX/g" | sed -e "s/zVidResFullscreenY=$OLDY/zVidResFullscreenY=$NEWY/g" | sed -e "s/zVidResFullscreenBPP=$OLDBPP/zVidResFullscreenBPP=$NEWBPP/g" > gothic.ini
}

prepare_patched_WineVesrsion()
{
POL_SetupWindow_install_wine "$1"
cd "$REPERTOIRE/WineVersions"
POL_SetupWindow_wait_next_signal "Removing old WineVersion" "$TYTUL"
rm -fr "$1-PA"
POL_SetupWindow_detect_exit

POL_SetupWindow_wait_next_signal "Copying WineVersion" "$TYTUL"
cp -r "$1" "$1-PA"
cp "$WINEPREFIX/drive_c/windows/temp/winepulse.drv.so" "$REPERTOIRE/WineVersions/$1-PA/usr/lib/wine/winepulse.drv.so"
POL_SetupWindow_detect_exit
}

POL_SetupWindow_Init
POL_SetupWindow_presentation "$TYTUL" "Piranha Bytes" "www.gothic2.com" "NSLW" "$PREFIX"

select_prefix "$REPERTOIRE/wineprefix/$PREFIX"

LATESTVERSION=$(Get_Latest_Wine_Version)
CHOSENWINEVERSION="$LATESTVERSION"
Use_WineVersion "$CHOSENWINEVERSION"

#asking about patching or updating Wine version
if [ -e "$REPERTOIRE/configurations/installed/$TYTUL" ]; then
POL_SetupWindow_menu "What do you want to do?" "Actions" "Change resolution~Update Wine version to $WORKINGWINEVERSION" "~"

if [ "$APP_ANSWER" == "Change resolution" ]then
Change_Resolution
elif [ "$APP_ANSWER" == "Update Wine version to $WORKINGWINEVERSION" ]
then
   CHOSENWINEVERSION="$LATESTVERSION-PA"
   download_pulseudio
   prepare_patched_WineVesrsion "$LATESTVERSION"
   cd "$WINEPREFIX/drive_c/windows/temp/"
   echo "[HKEY_CURRENT_USER\\\\Software\\\\Wine\\\\Drivers]" > pa.reg
   echo "\\"Audio\\"=\\"pulse\\"" >> pa.reg
   regedit pa.reg
   Set_WineVersion_Assign "$CHOSENWINEVERSION" "$TYTUL"
fi

POL_SetupWindow_Close
exit
fi

#The Addon exe is in a subdirectory
POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom "Addon/Gothic2-Addon-Setup.exe"

#taking icon from the game
convert "$CDROM/AutoRun.ico" -geometry 32X32 "$REPERTOIRE/icones/32/$TYTUL"

cd "$REPERTOIRE/ressources"
if [ ! -e "gothic2_vdfs-patch.zip" ]; then
POL_SetupWindow_wait_next_signal "Downloading VDFS patch..." "$TYTUL"
wget http://forum.jowood.de/attachment.php?attachmentid=25660 --output-document=gothic2_vdfs-patch.zip
POL_SetupWindow_detect_exit
fi

cd "$WINEPREFIX/drive_c/windows/temp/"
echo "[HKEY_LOCAL_MACHINE\\\\Software\\\\Wine\\\\Drives]" > cdrom.reg
echo "\\"g:\\"=\\"cdrom\\"" >> cdrom.reg
regedit cdrom.reg
sleep 5

#starting installation
POL_SetupWindow_wait_next_signal "Installation in progress..." "$TYTUL"
cd "$CDROM"
wine "Addon/Gothic2-Addon-Setup.exe"
POL_SetupWindow_detect_exit

#applying vdfs patch
POL_SetupWindow_wait_next_signal "Installing VDFS patch..." "$TYTUL"
cd "$WINEPREFIX/drive_c/windows/temp/"
unzip "$REPERTOIRE/ressources/gothic2_vdfs-patch.zip"
wine gothic2_vdfs-patch.exe
POL_SetupWindow_detect_exit

#cleaning temp
#cd "$WINEPREFIX/drive_c/windows/temp/"
#rm -rf *

#making shortcut
mv -f "$REPERTOIRE/configurations/installed/Gothic 2" "$REPERTOIRE/configurations/installed/$TYTUL"
Set_WineVersion_Assign "$CHOSENWINEVERSION" "$TYTUL"
POL_SetupWindow_message "$TYTUL has been installed successfully" "$TYTUL"

#asking about resolution
POL_SetupWindow_question "Every time you want to change game resolution\\nyou'll have to run this script again\\nDo you want to change resolution right now?" "$TYTUL"
if [ "$APP_ANSWER" == "TRUE" ] ;then
Change_Resolution
fi

POL_SetupWindow_message_image "The game will show error about VDFS\\neverytime you'll try to run it\\nPlease don't be bothered by that and just hit OK\\nThe game will start after" "Note about resolution" "/usr/share/playonlinux/themes/tango/info.png"

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


Oh, and the game runs perfectly on my system (Archlinux 32-bit).

Edited by verdan

This site allows content generated by members, and we promptly remove any content that infringes copyright according to our Terms of Service. To report copyright infringement, please send a notice to dmca-notice@playonlinux.com