Форум

Battlefield 1942 The Complete Collection

Автор Replies
Paul Mallako Saturday 6 March 2010 at 4:47
Paul MallakoAnonymous

Here is my script to install Battlefield 1942 The Complete collection.

This collection contains: Battlefield 1942 and its expansions The Road to Rome and Secret Weapons of WWII, Battlefield Vietnam.

plus Map editor, mod development toolkit, etc....

This script can:
- install the games and its expansions.
- ask for patching BF 1942 to 1.61
- ask for patching BF Vietnam to 1.21
- creates all links to executables

Version of wine : 1.1.23
Distribution : Fedora
Version of the distribution : 10 (Cambridge) - 32bit
Graphics card : GeForce 8600M GT/PCI/SSE2
Driver: from kmod-nvidia package installed with yum

#!/bin/bash

#
# This script is based on Planescape Torment script
#

if [ "$PLAYONLINUX" = "" ]
then
exit 0
fi
source "$PLAYONLINUX/lib/sources"
 
VERSIONWINE=$(wine --version)
TYTUL="Battlefield 1942, The complete collection"
PREFIX="Battlefield1942"
TEMP_DIR="$REPERTOIRE/tmp"
POL_SetupWindow_Init
POL_SetupWindow_presentation "$TYTUL" "Eletronic Arts" "N/A" "FSM" "$PREFIX"
cfg_check
# 
# roda_teste()
# {
#   wine $REPERTOIRE/tmp/pbsetup.exe
#   
# }

#procedure for patching BF 1942 and Vietnam
patch_BF()
{
  POL_SetupWindow_menu "What installer should do?" "Actions" "Let me choose patch manually~Download patch automatically" "~"
  if [ "$APP_ANSWER" == "Let me choose patch manually" ]
    then
      POL_SetupWindow_browse "Select patch file" "$TYTUL" ""
      POL_SetupWindow_wait_next_signal "PlayOnLinux is installing patch" "$TYTUL"
      wine "$APP_ANSWER"
      POL_SetupWindow_detect_exit
      POL_SetupWindow_message "Patch for $TYTUL has been installed successfully" "$TYTUL"
  elif [ "$APP_ANSWER" == "Download patch automatically" ]
    then
      POL_SetupWindow_wait_next_signal "PlayOnLinux is downloading $1" "$TYTUL"
      cd "$TEMP_DIR"
      wget "ftp://largedownloads.ea.com/pub/patches/$1"
      POL_SetupWindow_wait_next_signal "PlayOnLinux is instaling the patch" "$TYTUL"
      wine "$1"
      POL_SetupWindow_detect_exit
      POL_SetupWindow_message "Patch for $TYTUL has been installed successfully" "$TYTUL"
      rm -f $1
  fi
}

#asking about patching
POL_SetupWindow_menu "What do you want to do?" "Actions" "install-game patch-BF_1942 patch-BF_Vietnam" " "
if [ "$APP_ANSWER" == "patch-BF_1942" ]; then
  if [ -e "$REPERTOIRE/wineprefix/$PREFIX" ]; then
    patch_BF "battlefield_1942_incremental_patch_v1.6_to_v1.61b.exe"
    POL_SetupWindow_Close
    exit
  else
    POL_SetupWindow_message "The installation was not detected, please verify the path.It should be\\n\\n$REPERTOIRE/wineprefix/$PREFIX" "$TYTUL"
    POL_SetupWindow_Close
    exit
  fi
fi
if [ "$APP_ANSWER" == "patch-BF_Vietnam" ]; then
  if [ -e "$REPERTOIRE/wineprefix/$PREFIX" ]; then
    patch_BF "battlefield_vietnam_incremental_patch_v1.2_to_v1.21.exe"
    POL_SetupWindow_Close
    exit
  else
    POL_SetupWindow_message "The installation was not detected, please verify the path.It should be\\n\\n$REPERTOIRE/wineprefix/$PREFIX" "$TYTUL"
    POL_SetupWindow_Close
    exit
  fi
fi

select_prefixe "$REPERTOIRE/wineprefix/$PREFIX"
 
POL_SetupWindow_question "Install Battlefield 1942 and its expasions?\\n\\nObs: Battlefield Vietnam is not a BF 1942 expansion" ""
if [ "$APP_ANSWER" == "TRUE" ] 
  then
    FLAG_1942=1
  else
    FLAG_1942=0
fi

POL_SetupWindow_question "Install Battlefield Vietnam?" ""
if [ "$APP_ANSWER" == "TRUE" ] 
  then
    FLAG_VI=1
  else
    FLAG_VI=0
fi
 
POL_SetupWindow_prefixcreate 
FULLPATH="$HOME/.PlayOnLinux/wineprefix/$PREFIX/drive_c/Program Files/EA GAMES"

