The forum

[Script] Battlefield 2142

Author Replies
CKDevelop Sunday 13 December 2009 at 15:01
CKDevelop

Hi all,
well here is a little script POL for this good little game.

#!/bin/bash
# Date : (2009-12-13 14-11)
# Last revision : (2009-12-30 14-11)
# Wine version used : 1.1.21
# Distribution used to test : Ubuntu 9.10
# Author : Re-scripted by CKDevelop based on the script NSLW of jau Battlefield 2
# Licence : Retail
 
[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"
 
TYTUL="Battlefield 2142"
PREFIX="Battlefield2142"
WORKINGWINEVERSION="1.1.21"
 
#procedure for patching Battlefield 2142
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"
 
#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" "~"
 
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
#fetching PROGRAMFILES environmental variable
PROGRAMFILES=`wine cmd /c echo "%ProgramFiles%"`
PROGRAMFILES=${PROGRAMFILES:3}
 
#adding CD-ROM as drive d: to winecfg
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
 
#starting installation
cd "$CDROM"
wine "setup.exe"
POL_SetupWindow_message "Click \\"Next\\" when installation will finish." "$TYTUL"
 
cd "$WINEPREFIX/drive_c/windows/temp/"
#setting OffscreenRenderingMode to fbo and Multisampling to enabled
echo "[HKEY_CURRENT_USER\\\\Software\\\\Wine\\\\Direct3D]" > fbo.reg
echo "\\"OffscreenRenderingMode\\"=\\"fbo\\"" >> fbo.reg
#echo "\\"Multisampling\\"=\\"enabled\\"" >> fbo.reg
regedit fbo.reg
 
#asking about graphic card
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?
It'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
 
#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
 
#setting decorated to N
echo "[HKEY_CURRENT_USER\\\\Software\\\\Wine\\\\X11 Driver]" > decorated.reg
echo "\\"Decorated\\"=\\"N\\"" >> decorated.reg
regedit decorated.reg
 
Set_DXGrab "On"
 
#cleaning temp
cd "$WINEPREFIX/drive_c/windows/temp/"
rm -rf *
 
#making shortcut
cp "$CDROM/BF2142.ico" "$REPERTOIRE/icones/32/$TYTUL"
#cp "$CDROM/BF2142.ico" "$REPERTOIRE/icones/32/Play BF2142 Online Now!"
POL_SetupWindow_make_shortcut "$PREFIX" "$PROGRAMFILES/Electronic Arts/Battlefield 2142" "BF2142.exe" "" "$TYTUL" "" "+menu 1 +fullscreen 1"
Set_WineVersion_Assign "$WORKINGWINEVERSION" "$TYTUL"
#POL_SetupWindow_make_shortcut "$PREFIX" "$PROGRAMFILES/Electronic Arts/Battlefield 2142" "BF2142.exe" "" "Play BF2142 Online Now!" "" "+playNow 1 +menu 1 +fullscreen 1"
#Set_WineVersion_Assign "$WORKINGWINEVERSION" "Play BF2142 Online Now!"
 
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"
#cp "$WINEPREFIX/drive_c/$PROGRAMFILES/Electronic Arts/Battlefield 2142/mods/xpack/bf2142xpack.ico" "$REPERTOIRE/icones/32/Play BF2142 SF Online Now!"
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"
#POL_SetupWindow_make_shortcut "$PREFIX" "$PROGRAMFILES/Electronic Arts/Battlefield 2142" "BF2142.exe" "" "Play BF2142 SF Online Now!" "" "+playNow 1 +menu 1 +fullscreen 1 +modPath mods/xpack"
#Set_WineVersion_Assign "$WORKINGWINEVERSION" "Play BF2142 SF Online Now!"
fi
 
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_battlefield2142
fi
 
POL_SetupWindow_message_image "Please note that this game has a copy protection system
and sadly, it prevents Wine from running the game.

PlayOnLinux will not provide any help concerning any illegal
stuff." "Note about copy protection" "$PLAYONLINUX/themes/tango/warning.png"
 
POL_SetupWindow_Close
exit


++

Edited by CKDevelop

NSLW Sunday 13 December 2009 at 15:55
NSLW

Did you wrote it yourself?
CKDevelop Sunday 13 December 2009 at 16:49
CKDevelop

I based the script on Battlefield 2 that the transition does not go on Ubuntu9.10 with version 1.1.21 of Wine, but it happens with the 1.1.29.

So I based on your script BF2 passes very well with BF2142

Just the path to reshape.

I apologize for not having said at the beginning this is an unintentionally forget me :incertain:...

Ps: Excuse my English but this is a Google translation

:D

Edited by CKDevelop

NSLW Monday 14 December 2009 at 7:55
NSLW

Ok.. but why do you use patched wine?
CKDevelop Monday 14 December 2009 at 11:49
CKDevelop

--- Okay. but why do you use patched "Wine? ---

I is not understood your question? In addition I have just tested BF2 and BF2142 and they look better spent with version 1.1.33 of Wine. There is no sound and texture issues on the ground.

You know if the script will not you again and you wish to change .... I'm trying and I'm posting the news. Otherwise when I feel like I script, and if the bases are free I emissions without scruple final time as they end up in the arms of community.

hihi + +

Edited by CKDevelop

NSLW Monday 14 December 2009 at 17:19
NSLW

I'm unable to understand google translator.
CKDevelop Monday 14 December 2009 at 20:40
CKDevelop

NSLW Tuesday 15 December 2009 at 19:14
NSLW

Maybe Berillions could help you translate your thoughts. I cannot accept script which uses patch (even if it's patch created by me) which isn't required. I don't see any recommendations for that patch on AppDB for BF2142

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