Het forum

SimCity 4

A script at last!

Auteur Antwoorden
Ghostofkendo Zaterdag 12 Juli 2008 om 22:56
Ghostofkendo

Hello everyone

Toumeno made a script for SimCity 4:


if [ "$PLAYONLINUX" = "" ]
then
exit 0
fi

source "$PLAYONLINUX/lib/sources"
POL_SetupWindow_Init
#Verifier les dépendences
cfg_check

#Presentation
POL_SetupWindow_presentation "SimCity 4" "EA Games - Maxis" "http://www.electronicarts.com" "Toumeno" "SimCity4"


if [ "$POL_LANG" == "fr" ]; then
LNG_SC4PATCH_DL="Téléchargement de la mise à jour..."
LNG_SC4_WHERE="Où avez-vous acheté votre jeu SimCity 4 ?"
LNG_SC4_WAIT="Patientez pendant la préparation de l'installation"
LNG_SC4_CD2="Veuillez insérer le CD2 et cliquer sur Suivant"
LNG_SC4_REMCD2="Veuillez enlever le CD2 et cliquer sur Suivant"
LNG_SC4_CHANGE="Quand l'installateur vous demandera le CD2, cliquez sur Suivant"
LNG_SC4_CONTINUE="Continuez l'installation s'il vous plait en cliquant sur Ok dans l'installateur
Cliquez sur suivant dans cette fenêtre uniquement quand
l'installation sera terminée"
LNG_SC4_CRACK="Vous aurez besoin d'un crack no cd pour lancer SimCity 4.
Vous devez posséder le jeu original.
PlayOnLinux ne vous fournira aucune aide pour les cracks no cd.
PlayOnLinux n'est pas reponsable de l'utilisation que vous faites du logiciel."
LNG_SC4_QUESTION="Votre jeu SimCity 4 est-il une édition Deluxe ?"
LNG_SC4_CD1="Veuillez insérer le CD 1 et cliquer sur Suivant"

else

LNG_SC4PATCH_DL="Downloading the update..."
LNG_SC4_WHERE="Where did you buy your SimCity 4 game?"
LNG_SC4_WAIT="Please wait during the installation's preparation"
LNG_SC4_CD2="Please insert the CD2 and click on Next"
LNG_SC4_REMCD2="Please remove the CD2 and click on Next"
LNG_SC4_CHANGE="When the installer will ask you for the CD2, click on Next"
LNG_SC4_CONTINUE="Please continue the installation by clicking Ok in the installer
Click on Next in this window ONLY if the install is finished"
LNG_SC4_CRACK="You will need a no cd crack to run SimCity 4.
You must own the original game.
PlayOnLinux will not give you any help about no cd cracks.
PlayOnLinux is not responsible of the use of the software."
LNG_SC4_QUESTION="Is your SimCity 4 game a Deluxe Edition ?"
LNG_SC4_CD1="Please insert the CD 1 and click on Next"

fi

#Préparation de Wine
mkdir -p "$REPERTOIRE/wineprefix/SimCity4"
cd "$REPERTOIRE/wineprefix/SimCity4"
select_prefixe "$(pwd)"
POL_SetupWindow_prefixcreate

POL_SetupWindow_message "$LNG_SC4_CD1"

#Détection du cd-rom
POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom "setup.exe"

# Réglages de Wine
Set_OS "win2k"
Set_Desktop On 1024 768
Set_SoundDriver alsa
Set_GLSL Off
Set_WineVersion_Session 0.9.44

# Installation du jeu

