Forums

[Script] Rise of Nations

Auteur Réponses
warcry Vendredi 11 September 2009 à 0:43
warcryAnonymous

I have made this script for install Rise of Nations (without expansion). I will publish the expansion script soon.
I post here to ask you if it works, if it's written OK, etc.

 

#!/bin/bash
# Date: (2009-08-10 23-55)
# Last revision: (2009-08-10 23-55)
# Wine version used: 1.1.29
# Licence: GPLv3
# Tested with standard Rise of Nations, not Gold Edition

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

source "$PLAYONLINUX/lib/sources"

TYTUL="Rise of Nations"

mkdir -p $REPERTOIRE/tmp/RON
cd $REPERTOIRE/tmp/RON
wget "http://img171.imageshack.us/img171/2002/leftz.jpg"
wget "http://img10.imageshack.us/img10/3687/topzp.jpg"

POL_SetupWindow_Init "$REPERTOIRE/tmp/RON/topzp.jpg" "$REPERTOIRE/tmp/RON/leftz.jpg"

if [ "$POL_LANG" == "es" ]; then
LNG_CABEXTRACT="Se necesita cabextract para extraer los cabinets de DirectX.\\n\\nPuedes instalarlo desde los repositorios de tu distro utilizando una herramienta como synaptic o apt-get. El paquete se llama \\"cabextract\\".\\nSin él no puedo continuar con la instalación."
LNG_MISSINGCOMPONENTS="Faltan componentes"
LNG_LOADINGSETUP="Cargando instalación"
LNG_INSTALLING="El instalador de Rise of Nations se está ejecutando.\\n\\nHaz una instalación normal. No instales GameSpy Arcade ni hagas click en \\"Jugar ahora\\".\\nCuando la instalación termine, haz clic en Siguiente.\\n\\nSi después de un tiempo el instalador todavía no ha aparecido, cancela y vuelve a\\nejecutar este script. Asegúrate de elegir bien el medio de instalación."
LNG_RUNNINGSETUP="Ejecutando instalación"
LNG_DOWNLOADINGUPDATE="Descargando actualización de Rise of Nations (es necesaria)"
LNG_SCREENSIZE="¿Qué tamaño de pantalla usarás para jugar al juego? (si no sabes, clic en Siguiente)"
LNG_DXLIBS="Instalando algunas bibliotecas de DirectX para el sonido"
LNG_INSTALLINGUPDATE="Instalando actualización"
LNG_INSTALLED="Rise of Nations ha sido instalado correctamente"
else
LNG_CABEXTRACT="cabextract is needed to extract the DirectX cabinets.\\n\\nYou can install them with the package tool of your Linux distribution (like Synaptic). The package name is \\"cabextract\\".\\nWithout cabextract I can't continue with the installation."
LNG_MISSINGCOMPONENTS="Missing components"
LNG_LOADINGSETUP="Loading Setup"
LNG_INSTALLING="The Rise of Nations Autorun is running.\\n\\nMake standard installation. Don't install GameSpy Arcade. Don't click to play now.\\nWhen the setup has been finished, click Next\\n\\nIf passed a while the installer hasn't appeared click \\"Cancel\\" and try again.\\nMake sure of choosing correct CD."
LNG_RUNNINGSETUP="Running Setup"
LNG_DOWNLOADINGUPDATE="Downloading update for Rise of Nations (required to be playable)"
LNG_SCREENSIZE="What screen size would you like to playing the game (if you don't known, click Next)"
LNG_DXLIBS="Installing DirectX libs required for sound"
LNG_INSTALLINGUPDATE="Installing update"
LNG_INSTALLED="Rise of Nations is installed"
fi

POL_SetupWindow_presentation "Rise of Nations" "Big Huge" "www.microsoft.com/Games/riseofnations/" "warcry" "Rise_of_Nations"

#cabextract is needed to extract DirectX archives
check_one "cabextract" "cabextract"

if [ "$MANQUE" == "true" ]
then
POL_SetupWindow_message "$LNG_CABEXTRACT" "$LNG_MISSINGCOMPONENTS"
POL_SetupẀindow_Close
exit
fi

POL_SetupWindow_cdrom
INSTALLER=$(Read_autorun)

select_prefix "$HOME/.PlayOnLinux/wineprefix/Rise_of_Nations/"
POL_SetupWindow_prefixcreate
PREFIX="$HOME/.PlayOnLinux/wineprefix/Rise_of_Nations"

#start installation

