Playing Life Is Strange: Before the Storm on Linux using Wine

This doesn’t really need much explanation since it’s platinum on WineHQ at the moment. If you know how Wine works, you don’t need the info in this post; but if you need a push then this can help. Basically the script, like in other posts I’ve made, will simply install steam and set everything up for you. Then, you have to install the game via Steam and you’re good to go. The desktop file at the end of the post is just for simplicity so that it’s easier to run, but you can run it manually or just create another launcher if you want.

I will gradually make my install scripts better, but this works for now. I’ve always used PlayOnLinux before, but since that platform hasn’t gotten much love lately; I decided to abandon it. I’ve tried multiple times to update my scripts on POL, but nothing ever happens since you need an admin to accept your changes all the time. Thus, I have decided to simply make bash scripts to install all my games, and share my results here. The goal is to have a general script template that I can use (that makes it more user friendly) that helps me and others to install games on Linux using Wine (without making it a larger project like POL). Anyway, enjoy :- ).

https://appdb.winehq.org/objectManager.php?sClass=version&iId=35717

But I’ll include the Steam install script anyway, plus the desktop file to launch it. An important detail about installing this, is that it has to be installed in a 64-bit prefix in Wine.

if ! [ -x "$(command -v wine)" ]; then
        echo "Installing latest wine"
        #Update all repos
        sudo apt-get update

        #Enable 32bit (If you're on 64bit)
        sudo dpkg --add-architecture i386

        #Add wine repo
        wget -nc https://dl.winehq.org/wine-builds/Release.key
        sudo apt-key add Release.key
        sudo apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/

        #Install wine-devel (3.11)
        sudo apt-get update
        sudo apt-get install --install-recommends winehq-devel
fi

#Install latest winetricks
echo "Installing latest winetricks"
wget  https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks
chmod +x winetricks
sudo mv winetricks /usr/bin

echo "Installing Steam and various"
mkdir -p ~/.wine-apps/lis
WINEARCH=win64 WINEPREFIX=~/.wine-apps/lis/ winetricks tahoma corefonts ie8 allfonts steam

if you get an error saying “The content servers are unreachable” when trying to install the game via steam, then the following Reddit thread might be able to help you with that.

Also, if you want to have a launcher that you can search for in Unity or Gnome, then just create the file steam-lis.desktop with this content (replace USER with your username).

sudo vim /usr/share/applications/steam-lis.desktop

[Desktop Entry]
Name=Steam Life Is Strange - Before The Storm
Exec=env WINEPREFIX="/home/USER/.wine-apps/lis/" wine "/home/USER/.wine-apps/lis/drive_c/Program Files (x86)/Steam/Steam.exe" -no-cef-sandbox
Type=Application
StartupNotify=true
Path="/home/USER/.wine-apps/lis/drive_c/Program Files (x86)/Steam/"
Icon=BAC4_steam.0
StartupWMClass=steam.exe
Name[en_US]=Steam - Life Is Strange - Before The Storm

 

 

Playing Final Fantasy XIV (FFXIV) on Linux using Wine

There’s a pretty neat Reddit thread about this issue, but I don’t want to use Gallium so I just made a simple script to install it for me. Since it took a bit of experimenting to get it work (In the end it was all about the wine version, and not many other prerequisites were needed) I’m posting it in case others find it useful. Note that the last line is how you start the game later, so just make a start script or a desktop shortcut to start it afterwards.

Distro: Ubuntu 18.04 (x64)

if ! [ -x "$(command -v wine)" ]; then
	echo "Installing latest wine"
	#Update all repos
	sudo apt-get update
 
	#Enable 32bit (If you're on 64bit)
	sudo dpkg --add-architecture i386

	#Add wine repo
	wget -nc https://dl.winehq.org/wine-builds/Release.key
	sudo apt-key add Release.key
	sudo apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/
 
	#Install wine-stable (3.0.1)
	sudo apt-get update
	sudo apt-get install --install-recommends winehq-stable
fi

echo "Installing latest winetricks"
wget  https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks
chmod +x winetricks
sudo mv winetricks /usr/bin

echo "Creating FFXIV Wine prefix"
mkdir ~/.ffxiv
cd ~/.ffxiv

