Forum

[script] Star Trek: Armada

Författare Svar
Jump to the page: 1 - 2
JimBo Friday 25 September 2009 at 7:38
JimBoAnonymous

Application/Game : Activision's Star Trek: Armada
Wine version : 1.1.32
Distribution : OpenSUSE
Distribution Version : 11.1 (32 bit)
Graphics card : Nvidia GeForce 7600 GT
Graphics card driver version : 190.42

Game Icon:

#!/bin/bash
# Date : (2009-09-20 09-00)
# Last revision : (2009-11-10 23:00)
# Wine version used : 1.1.32
# Distribution used to test : OpenSUSE 11.1 (32 & 64 bit)
# Author : JimBo
# Licence : Freeware
#
# This is a PlayOnLinux script for Activisions Star Trek: Armada
#
# Note:  The Wine registry changes included in this script work well with my Nvidia
#        card. Use the Advanced Wine Configuration plugin to tweak settings, if required.
#

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

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

TYTUL="Star Trek - Armada"
PREFIX="StarTrekArmada"

#game patch routine
patch_armada()
{
cd "$HOME"
POL_SetupWindow_browse "Please select the patch file" "Patch selection" ""
POL_SetupWindow_wait_next_signal "Patch installation in progress..." "$TYTUL"
wine "$APP_ANSWER"
POL_SetupWindow_detect_exit
}

POL_SetupWindow_Init
POL_SetupWindow_presentation "$TYTUL" "Activision" "http://www.activision.com" "JimBo" "$PREFIX"

select_prefix "$REPERTOIRE/wineprefix/$PREFIX"
POL_SetupWindow_prefixcreate 

Set_OS "win98"
POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom "setup/setup.exe"

POL_SetupWindow_wait_next_signal "Installation in progress..." "$TYTUL"
cd "$CDROM/setup"
wine "setup.exe"
POL_SetupWindow_detect_exit

#asking if you wish to patch your install
POL_SetupWindow_question "Do you have a post-installation patch you'd like to install?" "Post-installation patch"
if [ "$APP_ANSWER" = "TRUE" ]; then
patch_armada
fi

#requesting video memory size for registry entries
POL_SetupWindow_menu_list "How much memory does your video card have?" "Video RAM" "32/64/128/256/512/768/1024" "/" "32"
VRAM="$APP_ANSWER"

#build registry entry file
TEMP="$REPERTOIRE/tmp"
cd "$TEMP"
echo "[HKEY_CURRENT_USER\\Software\\Wine\\Direct3D]" > armada.reg
echo "\\"DirectDrawRenderer\\"=\\"opengl\\"" >> armada.reg
echo "\\"UseGLSL\\"=\\"enabled\\"" >> armada.reg
echo "\\"VideoMemorySize\\"=\\"$VRAM\\"" >> armada.reg
 
regedit "$TEMP/armada.reg"
sleep 2
rm "$TEMP/armada.reg"

#give the option to run the game windowed or full screen
POL_SetupWindow_menu "How do you want to run the game?" "Windowed or Full Screen" "Full Screen/Windowed" "/"
if [ "$APP_ANSWER" = "Windowed" ]; then
Set_Desktop "On" "800" "600"
elif [ "$APP_ANSWER" = "Full Screen" ]; then
Set_Desktop "Off"
fi

#copy the icon
cp $(find "$HOME/.local/share/icons/" -type f | grep '_armada.xpm') "$REPERTOIRE/icones/32/$TYTUL"

POL_SetupWindow_make_shortcut "$PREFIX" "$PROGRAMFILES/Activision/Star Trek - Armada" "Armada.exe" "" "$TYTUL"

POL_SetupWindow_reboot
POL_SetupWindow_Close
exit

Ändrat av JimBo

NSLW Friday 25 September 2009 at 8:23
NSLW

