#!/bin/bash
if
[
"$PLAYONLINUX"
=
""
];
then
exit
0
fi
source
"$PLAYONLINUX/lib/sources"
VERSIONWINE=$(wine --version)
TYTUL=
"S.T.A.L.K.E.R. - Clear Sky"
PREFIX=
"STALKERCS"
WORKINGWINEVERSION=
"1.1.25"
patch_stalker() {
POL_SetupWindow_browse
"Select patch file downloaded from www.stalker-game.com"
"$TYTUL"
""
wine
"$APP_ANSWER"
POL_SetupWindow_wait_next_signal
"Installation in progress..."
"$TYTUL"
POL_SetupWindow_detect_exit
POL_SetupWindow_message
"Patch for $TYTUL has been installed successfully"
"$TYTUL"
}
download_libraries() {
cd
"$REPERTOIRE/ressources/"
if
[ ! -e $REPERTOIRE
/ressources/STALKER_ClearSky
.
tar
.gz ];
then
fi
tar
-xzvf
"STALKER_ClearSky.tar.gz"
}
prepare_patched_WineVersion() {
POL_SetupWindow_install_wine
"$1"
cd
$REPERTOIRE
/WineVersions
POL_SetupWindow_wait_next_signal
"Copying WineVersion"
"$TYTUL"
rm
-Rf
"$1-$PREFIX"
cp
-R
"$1"
"$1-$PREFIX"
rm
-Rf
"$REPERTOIRE/WineVersions/$1-$PREFIX/usr/lib/wine/dinput.dll.so"
mv
"$REPERTOIRE/ressources/dinput.dll.so"
"$REPERTOIRE/WineVersions/$1-$PREFIX/usr/lib/wine/dinput.dll.so"
POL_SetupWindow_detect_exit
}
copy_libraries() {
cd
"$WINEPREFIX/drive_c/windows/system32/"
mv
"$REPERTOIRE/ressources/d3dx9_31.dll"
d3dx9_31.dll
mv
"$REPERTOIRE/ressources/d3dx9_36.dll"
d3dx9_36.dll
mv
"$REPERTOIRE/ressources/d3dx9_37.dll"
d3dx9_37.dll
mv
"$REPERTOIRE/ressources/dinput.dll"
dinput.dll
cp
"$REPERTOIRE/ressources/openal32.dll"
openal32.dll
cp
"$REPERTOIRE/ressources/wrap_oal.dll"
wrap_oal.dll
cd
"$WINEPREFIX/drive_c/Program Files/Deep Silver/S.T.A.L.K.E.R. - Clear Sky/bin"
mv
"$REPERTOIRE/ressources/openal32.dll"
openal32.dll
mv
"$REPERTOIRE/ressources/wrap_oal.dll"
wrap_oal.dll
}
POL_SetupWindow_Init
POL_SetupWindow_presentation
"$TYTUL"
"Deep Silver"
"N/A"
"NSLW"
"$PREFIX"
select_prefixe
"$REPERTOIRE/wineprefix/$PREFIX"
POL_SetupWindow_menu
"What do you want to do?"
"Actions"
"Install the game:Patch your game"
":"
if
[
"$APP_ANSWER"
==
"Patch your game"
];
then
if
[ -e
"$REPERTOIRE/wineprefix/$PREFIX"
];
then
patch_stalker
fi
POL_SetupWindow_Close
fi
POL_SetupWindow_prefixcreate
POL_SetupWindow_menu
"What Wineversion would you like to use?"
"WineVersions"
"Patched $WORKINGWINEVERSION version (recommended):Patched latest version (untested):Unpatched version"
":"
download_libraries
if
[
"$APP_ANSWER"
==
"Patched $WORKINGWINEVERSION version (recommended)"
];
then
CHOSENWINEVERSION=$WORKINGWINEVERSION-$PREFIX
prepare_patched_WineVersion
"$WORKINGWINEVERSION"
elif
[
"$APP_ANSWER"
==
"Patched latest version (untested)"
];
then
cd
"$WINEPREFIX/drive_c/windows/temp"
wget http:
//mulx
.playonlinux.com
/wine/linux-i386/LIST
cat
LIST |
sed
-e
's/\\.//g'
|
cut
-d
';'
-f2 |
sort
-n |
tail
-n1 >& LatestVersion.txt
x=`
cat
LatestVersion.txt |
cut
-c1-1`
y=`
cat
LatestVersion.txt |
cut
-c2-2`
z=`
cat
LatestVersion.txt |
cut
-c3-4`
LATESTVERSION=$x.$y.$z
CHOSENWINEVERSION=$LATESTVERSION-$PREFIX
prepare_patched_WineVersion
"$LATESTVERSION"
else
CHOSENWINEVERSION=$VERSIONWINE
fi
POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom
"setup.exe"
cd
$WINEPREFIX
/dosdevices
ln
-s $CDROM d:
echo
"[HKEY_LOCAL_MACHINE\\\\Software\\\\Wine\\\\Drives]"
> $REPERTOIRE
/tmp/cdrom
.reg
echo
"\\"
d:\\
"=\\"
cdrom\\
""
>> $REPERTOIRE
/tmp/cdrom
.reg
regedit
"$REPERTOIRE/tmp/cdrom.reg"
POL_SetupWindow_message
"Wait 5 seconds then click next. Please install the game in the default directory."
"$TYTUL"
cd
$REPERTOIRE
/ressources/
POL_SetupWindow_wait_next_signal
"Installation in progress..."
"$TYTUL"
cd
$CDROM
wine $CDROM
/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-640-768-896-1024-2048"
"-"
"256"
VMS=
"$APP_ANSWER"
copy_libraries
cd
"$WINEPREFIX/drive_c/windows/temp/"
echo
"[HKEY_CURRENT_USER\\\\Software\\\\Wine\\\\Direct3D]"
> vms.reg
echo
"\\"
VideoMemorySize\\
"=\\"
$VMS\\
""
>> vms.reg
regedit vms.reg
echo
"[HKEY_CURRENT_USER\\\\Software\\\\Wine\\\\DllOverrides]"
> override.reg
echo
"\\"
d3dx9_31.dll\\
"=\\"
native\\
""
>> override.reg
echo
"\\"
d3dx9_36.dll\\
"=\\"
native\\
""
>> override.reg
echo
"\\"
d3dx9_37.dll\\
"=\\"
native\\
""
>> override.reg
regedit override.reg
echo
"[HKEY_CURRENT_USER\\\\Software\\\\Wine\\\\Direct3D]"
> fbo.reg
echo
"\\"
OffscreenRenderingMode\\
"=\\"
fbo\\
""
>> fbo.reg
regedit fbo.reg
echo
"[HKEY_CURRENT_USER\\\\Software\\\\Wine\\\\DirectInput]"
> mwo.reg
echo
"\\"
MouseWarpOverride\\
"=\\"
force\\
""
>> mwo.reg
regedit mwo.reg
cd
"$WINEPREFIX/drive_c/windows/temp/"
rm
-Rf *
cp
"$CDROM/stalker.ico"
"$REPERTOIRE/icones/32/$TYTUL"
POL_SetupWindow_make_shortcut
"$PREFIX"
"Program Files/Deep Silver/S.T.A.L.K.E.R. - Clear Sky"
"bin/xrEngine.exe"
""
"$TYTUL"
""
"-i"
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_stalker
fi
POL_SetupWindow_Close
exit