Forum

[script] Anno 1602

Författare Svar
marco_g Monday 24 May 2010 at 19:21
marco_gAnonymous

Here is a script for Anno 1602 (the regular version) and a script to patch Anno 1602. The patch is for the dutch version of the game. However, the script was created such that it can be easily extended to other versions.

#!/bin/bash
# Date : (2010-05-29)
# Last revision : (2010-07-25)
# Wine version used : 1.1.44
# Distribution used to test : Ubuntu 10.04
# Author : Marco Gerards
# Licence : GPLv3
# Depend : none

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

TITLE="Anno 1602: Creation of a New World"
AUTHOR="Marco Gerards"
PREFIX="Anno1602"
PREFIXDIR="$REPERTOIRE/wineprefix/$PREFIX"
WORKINGWINEVERSION="1.1.44"

wget http://upload.wikimedia.org/wikipedia/en/3/32/Anno_1602_-_Creation_of_a_New_World_Coverart.png --output-document="$REPERTOIRE/tmp/leftnotscaled.png"
convert "$REPERTOIRE/tmp/leftnotscaled.png" -scale 150x356\\! "$REPERTOIRE/tmp/left.jpeg"
POL_SetupWindow_Init "" "$REPERTOIRE/tmp/left.jpeg"

POL_SetupWindow_presentation "$TITLE" "Sunflowers" "http://anno.uk.ubi.com/pc/history1602.php" "$AUTHOR" "$PREFIX"
select_prefix "$PREFIXDIR"

# Let the user select a CDROM
POL_SetupWindow_cdrom

# Check if this CDROM is the correct CDROM
POL_SetupWindow_check_cdrom "/Anno1602/1602.exe"

# To make sure the user has the same environment as the game was
# tested with.
POL_SetupWindow_install_wine "$WORKINGWINEVERSION"

Use_WineVersion "$WORKINGWINEVERSION"

POL_SetupWindow_prefixcreate

POL_SetupWindow_message "Click Forward to start the installation.  This can take a while."

# Installation using Setup.exe does not work, manual installation does
# work.  See http://www.capsu.org/1602/7.html for details
cd "$WINEPREFIX/drive_c"
mkdir Anno1602
cd Anno1602
POL_SetupWindow_wait_next_signal 
cp -r "$CDROM/Anno1602/"* . 
chmod -R a+rw *
rm -r MUSIC8
rm -r VideoSmk
POL_SetupWindow_detect_exit

cat <<EOF >> "$REPERTOIRE/tmp/anno.reg"
[HKEY_CURRENT_USER\\Software\\Anno1602]
"INSTALL_DIR"="C:\\\\"
"CDROM_DIR"="D:\\\\"
"INSTALL_SIZE"="MAX"
"VIDEO_QUALITAET"="H"
"MAUS_TYP"="S"
"MUSIK_FLAG"="E"
"SOUND_FLAG"="E"
"SCREENMODE"=dword:00000320
"VERSION"="EDIT"
EOF

regedit "$REPERTOIRE/tmp/anno.reg"
rm "$REPERTOIRE/tmp/anno.reg"

convert "$CDROM/Autorun.ico" "$REPERTOIRE/icones/32/$TITLE"

# Make a short cut
POL_SetupWindow_make_shortcut "$PREFIX" "Anno1602" "1602.exe" "" "$TITLE"
Set_WineVersion_Assign "$WORKINGWINEVERSION" "$TITLE"

# Done!
POL_SetupWindow_message "$TITLE installed"

POL_SetupWindow_Close
exit


Patch:

#!/bin/bash
# Date : (2010-05-24)
# Last revision : (2010-07-25)
# Wine version used : 1.1.44
# Distribution used to test : Ubuntu 10.04
# Author : Marco Gerards
# Licence : GPLv3
# Depend : none

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

TITLE="Anno 1602: Creation of a New World - Patch"
AUTHOR="Marco Gerards"
PREFIX="Anno1602"
PREFIXDIR="$REPERTOIRE/wineprefix/$PREFIX"
WORKINGWINEVERSION="1.1.44"

