#!/bin/bash
[
"$PLAYONLINUX"
=
""
] &&
exit
0
source
"$PLAYONLINUX/lib/sources"
PROGRAMFILES=`wine cmd
/c
echo
"%ProgramFiles%"
`
PROGRAMFILES=${PROGRAMFILES:3}
TYTUL=
"F.E.A.R. 2 Project Origin"
PREFIX=
"FEAR2"
STEAM=
"0"
Get_Latest_Wine_Version()
{
cd
"$REPERTOIRE/tmp"
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)"
}
POL_SetupWindow_make_icon_for_shortcut()
{
LAUNCHERFILENAME=
"$REPERTOIRE/configurations/installed/$1"
EXEPATH=`
cat
"$LAUNCHERFILENAME"
|
tail
-n 2 |
head
-n 1 |
cut
-d
'"'
-f2`
EXENAME=`
cat
"$LAUNCHERFILENAME"
|
tail
-n 1 |
cut
-d
'"'
-f2`
wrestool
"$EXEPATH/$EXENAME"
-x -t14 >
"$REPERTOIRE/tmp/icon.ico"
ICOBITDEPTH=`icotool -l
"$REPERTOIRE/tmp/icon.ico"
|
grep
'\\-\\-width=32'
|
cut
-d
' '
-f5 |
cut
-d
'='
-f2 |
sort
-n |
tail
-n 1`
ICOINDEX=`icotool -l
"$REPERTOIRE/tmp/icon.ico"
|
grep
"\\-\\-width=32"
|
grep
"\\-\\-bit-depth=$ICOBITDEPTH"
|
tail
-n 1 |
cut
-d
' '
-f2 |
cut
-d
'='
-f2`
icotool -x --index=$ICOINDEX
"$REPERTOIRE/tmp/icon.ico"
-o
"$REPERTOIRE/icones/32/$1"
}
wget http:
//upload
.wikimedia.org
/wikipedia/en/9/90/POF2picture
.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
"$TYTUL"
"Monolith"
"www.whatisfear.com"
"NSLW"
"$PREFIX"
if
[ ! -e
"$REPERTOIRE/configurations/installed/Steam"
];
then
POL_SetupWindow_message
"Please install Steam before $TYTUL"
POL_SetupWindow_Close
exit
fi
POL_SetupWindow_menu
"What do you want to do?"
"Actions"
"Install game from DVD~Adapt Steam version"
"~"
if
[
"$APP_ANSWER"
==
"Adapt Steam version"
];
then
if
[ ! -d
"$REPERTOIRE/wineprefix/Steam/drive_c/$PROGRAMFILES/Steam/steamapps/common/fear2"
];
then
POL_SetupWindow_message
"Please install $TYTUL in Steam first"
POL_SetupWindow_Close
exit
else
STEAM=
"1"
fi
fi
select_prefix
"$REPERTOIRE/wineprefix/$PREFIX"
LATESTVERSION=$(Get_Latest_Wine_Version)
CHOSENWINEVERSION=
"$LATESTVERSION"
POL_SetupWindow_install_wine
"$LATESTVERSION"
Use_WineVersion
"$CHOSENWINEVERSION"
POL_SetupWindow_prefixcreate
if
[ ! -e
"$HOME/.winetrickscache/vcredist_x86.exe"
]
then
mkdir
"$HOME/.winetrickscache"
cd
"$HOME/.winetrickscache"
fi
cd
"$REPERTOIRE/ressources"
if
[
"`sha1sum < wmfadist.exe | sed 's/ .*//'`"
!=
"333750aa2d2121ad3e332ada651add83170b7bf8"
];
then
POL_SetupWindow_wait_next_signal
"PlayOnLinux is downloading Windows Media Format 9..."
"$TYTUL"
wget http:
//www
.acoustica.com
/downloading
.asp?p=1002
POL_SetupWindow_detect_exit
fi
if
[
"`sha1sum < winetricks | sed 's/ .*//'`"
!=
"e71457524b2f9a0c81369745ea9018d9278565b2"
];
then
wget http:
//winezeug
.googlecode.com
/svn/trunk/winetricks
--output-document=winetricks
fi
WINETRICKSDX=`
cat
winetricks |
grep
\\
/directx
|
cut
-d
'_'
-f2`
WINETRICKSDXLINK=`
cat
winetricks |
grep
\\
/directx
|
cut
-d
'/'
-f5,6,7,8`
cd
"$WINEPREFIX/drive_c/windows/temp"
cat
"$REPERTOIRE/ressources/winetricks"
|
sed
-e
's/set_winver\\ win2k/set_winver\\ winxp/'
> winetricks
if
[ ! -e
"$HOME/.winetrickscache/directx_${WINETRICKSDX}_redist.exe"
];
then
mkdir
"$HOME/.winetrickscache"
cd
"$HOME/.winetrickscache"
fi
if
[
"$STEAM"
==
"0"
];
then
select_prefix
"$REPERTOIRE/wineprefix/Steam"
POL_SetupWindow_message
"Please insert first F.E.A.R. 2 DVD"
"$TYTUL"
POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom
"Setup.exe"
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
"$CDROM"
wine
"Setup.exe"
POL_SetupWindow_message
"Please insert second DVD when installer asks and press Forward"
"$TYTUL"
wine
eject
d:
POL_SetupWindow_message
"Click \\"
Next\\
" when installation will finish."
"$TYTUL"
fi
select_prefix
"$REPERTOIRE/wineprefix/$PREFIX"
cd
"$WINEPREFIX/drive_c/windows/temp/"
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
echo
"[HKEY_CURRENT_USER\\\\Software\\\\Wine\\\\Direct3D]"
> msa.reg
echo
"\\"
Multisampling\\
"=\\"
enabled\\
""
>> msa.reg
regedit msa.reg
cd
"$WINEPREFIX/drive_c/windows/temp"
POL_SetupWindow_wait_next_signal
"Installing DirectX libraries..."
"$TYTUL"
bash
winetricks -q directx9
POL_SetupWindow_detect_exit
POL_SetupWindow_wait_next_signal
"Installing Visual C++ 2005 SP1 runtime libraries..."
"$TYTUL"
bash
winetricks -q vcrun2005sp1
POL_SetupWindow_detect_exit
cd
"$REPERTOIRE/ressources"
POL_SetupWindow_wait_next_signal
"Installing Windows Media Format 9..."
"$TYTUL"
wine wmfadist.exe
/Q
POL_SetupWindow_detect_exit
Set_Managed
"Off"
cd
"$WINEPREFIX/drive_c/windows/temp/"
rm
-rf *
POL_SetupWindow_make_shortcut
"$PREFIX"
"$PROGRAMFILES/Steam/steamapps/common/fear2"
"FEAR2.exe"
""
"$TYTUL"
""
""
Set_WineVersion_Assign
"$CHOSENWINEVERSION"
"$TYTUL"
cd
"$REPERTOIRE/configurations/installed"
mv
-f
"$TYTUL"
"FEAR2"
cat
"FEAR2"
|
sed
-e
"s/$PREFIX\\/drive\\_c/Steam\\/drive\\_c/"
>
"$TYTUL"
rm
-f
"FEAR2"
POL_SetupWindow_make_icon_for_shortcut
"$TYTUL"
POL_SetupWindow_message
"$TYTUL has been installed successfully"
"$TYTUL"
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