POL_SetupWindow_wait_next_signal "$LNG_LOADINGSETUP" "Rise of Nations"
#Fetch PROGRAMFILES environmental variable
PROGRAMFILES=`wine cmd /c echo "%ProgramFiles%"`
PROGRAMFILES=${PROGRAMFILES:3}
#Fetching APPDATA environmental variable
APPDATA=`wine cmd /c echo "%AppData%"`
APPDATA=${APPDATA:3}
echo $APPDATA | sed 's/\\\\/\\//g' > $REPERTOIRE/tmp/RON/appdata #this change \\ with /
APPDATA=`cat $REPERTOIRE/tmp/RON/appdata`
echo "$PREFIX/drive_c/$APPDATA/Microsoft Games/Rise of Nations"
wine $INSTALLER
POL_SetupWindow_detect_exit
POL_SetupWindow_message "$LNG_INSTALLING" "$LNG_RUNNINGSETUP"

#Download update for Rise of Nations, needed to solve the click bug http://bugs.winehq.org/show_bug.cgi?id=17614

mkdir $REPERTOIRE/downloads
cd $REPERTOIRE/downloads
if [ "`sha1sum ronpatch.exe`" != "728bb284f2ba335dcfdae6bd889facdeca100662 ronpatch.exe" ]
then
POL_SetupWindow_download "$LNG_DOWNLOADINGUPDATE" "Rise of Nations update" "http://download.microsoft.com/download/b/9/5/b95728f8-9727-43cd-834f-a11d019cae9f/ronpatch.exe"
fi

#Working in window works better
XRANDR=`xrandr --current | grep current`
SCREEN_SIZE=`echo $XRANDR | cut -d , -f 2 | cut -d \\ -f 3`x`echo $XRANDR | cut -d , -f 2 | cut -d \\ -f 5`
POL_SetupWindow_textbox "$LNG_SCREENSIZE" "Rise of Nations" "$SCREEN_SIZE"

W_WIDTH=`echo $APP_ANSWER | cut -d x -f 1`
W_HEIGHT=`echo $APP_ANSWER | cut -d x -f 2`
Set_Desktop On $W_WIDTH $W_HEIGHT

#There are to set some settings in rise2.ini to get the game work properly (click bug)
mkdir -p "$PREFIX/drive_c/$APPDATA/Microsoft Games/Rise of Nations"
cd "$PREFIX/drive_c/$APPDATA/Microsoft Games/Rise of Nations"
#this file is naturally created after the patch
echo "[RISE OF NATIONS]

Windowed Width=$W_WIDTH

Windowed Height=$W_HEIGHT

FullScreen=1

VSync=1

AllowAllResolutions=0

IgnoreMinimizeOnTabOut=0

ConfigDatabase=BHGVidCardConfig.txt

ESCKeyGoesToMenu=1

ClickDragTiming=5

ClickDragLowSensitive=20

ClickDragHighSensitive=64

ClickDragRightSensitive=6

SkipIntroMovies=0

ForceHardwareCursor=0

ForceGDICursor=0

ForceBWCursor=0

ForceStaticCursor=0

ForceAGPVBs=0

Don't Allow Texture Compression=0

SYS_grade_override(A-F or AUTO)=AUTO

MEM_grade_override(A-F or AUTO)=AUTO

CPU_grade_override(A-F or AUTO)=AUTO

GPU_grade_override(A-F or AUTO)=AUTO

TEXTURE_grade_override(FULL, HALF, QUARTER, AUTO)=AUTO

UseAltColors=0

Console Coord Mode=0

Console Name Mode=2

Sound Enabled=1

BackVidAsSlideShow=0

UseVTUNEDLL=0

TestDelayRenderAMin=0

TestDelayRenderBMin=0

TestDelayRenderAMax=0

TestDelayRenderBMax=0

Force Profile Menu=0

ForceLowCPUBackgroundVid=1
" > rise2.ini

#Some native DirectX libs are required for sound
POL_SetupWindow_wait_next_signal "$LNG_DXLIBS" "Rise of Nations"
mkdir -p $REPERTOIRE/tmp/RON/dxcab_tmp/
cd $REPERTOIRE/tmp/RON/dxcab_tmp/
cabextract $CDROM/DIRECTX/DXNT.CAB
cp dsound.dll $PREFIX/drive_c/windows/system32/
cp dmime.dll $PREFIX/drive_c/windows/system32/
cp dmsynth.dll $PREFIX/drive_c/windows/system32/
cp dmusic.dll $PREFIX/drive_c/windows/system32/
cp dswave.dll $PREFIX/drive_c/windows/system32/
cp dmloader.dll $PREFIX/drive_c/windows/system32/ #this and following are for intro videos
cp quartz.dll $PREFIX/drive_c/windows/system32/
cp devenum.dll $PREFIX/drive_c/windows/system32/