LNG_DOWNLOADING="PlayOnLinux is downloading"
LNG_LANGUAGE="What is your language version?"
LNG_INSTALLATIONINPROGRESS="Installation in progress..."
LNG_PATCHSUCCES="Patch for $TITLE has been installed successfully."
LNG_CHOOSEACTION="What do you want to do?"
LNG_PATCHM="Let me choose patch manually"
LNG_PATCHA="Download patch automatically"
LNG_PATCHLOCATION="Where is your patch located?"

wget http://upload.wikimedia.org/wikipedia/en/3/32/Anno_1602_-_Creation_of_a_New_World_Coverart.png --output-document="$REPERTOIRE/tmp/leftnotscaled.png"
convert "$REPERTOIRE/tmp/leftnotscaled.png" -scale 150x356\\! "$REPERTOIRE/tmp/left.jpeg"
POL_SetupWindow_Init "" "$REPERTOIRE/tmp/left.jpeg"

POL_SetupWindow_checkexist()
{	
	if [ ! -e $REPERTOIRE/wineprefix/$1 ]; then
		if [ "$POL_LANG" == "fr" ]; then
			LNG_PREFIX_NOT_EXIST="Le jeu n'est pas installé."
		else
			LNG_PREFIX_NOT_EXIST="The Game is not installed."
		fi
		POL_SetupWindow_message_image "$LNG_PREFIX_NOT_EXIST" "Prefix Checker" "$PLAYONLINUX/themes/tango/warning.png"
		exit
	fi
}
 
POL_SetupWindow_checkexist "$PREFIX"

POL_SetupWindow_presentation "$TITLE" "Sunflowers" "http://anno.uk.ubi.com/pc/history1602.php" "$AUTHOR" "$PREFIX"

select_prefix "$PREFIXDIR"

POL_SetupWindow_install_wine "$WORKINGWINEVERSION"

Use_WineVersion "$WORKINGWINEVERSION"

# Automatically determine which patch to install.  Currently only
# downloading the Dutch version of the game is supported.
if [ -e $WINEPREFIX/drive_c/Anno1602/LeesDit.rtf ] ; then
  PATCHNAME="Anno 1602 patch 1 dutch"
  PATCHFILE="anno1602patch1_dut.exe"
else
  POL_SetupWindow_message_image "Downloading the patch for your version of Anno 1602 is not supported yet" "$TITLE" "$PLAYONLINUX/themes/tango/error.png"
  POL_SetupWindow_Close
  exit
fi

POL_SetupWindow_menu "$LNG_CHOOSEACTION" "Actions" "$LNG_PATCHM~$LNG_PATCHA" "~"
if [ "$APP_ANSWER" == "$LNG_PATCHM" ]; then
  POL_SetupWindow_browse "$LNG_PATCHLOCATION" "$TITLE" ""
  PATCHFILE="$APP_ANSWER"
else
  # Patch the game
  POL_SetupWindow_message "The patch \\"$PATCHNAME\\" for Anno 1602 will be downloaded and installed"

  cd "$REPERTOIRE/ressources"
  if [ ! -e "$PATCHFILE" ]; then
    POL_SetupWindow_download "$LNG_DOWNLOADING $TITLE" "$TITLE" "http://annomuseum.de/webseiten/SF/download.sunflowers.de/$PATCHFILE" 
  fi
fi

POL_SetupWindow_wait_next_signal "$LNG_INSTALLATIONINPROGRESS" "$TITLE"
wine "$PATCHFILE"
POL_SetupWindow_detect_exit
POL_SetupWindow_message "$LNG_PATCHSUCCES" "$TITLE"

POL_SetupWindow_Close
exit

Ändrat av marco_g

NSLW Tuesday 25 May 2010 at 7:50
NSLW