echo "Downloading FFXIV setup file"
wget http://gdl.square-enix.com/ffxiv/inst/ffxivsetup.exe

echo "Installing required files with winetricks"
WINEARCH=win32 WINEPREFIX=~/.ffxiv winetricks -q corefonts allfonts tahoma #ie8 wininet winhttp wmp9 wmp10 xinput ie8_kb2936068 devenum quartz hosts win7

echo "Installing game client"
WINEARCH=win32 WINEPREFIX=~/.ffxiv wine ffxivsetup.exe

echo "Starting game client. Please login and install the game"
cd "drive_c/Program Files/SquareEnix/FINAL FANTASY XIV - A Realm Reborn/boot"
WINEARCH=win32 WINEPREFIX=~/.ffxiv wine ffxivboot.exe

 

Playing visual novels on Linux using Wine

So I play a lot of visual novels these days. One problem is that most of them are only released on Windows, and I don’t use Windows. So for that I use Wine. Below is a simple script to setup Steam with Wine so that you can play the visual novels available through Steam. Make sure you check the visual novel on steam before you use this solution however, since some of them do have Linux support and can be run via the Steam Linux client.

Distro: Ubuntu 18.04 (x64)

if ! [ -x "$(command -v wine)" ]; then
	echo "Installing latest wine"
	#Update all repos
	sudo apt-get update

	#Enable 32bit (If you're on 64bit)
	sudo dpkg --add-architecture i386

	#Add wine repo
	wget -nc https://dl.winehq.org/wine-builds/Release.key
	sudo apt-key add Release.key
	sudo apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/

	#Install wine-stable (3.0.1)
	sudo apt-get update
	sudo apt-get install --install-recommends winehq-stable
fi

#Install latest winetricks
echo "Installing latest winetricks"
wget  https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks
chmod +x winetricks
sudo mv winetricks /usr/bin

echo "Installing Steam and various"
mkdir -p ~/.wine-apps/steam
WINEARCH=win32 WINEPREFIX=~/.wine-apps/steam/ winetricks tahoma corefonts ie8 allfonts steam

echo "Login to steam and install the Visual Novel"

 

Also, if you need a desktop icon for the Steam client, you can put it in the file /usr/share/applications/steam-windows.desktop (Remember to replace USER with your username).

[Desktop Entry]
Name=Steam
Exec=env WINEPREFIX="/home/USER/.wine-apps/steam" wine "/home/USER/.wine-apps/steam/drive_c/Program Files/Steam/Steam.exe" -no-cef-sandbox
Type=Application
StartupNotify=true
Path=/home/USER/.wine-apps/steam/dosdevices/c:/Program Files/Steam
Icon=BAC4_steam.0
StartupWMClass=steam.exe
Name[en_US]=Steam - Windows

 

For other visual novels not on Steam, I just create a folder called “Games” under “/home/USER/.wine-apps/steam/dosdevices/c:/Program Files/” and put them there. Then you can add another shortcut to that specific game like below.

[Desktop Entry]
Name=VisualNovel
Exec=env WINEPREFIX="/home/USER/.wine-apps/steam" wine "/home/USER/.wine-apps/steam/drive_c/Program Files/Games/VN/VisualNovel.exe"
Type=Application
StartupNotify=true
Path=/home/USER/.wine-apps/steam/dosdevices/c:/Program Files/Games
Icon=/path/to/icon/file
StartupWMClass=VisualNovel.exe
Name[en_US]=VisualNovel

For steam download issue: https://www.reddit.com/r/wine_gaming/comments/8r0gh6/steam_in_winedevel_content_servers_unreachable/

Also, some visual novels outside of Steam may run into all sorts of problems. You can install a separate Wine prefix for that and do individual settings for such games. The following worked for me for one game that crashed when going into full screen. Generally I try to stick with the ones on Steam as I keep having the most luck with them using Wine. Sometimes they simply aren’t available though.

mkdir -p ~/.wine-apps/vn
WINEARCH=win32 WINEPREFIX=~/.wine-apps/vn/ winetricks tahoma corefonts ie8 allfonts d3dx9_36 wmp9 quartz ddr=gdi win7