# function which copy disks to ~/.Playonlinux/tmp/disk_?
function copy_disk() {
  POL_SetupWindow_message "Please insert disk $1, mount it and press 'Forward'" "$TYTUL"
  POL_SetupWindow_cdrom
  POL_SetupWindow_wait_next_signal "Copying disk $1" "$TYTUL"
  cd $CDROM
  mkdir -p "$TEMP_DIR/disk_$1"
  cp -fr * "$TEMP_DIR/disk_$1"
  POL_SetupWindow_detect_exit
  umount $CDROM
  eject
}

# Copy Cds to ~/.Playonlinux/tmp/disk_?
POL_SetupWindow_message "All needed disks will be copied first to\\n$TEMP_DIR/disk_#" "$TYTUL"
DIR=$(pwd)

if [ $FLAG_1942 == 1 ] # if Battlefield 1942 and its expasions are going to be installed
  then
    NUMBER=1
    while [ $NUMBER -le 4 ]
      do
	copy_disk "$NUMBER"
	NUMBER=$(( NUMBER + 1 ));
      done
  fi
if [ $FLAG_VI == 1 ] # if Battlefield Vietnam is going to be installed
  then
    NUMBER=5
    while [ $NUMBER -le 8 ]
      do
	copy_disk "$NUMBER"
        NUMBER=$(( NUMBER + 1 ));
      done
  fi

chmod 777 $TEMP_DIR -R
 
#starting installation

if [ $FLAG_1942 == 1 ] # if Battlefield 1942 is going to be installed
  then
    POL_SetupWindow_message "Battlefield 1942 is going to be installed now.\\nPlease insert disk labeled 'DISC 1' and mount it." "$TYTUL"
    POL_SetupWindow_wait_next_signal "Installation of Battlefield 1942 in progress...\\n\\nYou don't have to change disks. When asked, just change the path\\n of each disk as below.\\n\\n disk 1: $TEMP_DIR/disk_1\\n disk 2: $TEMP_DIR/disk_2\\n disk 3: $TEMP_DIR/disk_3\\n disk 4: $TEMP_DIR/disk_4\\n" "$TYTUL"
    cd "$TEMP_DIR/disk_1"
    wine "Setup.exe"
    POL_SetupWindow_detect_exit
    cd ..
    # remove directories with BF 1942 discs to avoid Vietnams installer confusion when switchin between discs during install
    cd "$TEMP_DIR"
    rm -rf disk_[1-4]
fi


    
if [ $FLAG_VI == 1 ] # if Battlefield Vietnam is going to be installed
  then
    POL_SetupWindow_message "Battlefield Vietnam is going to be installed now.\\nPlease insert disk labeled 'DISC 5' and mount it." "$TYTUL"
    POL_SetupWindow_wait_next_signal "Installation of Battlefield 1942 in progress...\\n\\nYou don't have to change disks. When asked, just change the path\\n of each disk as below.\\n\\n disk 1: $TEMP_DIR/disk_5\\n disk 2: $TEMP_DIR/disk_6\\n disk 3: $TEMP_DIR/disk_7\\n disk 4: $TEMP_DIR/disk_8\\n" "$TYTUL"
    cd "$TEMP_DIR/disk_5"
    wine "Setup.exe"
    POL_SetupWindow_detect_exit
    # remove directories with BF Vietnam discs
    cd "$TEMP_DIR"
    rm -rf disk_[5-8]
fi