1) Heading should look different
2) Use select_prefix
3) quote paths
4) do
cd "$TEMP"
echo "[HKEY_CURRENT_USER\\Software\\Wine\\Direct3D]" > armada.reg
5) In German there is Programme and in Spanish there is Archivo de programma and not Program Files so your script doesn't work for everyone
6) use POL_SetupWindow_wait_next_signal and POL_SetupWindow_detect_exit at installing patch
JimBo Friday 25 September 2009 at 22:30
JimBoAnonymous

1) Should I use the heading from your 'Winamp' install script as an example? If so, can I add extra lines (ie. the Note)
2) I started this script with the 'Script Creator' plugin...and it used 'select_prefixe'. I'll fix it.
3) Not sure what you mean...all the paths in my script are quoted. (" ") Can you give me an example?
4) Will do.
5) Is that why you use this code in your Winamp install script:
PROGRAMFILES=`wine cmd /c echo "%ProgramFiles%"`
PROGRAMFILES=${PROGRAMFILES:3}
6) Like this?...
patch_armada()
{
cd $HOME
POL_SetupWindow_browse "Please select the patch file" "Patch selection" ""
POL_SetupWindow_wait_next_signal "Patch installation in progress..." "Patch"
wine "$APP_ANSWER"
POL_SetupWindow_detect_exit
}
NSLW Saturday 26 September 2009 at 13:47
NSLW

1) Yes of course
2) Script Creator is bit outdated and prefixe is from French AFAIK French words in functions shouldn't be used anymore in scripts
3) cd $CDROM
if it would be quoted then
cd $CDROM
5) Yes
6) Yes

you could also look for icon for that game (in ~/.local/share/icons) and copy it to "~/.PlayOnLinux/icones/32" with the name of the script (without any extensions)
JimBo Tuesday 29 September 2009 at 5:40
JimBoAnonymous

Ok...how does this look?

#!/bin/bash
# Date : (2009-09-20 09-00)
# Last revision : (2009-09-28 22:30)
# Wine version used : 1.1.29
# Distribution used to test : OpenSUSE 11.1 (32 & 64 bit)
# Author : JimBo
# Licence : Freeware
#
# This is a PlayOnLinux script for Activisions Star Trek: Armada
#
# Note:  The Wine registry changes included in this script work well with
#             my Nvidia card. Use the Advanced Wine Configuration plugin to
#             tweak settings, if required.
#

if [ "$PLAYONLINUX" = "" ]
then
exit 0
fi
source "$PLAYONLINUX/lib/sources"

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

TYTUL="Star Trek: Armada"
PREFIX="StarTrekArmada"

#game patch routine
patch_armada()
{
cd "$HOME"
POL_SetupWindow_browse "Please select the patch file" "Patch selection" ""
POL_SetupWindow_wait_next_signal "Patch installation in progress..." "Patch"
wine "$APP_ANSWER"
sleep 5
POL_SetupWindow_detect_exit
} 

POL_SetupWindow_Init
POL_SetupWindow_presentation "$TYTUL" "Activision" "http://www.activision.com" "JimBo" "$PREFIX"

select_prefix "$REPERTOIRE/wineprefix/$PREFIX"
POL_SetupWindow_prefixcreate 

Set_OS "win98"
POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom "setup.exe"

cd "$CDROM"
POL_SetupWindow_wait_next_signal "Installation in progress..." "$TYTUL"
wine "$CDROM/setup.exe"
sleep 10
POL_SetupWindow_detect_exit

#asking if you wish to patch your install
POL_SetupWindow_question "Do you have a post-installation patch you'd like to install?" "Post-installation patch"
if [ "$APP_ANSWER" = "TRUE" ]; then
patch_armada
fi

#requesting video memory size for registry entries
POL_SetupWindow_menu_list "How much memory does your video card have?" "Video RAM" "32/64/128/256/512/768/1024" "/" "32"
VRAM="$APP_ANSWER"