#Start game
env WINEPREFIX="/home/USER/.wine-apps/vn" wine "/home/USER/.wine-apps/vn/drive_c/Program Files/Games/vn/vn.exe"

 

Installing EiskaltDC++ 2.2.10 on Ubuntu 18.04

Nothing really special, I just keep forgetting which packages I need (And it’s bothersome to keep going through the list of requirements). So here’s a quick guide/script of how to download and compile it. Mostly for myself, but I thought maybe someone else could make use of it.

sudo apt-get -y build-dep eiskaltdcpp-qt eiskaltdcpp eiskaltdcpp-cli eiskaltdcpp-common libeiskaltdcpp-devlibeiskaltdcpp-dev

sudo apt-get -y install libqt5core5a qt5-default qttools5-dev-tools qtmultimedia5-dev libbz2-dev libssl1.0-dev libidn11-dev libboost1.65-dev libaspell-dev libre2-dev libminiupnpc-dev lua5.1 liblua5.1-dev liblua50-dev libboost-system1.65-dev qml-module-qtquick2 libdee-qt5-dev qtscript5-dev qtdeclarative5-dev libqt4-dev libqt4-declarative

git clone https://github.com/eiskaltdcpp/eiskaltdcpp.git

cd eiskaltdcpp/

mkdir builddir && cd builddir

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DUSE_QT=ON -DUSE_GTK=ON -DUSE_JS=ON -DUSE_ASPELL=ON -DUSE_QT_QML=ON -DUSE_QT_SQLITE=ON -DLUA_SCRIPT=ON -DWITH_LUASCRIPTS=ON -DWITH_SOUNDS=ON -DPERL_REGEX=ON -DNO_UI_DAEMON=ON -DJSONRPC_DAEMON=ON -DUSE_CLI_JSONRPC=ON -DUSE_MINIUPNP=ON -DLOCAL_MINIUPNP=ON ..

make

sudo make install

‘make install’ will create a desktop file for you, so you should be able to reach it from whatever menu system you’re using, and add it to favorites/create a shortcut. I know there are some stuff that could be improved, but meh. If anyone feels like pointing them out, then feel free to do so 🙂

Having fun with reverse vending machines

I have a bad habit of breaking things on purpose, just to see what would happen if I do.
And in this case, I was recycling some bottles a few weeks ago, and I happened to take a quick look at the EAN code on the receipts that I got from the machine.

receipt1

From the pictures we can immediately come to two conclusions

1: The 7 digits (read from left to right) are probably the same on all the receipts from the same machine.

2: The third digit (read from right to left) is the amount of money on the receipt

Now, these receipts are usually given to the cashier.
When given to the cashier, she/he scans them and makes sure that they’re valid and then proceeds to give you the money or takes the money off from your purchase.
The cashier then draws a line over the EAN codes of the receipts and keeps them, so that it can’t be used again.

From that behavior, and from what we saw before on the receipts, we can draw another conclusion

3: The receipt is not unique, and could be scanned as many times as we want (We could make copies of it for example)

The receipts seem to vary a bit between machines/stores (gonna check if I can find some more info on that).
But for now I’ll focus on the Tomra T-83 HCpIII that this store has.

Tomra T-83 HCp website
Tomra T-83 HCp PDF

tomra-t-83hcp_p1

Now, if you create fake receipts with a normal printer, it would probably be discovered by the cashier, since the receipts use a special kind of paper and ink.
Although those printers + paper aren’t very hard to come by, so that wouldn’t be too hard to solve.

Epson TM-T88IV

tmt88iv

But, let’s put that aside and assume that you can’t go via the cashier (My goal here is not to create fake receipts and earn a bunch of money, so going via the cashier and getting cash would be pointless here). In the store where I am conducting these little experiments, there’s a “self checkout” area, where you can draw your membership card, scan everything yourself and then pay with a credit or debit card (They have random checks at times to make sure that people aren’t cheating). Next to the machine where you scan the EAN codes of the products that you are buying, there’s a small machine where you can put in different notes (with EAN codes) with offers on (buy 2 get 70% of on the third blabla etc), but you can also put in your receipts there and it will scan it, verify it and then draw the amount of your purchase.

A few things that should be noted here are;

