#!/bin/bash
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
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"
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
}
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
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
}
POL_SetupWindow_message
"All needed disks will be copied first to\\n$TEMP_DIR/disk_#"
"$TYTUL"
DIR=$(
pwd
)
if
[ $FLAG_1942 == 1 ]
then
NUMBER=1
while
[ $NUMBER -
le
4 ]
do
copy_disk
"$NUMBER"
NUMBER=$(( NUMBER + 1 ));
done
fi
if
[ $FLAG_VI == 1 ]
then
NUMBER=5
while
[ $NUMBER -
le
8 ]
do
copy_disk
"$NUMBER"
NUMBER=$(( NUMBER + 1 ));
done
fi
chmod
777 $TEMP_DIR -R
if
[ $FLAG_1942 == 1 ]
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
..
cd
"$TEMP_DIR"
rm
-rf disk_[1-4]
fi
if
[ $FLAG_VI == 1 ]
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
cd
"$TEMP_DIR"
rm
-rf disk_[5-8]
fi
if
[ $FLAG_1942 == 1 ]
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
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
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
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
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 ]
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
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
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
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