The forum

[Script] GOG.com - Anvil of Dawn

Author Replies
kanito8a Sunday 3 August 2014 at 3:51
kanito8a

This is my first script. I haven`t been able to create the full size icon properly. Other than that, the script works  fine, I've tested with Ubuntu 12.04 and 14.04.

 

#!/bin/bash
# Date : (2014-08-01 18:50:55)
# Last revision : (2014-08-03 11:48:47)
# Wine version used : 1.6.2-dos_support_0.6
# Distribution used to test : Ubuntu 14.04
# Author : Victor Ochoa (kanito8a)
# Script licence : GPL v.2
# Program licence : Retail
# Depend :

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

# CONSTANTS
GOGID="anvil_of_dawn"
PREFIX="AnvilofDawn_gog"
WORKING_WINE_VERSION="1.6.2-dos_support_0.6"
TITLE="GOG.com - Anvil of Dawn"
DEVELOPER="DreamForge Intertainment / Ubisoft"
INSTALL_FILE_HASH="8ecba50452dbe230a2e1a868be422dc6"
INSTALL_DIR="Anvil of Dawn"
EXEC="ANVIL.EXE"
MANUAL="Anvil of Dawn - Manual.pdf"
SHORTCUT_NAME="Anvil of Dawn"

# IMAGES SETUP
POL_GetSetupImages "http://files.playonlinux.com/resources/setups/$PREFIX/top.png" "http://files.playonlinux.com/resources/setups
/$PREFIX/left.png" "$TITLE"

# INSTALLATION
POL_SetupWindow_Init
POL_Debug_Init
POL_SetupWindow_presentation "$TITLE" "$DEVELOPER" "http://www.gog.com/gamecard/$GOGID" "Victor Ochoa" "$PREFIX"

POL_Call POL_GoG_setup "$GOGID" "$INSTALL_FILE_HASH"
 
POL_Wine_SelectPrefix "$PREFIX"
POL_Wine_PrefixCreate "$WORKING_WINE_VERSION"
 
POL_Call POL_GoG_install

# DOSBOX AUTOEXEC
cat <<_EOFAE_ > "$WINEPREFIX/drive_c/autoexec.bat"
imgmount d "$WINEPREFIX/drive_c/GOG Games/$INSTALL_DIR/Anvil.dat" -t iso -fs iso
_EOFAE_

# DOSBOX CONFIG
cat <<_EOFCFG_ >> "$WINEPREFIX/playonlinux_dos.cfg"
manual_mount=true
dosbox_memsize=16
cpu_core=auto
cpu_cputype=auto
cpu_cycles=20000
render_aspect=true
mixer_blocksize=1024
mixer_prebuffer=240
sblaster_sbtype=sb16
sblaster_sbbase=220
sblaster_irq=5
sblaster_dma=1
sblaster_hdma=5
sblaster_sbmixer=true
sblaster_oplmode=auto
sblaster_oplemu=default
sblaster_oplrate=44100
_EOFCFG_

# SHORTCUTS
POL_Shortcut "GOG Games/$INSTALL_DIR/$EXEC" "$SHORTCUT_NAME" "$SHORTCUT_NAME.png" "-p" "Game;RolePlaying;"
POL_Shortcut_Document "$SHORTCUT_NAME" "$WINEPREFIX/drive_c/GOG Games/$INSTALL_DIR/$MANUAL"

# THE END
POL_SetupWindow_Close

exit 0

 

Script Icon (22x22):

Installed program icon (48x48)

Top Image:

Left image:

Capture:

 

EDIT: Script modified.

Edited by kanito8a

petch Sunday 3 August 2014 at 10:33
petch
Developer

Hi kanito8a,

Cool, I have this game (played it a long time ago), but didn't have time to write a script for it ;)

Ok, let's start with script review, most of the script is good,, there's not much to say:

POL_Install_DosboxDrive

Don't know in what old script you found this statement, but it's totally obsolete for new DOSBox support.

Admittedly it's for now only documented in a hidden place.

imgmount d "$WINEPREFIX/drive_c/GOG Games/$INSTALL_DIR/$GAME_DIR/Anvil.dat" -t iso -fs iso

$GAME_DIR is never defined in your script

# DOSBOX CONFIG
cat <<_EOFCFG_ >> "$WINEPREFIX/playonlinux_dos.cfg"
...

Since you're using imgmount, manual_mount=true should be used in playonlinux_dos.cfg (and that will make imgmount -u unnecessary)

# CONVERT AND COPY ICON
convert "$WINEPREFIX/drive_c/GOG Games/$INSTALL_DIR/$GAME_DIR/gfw_high.ico" "$WINEPREFIX/drive_c/GOG Games/$INSTALL_DIR/$GAME_DIR/gfw.png"
 
cp "$WINEPREFIX/drive_c/GOG Games/$INSTALL_DIR/$GAME_DIR/gfw-5.png" "$REPERTOIRE/icones/32/$SHORTCUT_NAME"

Computing icons in script is depreciated, those days the recommended way is to get icons from the server (that's what the third parameter from POL_Shortcut is for); They're needed for repository lists anyway.

In my other scripts I didn't standardize on using gog.com's round icons, maybe all icons could be derived from your "top" gfx? I'm not sure Anvil of Dawn ever had any "official" icon...

kanito8a Sunday 3 August 2014 at 12:52
kanito8a

Thanks for the quick response. 

I've changed the script in the first post, with your suggestions. My only doubt is about the game icon. I don't know how to get the icon from the server sad. I've been trying to see how it's done for other old games like Dragonshpere, but I can't find how to do it.

petch Sunday 3 August 2014 at 20:35
petch
Developer

As I said, it's the point of the 3rd parameter of POL_Shortcut; As soon as it's not an empty string, the script will try to fetch the icon from http://repository.playonlinux.com/icones/<3rd parameter>

So all what's needed is to upload the icon in the right place on the server, since it's not automated yet it just requires some maintainer help to upload it...

kanito8a Sunday 3 August 2014 at 22:06
kanito8a

OK, now I inderstand. I've uploaded to the first post the full size icon for the game. The script already uses the third parameter of POL_Shortcut, so I think it should work ok.

Thanks for the help!