Das Forum

[script] Call Of Duty : Modern Warfare 2

Autor Antworten
NSLW Friday 13 November 2009 at 11:20
NSLW

Hello,
I wrote script which installs Call Of Duty : Modern Warfare 2.
Wine version : 1.1.32
Distribution : Fedora
Distribution Version : 11 (32 bit)
Graphics card : Nvidia, GeForce 9xxx
Drivers of the graphics card : 190.42
Comments :

Icon for the game:





#!/bin/bash
# Date : (2009-11-13 10-00)
# Last revision : (2009-11-13 19-30)
# Wine version used : 1.1.32
# Distribution used to test : Fedora 11
# Author : NSLW
# Licence : Retail

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

TYTUL="Call of Duty: Modern Warfare 2"
PREFIX="CODMW2"
STEAM=0

Get_Latest_Wine_Version()
{
cd "$REPERTOIRE/tmp"
POL_SetupWindow_download "Downloading Wine versions list" "$TYTUL" "http://mulx.playonlinux.com/wine/linux-i386/LIST"
xyz=`cat "$REPERTOIRE/tmp/LIST" | sed -e 's/\\.//g' | cut -d';' -f2 | sort -n | tail -n1`
echo "$(echo $xyz | cut -c1-1).$(echo $xyz | cut -c2-2).$(echo $xyz | cut -c3-4)"
}

wget http://upload.wikimedia.org/wikipedia/en/d/db/Modern_Warfare_2_cover.PNG --output-document="$REPERTOIRE/tmp/leftnotscaled.jpeg"
convert "$REPERTOIRE/tmp/leftnotscaled.jpeg" -scale 150x356\\! "$REPERTOIRE/tmp/left.jpeg"
POL_SetupWindow_Init "" "$REPERTOIRE/tmp/left.jpeg"

POL_SetupWindow_presentation "$TYTUL" "infinityward" "www.infinityward.com" "NSLW" "$PREFIX" 

select_prefix "$REPERTOIRE/wineprefix/$PREFIX"

#asking about Steam
POL_SetupWindow_menu "What do you want to do?" "Actions" "Install from DVD~Install Steam version from DVD" "~"
if [ "$APP_ANSWER" == "Adapt Steam version" ]; then

	if [ ! -e "$REPERTOIRE/configurations/installed/Steam" ]; then
	POL_SetupWindow_message "Please install Steam before $TYTUL"
	POL_SetupWindow_Close
	exit
	fi

	if [ ! -d "$REPERTOIRE/wineprefix/Steam/drive_c/$PROGRAMFILES/Steam/steamapps/common/call of duty modern warfare 2" ];then
		POL_SetupWindow_message "Please install $TYTUL in Steam first"
		POL_SetupWindow_Close
		exit
	else
	STEAM="1"
	fi
elif [ "$APP_ANSWER" == "Install Steam version from DVD" ]; then

	if [ ! -e "$REPERTOIRE/configurations/installed/Steam" ]; then
	POL_SetupWindow_message "Please install Steam before $TYTUL"
	POL_SetupWindow_Close
	exit
	fi

	select_prefix "$REPERTOIRE/wineprefix/Steam"
	STEAM="2"
fi

LATESTVERSION=$(Get_Latest_Wine_Version)
CHOSENWINEVERSION="$LATESTVERSION"
POL_SetupWindow_install_wine "$CHOSENWINEVERSION"
Use_WineVersion "$CHOSENWINEVERSION"

if [ "$STEAM" == "0" ] || [ "$STEAM" == "2" ] ; then

POL_SetupWindow_message "Please insert $TYTUL media into your disk drive."
POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom "Setup.exe"

mkdir "$HOME/.winetrickscache"
cd "$HOME/.winetrickscache"
# checking if mfc42 is in wine tricks cache if not then download
if [ ! -e "vc6redistsetup_enu.exe" ]
then
POL_SetupWindow_download "PlayOnLinux is downloading Visual C++ 6 runtime libraries" "Visual C++ 6" "http://download.microsoft.com/download/vc60pro/update/1/w9xnt4/en-us/vc6redistsetup_enu.exe"
fi

if [ "$STEAM" == "0" ] ; then
POL_SetupWindow_prefixcreate
fi

