The forum

Ultima 1+2+3 GOG.com Edition

Author Replies
sgalland Saturday 14 April 2012 at 21:27
sgallandAnonymous

Hello, I have been trying to figure out how to get Ultima 1+2+3 to work with Wine and I finally broke down and wrote a POL Script. I hope you enjoy it.

PS. I was unable to get the icon parameter to work. If someone can give me an example of how to set it I would be very happy to modify the script.

Thanks.

#!/bin/bash
# Date : (2012-04-10 23:39)
# Last revision : (2012-04-10 23:39)
# Wine version used : 1.3.36
# Distribution used to test : Ubuntu 11.10
# Author : Sean Galland
# Script licence : GPL 2
# Program licence : Closed Source
# Depend : None
[ -z "$PLAYONLINUX" ] && exit 0
source "$PLAYONLINUX/lib/sources"

PREFIX="ULTIMATRILOGY_GOG"
WORKING_WINE_VERSION="1.3.36"
INSTALLBIN="setup_ultima_trilogy.exe"

TITLE="Ultima 1+2+3 (GOG.com)"
URL="http://www.gog.com/en/gamecard/ultima_1_2_3"

POL_SetupWindow_Init
POL_Debug_Init

POL_SetupWindow_presentation "$TITLE" "Origin Systems" "$URL" "Sean Galland" "$PREFIX"

if [ -z "$POL_SELECTED_FILE" ]; then
POL_SetupWindow_question "$(eval_gettext 'Do you want to download $TITLE from GOG.com?')" "$TITLE"
[ "$APP_ANSWER" = "TRUE" ] && POL_Browser "$URL"
fi

POL_Wine_SelectPrefix "$PREFIX"
POL_Wine_PrefixCreate "$WORKING_WINE_VERSION"

if [ -n "$POL_SELECTED_FILE" ]; then
ARCHIVE="$POL_SELECTED_FILE"
else
cd $HOME
POL_SetupWindow_browse "$(eval_gettext 'Please select the setup file to run.')" "$TITLE" "$INSTALLBIN"
ARCHIVE="$APP_ANSWER"
fi

POL_SetupWindow_wait "$(eval_gettext 'Please wait while $TITLE is installed.')" "$TITLE"
POL_Wine start /unix "$ARCHIVE" || POL_Debug_Fatal "$(eval_gettext 'Error while installing archive')"
POL_Wine_WaitExit "$TITLE"

Set_OS winxp
POL_SetupWindow_VMS "16"
POL_Wine_reboot

POL_SetupWindow_make_shortcut "$PREFIX" "$PROGRAMFILES/GOG.com/Ultima Trilogy/Ultima1/" "C:/$PROGRAMFILES/GOG.com/Ultima Trilogy/DOSBOX/DOSBox.exe" "" "Ultima 1" "" "-conf dosboxULTIMA1.conf -noconsole"
POL_SetupWindow_make_shortcut "$PREFIX" "$PROGRAMFILES/GOG.com/Ultima Trilogy/Ultima2/" "C:/$PROGRAMFILES/GOG.com/Ultima Trilogy/DOSBOX/DOSBox.exe" "" "Ultima 2" "" "-conf dosboxULTIMA2.conf -noconsole"
POL_SetupWindow_make_shortcut "$PREFIX" "$PROGRAMFILES/GOG.com/Ultima Trilogy/Ultima3/" "C:/$PROGRAMFILES/GOG.com/Ultima Trilogy/DOSBOX/DOSBox.exe" "" "Ultima 3" "" "-conf dosboxULTIMA3.conf -noconsole"


POL_SetupWindow_Close
exit

Edited by sgalland

petch Saturday 14 April 2012 at 22:38
petch
Developer

Hello,
To answer your question, POL_SetupWindow_make_shortcut, beside being obsoleted by POL_Shortcut, could only take an icon from PlayOnLinux web server, so you need some access to the server to store icons.

