You are here > Les forums > Your creations. > [script] Battlefield 2 fr

Forums

[script] Battlefield 2

New topic  - Reply
Author Replies
NSLW Monday 11 May 2009 at 18:09 - [Quote]
Membre

Membre
Hello,
I wrote script which installs Battlefield 2. It also can patch the game after it's been installed

Wine version : 1.1.21
Distribution : Fedora
Distribution Version : 10 (32 bit)
Graphics card : Nvidia, GeForce 9xxx
Drivers of the graphics card : 185.18.08
Comments
-use latest 1.41 game patch
-game doesn't work with original bf2.exe
-don't set sound to hardware acceleration
-disable EAX, Dynamic Shadows, Dynamic Light
-punkbuster doesn't work
-override antialiasing to at least 2x in nvidia-settings

The script should be tested more so don't expect this to work in every case.

Icon for the game:




#!/bin/bash
# Date : (2009-05-30 18-00)
# Last revision : (2009-05-30 18-00)
# Wine version used : 1.1.21
# Distribution used to test : Fedora 10
# Author : NSLW
# Licence : Retail
# Depend : unzip

[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"

TYTUL="Battlefield 2"
PREFIX="Battlefield2"
WORKINGWINEVERSION="1.1.21"
 
#procedure for patching Battlefield 2
patch_battlefield2()
{
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
}

download_wined3d()
{
cd "$REPERTOIRE/ressources/"
if [ ! -e "$REPERTOIRE/ressources/wined3d.dll.so-bf2-$WORKINGWINEVERSION.zip" ]; then
POL_SetupWindow_download "Downloading patch by Henri Verbeet" "$TYTUL" "http://www.hostmen.pl/upload/wined3d.dll.so-bf2-$WORKINGWINEVERSION.zip"
fi
cd "$WINEPREFIX/drive_c/windows/temp/"
unzip "$REPERTOIRE/ressources/wined3d.dll.so-bf2-$WORKINGWINEVERSION.zip"
}

POL_SetupWindow_Init
POL_SetupWindow_presentation "$TYTUL" "EA" "N/A" "NSLW" "$PREFIX" 
 
select_prefix "$REPERTOIRE/wineprefix/$PREFIX"
 
#asking about patching
POL_SetupWindow_menu "What do you want to do?" "Actions" "install-game patch-game" " "
if [ "$APP_ANSWER" == "patch-game" ]; then
	if [ -e "$REPERTOIRE/wineprefix/$PREFIX" ]; then
	patch_battlefield2
	fi
POL_SetupWindow_Close
fi
 
POL_SetupWindow_prefixcreate

download_wined3d
prepare_patched_WineVesrsion "$WORKINGWINEVERSION"
Use_WineVersion "$WORKINGWINEVERSION"

POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom "setup.exe"
 
#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
 
POL_SetupWindow_message "Wait 5 seconds then click next" "$TYTUL"

#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?\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
 
#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-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/BF2.ico" "$REPERTOIRE/icones/32/$TYTUL"
cp "$CDROM/BF2.ico" "$REPERTOIRE/icones/32/Play BF2 Online Now!"
POL_SetupWindow_make_shortcut "$PREFIX" "Program Files/EA GAMES/Battlefield 2" "BF2.exe" "" "$TYTUL" "" "+menu 1 +fullscreen 1"
Set_WineVersion_Assign "$WORKINGWINEVERSION" "$TYTUL"
POL_SetupWindow_make_shortcut "$PREFIX" "Program Files/EA GAMES/Battlefield 2" "BF2.exe" "" "Play BF2 Online Now!" "" "+playNow 1 +menu 1 +fullscreen 1"
Set_WineVersion_Assign "$WORKINGWINEVERSION" "Play BF2 Online Now!"

POL_SetupWindow_menu "What is the version of your game?" "Version" "Deluxe Normal" " "
if [ "$APP_ANSWER" == "Deluxe" ]; then
cp "$WINEPREFIX/drive_c/Program Files/EA GAMES/Battlefield 2/mods/xpack/bf2xpack.ico" "$REPERTOIRE/icones/32/$TYTUL Special Forces"
cp "$WINEPREFIX/drive_c/Program Files/EA GAMES/Battlefield 2/mods/xpack/bf2xpack.ico" "$REPERTOIRE/icones/32/Play BF2 SF Online Now!"
POL_SetupWindow_make_shortcut "$PREFIX" "Program Files/EA GAMES/Battlefield 2" "BF2.exe" "" "$TYTUL Special Forces" "" "+menu 1 +fullscreen 1 +modPath mods/xpack"
Set_WineVersion_Assign "$WORKINGWINEVERSION" "$TYTUL Special Forces"
POL_SetupWindow_make_shortcut "$PREFIX" "Program Files/EA GAMES/Battlefield 2" "BF2.exe" "" "Play BF2 SF Online Now!" "" "+playNow 1 +menu 1 +fullscreen 1 +modPath mods/xpack"
Set_WineVersion_Assign "$WORKINGWINEVERSION" "Play BF2 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_battlefield2
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" "/usr/share/playonlinux/themes/tango/warning.png"

POL_SetupWindow_Close
exit

Edited by NSLW

GNU_Raziel Wednesday 20 May 2009 at 14:54 - [Quote]
Admin

Admin
Script deleted as you requested.

Edited by GNU_Raziel


Linux a un noyau, Windows a un pépin.
Si Microsoft inventait quelque chose qui ne plante pas, ca serait le clou.
http://gnuraziel.labrute.fr - Deviens mon élève petit scarabé
imanligenc Saturday 17 September 2011 at 13:15 - [Quote]
Membre

Membre
Hello.
I've installed the game with this script and patched to 1.41. When I run game I am getting this error:



Can ayone help me?
imanligenc Saturday 17 September 2011 at 14:54 - [Quote]
Membre

Membre
This is the debug output.

[POL_Wine_SetVersionEnv] Message: Setting wine version path: 1.1.41, x86
[POL_Wine_SetVersionEnv] Message: "/home/muhammed/.PlayOnLinux//wine/linux-x86/1.1.41" exists
[POL_Wine] Message: Running wine-1.1.41 BF2.exe
fixme:system:SystemParametersInfoW Unimplemented action: 94 (SPI_GETMOUSETRAILS)
fixme:system:SystemParametersInfoW Unimplemented action: 59 (SPI_SETSTICKYKEYS)
fixme:system:SystemParametersInfoW Unimplemented action: 53 (SPI_SETTOGGLEKEYS)
fixme:system:SystemParametersInfoW Unimplemented action: 51 (SPI_SETFILTERKEYS)
fixme:dsalsa:IDsDriverBufferImpl_SetVolumePan (0x127040,0x142640): stub
fixme:win:EnumDisplayDevicesW ((null),0,0x32edd4,0x00000000), stub!
fixme:win:EnumDisplayDevicesW ((null),0,0x32e724,0x00000000), stub!
fixme:win:EnumDisplayDevicesW ((null),0,0x32dc64,0x00000000), stub!
fixme:win:EnumDisplayDevicesW ((null),0,0x32dd24,0x00000000), stub!
err:avicap:query_video_device /dev/video0: Querying failed: Not a V4L compatible device
fixme:devenum:DEVENUM_ICreateDevEnum_CreateClassEnumerator Category {cc7bfb41-f175-11d1-a392-00e0291f3959} not found
fixme:devenum:DEVENUM_ICreateDevEnum_CreateClassEnumerator Category {cc7bfb46-f175-11d1-a392-00e0291f3959} not found
err:x11settings:X11DRV_ChangeDisplaySettingsEx No matching mode found 800x600x32 @85! (desktop)
fixme:d3d:debug_d3dformat Unrecognized 1178752590 (as fourcc: NVBF) WINED3DFORMAT!
fixme:d3d:getFormatDescEntry Can't find format unrecognized(1178752590) in the format lookup table
fixme:d3d9:Direct3DShaderValidatorCreate9 stub
[POL_Wine] Message: Wine return: 0

Edited by imanligenc

Il n'y a rien à voir ici