echo "[HKEY_CURRENT_USER\\\\Software\\\\Wine\\\\DllOverrides]" > $REPERTOIRE/tmp/RON/dx.reg
echo "\\"dsound\\"=\\"native,builtin\\"" >> $REPERTOIRE/tmp/RON/dx.reg
echo "\\"dmime\\"=\\"native,builtin\\"" >> $REPERTOIRE/tmp/RON/dx.reg
echo "\\"dmsynth\\"=\\"native,builtin\\"" >> $REPERTOIRE/tmp/RON/dx.reg
echo "\\"dmusic\\"=\\"native,builtin\\"" >> $REPERTOIRE/tmp/RON/dx.reg
echo "\\"dswave\\"=\\"native,builtin\\"" >> $REPERTOIRE/tmp/RON/dx.reg
echo "\\"dmloader\\"=\\"native,builtin\\"" >> $REPERTOIRE/tmp/RON/dx.reg
echo "\\"quartz\\"=\\"native,builtin\\"" >> $REPERTOIRE/tmp/RON/dx.reg
echo "\\"devenum\\"=\\"native,builtin\\"" >> $REPERTOIRE/tmp/RON/dx.reg
echo "\\"l3codecx\\"=\\"native,builtin\\"" >> $REPERTOIRE/tmp/RON/dx.reg
echo "" >> $REPERTOIRE/tmp/RON/dx.reg
#this is more personal, I don't like the blue-Windows background color every time the game is loading
echo "[HKEY_CURRENT_USER\\\\Control Panel\\\\Colors]" >> $REPERTOIRE/tmp/RON/dx.reg
echo "\\"Background\\"=\\"0 0 0\\"" >> $REPERTOIRE/tmp/RON/dx.reg
echo "\\"ButtonFace\\"=\\"192 192 192\\"" >> $REPERTOIRE/tmp/RON/dx.reg
regedit $REPERTOIRE/tmp/RON/dx.reg

POL_SetupWindow_detect_exit

#Installing the patch should be the last
POL_SetupWindow_wait_next_signal "$LNG_INSTALLINGUPDATE" "Rise of Nations"
wine $REPERTOIRE/downloads/ronpatch.exe
POL_SetupWindow_detect_exit

#Create a launcher and delete temporary files
POL_SetupWindow_make_shortcut "Rise_of_Nations" "$PROGRAMFILES/Microsoft Games/Rise of Nations" "rise.exe" "" "Rise of Nations" ""

#Clean temp
rm -R $REPERTOIRE/tmp/RON
clean_tmp

POL_SetupWindow_message "$LNG_INSTALLED"

POL_SetupWindow_Close
exit

Edité par Dadu042

NSLW Vendredi 11 September 2009 à 8:26
NSLW

if [ "$PLAYONLINUX" = "" ]then
exit 0
fi 
This is wrong

TYTUL="Rise of Nations" 
you musn't use TYTUL, it is only Title in Polish language

#cabextract is needed to extract DirectX archives
check_one "cabextract" "cabextract" 
You don't need this as cabextract i POL's dependency

select_prefix "$HOME/.PlayOnLinux/wineprefix/Rise_of_Nations/" 
This should be written otherwise

echo "\\"dsound\\"=\\"native,builtin\\"" >> $REPERTOIRE/tmp/RON/dx.reg

you can do
cd "$REPERTOIRE/tmp/RON"
echo "\\"dsound\\"=\\"native,builtin\\"" >> dx.reg


#this is more personal, I don't like the blue-Windows background color every time the game is loading
echo "[HKEY_CURRENT_USER\\\\Control Panel\\\\Colors]" >> $REPERTOIRE/tmp/RON/dx.reg
echo "\\"Background\\"=\\"0 0 0\\"" >> $REPERTOIRE/tmp/RON/dx.reg
echo "\\"ButtonFace\\"=\\"192 192 192\\"" >> $REPERTOIRE/tmp/RON/dx.reg
regedit $REPERTOIRE/tmp/RON/dx.reg 
Is this required to run the game?
warcry Vendredi 11 September 2009 à 13:41
warcryAnonymous

if [ "$PLAYONLINUX" = "" ]then
exit 0
fi 
This is wrong
[/qoute]
really? http://www.playonmac.com/en/dev-documentation-1.html
Perhaps "then" should be in new line, in my script it's in new line, I don't know why it's in the same when I posted here. =S
[quote from=NSLW]
TYTUL="Rise of Nations" 
you musn't use TYTUL, it is only Title in Polish language

Quote from NSLW

fixed, I got confused