4: The paper with the different offers and the recycling receipts, are on different kind of papers with different ink and quality, which makes me think that there aren’t many (if any) restrictions on the size and quality of the paper and EAN code, as long as it’s readable. Thus, even if I wanted to print it on normal A4 paper that I have in my printer at home, it would probably work.

5: The company that makes this EAN code reader is not the same one that makes the reverse vending machine for recycling the cans.

6: When the paper is inserted into the EAN code reader, if the EAN is valid, the machine keeps the paper. This further confirms point 3 that the code could probably be scanned several times if we wanted (which makes me think of a few fun things we could do with those “Weekly offers” papers that we get sometimes when shopping there, but that’s for another blog entry).

Now that we know all this, we need to do a few things!

* We need to analyze the receipts and figure out what the numbers are (to make templates later)

* We need to gather info on the machines that are used in this experiment (EAN barcode printers and scanners)

* Write a program that can generate these receipts from a template (Might as well do it while I’m at it)

So these are the two receipts that I have right now

Store: ICA Kvantum (Malmborgs Mobilia Malmö)
Machine: Tomra T-83 HCpIII
EAN Code: 9 999900 000702

Store: ICA Kvantum (Malmborgs Mobilia Malmö)
Machine: Tomra T-83 HCpIII
EAN Code: 9 999900 001006

These receipts use the EAN-13 standard, and since we already concluded that the first part of the code is the same on all these receipts,
we’ll just focus on the last part of the code, the 001006 and 000702.
According to the EAN-13 standard, the last digit is always the “check digit” or “checksum”, which is calculated like this:

References:
http://en.wikipedia.org/wiki/ISBN#ISBN-13_check_digit_calculation
http://en.wikipedia.org/wiki/EAN-13

9*1 + 9*3 + 9*1 + 9*3 + 9*1 + 0*3 + 0*1 + 0*3 + 0*1 + 0*3 + 7*1 + 0*3
=
9 + 27 + 9 + 27 + 9 + 7 = 88
=>
88/10 = 8,8
(take the rest)
10 - 8 = 2
The check digit is 2

So now that we know what the check digit is and how to calculate it, let’s focus on the rest of the numbers that we have left, which is the 001006 and 000702.
If we remove the check digit, we have this

00100
00070

And since we had one receipt on 10 SEK and one with 7 SEK, this one is pretty easy to guess, that on the first one, the “10” part is the 10 SEK, and on the second one the “7” is the 7 SEK.
So from this we can conclude that reading it from left to right, we have a digit for thousand, hundred, ten, ones and a decimal (Under 1 SEK is öre, but we don’t have that as a part of our currency any longer in Sweden, so I’ll just call it decimal for now).

So now that we know all this, we can actually create a fake receipt with just about any value we want (that fits in the EAN code of course).
To try this out and see how close to the original we can get without just putting a receipt in a machine and making copies, I have created a template in LaTex where one can just insert the right values in the template, and then convert it to a picture or PDF and print it to get the finished receipt.
The template can be seen below.

Template in LaTeX:

documentclass[12pt]{article}
usepackage{lmodern}
usepackage[utf8]{inputenc}
usepackage[paperwidth=57mm,paperheight=113mm,margin=3mm]{geometry}
%usepackage{geometry}
usepackage{graphicx}
usepackage{setspace}
usepackage{color}
%usepackage{ean13}
usepackage{soul}
geometry{verbose}
makeatletter

title{ICA Kvantum T-83HCp Receipt Template}
date{today}
makeatother

begin{document}
%begin{minipage}[t]{57mm}
centering{includegraphics{STORE_LOGO_IMG}}
pagecolor{white}
vspace{1mm}

textsf{textbf{Large TITLE_PART_1}}textsf{Large {} }
{Large {} {} {} }textsf{Large {} }textsf{textbf{Large TITLE_PART_2}}{Large }

%Large space between title and total
vspace{20mm}

%Total amount of money
centering
colorbox{black}{hspace{linewidth}hspace{HSPACEfboxsep}color{white}textbf{Large TOTAL_MONEY}{Large }}{Large par}

%Tiny space between total and ean
vspace{1mm}
centering
%EAN image
includegraphics{EAN_IMG}

%Space plus ean numbers under ean
begin{spacing}{0.5}
textsf{textbf{textsc{small EAN_NUM}}}{small par}
end{spacing}