1) Why do you copy game from CD instead of installing it?
2) In patch script you should also use
POL_SetupWindow_install_wine "$WORKINGWINEVERSION"
because it's not always true that user has Wine $WORKINGWINEVERSION
3) In patch script
What if servers are down or user has it's own patch on hdd? You should add possibility to install user's patch. You can see how it's done [url=http://www.playonlinux.com/repository/?script=624]here[/ur]
4) What's the reason for choosing Wine 1.1.37?
5) Why echo "http://annomuseum.de/webseiten/SF/download.sunflowers.de/$PATCHFILE" ?
6) Use $REPERTOIRE instead of $HOME/.PlayOnLinux
marco_g Tuesday 25 May 2010 at 8:12
marco_gAnonymous

1) Why do you copy game from CD instead of installing it?

Quote from NSLW


Unfortunately the installer will not work. Copying it seems to be the commonly accepted solution:
http://appdb.winehq.org/objectManager.php?sClass=version&iId=11464&iTestingId=49924


2) In patch script you should also use
POL_SetupWindow_install_wine "$WORKINGWINEVERSION"
because it's not always true that user has Wine $WORKINGWINEVERSION

Quote from NSLW


Oops, I will add this.


3) In patch script
What if servers are down or user has it's own patch on hdd? You should add possibility to install user's patch. You can see how it's done [url=http://www.playonlinux.com/repository/?script=624]here[/ur]

Quote from NSLW


I will do that.


4) What's the reason for choosing Wine 1.1.37?

Quote from NSLW


One user (although on the mac) marked it as platinum:
http://appdb.winehq.org/objectManager.php?sClass=version&iId=11464&iTestingId=49924

So if I have to try one initial version, I will select the one with the highest rating on WineHQ. Do I have to use other criteria to select a wine version?


5) Why echo "http://annomuseum.de/webseiten/SF/download.sunflowers.de/$PATCHFILE" ?

Quote from NSLW


Oops :-°


6) Use $REPERTOIRE instead of $HOME/.PlayOnLinux

Quote from NSLW


I will change this.

Later I will post a new patch.

Ändrat av marco_g

NSLW Tuesday 25 May 2010 at 9:17
NSLW



4) What's the reason for choosing Wine 1.1.37?

Quote from marco_g


One user (although on the mac) marked it as platinum:
http://appdb.winehq.org/objectManager.php?sClass=version&iId=11464&iTestingId=49924

So if I have to try one initial version, I will select the one with the highest rating on WineHQ. Do I have to use other criteria to select a wine version?

Quote from NSLW

Use the latest Wine version, check if the game installs and runs, if not then lower the version number. It's very easy and fast to do in POL.


Later I will post a new patch.

Quote from marco_g

Please edit your first post rather than posting new script.
marco_g Saturday 29 May 2010 at 20:23
marco_gAnonymous



4) What's the reason for choosing Wine 1.1.37?

Quote from NSLW


One user (although on the mac) marked it as platinum:
http://appdb.winehq.org/objectManager.php?sClass=version&iId=11464&iTestingId=49924

So if I have to try one initial version, I will select the one with the highest rating on WineHQ. Do I have to use other criteria to select a wine version?

Quote from marco_g

Use the latest Wine version, check if the game installs and runs, if not then lower the version number. It's very easy and fast to do in POL.

Quote from NSLW


I have done this and changed the other things you asked me to change.



Later I will post a new patch.

Quote from NSLW

Please edit your first post rather than posting new script.

Quote from marco_g


Okay, I have edited my first post.
NSLW Wednesday 2 June 2010 at 21:37
NSLW

If you copy the game instead of installing it you can embrace copying process by following commands POL_SetupWindow_wait_next_signal
and
POL_SetupWindow_detect_exit
Currently you use POL_SetupWindow_message and during copying process some users may have feeling that program stalled.


Following
PATCHFILE=$APP_ANSWER
won't work if APP_ANSWER is /home/user/Desktop/my patch/annopatch.exe

Ändrat av NSLW

marco_g Sunday 25 July 2010 at 10:30
marco_gAnonymous

Sorry for the late reply. I have updated the script in the first post and will send it in for validation real soon.
If you accept it, you can consider to use the icon which was used for Anno 1602 KE.

In a few weeks I will create a script for Anno 1602 GE, which cannot be installed using this script,
while this game cannot be installed in the way Anno 1602 GE has to be installed...