#build registry entry file
TEMP="$REPERTOIRE/tmp"
cd "$TEMP"
echo "[HKEY_CURRENT_USER\\Software\\Wine\\Direct3D]" > armada.reg
echo "\\"DirectDrawRenderer\\"=\\"opengl\\"" >> armada.reg
echo "\\"UseGLSL\\"=\\"enabled\\"" >> armada.reg
echo "\\"VideoMemorySize\\"=\\"$VRAM\\"" >> armada.reg
echo "\\"OffscreenRenderingMode\\"=\\"backbuffer\\"" >> armada.reg
echo "\\"RenderTargetLockMode\\"=\\"auto\\"" >> armada.reg
echo "\\"Multisampling\\"=\\"disabled\\"" >> armada.reg
 
regedit "$TEMP/armada.reg"
Set_GLSL "On"
sleep 2
rm "$TEMP/armada.reg"

#give the option to run the game windowed or full screen
POL_SetupWindow_menu "How do you want to run the game?" "Windowed or Full Screen" "Full Screen/Windowed" "/"
if [ "$APP_ANSWER" = "Windowed"]; then
Set_Desktop "On" "800" "600"
elif [ "$APP_ANSWER" = "Full Screen"]; then
Set_Desktop "Off"
fi

#copy the icon
cp "$HOME/.local/share/icons/c9ab_armada.xpm" "$REPERTOIRE/icones/32/$TYTUL"

POL_SetupWindow_make_shortcut "$PREFIX" "$PROGRAMFILES/Activision/Star Trek - Armada" "Armada.exe" "" "$TYTUL"

POL_SetupWindow_reboot
POL_SetupWindow_Close
exit
NSLW Tuesday 29 September 2009 at 11:54
NSLW

Use
[ "$PLAYONLINUX" = "" ] && exit 0
instead
if [ "$PLAYONLINUX" = "" ]then
exit 0
fi


Why do you do ?
sleep 5

If the POL_SetupWindow_wait_next_signal don't work as it should then do it as in this script
JimBo Tuesday 6 October 2009 at 1:45
JimBoAnonymous

Did the "sleep 5" as a delay in the script to allow time for the patch program to complete. The "POL_SetupWindow_wait_next_signal / POL_SetupWindow_detect_exit" command nest did not work for the "setup.exe" program from the CD, so I assumed the same thing would happen with the patch program.

Made some more modifications...here is the updated and fully tested code:

#!/bin/bash
# Date : (2009-09-20 09-00)
# Last revision : (2009-09-28 22:30)
# Wine version used : 1.1.29
# Distribution used to test : OpenSUSE 11.1 (32 & 64 bit)
# Author : JimBo
# Licence : Freeware
#
# This is a PlayOnLinux script for Activisions Star Trek: Armada
#
# Note:  The Wine registry changes included in this script work well with my Nvidia
#        card. Use the Advanced Wine Configuration plugin to tweak settings, if required.
#

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

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

TYTUL="Star Trek: Armada"
PREFIX="StarTrekArmada"

#game patch routine
patch_armada()
{
cd "$HOME"
POL_SetupWindow_browse "Please select the patch file" "Patch selection" ""
POL_SetupWindow_wait_next_signal "Patch installation in progress..." "$TYTUL"
wine "$APP_ANSWER"
POL_SetupWindow_detect_exit
}

POL_SetupWindow_Init
POL_SetupWindow_presentation "$TYTUL" "Activision" "http://www.activision.com" "JimBo" "$PREFIX"

select_prefix "$REPERTOIRE/wineprefix/$PREFIX"
POL_SetupWindow_prefixcreate 

Set_OS "win98"
POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom "setup.exe"

cd "$CDROM"
POL_SetupWindow_wait_next_signal "Installation in progress..." "$TYTUL"
wine "$CDROM/setup.exe"
sleep 10
POL_SetupWindow_detect_exit

#asking if you wish to patch your install
POL_SetupWindow_question "Do you have a post-installation patch you'd like to install?" "Post-installation patch"
if [ "$APP_ANSWER" = "TRUE" ]; then
patch_armada
fi

#requesting video memory size for registry entries
POL_SetupWindow_menu_list "How much memory does your video card have?" "Video RAM" "32/64/128/256/512/768/1024" "/" "32"
VRAM="$APP_ANSWER"