#fetching PROGRAMFILES environmental variable
PROGRAMFILES=`wine cmd /c echo "%ProgramFiles%"`
PROGRAMFILES=${PROGRAMFILES:3}

#adding CD-ROM as drive d: to winecfg
CDROM2=${CDROM//"1"/"2"} #CODMW2_DISK2
cd "$WINEPREFIX/dosdevices"
ln -s "$CDROM" d:
ln -s "$CDROM2" e:

cd "$WINEPREFIX/drive_c/windows/temp/"
echo "[HKEY_LOCAL_MACHINE\\\\Software\\\\Wine\\\\Drives]" > cdrom.reg
echo "\\"d:\\"=\\"cdrom\\"" >> cdrom.reg
echo "\\"e:\\"=\\"cdrom\\"" >> cdrom.reg
regedit cdrom.reg
sleep 5

cd "$REPERTOIRE/ressources/"
#downloading winetricks
if [ "`sha1sum < winetricks | sed 's/ .*//'`" != "0e10e20bf6920e2ae32372e10b5872f7c21a8fd4" ]; then
wget http://winezeug.googlecode.com/svn/trunk/winetricks --output-document=winetricks
fi

#installing mfc42
POL_SetupWindow_wait_next_signal "Installing Visual C++ 6 runtime libraries..." "$TYTUL"
bash winetricks -q mfc42
POL_SetupWindow_detect_exit

#starting installation
POL_SetupWindow_wait_next_signal "Installation in progress..." "$TYTUL"
cd "$CDROM"
wine "Setup.exe"
POL_SetupWindow_detect_exit

cd  "$WINEPREFIX/drive_c/windows/temp/"
convert "$CDROM/mw2.ico" -geometry 32X32 "codmw4.png"
cp "codmw4-1.png" "$REPERTOIRE/icones/32/$TYTUL Singleplayer"
cp "codmw4-1.png" "$REPERTOIRE/icones/32/$TYTUL Multiplayer"

fi

cd "$WINEPREFIX/drive_c/windows/temp/"
#setting Multisampling to enabled
echo "[HKEY_CURRENT_USER\\\\Software\\\\Wine\\\\Direct3D]" > msa.reg
echo "\\"Multisampling\\"=\\"enabled\\"" >> msa.reg
regedit msa.reg

#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

#cleaning temp
cd "$WINEPREFIX/drive_c/windows/temp"
rm -rf *

#making shortcut
if [ "$STEAM" == "0" ] ; then
	POL_SetupWindow_make_shortcut "$PREFIX" "$PROGRAMFILES/Activision/Modern Warfare 2" "iw4sp.exe" "" "$TYTUL Singleplayer" "" ""
	POL_SetupWindow_make_shortcut "$PREFIX" "$PROGRAMFILES/Activision/Modern Warfare 2" "iw4mp.exe" "" "$TYTUL Multiplayer" "" ""
else
	POL_SetupWindow_make_shortcut "$PREFIX" "$PROGRAMFILES/Steam/steamapps/common/call of duty modern warfare 2" "iw4sp.exe" "" "$TYTUL Singleplayer" "" ""
	POL_SetupWindow_make_shortcut "$PREFIX" "$PROGRAMFILES/Steam/steamapps/common/call of duty modern warfare 2" "iw4mp.exe" "" "$TYTUL Multiplayer" "" ""
fi
Set_WineVersion_Assign "$CHOSENWINEVERSION" "$TYTUL Singleplayer"
Set_WineVersion_Assign "$CHOSENWINEVERSION" "$TYTUL Multiplayer"

POL_SetupWindow_message "$TYTUL has been installed successfully" "$TYTUL"

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

Editiert von: NSLW

Berillions Friday 13 November 2009 at 19:04
Berillions

Hello NSLW,

I have a problem with your script. After to launch the Setup, the installation is blocked when he wants to install Steam.

It's a small windows, her title is : Steam Setup and the message is : installation of components systems, please wait" (In French it's : Installation des composants systèmes, veuillez patienter).

It's normal that it's long or not?

Thanks

NSLW Friday 13 November 2009 at 19:14
NSLW

Hello NSLW,

I have a problem with your script. After to launch the Setup, the installation is blocked when he wants to install Steam.

It's a small windows, her title is : Steam Setup and the message is : installation of components systems, please wait" (In French it's : Installation des composants systèmes, veuillez patienter).

