#!/bin/bash
[
"$PLAYONLINUX"
=
""
] &&
exit
0
source
"$PLAYONLINUX/lib/sources"
PROGRAMFILES=`wine cmd
/c
echo
"%ProgramFiles%"
`
PROGRAMFILES=${PROGRAMFILES:3}
TYTUL=
"Gothic"
PREFIX=
"Gothic"
WORKINGWINEVERSION=
"1.1.25"
patch_gothic()
{
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/Piranha Bytes/Gothic/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"
"1280x800~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
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.piranha-bytes.com"
"NSLW"
"$PREFIX"
select_prefix
"$REPERTOIRE/wineprefix/$PREFIX"
LATESTVERSION=$(Get_Latest_Wine_Version)
CHOSENWINEVERSION=
"$LATESTVERSION"
Use_WineVersion
"$CHOSENWINEVERSION"
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_gothic
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"
convert
"$CDROM/gothic.ico"
-geometry 32X32
"$REPERTOIRE/icones/32/$TYTUL"
POL_SetupWindow_prefixcreate
CDROM2=${CDROM
//
"1"
/
"2"
}
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
cd
"$REPERTOIRE/ressources/"
POL_SetupWindow_wait_next_signal
"PlayOnLinux is downloading DLLs required for displaying help"
"$TYTUL"
if
[
"`sha1sum < dmband.dll | sed 's/ .*//'`"
!=
"72d574b557865850247e58ee69af84e37ef75ac2"
];
then
fi
if
[
"`sha1sum < dmcompos.dll | sed 's/ .*//'`"
!=
"bc775f826398e9c6a656acbd41808217c995781e"
];
then
fi
if
[
"`sha1sum < dmime.dll | sed 's/ .*//'`"
!=
"4dd11c042fd420325044ea379935a10102b0cc00"
];
then
fi
if
[
"`sha1sum < dmloader.dll | sed 's/ .*//'`"
!=
"4250676edacc33c54c6db511c812ff71571c305a"
];
then
fi
if
[
"`sha1sum < dmsynth.dll | sed 's/ .*//'`"
!=
"7a7843d5f385795d6cc18f86e78c191ecd524424"
];
then
fi
if
[
"`sha1sum < dmusic.dll | sed 's/ .*//'`"
!=
"4eb4aa8f545c0073d012bfc69ceb837098db4f2e"
];
then
fi
if
[
"`sha1sum < dmstyle.dll.zip | sed 's/ .*//'`"
!=
"e860c26e23310a5765c2e2110e40c5c076503643"
];
then
fi
unzip dmstyle.dll.zip
POL_SetupWindow_detect_exit
POL_SetupWindow_wait_next_signal
"Installation in progress..."
"$TYTUL"
cd
"$CDROM"
wine
"Setup.exe"
POL_SetupWindow_detect_exit
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
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
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
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
POL_SetupWindow_make_shortcut
"$PREFIX"
"$PROGRAMFILES/Piranha Bytes/Gothic/System"
"GOTHIC.EXE"
""
"$TYTUL"
""
""
Set_WineVersion_Assign
"$CHOSENWINEVERSION"
"$TYTUL"
POL_SetupWindow_message
"$TYTUL has been installed successfully"
"$TYTUL"
POL_SetupWindow_question
"Do you want to patch your game?"
"$TYTUL"
if
[
"$APP_ANSWER"
==
"TRUE"
] ;
then
patch_gothic2
fi
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_Close
exit