#build registry entry file
TEMP="$REPERTOIRE/tmp"
cd "$TEMP"
echo "[HKEY_CURRENT_USER\\Software\\Wine\\Direct3D]" > armada.reg
echo "\\"DirectDrawRenderer\\"=\\"opengl\\"" >> armada.reg
echo "\\"UseGLSL\\"=\\"enabled\\"" >> armada.reg
echo "\\"VideoMemorySize\\"=\\"$VRAM\\"" >> armada.reg
echo "\\"OffscreenRenderingMode\\"=\\"backbuffer\\"" >> armada.reg
echo "\\"RenderTargetLockMode\\"=\\"auto\\"" >> armada.reg
echo "\\"Multisampling\\"=\\"disabled\\"" >> armada.reg
 
regedit "$TEMP/armada.reg"
Set_GLSL "On"
sleep 2
rm "$TEMP/armada.reg"

#give the option to run the game windowed or full screen
POL_SetupWindow_menu "How do you want to run the game?" "Windowed or Full Screen" "Full Screen/Windowed" "/"
if [ "$APP_ANSWER" = "Windowed"]; then
Set_Desktop "On" "800" "600"
elif [ "$APP_ANSWER" = "Full Screen"]; then
Set_Desktop "Off"
fi

#copy the icon
cp "$HOME/.local/share/icons/c9ab_armada.xpm" "$REPERTOIRE/icones/32/$TYTUL"

POL_SetupWindow_make_shortcut "$PREFIX" "$PROGRAMFILES/Activision/Star Trek - Armada" "Armada.exe" "" "$TYTUL"

POL_SetupWindow_reboot
POL_SetupWindow_Close
exit
NSLW Tuesday 6 October 2009 at 7:51
NSLW

If POL_SetupWindow_wait_next_signal don't work, don't use it at all. Do it as I made it in script I gave you above. Sleep command is not a way to do this, it only delays.

BTW. Don't set UseGLSL, RenderTargetLockMode, Multisampling because they have default values the same as you set them.

Ändrat av NSLW

JimBo Saturday 10 October 2009 at 3:19
JimBoAnonymous

Wasn't sure if the 'POL_SetupWindow_Wait...' thing didn't work only on my distro. Left it in just in case it works for someone else. The 'Sleep 10' is to give time for the 'setup.exe' to kick off and hide the window as to not confuse people in thinking the install took less then a second. I don't really see the harm in leaving both in.

On my machine the UseGLSL registry entry is blank by default...besides I'm not a big fan of relying on 'defaults' to stay true for the duration. One thing I've learned with OpenSource, is things keep evolving, and changing. If it's all the same to you, I feel more comfortable leaving stuff in the script that I know works for the game.
NSLW Saturday 10 October 2009 at 9:11
NSLW

Wasn't sure if the 'POL_SetupWindow_Wait...' thing didn't work only on my distro. Left it in just in case it works for someone else. The 'Sleep 10' is to give time for the 'setup.exe' to kick off and hide the window as to not confuse people in thinking the install took less then a second. I don't really see the harm in leaving both in.

Quote from JimBo

I do see harm. It doesn't work so why should be in script? Next thing is that script goes forward and does things that should be done after successful installation.


On my machine the UseGLSL registry entry is blank by default...besides I'm not a big fan of relying on 'defaults' to stay true for the duration. One thing I've learned with OpenSource, is things keep evolving, and changing. If it's all the same to you, I feel more comfortable leaving stuff in the script that I know works for the game.

Quote from JimBo


Then you should set 150 values because their defaults may change in future. That's sinless, you should set value only if it's needed.
JimBo Friday 16 October 2009 at 3:54
JimBoAnonymous

Ok...I've been able to sort out the first issue. Turns out the 'setup.exe' at the root of the CDROM was simply calling a 'setup.exe' in the setup folder. So I changed the script to call that one...now everything behaves properly.