#cabextract is needed to extract DirectX archives
check_one "cabextract" "cabextract" 
You don't need this as cabextract i POL's dependency

Quote from NSLW

fixed


select_prefix "$HOME/.PlayOnLinux/wineprefix/Rise_of_Nations/" 
This should be written otherwise

Quote from NSLW

I don't understand. I see it in documentation. http://www.playonmac.com/en/dev-documentation-5.html


echo "\\"dsound\\"=\\"native,builtin\\"" >> $REPERTOIRE/tmp/RON/dx.reg

you can do
cd "$REPERTOIRE/tmp/RON"
echo "\\"dsound\\"=\\"native,builtin\\"" >> dx.reg

Quote from NSLW

fixed


#this is more personal, I don't like the blue-Windows background color every time the game is loading
echo "[HKEY_CURRENT_USER\\\\Control Panel\\\\Colors]" >> $REPERTOIRE/tmp/RON/dx.reg
echo "\\"Background\\"=\\"0 0 0\\"" >> $REPERTOIRE/tmp/RON/dx.reg
echo "\\"ButtonFace\\"=\\"192 192 192\\"" >> $REPERTOIRE/tmp/RON/dx.reg
regedit $REPERTOIRE/tmp/RON/dx.reg 
Is this required to run the game?

Quote from NSLW

Not, It's to not see the blue screen while loading the game

Edité par warcry

warcry Vendredi 11 September 2009 à 13:55
warcryAnonymous

oops, i forgot to post the fixed version:
http://pastebin.com/f7442cdf1
http://pastebin.com/m4f3f3179

Edité par warcry

NSLW Vendredi 11 September 2009 à 13:59
NSLW

really? http://www.playonmac.com/en/dev-documentation-1.html
Perhaps "then" should be in new line, in my script it's in new line, I don't know why it's in the same when I posted here. =S 

No, just do short
[ "$PLAYONLINUX" = "" ] && exit
source "$PLAYONLINUX/lib/sources"

I don't understand. I see it in documentation. http://www.playonmac.com/en/dev-documentation-5.html

Citer

I think this must be clarified but for know it's better to use POL's REPERTOIRE so it would look like
select_prefix "$REPERTOIRE/wineprefix/Rise_of_Nations/"



echo "\\"dsound\\"=\\"native,builtin\\"" >> $REPERTOIRE/tmp/RON/dx.reg

you can do
cd "$REPERTOIRE/tmp/RON"
echo "\\"dsound\\"=\\"native,builtin\\"" >> dx.reg

Quote from warcry

fixed

Quote from NSLW


No you didn't fix that
warcry Vendredi 11 September 2009 à 14:04
warcryAnonymous

Now is it fixed? http://pastebin.com/m4165482




echo "\\"dsound\\"=\\"native,builtin\\"" >> $REPERTOIRE/tmp/RON/dx.reg

you can do
cd "$REPERTOIRE/tmp/RON"
echo "\\"dsound\\"=\\"native,builtin\\"" >> dx.reg

Quote from NSLW

fixed

Quote from warcry


No you didn't fix that

Quote from NSLW

why not?
NSLW Vendredi 11 September 2009 à 18:38
NSLW

Yes, now it's fixed.
1)Here is one more thing that i don't like
mkdir $REPERTOIRE/downloads
for such things there is $REPERTOIRE/ressources directory so no need to create another

2)In heading of script there is also no
# Distribution used to test:
# Author:

3) you don't need this
PREFIX="$HOME/.PlayOnLinux/wineprefix/Rise_of_Nations" 
just use WINEPREFIX variable

4)You could also take all the paths in quotes like e.g this
cd $REPERTOIRE/tmp/RON/dxcab_tmp/
could look like this
cd "$REPERTOIRE/tmp/RON/dxcab_tmp/"
Second case is better because when space occur in name then in first case command won't work as it should

Edité par NSLW

warcry Dimanche 13 September 2009 à 14:03
warcryAnonymous

1) I didn't known. fixed!
2) Really matters the distribution? Wine is the same for all, but fixed
3) ok, fixed
4) fixed in most, I think.

http://pastebin.com/m6f6d501
Ignore the blank lines you see... PasteBin hates me.
warcry Dimanche 13 September 2009 à 14:32
warcryAnonymous

damn invisible characters and damn DOS format!
re-fixed script:
http://pastebin.com/m3106c298
warcry Dimanche 13 September 2009 à 15:12
warcryAnonymous

Now my script doesn't work :cry:

This site allows content generated by members, and we promptly remove any content that infringes copyright according to our Terms of Service. To report copyright infringement, please send a notice to dmcayonlinux.com