#making shortcut and asking about patching 
if [ $FLAG_1942 == 1 ] # if Battlefield Vietnam is going to be installed
  then
    NAME="Battlefield 1942"
    cp "~/.local/share/icons/2948_bf1942.0.png" "$REPERTOIRE/icones/32/$NAME"
    POL_SetupWindow_make_shortcut "$PREFIX" "Program Files/EA GAMES/Battlefield 1942" "BF1942.exe" "" "$NAME" "" "-opengl"
    POL_SetupWindow_question "Do you want to patch Battlefield 1942?" "$TYTUL"
    if [ "$APP_ANSWER" == "TRUE" ] ;then
      patch_BF "battlefield_1942_incremental_patch_v1.6_to_v1.61b.exe"
    fi
    
    # ask if a shortcut to Battlefield 1942 The Road To Rome must be created
    if [ -e "$FULLPATH/Battlefield 1942/Mods/XPack1" ]; then
      POL_SetupWindow_question "Do you want to create a shortcut to Battlefield 1942 The Road to Rome?" "$TYTUL"
      if [ "$APP_ANSWER" == "TRUE" ] ;then
	NAME="Battlefield 1942 The Road to Rome"
	cp "$REPERTOIRE/icones/32/Battlefield 1942" "$REPERTOIRE/icones/32/$NAME"
	POL_SetupWindow_make_shortcut "$PREFIX" "Program Files/EA GAMES/Battlefield 1942" "BF1942.exe" "" "$NAME" "+game XPack1" "-opengl"
      fi
    fi
    
    # ask if a shortcut to Battlefield 1942 Secret Weapons of WWII must be created
    if [ -e "$FULLPATH/Battlefield 1942/Mods/XPack2" ]; then
      POL_SetupWindow_question "Do you want to create a shortcut to Battlefield 1942 Secret Weapons of WWII?" "$TYTUL"
      if [ "$APP_ANSWER" == "TRUE" ] ;then
	NAME="Battlefield 1942 Secret Weapons of WWII"
	cp "$REPERTOIRE/icones/32/Battlefield 1942" "$REPERTOIRE/icones/32/$NAME"
	POL_SetupWindow_make_shortcut "$PREFIX" "Program Files/EA GAMES/Battlefield 1942" "BF1942.exe" "" "$NAME" "+game XPack2" "-opengl"
      fi
    fi
    
    # ask if a shortcut to Battlecraft 1942 must be created
    if [ -e "$FULLPATH/Battlecraft 1942" ]; then
      POL_SetupWindow_question "Do you want to create a shortcut to Battlecraft 1942?" "$TYTUL"
      if [ "$APP_ANSWER" == "TRUE" ] ;then
	NAME="Battlecraft 1942"
	POL_SetupWindow_make_shortcut "$PREFIX" "Program Files/EA GAMES/Battlecraft 1942" "bc42.exe" "" "$NAME" "" ""
      fi
    fi
    
    # ask if a shortcut to Battlefield Mod Development Toolkit must be created
    if [ -e "$FULLPATH/Battlefield Mod Development Toolkit" ]; then
      POL_SetupWindow_question "Do you want to create a shortcut to Battlefield Mod Development Toolkit?" "$TYTUL"
      if [ "$APP_ANSWER" == "TRUE" ] ;then
	NAME="Battlefield Mod Development Toolkit"
	POL_SetupWindow_make_shortcut "$PREFIX" "Program Files/EA GAMES/Battlefield Mod Development Toolkit" "BF_Tools.exe" "" "$NAME" "" ""
      fi
    fi
fi

if [ $FLAG_VI == 1 ] # if Battlefield Vietnam is going to be installed
  then
    NAME="Battlefield Vietnam"
    cp "$TEMP_DIR/disk_5/BFVietnam.ico" "$REPERTOIRE/icones/32/$NAME"
    POL_SetupWindow_make_shortcut "$PREFIX" "Program Files/EA GAMES/Battlefield Vietnam" "bfvietnam.exe" "" "$NAME" "" ""
    if [ "$APP_ANSWER" == "TRUE" ] ;then
      patch_BF "battlefield_vietnam_incremental_patch_v1.2_to_v1.21.exe"
    fi
    
    # ask if a shortcut to Battlefield Vietnam World War II must be created
    if [ -e "$FULLPATH/Battlefield Vietnam/Mods/BFV_WW2Mod" ]; then
      POL_SetupWindow_question "Do you want to create a shortcut to Battlefield Vietnam World War II?" "$TYTUL"
      if [ "$APP_ANSWER" == "TRUE" ] ;then
	NAME="Battlefield Vietnam World War II"
	cp "$REPERTOIRE/icones/32/Battlefield Vietnam" "$REPERTOIRE/icones/32/$NAME"
        POL_SetupWindow_make_shortcut "$PREFIX" "Program Files/EA GAMES/Battlefield Vietnam" "bfvietnam.exe" "" "$NAME" "" "+game BFV_WW2Mod"
      fi
    fi
    
    # ask if a shortcut to Battlecraft 1942 must be created
    if [ -e "$FULLPATH/Battlecraft Vietnam" ]; then
      POL_SetupWindow_question "Do you want to create a shortcut to Battlecraft Vietnam?" "$TYTUL"
      if [ "$APP_ANSWER" == "TRUE" ] ;then
	NAME="Battlecraft Vietnam"
	POL_SetupWindow_make_shortcut "$PREFIX" "Program Files/EA GAMES/Battlecraft Vietnem" "bcv.exe" "" "$NAME" "" ""
      fi
    fi
    
    # ask if a shortcut to Battlefield Mod Development Toolkit must be created
    if [ -e "$FULLPATH/Battlefield Mod Development Toolkit" ]; then
      POL_SetupWindow_question "Do you want to create a shortcut to Battlefield Mod Development Toolkit?" "$TYTUL"
      if [ "$APP_ANSWER" == "TRUE" ] ;then
	NAME="Battlefield Mod Development Toolkit"
	POL_SetupWindow_make_shortcut "$PREFIX" "Program Files/EA GAMES/Battlefield Mod Development Toolkit" "BF_Tools.exe" "" "$NAME" "" ""
      fi
    fi
fi
 
POL_SetupWindow_message "$TYTUL has been installed successfully" "$TYTUL"
 
POL_SetupWindow_Close
exit

Вы находитесь здесь: Index > Your creations. > Battlefield 1942 The Complete Collection

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 dmcayonlinux.com