# Créer les lecteurs Windows
cd "$REPERTOIRE/wineprefix/SimCity4/dosdevices"
rm ./*
ln -s "$REPERTOIRE/wineprefix/SimCity4/drive_c" "c:"
ln -s "$CDROM" "d:"
ln -s "/" "z:"


mkdir "$REPERTOIRE/wineprefix/SimCity4/temp"
cd "$REPERTOIRE/wineprefix/SimCity4/temp"
mkdir sc4setup

POL_SetupWindow_question "$LNG_SC4_QUESTION" "SimCity 4"
DELUXE="$APP_ANSWER"

if [ "$DELUXE" == 1 ]
then

FOLDER="Program Files/Maxis/SimCity 4 Deluxe/Apps/"

else

FOLDER="Program Files/Maxis/SimCity 4/Apps/"

fi



POL_SetupWindow_wait_next_signal "$LNG_SC4_WAIT" "SimCity 4"
cp -vR $CDROM/* ./sc4setup/
POL_SetupWindow_detect_exit
POL_SetupWindow_message "$LNG_SC4_CD2"

cd "$REPERTOIRE/wineprefix/SimCity4/temp"
mkdir sc4setup2
POL_SetupWindow_wait_next_signal "$LNG_SC4_WAIT" "SimCity 4"
cp -vR $CDROM/* ./sc4setup2/
chmod -R 777 "$REPERTOIRE/wineprefix/SimCity4/temp"
POL_SetupWindow_detect_exit
POL_SetupWindow_message "$LNG_SC4_REMCD2"

cd sc4setup

wine setup.exe
POL_SetupWindow_message "$LNG_SC4_CHANGE"
cd "$REPERTOIRE/wineprefix/SimCity4/temp"
mv sc4setup sc4setup1
mv sc4setup2 sc4setup
POL_SetupWindow_message "$LNG_SC4_CONTINUE"

#Réglage du problème Graphics Rules

cd "$REPERTOIRE/wineprefix/SimCity4/drive_c/Program Files/Maxis/SimCity 4"
cp "Graphics Rules.sgr" "Graphics Rules.backup"

### Téléchargement et installation mise à jour ###


cd "$REPERTOIRE/wineprefix/SimCity4/temp"


POL_SetupWindow_menu "$LNG_SC4_WHERE" "" "Europe/South and Central America/Africa/Russia/Mexico~North America/South Africa/India/Pakistan/Australia/New Zealand~Korea/Thailand/Tawain/Hong Kong~China~Japan" "~"
COUNTRY="$APP_ANSWER"
if [ "$COUNTRY" == "Europe/South and Central America/Africa/Russia/Mexico" ]
then

POL_SetupWindow_download "$LNG_SC4PATCH_DL" "SimCity 4" "http://simcity.ea.com/update/exe/R1/UPDATE-SKU2-TO-P2.EXE"
POL_SetupWindow_wait_next_signal "Installing update" "SimCity 4"
wine UPDATE-SKU2-TO-P2.EXE
POL_SetupWindow_detect_exit
POL_SetupWindow_message "SimCity 4 updated."
fi

if [ "$COUNTRY" == "North America/South Africa/India/Pakistan/Australia/New Zealand" ]
then

POL_SetupWindow_download "$LNG_SC4PATCH_DL" "SimCity 4" "http://simcity.ea.com/update/exe/R1/UPDATE-SKU1-TO-P2.EXE"
POL_SetupWindow_wait_next_signal "Installing update" "SimCity 4"
wine UPDATE-SKU1-TO-P2.EXE
POL_SetupWindow_detect_exit
POL_SetupWindow_message "SimCity 4 updated."

fi

if [ "$COUNTRY" == "Korea/Thailand/Tawain/Hong Kong" ]
then

POL_SetupWindow_download "$LNG_SC4PATCH_DL" "SimCity 4" "http://simcity.ea.com/update/exe/R1/UPDATE-SKU3-TO-P2.EXE"
POL_SetupWindow_wait_next_signal "Installing update" "SimCity 4"
wine UPDATE-SKU3-TO-P2.EXE
POL_SetupWindow_detect_exit
POL_SetupWindow_message "SimCity 4 updated."

fi

if [ "$COUNTRY" == "China" ]
then

POL_SetupWindow_download "$LNG_SC4PATCH_DL" "SimCity 4" "http://simcity.ea.com/update/exe/R1/UPDATE-SKU4-TO-P2.EXE"
POL_SetupWindow_wait_next_signal "Installing update" "SimCity 4"
wine UPDATE-SKU4-TO-P2.EXE
POL_SetupWindow_detect_exit
POL_SetupWindow_message "SimCity 4 updated."

fi

if [ "$COUNTRY" == "Japan" ]
then

POL_SetupWindow_download "$LNG_SC4PATCH_DL" "SimCity 4" "http://simcity.ea.com/update/exe/R1/UPDATE-SKU5-TO-P2.EXE"
POL_SetupWindow_wait_next_signal "Installing update" "SimCity 4"
wine UPDATE-SKU5-TO-P2.EXE
POL_SetupWindow_detect_exit
POL_SetupWindow_message "SimCity 4 updated."

fi

### FIN de téléchargement et installation mise à jour ###




cd "$REPERTOIRE/wineprefix/SimCity 4/drive_c/Program Files/Maxis/SimCity 4"
cp "Graphics Rules.sgr" "Graphics Rules.new"
cp "Graphics Rules.backup" "Graphics Rules.sgr"



#Fin du code du jeu
#Création du lanceur

POL_SetupWindow_make_shortcut "SimCity4" "$FOLDER" "SimCity 4.exe" "simcity4.xpm" "SimCity 4" "" "-d:software"
Set_WineVersion_Assign "0.9.44" "SimCity 4"
Set_Desktop Off

POL_SetupWindow_reboot
rm -rf "$REPERTOIRE/wineprefix/SimCity4/temp"
POL_SetupWindow_message "Installation terminée

Install finished"
POL_SetupWindow_message "$LNG_SC4_CRACK"
POL_SetupWindow_Close
exit


He would like you to test it and answer these few questions

Does the game runs?
Is display working correctly?
Set the game's resolution to 1280*1024, is the game in full screen?
Does the sound works?

Thank you very much

PS to the admins: here is the icon: http://sauercube.freezee.org/simcity4.xpm thank you to upload it
the screenshot: http://sauercube.freezee.org/SimCity 4.jpg

Aangepast door Toumeno

bpl07 Zondag 13 Juli 2008 om 19:01
bpl07Anonymous

The script doesn't copy the contents of the 2 cds to the temp folder. Maybe I need to mount it another way?
bpl07 Zondag 13 Juli 2008 om 19:12
bpl07Anonymous

Fixed it. My automount was mounting the cd at /media/SC4DELUXE1 instead of /media/cdrom0. I manually mounted them in terminal and the setup is working now.
bpl07 Maandag 14 Juli 2008 om 0:39
bpl07Anonymous

The installation gets stuck at 0%. It puts files where they should be though, at least for the 1st cd, but doesn't fully install. I'll play with it more tonight. I've gotten it to work before, so I know it'll work on my system.
bpl07 Maandag 14 Juli 2008 om 15:19
bpl07Anonymous

The installation gets stuck at the point where it asks for the second cd. When I press next in the script, the "insert cd 2" message disappears but the installation doesn't continue.
Toumeno Maandag 14 Juli 2008 om 22:27
Toumeno

bpl07, after clicked on Next in the script, you must go back in the installation and click on Ok
bpl07 Maandag 14 Juli 2008 om 23:40
bpl07Anonymous

The box to click ok disappears before I can click it. That's what I meant by my previous post. When I install in windows, putting the second cd in makes the pop-up disappear also.
Toumeno Dinsdag 15 Juli 2008 om 0:02
Toumeno

Now the script runs with SC4 Deluxe
bpl07, retry the installation, because it uses Wine 0.9.19 instead of 0.9.44
bpl07 Dinsdag 15 Juli 2008 om 3:49
bpl07Anonymous

Still getting stuck at the second cd.

When I installed this a few months ago, I copied the first cd to a temp folder, but I kept the second cd in the drive and just let it recognize it automatically when it needed it during the installation. I'll try this later if I get a chance, but I'm not sure why the script isn't working as is.
chemist Dinsdag 15 Juli 2008 om 6:18
chemistAnonymous

POL installed (as root) from playonlinux-3.0.7-fedora0.noarch.rpm on a Dell Inspiron 1300 laptop. I pasted the script posted by the OP to a file (Sc4.pol) and stuck two lines at the top:

#!/bin/bash -p
export PLAYONLINUX=/usr/share/playonlinux

I then ran it as an ordinary user. Note this was the first time I used POL. I am a programmer who is experienced with Linux but a novice with Wine.

Downloading updates seemed to go on so long I thought it was broken. Other than that no problem.

Then things start to get weird. A second window pops up offering to install Microsoft fonts, but the first installation window (with the googly eyes icon instead of "a c b" icon) remains active and duplicates the output of the second window. I choose to interact with the second window.

Now the 2nd window tells me to "Please wait... Click on download to start". This is confusing because there is no download button. One button is Cancel and the other one starts "Please wait" and there the label is cut off by the edge of the window. I clicked on the second button anyway.

At this point I noticed the following error messages were displayed in the terminal window:

err:alsa:ALSA_CheckSetVolume Could not find 'PCM Playback Volume' element
fixme:mixer:ALSA_MixerInit No master control found on Microsoft LifeChat LX-3000 , disabling mixer
Could not load Mozilla. HTML rendering will be disabled.
cp: target `/windows/fonts/' is not a directory

These messages did not mean anything to me. Should I have Mozilla installed? I have Firefox already. Should I have created a directory /windows/font before I started?

Then it downloaded Wine 0.9.x. This seemed odd because I already had wine 1.0 installed. After downloading it wrote a very large number of unimportant lines to the terminal window. I should have used tee to capture them in a file because it has overflowed my scrollback buffer.

Asked whether my game was the Deluxe version. No problems but once again it spammed the terminal with informational messages that the user could probably do without. A progress bar would be more user friendly.

Minor point: several times I was asked to click on Next when the button was actually labelled Forward.

Skipping long boring part... after removing CD2 I get the following error

./SC4.pol: line 109: 23307 Segmentation fault wine setup.exe
and a SELinux alert:

SELinux is preventing wine-preloader (unconfined_t) "mmap_zero" to <Unknown> (unconfined_t).
chemist Dinsdag 15 Juli 2008 om 6:38
chemistAnonymous

I got around the SELinux problem

[root@inspiron ~]# audit2allow -m local -l -i /var/log/audit/audit.log > local.te
[root@inspiron ~]# checkmodule -M -m -o local.mod local.te
checkmodule: loading policy configuration from local.te
checkmodule: policy configuration loaded
checkmodule: writing binary representation (version 6) to local.mod
[root@inspiron ~]# semodule_package -o local.pp -m local.mod
[root@inspiron ~]# semodule -i local.pp


Now I get stuck on the 2nd CD. The installer does not recognize that the 2nd CD is present.
Toumeno Dinsdag 15 Juli 2008 om 14:38
Toumeno

Few improvements in the script. Uninstall SC4 (and its prefixe) and retry.
tarzasai Vrijdag 18 Juli 2008 om 10:05
tarzasaiAnonymous

i got stuck on the 2nd cd request too, i think because the sc4 setup program look for it in the .PlayOnLinux/wineprefix/SimCity4/dosdevices/d: path, so the "mv sc4setup sc4setup1" "mv sc4setup2 sc4setup" commands seems pretty useless. better try something like "ln -sf sc4setup $HOME/.PlayOnLinux/wineprefix/SimCity4/dosdevices/d:"...
anyway after that i played sc4 for maybe 3 hours, it pretty works, thank for the script.
Toumeno Vrijdag 18 Juli 2008 om 15:55
Toumeno

for deluxe editions only :


if [ "$PLAYONLINUX" = "" ]
then
exit 0
fi

source "$PLAYONLINUX/lib/sources"
POL_SetupWindow_Init
#Verifier les dépendences
cfg_check

#Presentation
POL_SetupWindow_presentation "SimCity 4 Deluxe" "EA Games - Maxis" "http://www.electronicarts.com" "Toumeno" "simcity4deluxe"


if [ "$POL_LANG" == "fr" ]; then


LNG_SC4_WAIT="Patientez pendant la préparation de l'installation"
LNG_SC4_CD2="Veuillez insérer le CD2 et cliquer sur Suivant"
LNG_SC4_REMCD2="Veuillez enlever le CD2 et cliquer sur Suivant"
LNG_SC4_CHANGE="Quand l'installateur vous demandera le CD2, cliquez sur Suivant"
LNG_SC4_CONTINUE="Continuez l'installation s'il vous plait en cliquant sur Ok dans l'installateur
Cliquez sur suivant dans cette fenêtre uniquement quand
l'installation sera terminée"
LNG_SC4_CRACK="Vous aurez besoin d'un crack no cd pour lancer SimCity 4.
Vous devez posséder le jeu original.
PlayOnLinux ne vous fournira aucune aide pour les cracks no cd.
PlayOnLinux n'est pas reponsable de l'utilisation que vous faites du logiciel."
LNG_SC4_CD1="Veuillez insérer le CD 1 et cliquer sur Suivant"

else



LNG_SC4_WAIT="Please wait during the installation's preparation"
LNG_SC4_CD2="Please insert the CD2 and click on Next"
LNG_SC4_REMCD2="Please remove the CD2 and click on Next"
LNG_SC4_CHANGE="When the installer will ask you for the CD2, click on Next"
LNG_SC4_CONTINUE="Please continue the installation by clicking Ok in the installer
Click on Next in this window ONLY if the install is finished"
LNG_SC4_CRACK="You will need a no cd crack to run SimCity 4.
You must own the original game.
PlayOnLinux will not give you any help about no cd cracks.
PlayOnLinux is not responsible of the use of the software."
LNG_SC4_CD1="Please insert the CD 1 and click on Next"

fi

#Préparation de Wine
mkdir -p "$REPERTOIRE/wineprefix/simcity4deluxe"
cd "$REPERTOIRE/wineprefix/simcity4deluxe"
select_prefixe "$(pwd)"
POL_SetupWindow_prefixcreate

POL_SetupWindow_message "$LNG_SC4_CD1"

#Détection du cd-rom
POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom "setup.exe"

# Réglages de Wine
Set_WineVersion_Session 0.9.19
Set_OS "win2k"
Set_Desktop On 1024 768
Set_SoundDriver alsa
Set_GLSL Off


# Installation du jeu

# Créer les lecteurs Windows
cd "$REPERTOIRE/wineprefix/simcity4deluxe/dosdevices"
rm ./*
ln -s "$REPERTOIRE/wineprefix/simcity4deluxe/drive_c" "c:"
ln -s "$CDROM" "d:"
ln -s "/" "z:"


mkdir "$REPERTOIRE/wineprefix/simcity4deluxe/temp"
cd "$REPERTOIRE/wineprefix/simcity4deluxe/temp"
mkdir sc4setup


POL_SetupWindow_wait_next_signal "$LNG_SC4_WAIT" "SimCity 4 Deluxe"
cp -vR $CDROM/* ./sc4setup/
POL_SetupWindow_detect_exit
POL_SetupWindow_message "$LNG_SC4_CD2"

#cd "$REPERTOIRE/wineprefix/simcity4deluxe/temp"
#mkdir sc4setup2
#POL_SetupWindow_wait_next_signal "$LNG_SC4_WAIT" "SimCity 4 Deluxe"
#cp -vR $CDROM/* ./sc4setup2/
#chmod -R 777 "$REPERTOIRE/wineprefix/simcity4deluxe/temp"
#POL_SetupWindow_detect_exit
#POL_SetupWindow_message "$LNG_SC4_REMCD2"

cd sc4setup
#POL_SetupWindow_wait_next_signal "Installing... / Installation en cours" "SimCity 4 Deluxe"
wine setup.exe
POL_SetupWindow_detect_exit

#POL_SetupWindow_message "$LNG_SC4_CHANGE"
#cd "$REPERTOIRE/wineprefix/simcity4deluxe/temp"
#mv sc4setup sc4setup1
#mv sc4setup2 sc4setup
#POL_SetupWindow_message "$LNG_SC4_CONTINUE"

#Fin du code du jeu
#Création du lanceur

POL_SetupWindow_make_shortcut "simcity4deluxe" "Program Files/Maxis/SimCity 4 Deluxe/Apps/" "SimCity 4.exe" "simcity4.xpm" "SimCity 4 Deluxe" "" "-d:software"
Set_WineVersion_Assign "1.1.0" "SimCity 4 Deluxe"
Set_Desktop Off

POL_SetupWindow_reboot
rm -rf "$REPERTOIRE/wineprefix/simcity4deluxe/temp"
POL_SetupWindow_message "Installation terminée

Install finished"
POL_SetupWindow_message "$LNG_SC4_CRACK"
POL_SetupWindow_Close
exit
Ulla Donderdag 31 Juli 2008 om 13:52
UllaAnonymous

Installation worked so far, but I can not start the programm. Console sais:
Running SimCity 4
SimCity 4: line 5: cd: /home/ulla/.PlayOnLinux/wineprefix/SimCity4/drive_c/Program Files/Maxis/SimCity 4/Apps/: No such file or directory
wine: could not load L"C:\\windows\\system32\\SimCity 4.exe": Modul nicht gefunden

Can you help me?
Toumeno Vrijdag 1 Augustus 2008 om 11:33
Toumeno

Ulla, have you SC4 Deluxe ?

Does /home/ulla/.PlayOnLinux/wineprefix/SimCity4/drive_c/Program Files/ exists ?
Je bent hier: Index > Your creations. > SimCity 4