#!/bin/bash
[
"$PLAYONLINUX"
=
""
] &&
exit
0
source
"$PLAYONLINUX/lib/sources"
TYTUL=
"Battlefield 2142"
PREFIX=
"Battlefield2142"
WORKINGWINEVERSION=
"1.1.33"
patch_battlefield2142()
{
POL_SetupWindow_browse
"Select patch file downloaded from support.ea.com"
"$TYTUL"
""
wine $APP_ANSWER
POL_SetupWindow_message
"Patch for $TYTUL has been installed successfully"
"$TYTUL"
}
prepare_patched_WineVesrsion()
{
POL_SetupWindow_install_wine
"$1"
cd
"$REPERTOIRE/WineVersions"
POL_SetupWindow_wait_next_signal
"Removing old WineVersion"
"$TYTUL"
rm
-fr
"$1-$PREFIX"
POL_SetupWindow_detect_exit
POL_SetupWindow_wait_next_signal
"Copying WineVersion"
"$TYTUL"
cp
-r
"$1"
"$1-$PREFIX"
rm
-fr
"$REPERTOIRE/WineVersions/$1-$PREFIX/usr/lib/wine/wined3d.dll.so"
cp
"$WINEPREFIX/drive_c/windows/temp/wined3d.dll.so"
"$REPERTOIRE/WineVersions/$1-$PREFIX/usr/lib/wine/wined3d.dll.so"
POL_SetupWindow_detect_exit
}
wget http:
//upload
.wikimedia.org
/wikipedia/en/thumb/4/40/Battlefield_2142_box_art
.png
/256px-Battlefield_2142_box_art
.png --output-document=
"$REPERTOIRE/tmp/leftnotscaled.png"
convert
"$REPERTOIRE/tmp/leftnotscaled.png"
-scale 150x356\\!
"$REPERTOIRE/tmp/left.png"
POL_SetupWindow_Init
""
"$REPERTOIRE/tmp/left.png"
POL_SetupWindow_presentation
"$TYTUL"
"Dice"
"battlefield.ea.com/battlefield/bf2142/"
"CKDevelop"
"$PREFIX"
select_prefix
"$REPERTOIRE/wineprefix/$PREFIX"
if
[ -e
"$REPERTOIRE/configurations/installed/$TYTUL"
];
then
POL_SetupWindow_menu
"What do you want to do?"
"Actions"
"Patch game"
"~"
if
[
"$APP_ANSWER"
==
"Patch game"
];
then
patch_battlefield2142
fi
POL_SetupWindow_Close
exit
fi
POL_SetupWindow_message
"Please insert $TYTUL media into your disk drive."
POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom
"setup.exe"
prepare_patched_WineVesrsion
"$WORKINGWINEVERSION"
Use_WineVersion
"$WORKINGWINEVERSION"
POL_SetupWindow_prefixcreate
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
cd
"$CDROM"
wine
"setup.exe"
POL_SetupWindow_message
"Click \\"
Next\\
" when installation will finish."
"$TYTUL"
cd
"$WINEPREFIX/drive_c/windows/temp/"
echo
"[HKEY_CURRENT_USER\\\\Software\\\\Wine\\\\Direct3D]"
> fbo.reg
echo
"\\"
OffscreenRenderingMode\\
"=\\"
fbo\\
""
>> fbo.reg
regedit fbo.reg
POL_SetupWindow_menu
"What graphic card do you have got?"
"Actions"
"NVIDIA ATI"
" "
if
[
"$APP_ANSWER"
==
"NVIDIA"
];
then
POL_SetupWindow_menu
"Do you've got \\"
DynamicTwinView\\
" set to \\"
FALSE\\
" in your xorg.conf?\\nIt's recommended"
"Question"
"Yes No Don't-know"
" "
if
[
"$APP_ANSWER"
==
"Yes"
];
then
echo
"Fullscreen"
else
Set_Desktop
"On"
"1920"
"1440"
fi
elif
[
"$APP_ANSWER"
==
"ATI"
]
then
echo
"\\"
UseGLSL\\
"=\\"
disabled\\
""
>> VideoDriver.reg
Set_Desktop
"On"
"1920"
"1440"
regedit VideoDriver.reg
fi
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\\\\X11 Driver]"
> decorated.reg
echo
"\\"
Decorated\\
"=\\"
N\\
""
>> decorated.reg
regedit decorated.reg
Set_DXGrab
"On"
cd
"$WINEPREFIX/drive_c/windows/temp/"
rm
-rf *
cp
"$CDROM/BF2142.ico"
"$REPERTOIRE/icones/32/$TYTUL"
POL_SetupWindow_make_shortcut
"$PREFIX"
"$PROGRAMFILES/Electronic Arts/Battlefield 2142"
"BF2142.exe"
""
"$TYTUL"
""
"+menu 1 +fullscreen 1"
Set_WineVersion_Assign
"$WORKINGWINEVERSION"
"$TYTUL"
POL_SetupWindow_menu
"What is the version of your game?"
"Version"
"Deluxe Normal"
" "
if
[
"$APP_ANSWER"
==
"Deluxe"
];
then
cp
"$WINEPREFIX/drive_c/$PROGRAMFILES/Electronic Arts/Battlefield 2142/mods/xpack/bf2142xpack.ico"
"$REPERTOIRE/icones/32/$TYTUL Special Forces"
POL_SetupWindow_make_shortcut
"$PREFIX"
"$PROGRAMFILES/Electronic Arts/Battlefield 2142"
"BF2142.exe"
""
"$TYTUL Special Forces"
""
"+menu 1 +fullscreen 1 +modPath mods/xpack"
Set_WineVersion_Assign
"$WORKINGWINEVERSION"
"$TYTUL Special Forces"
fi
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_battlefield2142
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