%Space between ean and bottle/can amount
vspace{4mm}

%Amount of bottles/cans
textsf{textbf{footnotesize COUNT_BOTTLE flaskor/burkar áhfill{}AMOUNT_PER_BOTTLE}}{footnotesize par}
textsf{textbf{footnotesize rule[0.5ex]{1columnwidth}{1pt}}}{footnotesize par}

begin{spacing}{0.8}
textsf{textbf{footnotesize MODEL_NAME}}{footnotesize par}
textsf{textbf{footnotesize SERIAL_NUMBER}}{footnotesize par}
textsf{textbf{footnotesize TIME DATE}}
end{spacing}
%end{minipage}
end{document}

Generator script:

gen.sh (For safety reasons, the barcode script is not included)

#!/bin/bash

# This is a generator script for the ICA Malmborgs template
# I have left out some important parts, to protect the store in question
# Usage:
# bash gen.sh total_money

# Copy template to a temporary location
cp receipt.tex /tmp/receipt.tmp.tex

#Set path, bar width and height
path="EAN_IMG.png"
barwidth=1
barheight=60

# Set the numbers for the EAN
first=9
left=999900
right=$(bash right.sh $1)

# Decide the control digit
control=$(bash control.sh $first $left $right)
echo $control

# Set hspace (it needs to differe depending on the input value)
hspace=$(bash hspace.sh $1)

# Create the barcode here named EAN_IMG.png
# You will have to figure out for yourself how to do that though
# And write the barcode script yourself
# <insert barcode call here>

# Get time and date values
time_var=$(date +%H:%M)
date_var=$(date +%d-$(echo $(date +%b) | tr '[:lower:]' '[:upper:]')-%Y)

# Replace placeholders in template
sed -i 's/STORE_LOGO_IMG/STORE_LOGO_IMG.jpg/g' /tmp/receipt.tmp.tex
sed -i 's/TITLE_PART_1/Malmborgs/g' /tmp/receipt.tmp.tex
sed -i 's/TITLE_PART_2/Mobilia/g' /tmp/receipt.tmp.tex
sed -i "s/HSPACE/$hspace/g" /tmp/receipt.tmp.tex
sed -i "s/TOTAL_MONEY/$1.00/g" /tmp/receipt.tmp.tex
sed -i 's/EAN_IMG/EAN_IMG.png/g' /tmp/receipt.tmp.tex
sed -i "s/EAN_NUM/$first \hspace{1mm} \so{$left} \hspace{1mm} \so{$right$control}/g" /tmp/receipt.tmp.tex
sed -i 's/COUNT_BOTTLE/7/g' /tmp/receipt.tmp.tex
sed -i 's/AMOUNT_PER_BOTTLE/1.00/g' /tmp/receipt.tmp.tex
sed -i 's/MODEL_NAME/Tomra 83 HCp3/g' /tmp/receipt.tmp.tex
sed -i 's/SERIAL_NUMBER/606657-90199310-01456-00/g' /tmp/receipt.tmp.tex
sed -i "s/TIME/$time_var/g" /tmp/receipt.tmp.tex
sed -i "s/DATE/$date_var/g" /tmp/receipt.tmp.tex

# Create PDF and PNG
pdflatex /tmp/receipt.tmp.tex receipt.tmp.pdf
convert receipt.tmp.pdf receipt.png

# remove temp files
rm /tmp/receipt.tmp.tex
rm EAN_IMG.png

 

hspace.sh – This one sets the hspace value (template design related)

#!/bin/bash

val=$1
hspace="-12"