I also trimmed down the registry entires to only include the ones that are noted as being required in order for the game to run properly. I've also tested it with the latest version of wine. Cool?

The new code is as follows:

#!/bin/bash
# Date : (2009-09-20 09-00)
# Last revision : (2009-10-15 21:30)
# Wine version used : 1.1.31
# Distribution used to test : OpenSUSE 11.1 (32 & 64 bit)
# Author : JimBo
# Licence : Freeware
#
# This is a PlayOnLinux script for Activisions Star Trek: Armada
#
# Note:  The Wine registry changes included in this script work well with my Nvidia
#        card. Use the Advanced Wine Configuration plugin to tweak settings, if required.
#

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

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

TYTUL="Star Trek: Armada"
PREFIX="StarTrekArmada"

#game patch routine
patch_armada()
{
cd "$HOME"
POL_SetupWindow_browse "Please select the patch file" "Patch selection" ""
POL_SetupWindow_wait_next_signal "Patch installation in progress..." "$TYTUL"
wine "$APP_ANSWER"
POL_SetupWindow_detect_exit
}

POL_SetupWindow_Init
POL_SetupWindow_presentation "$TYTUL" "Activision" "http://www.activision.com" "JimBo" "$PREFIX"

select_prefix "$REPERTOIRE/wineprefix/$PREFIX"
POL_SetupWindow_prefixcreate 

Set_OS "win98"
POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom "setup/setup.exe"

cd "$CDROM"
POL_SetupWindow_wait_next_signal "Installation in progress..." "$TYTUL"
wine "$CDROM/setup/setup.exe"
POL_SetupWindow_detect_exit

#asking if you wish to patch your install
POL_SetupWindow_question "Do you have a post-installation patch you'd like to install?" "Post-installation patch"
if [ "$APP_ANSWER" = "TRUE" ]; then
patch_armada
fi

#requesting video memory size for registry entries
POL_SetupWindow_menu_list "How much memory does your video card have?" "Video RAM" "32/64/128/256/512/768/1024" "/" "32"
VRAM="$APP_ANSWER"

#build registry entry file
TEMP="$REPERTOIRE/tmp"
cd "$TEMP"
echo "[HKEY_CURRENT_USER\\Software\\Wine\\Direct3D]" > armada.reg
echo "\\"DirectDrawRenderer\\"=\\"opengl\\"" >> armada.reg
echo "\\"UseGLSL\\"=\\"enabled\\"" >> armada.reg
echo "\\"VideoMemorySize\\"=\\"$VRAM\\"" >> armada.reg
 
regedit "$TEMP/armada.reg"
Set_GLSL "On"
sleep 2
rm "$TEMP/armada.reg"

#give the option to run the game windowed or full screen
POL_SetupWindow_menu "How do you want to run the game?" "Windowed or Full Screen" "Full Screen/Windowed" "/"
if [ "$APP_ANSWER" = "Windowed"]; then
Set_Desktop "On" "800" "600"
elif [ "$APP_ANSWER" = "Full Screen"]; then
Set_Desktop "Off"
fi

#copy the icon
cp "$HOME/.local/share/icons/c9ab_armada.xpm" "$REPERTOIRE/icones/32/$TYTUL"

POL_SetupWindow_make_shortcut "$PREFIX" "$PROGRAMFILES/Activision/Star Trek - Armada" "Armada.exe" "" "$TYTUL"

POL_SetupWindow_reboot
POL_SetupWindow_Close
exit
JimBo Friday 16 October 2009 at 3:56
JimBoAnonymous

Forgot to ask: should I be editing/updating my original message/code, or keep posting it the way that I have been?

And how do you guys get the game icon in your post?

Ändrat av JimBo

NSLW Saturday 17 October 2009 at 14:38
NSLW

I also trimmed down the registry entires to only include the ones that are noted as being required in order for the game to run properly. I've also tested it with the latest version of wine. Cool?

Quote from JimBo

This
echo "\\"UseGLSL\\"=\\"enabled\\"" >> armada.reg
is default setting since I don't even remember when.