You should use POL_Shortcut instead, eventually later overwriting the icons generated (~/.PlayOnLinux/icones/32/shortcutname and ~/.PlayOnLinux/icones/full_size/shortcutname) with a 32x32 icon for the former, a square icon for the latter, using cp or convert (or another method).
Since 4.0.17 there's a way to take icons from GOG's gfw_high.ico (see http://www.playonlinux.com/repository/?script=1080 for an example). All this may change, there's room for improvements in the area of icons handling.

Note that start /unix is almost always useless and will prevent POL from automatically stopping the installer if the user aborts the script, so it's better to remove it.

Beside that, we've been working on several features lately that could help you improve your script:

- GOG integration, now scripts can download the games from GOG.com by themselves. The POL_GoG_setup function takes a game identifier (the end of game's page URL) and the MD5 hash of the different parts of the installer, and will by itself either accept local files, or initiate a download. It returns with $POL_GoG_location containing the path of the install binary, so all you need is to execute it. The script mentioned above can also be used as an example of this feature. You can follow the "Last changes" link on the page to see what I needed to adapt in the script.

- DOSBox integration, it's brand new so it's still a bit rough on the edges, but it already works well, using native DOSBox (and this is the mandatory method for scripts for DOS games to enter the official repository). Basically all you need to do is to use a Wine version with DOSBox support (say, 1.4-dos_support)! Worse case, if the [autoexec] section of GOG's dosbox.conf file does more than change directories, start the game and exit, you may have to write an autoexec.bat batch file at the root of the drive_c virtual disk with the extra statements. If you want an example of this, you can check http://www.playonlinux.com/repository/?script=1125.

As you can see, things have been moving fast around GOG's integration! I hope that's not too overwhelming...
Feel free to ask for explanations if something is not clear, as this is all undocumented for now...

Last but not least, I'm very pleased to see people interested in writing PlayOnLinux scripts for GOG games!

Regards, Pierre.

Edited by petch

sgalland Tuesday 24 April 2012 at 6:46
sgallandAnonymous

Thanks for the feedback. I will implement those changes.
sgalland Tuesday 8 May 2012 at 16:33
sgallandAnonymous

How exactly do you use POL_GoG_setup? I tried using:

POL_GoG_setup "ultima_1_2_3" "397c41df72e3f15a65132d942a69a1db"

and nothing happens. I tried using POL_SetupWindow_Init prior to POL_Gog_setup and a window shows up but it is emtpy. I assume I am doing something wrong.
Quentin PÂRIS Tuesday 8 May 2012 at 16:45
Quentin PÂRIS
Admin

POL_Call POL_GoG_setup "ultima_1_2_3" "397c41df72e3f15a65132d942a69a1db"
sgalland Friday 11 May 2012 at 8:59
sgallandAnonymous

Sorry for another questions - I am trying to use POL_Shortcut so I can specify the configuration file for DOSBox. It doesn't seem to be able to find the file:

POL_Shortcut "DOSBox.exe" "Ultima 1" "~/.PlayOnLinux/wineprefix/ULTIMATRILOGY_GOG/drive_c/Program Files/GOG.com/Ultima Trilogy/Ultima1/gfw_high.ico" "-conf $WINEPREFIX/drive_c/$PROGRAMFILES/GOG.com/Ultima Trilogy/Ultima1/dosboxULTIMA1.conf" #"-conf C:/$PROGRAMFILES/GOG.com/Ultima Trilogy/Ultima1/dosboxULTIMA1.conf"

I have tried both formats, first using the path in the comment and the path that is in the last parameter of the function call. I am just not sure what format to use to specify the path to the DOSBox configuration file.

Thanks!
petch Friday 11 May 2012 at 10:43
petch
Developer

Ok, since it evolved since my last message on the topic, I'll give a try at a

DOSBox support HOWTO
==================

* First, you must use some "Wine version" with dos support for your virtual disk, latest is currently 1.4-dos_support_0.4;

* DOSBox will get default settings from this support. To override some, you'll need a $WINEPREFIX/playonlinux_dos.cfg file; Lines must have the format:
sectionname_settingname=value
See DOSBox 0.74 documentation for valid section and setting names; For example
dosbox_memsize=16

Remark 1: this file will be sourced, so be sure to single quote values that could be interpreted by Bash;
Remark 2: there's a new set of functions POL_Config_DosPrefixRead / POL_Config_DosPrefixWrite / POL_Config_DosPrefixDelete to manage those files, but they only exist since POL 4.0.18, so if you use them you'll also need to add POL_RequiredVersion "4.0.18" just after POL_SetupWindow_Init.

* The C: drive will be mapped to the virtual disk root, and by default the support will try to map the same drives as the Wine environment. If you don't want the latter, just C: mapping, you can add the pseudo-setting manual_mount=true

* If there's an autoexec.bat file at the root of your virtual disk, it will be interpreted at the beginning of each DOSBox session in this virtual disk. It's the recommended place to put mount and imgmount statements.

* That should be enough to create working shortcuts on exe files in this virtual disk; The support can tell apart MS-DOS from Windows executables and start DOSBox when necessary.

* You should also be able to create shortcuts on MS-DOS batch (bat) files if they start with an @ECHO OFF line so they're recognized as such (by the "file" command actually). You'll also probably want an EXIT statement at the end of batch files so the DOSBox window closes itself after program exit (unless debug mode is enabled for the shortcut).

* If you have specific needs, like starting MS-DOS com files, or set shortcut-specific initializations, you can create extra batch files and make shortcut out of them.


That's mostly all there is to it. The fact that C: drive is always mapped to the root of the virtual disk sometimes requires some arrangements during installation, like moving some files around back into the root directory of the virtual disk.
The Linux-to-DOSBox path translation ("shortizing") in the support is not perfect; Another reason for further arrangements are subdirectories with similar prefix side-by-side, you may also have to give them standard MS-DOS names (8+3 characters) to work around this problem.

Edited by petch

petch Friday 11 May 2012 at 11:52
petch
Developer

I know Quentin has done some DOSBox scripts, like (I don't know the full list):

- Indiana Jones and the Fate of Atlantis
- Prince Of Persia - Original
- Theme Hospital
- Warcraft II: Beyond the Dark Portal
- Warcraft II: Tides of Darkness

and mines:

- Good Old Games - Betrayal at Krondor Pack
- Good Old Games - Earthworm Jim
- The Elder Scrolls: Arena
- The Elder Scrolls: Daggerfall
- Good Old Games - Gabriel Knight 1: Sins of the Fathers
- Good Old Games - Little Big Adventure
- Good Old Games - Might and Magic 6-Pack
- Good Old Games - Realms of the Haunting
- Good Old Games - Redneck Rampage Collection
- Good Old Games - Screamer (in testing category, the game is not very stable)
- Good Old Games - Simcity 2000 Special Edition
- Good Old Games - Starflight 1 and 2
- Good Old Games - Stonekeep
- Good Old Games - The Last Express
- Good Old Games - Theme Hospital

Hope this gives you some examples for dos support usage...
petch Monday 18 June 2012 at 19:34
petch
Developer

Latest version is 1.4-dos_support_0.5, with some fixes for Arch Linux (I think this is all?)
petch Tuesday 29 January 2013 at 18:51
petch
Developer

Latest version is 1.4-dos_support_0.6, that fixes some missing configuration keys, and has better Unix to DOS path translation (gives exact result more often; can still be wrong if several paths resolve to the same shortname).

Edited by petch

petch Tuesday 29 January 2013 at 19:19
petch
Developer

New scripts using native DOSBox support:
- GOG.com - Alien Breed and Tower Assault
- GOG.com - Alone in the Dark 1, 2 and 3
- GOG.com - Bioforge
- GOG.com - Crusader: No Remorse
- GOG.com - Crusader: No Regret
- GOG.com - Darklands
- GOG.com - Dragonsphere
- GOG.com - Duke Nukem 3D Atomic Edition
- GOG.com - Gabriel Knight 2: The Beast Within
- GOG.com - Gabriel Knight 3: Blood of the Sacred, Blood of the Damned
- GOG.com - Lands of Lore 1 & 2
- GOG.com - Little Big Adventure 2
- GOG.com - Master of Magic
- GOG.com - Master of Orion 1 & 2
- GOG.com - Normality
- GOG.com - One Unit Whole Blood
- GOG.com - Pirates Pack
- GOG.com - Populous 2
- GOG.com - Realms of Arkania 1, 2 and 3
- GOG.com - Screamer 2
- GOG.com - Space Quest 4, 5, 6
- GOG.com - Spycraft: the Great Game
- GOG.com - Syndicate
- GOG.com - Tex Murphy: The Pandora Directive
- GOG.com - Tex Murphy: Under a Killing Moon
- GOG.com - The Incredible Machine Mega Pack
- GOG.com - Torin's Passage
- GOG.com - Tyrian 2000
- GOG.com - Ultima 4
- GOG.com - Ultima Underworld 1 & 2
- GOG.com - Ultima Worlds of Adventure 2: Martian Dreams
- GOG.com - Wing Commander 1 & 2
- GOG.com - Worlds of Ultima: The Savage Empire
-
petch Wednesday 2 April 2014 at 23:49
petch
Developer

Latest version is 1.6.2-dos_support_0.6, which is basically the same DOSBox support but grafted on top of Wine 1.6.2 instead of 1.4, which may be necessary if they're issues with installation using Wine 1.4.x.