#There's probably a better way to do this
if  [[ ${#val} = 1 ]] ; then
   hspace="-12"
elif  [[ ${#val} = 2 ]] ; then
   hspace="-15"
elif [[ ${#val} = 3 ]] ; then
   hspace="-20"
elif [[ ${#val} = 4 ]] ; then
   hspace="-25"
fi

echo $hspace

 

control.sh – This one calculates the control digit

#!/bin/bash

var=$1$2$3
echo $var
vartwo=0

for i in {0..11}
do
    tmp=${var:$i:1}

    if [ $(($(($i+1))%2)) -eq 0 ] ; then
        vartwo=$(($vartwo+$(($tmp*3))))
    else
        vartwo=$(($vartwo+$(($tmp*1))))
    fi
done

vartwo=$(($vartwo%10))
vartwo=$((10-$vartwo))
echo $vartwo

 

right.sh – This one calculates the right part of the EAN number

#!/bin/bash

val=$1
right=0

#There's probably a better way to do this
if  [[ ${#val} = 1 ]] ; then
   right="000${val}0"
elif  [[ ${#val} = 2 ]] ; then
   right="00${val}0"
elif [[ ${#val} = 3 ]] ; then
   right="0${val}0"
elif [[ ${#val} = 4 ]] ; then
   right="${val}0"
fi

echo $right

 

Usage:
The easiest way to use it would be to simply run the gen.sh script. As it is right now the script will probably fail, since the pictures are missing, which I will not provide right now. But when it works, it will output a pdf and a png with the receipt. An easier way to generate them will be made together with a colleague of mine, although this will probably not be release to the public, and only presented to the company that I have targeted in this little research.

bash gen.sh sek

 

Requirements

The soul LaTeX package
The lmodern fonts for LaTeX

Result:

The EAN code has been made a bit smaller now so that it can’t be scanned in the stores.
receipt

This concludes my research for now on this topic.
I have a solution for this problem that I will write about in another post later.

Click HERE for part 2

Wrote my first install script for PlayOnLinux

I like to play games once in a while, but I don’t have Windows.
So like many other Linux gamers, I use Wine, but I like to have an overlay to keep things neat and organized, and thus I use PlayOnLinux.
PlayOnLinux comes with installation scripts so that the games will work right away without me having to fiddle around with a bunch of hacks to get it working, but as it turns out, the game I wanted to play (Civilization IV: Complete Edition) didn’t have an installation script that worked, so I decided to write my own and try to get it approved by the people at PlayOnLinux, and thus added to the software list of approved and signed scripts 🙂

It hasn’t been approved yet, but it’s getting there.
This is the script so far (fully working in this state).

Go to the link below for the newest development info
http://www.playonlinux.com/en/topic-10740.html

Another interesting thing to note, is that I am hosting the Civ IV patches myself that the script is downloading and installing, since I want to make sure that it’s always being hosted on a fast connection for everyone to use.

If anyone else need the patches for use outside of this script, you can download them below. (The patches below are no longer hosted by me!)

Civilization IV Patch 1.74
Civilization IV – Warlords Patch 2.13
Civilization IV – Beyond The Sword Patch 3.19

#!/bin/bash
# Date : (2013-06-26)
# Last revision : (2013-07-23)
# Wine version used : 1.4.1
# Distribution used to test : xUbuntu 13.10
# Author : Jinny Ramsmark
# Licence : GPLv3
# Depend : msxml3, d3dx9

# This script was tested using the DVD version of `Civilization IV: Complete'
# version 1.74, bought in the Sweden in 2011.

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

TITLE="Civilization IV: Complete Edition"
TITLECIV="Civilization IV"
TITLEBTS="Civilization IV - Beyond The Sword"
TITLEW="Civilization IV - Warlords"
TITLECOL="Civilization IV - Colonization"
AUTHOR="Jinny Ramsmark"
PREFIX="Civilization4"
WORKINGWINEVERSION="1.4.1"
STEAM_ID_CIV="3900"
STEAM_ID_W="3990"
STEAM_ID_BTS="8800"
STEAM_ID_COL="16810"

POL_GetSetupImages "http://files.playonlinux.com/resources/setups/$PREFIX/top.jpg" "http://files.playonlinux.com/resources/setups/$PREFIX/left.jpg" "$TITLE"

POL_SetupWindow_Init
POL_SetupWindow_SetID 1779
POL_Debug_Init

POL_SetupWindow_presentation "$TITLE" "Firaxis Games" "http://www.firaxis.com/" "$AUTHOR" "$PREFIX"
POL_Wine_SelectPrefix "$PREFIX"

POL_SetupWindow_InstallMethod "DVD,STEAM"

if [ "$INSTALL_METHOD" == "DVD" ]; then
    # Let the user select a DVD
    POL_SetupWindow_cdrom

    # Check if this DVD is the Civilization IV DVD
    POL_SetupWindow_check_cdrom "Autorun/Civ4Installer.ico"
fi

# Set and install the correct Wine version
POL_Wine_PrefixCreate "$WORKINGWINEVERSION"

# Install DirectX9
POL_Call POL_Install_d3dx9

if [ "$INSTALL_METHOD" == "DVD" ]; then
    # Run installer
    POL_Wine_WaitBefore "$TITLECIV"
    POL_Wine start /unix "$CDROM/setup.exe"
    POL_Wine_WaitExit "$TITLECIV"

    #Patch Civilization IV: Beyond the sword to 3.19
    cd "$POL_USER_ROOT/tmp"
    POL_Download "http://ayu.alcor.se/files/Civ4BeyondTheSwordPatch3.19.exe" "c45f6e028f51db2386120a5861eabe7c"
    POL_Wine_WaitBefore "$TITLECIV"
    POL_Wine Civ4BeyondTheSwordPatch3.19.exe
    POL_Wine_WaitExit "$TITLECIV"
else
    POL_Call POL_Install_steam

    # Start steam, update it, and install the games
    cd "$WINEPREFIX/drive_c/$PROGRAMFILES/Steam"
    POL_Wine start /unix "Steam.exe" steam://install/$STEAM_ID_CIV
    POL_SetupWindow_message "$(eval_gettext 'Steam is about to perform an update.nAfter Steam finishes updating and shows you to the login interface, login and then let $TITLE install.nnWhen the installation is finished, press next (Do not close Steam)')" "$TITLECIV"

    POL_Wine start /unix "Steam.exe" steam://install/$STEAM_ID_W
    POL_SetupWindow_message "$(eval_gettext 'Steam is installing $TITLEW, press next when the installation is finished')" "$TITLECIV"

    POL_Wine start /unix "Steam.exe" steam://install/$STEAM_ID_BTS
    POL_SetupWindow_message "$(eval_gettext 'Steam is installing $TITLEBTS, press next when the installation is finished')" "$TITLECIV"

    POL_Wine start /unix "Steam.exe" steam://install/$STEAM_ID_COL
    POL_SetupWindow_message "$(eval_gettext 'Steam is installing $TITLECOL, please quit Steam properly when the installation is finished (make sure Steam is not still in the traybar) and then press next so that the installation script can continue.')" "$TITLECIV"
    POL_Wine_WaitExit "$TITLECIV"
fi

# Install msxml3.msi
# Override for msxml3 is needed before the install
# The msvcr71 one is just there so that mods will work later on

POL_Wine_OverrideDLL "native" "msxml3"
POL_Wine_OverrideDLL "builtin" "msvcr71"
POL_Call POL_Install_msxml3

#Create shortcuts
if [ "$INSTALL_METHOD" == "STEAM" ]; then
    POL_Shortcut "Steam.exe" "$TITLECIV" "$TITLECIV.png" "-applaunch $STEAM_ID_CIV" "Game;StrategyGame;"
    POL_Shortcut "Steam.exe" "$TITLEBTS" "$TITLEBTS.png" "-applaunch $STEAM_ID_BTS" "Game;StrategyGame;"
    POL_Shortcut "Steam.exe" "$TITLEW" "$TITLEW.png" "-applaunch $STEAM_ID_W" "Game;StrategyGame;"
    POL_Shortcut "Steam.exe" "$TITLECOL" "$TITLECOL.png" "-applaunch $STEAM_ID_COL" "Game;StrategyGame;"
    POL_Shortcut "Steam.exe" "Steam - Civ IV" "" "" "Game;"
else
    POL_Shortcut "Civilization4.exe" "$TITLECIV" "$TITLECIV.png" "" "Game;StrategyGame;"
    POL_Shortcut "Civ4BeyondSword.exe" "$TITLEBTS" "$TITLEBTS.png" "" "Game;StrategyGame;"
    POL_Shortcut "Civ4Warlords.exe" "$TITLEW" "$TITLEW.png" "" "Game;StrategyGame;"
fi

#Done!
POL_SetupWindow_message "$(eval_gettext 'Installation finishednnThe game might crash on the first attempt, but no worries, just try one more time.')" "$TITLECIV"
POL_SetupWindow_Close
exit 0