Forgot to ask: should I be editing/updating my original message/code, or keep posting it the way that I have been?

Quote from JimBo

Just edit first post.

And how do you guys get the game icon in your post?

Quote from JimBo

If you upload to imageshack.us then you'll get special link for it then you only need to paste it to Message window you normally write here on the forum.
JimBo Wednesday 21 October 2009 at 23:44
JimBoAnonymous


This
echo "\\"UseGLSL\\"=\\"enabled\\"" >> armada.reg
is default setting since I don't even remember when.

Quote from NSLW


Is the Set_GLSL "On" command the same as that registry entry?

Just edit first post.

If you upload to imageshack.us then you'll get special link for it then you only need to paste it to Message window you normally write here on the forum.

Quote from NSLW


Will do!
NSLW Thursday 22 October 2009 at 9:12
NSLW


Is the Set_GLSL "On" command the same as that registry entry?

Quote from JimBo

Yes but it isn't needed because it's default setting.
JimBo Sunday 8 November 2009 at 6:58
JimBoAnonymous


Yes but it isn't needed because it's default setting.

Quote from NSLW


Ok...edited the first post, and was able to included the Game Icon...thanks for the ImageShack link. I removed the "Set_GLSL On" command...but kept the registry entry. On my machine the GLSL entry on Wine always defaults to an empty value. Not sure if that means enabled or disabled. I have noticed that if it's not 'enabled' the game has some serious video issues.

Now to try Star Trek: Armada II! :D

Thanks for your guidance!
NSLW Sunday 8 November 2009 at 10:19
NSLW

Use
"$HOME/.local/share/icons/*_armada.xpm"
instead of
"$HOME/.local/share/icons/c9ab_armada.xpm"

Do
POL_SetupWindow_wait_next_signal "Installation in progress..." "$TYTUL"
cd "$CDROM/setup"
wine "setup.exe"
POL_SetupWindow_detect_exit
instead of
cd "$CDROM"
POL_SetupWindow_wait_next_signal "Installation in progress..." "$TYTUL"
wine "$CDROM/setup/setup.exe"
POL_SetupWindow_detect_exit
JimBo Wednesday 11 November 2009 at 7:37
JimBoAnonymous

Use

"$HOME/.local/share/icons/*_armada.xpm"
instead of
"$HOME/.local/share/icons/c9ab_armada.xpm"

Quote from NSLW


The CP command with a wild card in a bash script doesn't work all that well...it produces a "cp: cannot stat" error. The following script line works nicely though:

cp $(find "$HOME/.local/share/icons/" -type f | grep '_armada.xpm') "$REPERTOIRE/icones/32/$TYTUL"

Aside from that one, I made the other change you suggested, and a couple of my own:

1. There was a minor syntax error on lines 74 and 76 in the if...elif statement. (Aside: running PlayOnLinux from the command line really helps with debugging scripts.) :)

2. I changed the name from "Star Trek: Armada" to "Star Trek - Armada". I figured the colon in the filename may cause problems for some file systems.

Are there any plans to include an 'uninstall' section in these scripts? I noticed when removing an application stuff is left behind...like Wine icons and application references. Makes things a confusing and requires a manual clean-up process many may not know how to accomplish properly.

Cheers!

J.

Ändrat av JimBo

NSLW Wednesday 11 November 2009 at 9:59
NSLW


Are there any plans to include an 'uninstall' section in these scripts? I noticed when removing an application stuff is left behind...like Wine icons and application references. Makes things a confusing and requires a manual clean-up process many may not know how to accomplish properly.

Quote from JimBo

You can use remove option. It makes no sense to uninstall application when it has its own wineprefix.
JimBo Wednesday 11 November 2009 at 18:20
JimBoAnonymous


You can use remove option. It makes no sense to uninstall application when it has its own wineprefix.

Quote from NSLW


Yes...but the remove option does not delete the stuff that gets created in the ".local/share" directories for Wine. They need to be deleted manually.