It's normal that it's long or not?

Thanks

Quote from Berillions

No it's not normal. Probably I've got an non-Steam version. I'll try to modify this script so it'll install your version.

BTW. On the first DVD I've got 8 files which weight ca. 7.9 GB
Berillions Friday 13 November 2009 at 19:16
Berillions

Yes, the first DVD has a size of 7.9GB and the second DVD 3.3GB.
But, your script is wrong because the game is installed in Steam.

Editiert von: Berillions


NSLW Friday 13 November 2009 at 19:39
NSLW

Yes, the first DVD has a size of 7.9GB and the second DVD 3.3GB.
But, your script is wrong because the game is installed in Steam.

Quote from Berillions

AFAIK there is more than one version of CODMW2. Yours is installed in Steam. Anyhow I modified my script, so it should install correctly.

BTW. Is your version of COD named Digital Download?
Berillions Friday 13 November 2009 at 23:31
Berillions

Humph, i have a problem to play at this game on linux.
After to install the game, i want to launch the game but i have an error message (Steam Message) who told me that the installation is not complete....

With winetricks, i have install Directx9, vcrun2005, always the same problem.

NSLW Saturday 14 November 2009 at 9:09
NSLW

You don't have to install neither directx9 nor vcrun2005 thought winetricks because these components are installed at the end of CODMW2 installation.
After complete and successful installation the game should weight 11.3 GB
oncl0ud9 Wednesday 18 November 2009 at 19:45
oncl0ud9Anonymous

It says when I copy the script and put it into a pol that it is invalid, do I just copy the script into gedit and save it as a pol? should I copy it a certain way? Thanks.

Editiert von: oncl0ud9

Quentin PÂRIS Thursday 19 November 2009 at 13:12
Quentin PÂRISAnonymous

I thought we took the decision to stop using winetricks.

In the present case, it is very easy, you just need to make one function
NSLW Thursday 19 November 2009 at 13:47
NSLW

I thought we took the decision to stop using winetricks.

In the present case, it is very easy, you just need to make one function

Quote from Tinou

Yes indeed but there is no function to install mfc42
Quentin PÂRIS Thursday 19 November 2009 at 17:13
Quentin PÂRISAnonymous

But you can make it ! It's very easy
NSLW Thursday 19 November 2009 at 18:06
NSLW

I thought that someone else will make this functions for me. I don't want to write something like API for myself, I want to write scripts.
Quentin PÂRIS Thursday 19 November 2009 at 20:06
Quentin PÂRISAnonymous

You won't write them for yourself but for all scriptors ...

If everybody develop his own script in his side, we won't be efficient ...

Anyway, we've planned to prevent the use of winetricks and old POL V2 function in about 6 months. We really should make an effort to clean up our scripts
NSLW Thursday 19 November 2009 at 20:57
NSLW

You won't write them for yourself but for all scriptors ...

If everybody develop his own script in his side, we won't be efficient ...

Anyway, we've planned to prevent the use of winetricks and old POL V2 function in about 6 months. We really should make an effort to clean up our scripts

Quote from Tinou


I won't be efficient writing two times more than needed (scripts plus functions). That's nice to prevent use of winetricks and old POL V2 functions. Second is easy but first requires more work that I don't want to assign me for but I would use these functions if someone would write them.
Quentin PÂRIS Thursday 19 November 2009 at 21:00
Quentin PÂRISAnonymous

I don't want you to write all the function, but honestly, when you have only ONE function which ONLY download one file and install it, it will not take exactely the same time than using winetricks in your script...
treetop Thursday 17 December 2009 at 0:06
treetopAnonymous

I'm confused about the script do i create a file add the text listed above? then use the POL option ?

Thanks for any advise.

-treetop


- Treetop
Dr Phil Thursday 17 December 2009 at 16:50
Dr Phil

Does anyone know how winetricks is licensed? There is no info about the license in the script. =/
If it is free software (or at least open source ;-)) we could just rip the code out with very small rewriting, but if it isn't..?
treetop Thursday 17 December 2009 at 17:49
treetopAnonymous

I figured our you can create a file add the scipt and it will load it but i cant seem to get MW2 to start i have it installed through steam it says the install was bad Can someone please help me get mw2 going ?


- Treetop