The forum

[Script] GOG.com - King's Bounty: The Legend

Author Replies
savornicesei Thursday 27 March 2014 at 13:56
savorniceseiAnonymous

Hi all,
I've been working on a POL script for the GOG.com version of King's Bounty: The Legend. I took inspiration and code from the existing POL script for KBL and Gothic 2 GOG.com script.

The script installs nicely KBL, the game starts. I am able to view the logos, select a character, see the story intro but then the graphics get mingled right when starting to play the map:


I've tried with wine version 1.7.15, 1.7.6 and 1.4.1, with WinXP and Win7.

#!/bin/bash
# Date : (2014-03-27 21-27)
# Last revision : (2014-02-23)
# Wine version used : 1.7.15
# Distribution used to test : Fedora 20
# Author : Simona Avornicesei savornicesei@gmail.com
# Script licence : -
# Program licence : -
# Depend :
 
[ -z "$PLAYONLINUX" ] && exit 0
source "$PLAYONLINUX/lib/sources"
 
GOGID="kings_bounty_the_legend"
PREFIX="KingsBountyLegend_gog"
WORKING_WINE_VERSION="1.7.15"
 
TITLE="GOG.com - King's Bounty: The Legend"
SHORTCUT_NAME="King's Bounty: The Legend"
IMG_URL=http://upload.wikimedia.org/wikipedia/en/3/38/King%27s_Bounty.jpg

#needed functions, taken from King's Bounty: The Legend POL script
#return = local path to scaled image
get_image() {
        URL=$1
        wget $URL --output-document="$REPERTOIRE/tmp/leftnotscaled.jpeg"
        convert "$REPERTOIRE/tmp/leftnotscaled.jpeg" -scale 150x356\! "$REPERTOIRE/tmp/left.jpeg"
        echo "$REPERTOIRE/tmp/left.jpeg"
}
  
#return = path to game.exe
get_gameexe() {
        cd $WINEPREFIX/drive_c  && find . -name kb.exe
}

#set properties and forget
install_configuration(){
        Set_GLSL On
}
 
install_directx(){
        #Creator : Berillions
          
         cd "$REPERTOIRE/ressources"
        #downloading directx9
        if [ ! -e "directx_aug2009_redist.exe" ];
        then
        POL_SetupWindow_download "Downloading" "directx9" "http://download.microsoft.com/download/B/7/9/B79FC9D7-47B8-48B7-A75E-101DEBEB5AB4/directx_aug2009_redist.exe"
        fi
          
        mkdir "Directx"
        cd Directx
        cabextract "../directx_aug2009_redist.exe"
          
        mkdir "d3dx9"
        cabextract -d "d3dx9" *d3dx9*x86*
          
        cd "d3dx9"
        mv *.dll "$WINEPREFIX/drive_c/windows/system32"
          
        #Réglage Directx9
        cd "$WINEPREFIX/drive_c/windows/temp"
cat << EOF > OGL.reg
[HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides]
"d3dx9_24"="native"
"d3dx9_25"="native"
"d3dx9_26"="native"
"d3dx9_27"="native"
"d3dx9_28"="native"
"d3dx9_29"="native"
"d3dx9_30"="native"
"d3dx9_31"="native"
"d3dx9_32"="native"
"d3dx9_33"="native"
"d3dx9_34"="native"
"d3dx9_35"="native"
"d3dx9_36"="native"
"d3dx9_37"="native"
"d3dx9_38"="native"
"d3dx9_39"="native"
"d3dx9_40"="native"
"d3dx9_41"="native"
"d3dx9_42"="native"
EOF
        regedit OGL.reg
          
        cd "$REPERTOIRE/ressources"
        rm -rf Directx
}
 
 
#main
POL_SetupWindow_Init
POL_SetupWindow_SetID 1313
POL_Debug_Init
 
POL_SetupWindow_presentation "$TITLE" "Katauri Interactive / 1C Publishing" "http://www.gog.com/game/$GOGID" "Simona Avornicesei" "$PREFIX"
 
POL_Call POL_GoG_setup "$GOGID" --alternate "setup_$GOGID" "1" "9e21f612ed8a79394be80faa92dc28b0" "1a7b4414f4a5ac7f17c4494dc927c7a0" "0c230c27da36755136fabee4b1553294"
 
POL_Wine_SelectPrefix "$PREFIX"
POL_Wine_PrefixCreate "$WORKING_WINE_VERSION"
 
POL_Call POL_GoG_install "/nogui"
 
 
# GoG work!
Set_OS win7
 
POL_SetupWindow_VMS "64"

POL_SetupWindow_wait_next_signal "Setting configuration properties" "$TITLE installation"
#install_configuration
#POL_Wine_Direct3D UseGLSL
POL_SetupWindow_detect_exit
 
#install_directx
#POL_Call POL_Install_d3dx9
#POL_Call POL_Install_d3dx9_36

#POL_Call POL_Install_gecko
#POL_Call POL_Install_tahoma
POL_Call POL_Install_d3dx9
POL_Call POL_Install_d3dx9_36
PoL_Call POL_Install_d3dx10
PoL_Call POL_Install_d3dx11
 
# Doesn't hurt ;)
POL_Wine_reboot

POL_Shortcut "kb.exe" "$SHORTCUT_NAME" "gfw_high.ico" "" "Game;StrategyGame;"
 
POL_SetupWindow_Close
 
exit 0




Nameless hero. Professional bug slayer mom.
petch Saturday 29 March 2014 at 20:37
petch


Hi,
Maybe you're experiencing some driver issue.

About the script, right now it contains lots of unused statements:

#return = local path to scaled image
get_image() {
        URL=$1
        wget $URL --output-document="$REPERTOIRE/tmp/leftnotscaled.jpeg"
        convert "$REPERTOIRE/tmp/leftnotscaled.jpeg" -scale 150x356\! "$REPERTOIRE/tmp/left.jpeg"
        echo "$REPERTOIRE/tmp/left.jpeg"
}

Unused code, not to mention that those days we prefer hosting images on the server rather than use ugly code in scripts. When the script is ready, just provide some link to a copy of the scaled gfx and I'll put it on the server.

#return = path to game.exe
get_gameexe() {
        cd $WINEPREFIX/drive_c  && find . -name kb.exe
}

Unused code

#set properties and forget
install_configuration(){
        Set_GLSL On
}

Unused code

install_directx(){
...

Unused and totally outdated code, use "function" scripts to install DirectX

POL_SetupWindow_wait_next_signal "Setting configuration properties" "$TITLE installation"
#install_configuration
#POL_Wine_Direct3D UseGLSL
POL_SetupWindow_detect_exit

Since this call is commented out, you can remove all that

#install_directx
#POL_Call POL_Install_d3dx9
#POL_Call POL_Install_d3dx9_36

Dead code

POL_Call POL_Install_d3dx9
POL_Call POL_Install_d3dx9_36
PoL_Call POL_Install_d3dx10
PoL_Call POL_Install_d3dx11

last two commands don't work because the case is wrong (must be POL in uppercase). So if installation works as-is, you didn't need them

POL_Shortcut "kb.exe" "$SHORTCUT_NAME" "gfw_high.ico" "" "Game;StrategyGame;"

Third parameter is the name of the file to get from the server, so a local filename doesn't work. If you get the right icon you don't need it.

Regards,
Pierre.

Edited by petch

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 dmca-notice@playonlinux.com