#!/bin/bash
# Date : (2019-08-08)
# Last revision : see changelog
# Wine version used : see below
# Distribution used to test : XUbuntu 18.04 x64
# Script licence : GPL3
# Program licence : Retail
# Playonlinux v4.3.4
#
# Tested version : 2x CD (latest files on CD #1: march 2004. readme.html : 1.5.0.46)
#
# Game based on (ie: middlewares): Direct 8 and 9.
#
#
# CHANGELOG:
# [Dadu042] (2019-08-08)
# First script.
#
# KNOWN ISSUES:
# - Wine 3.0.3, 4.0.1: the original CD-ROM #1 (march 2004) not recognized by the DRM, game can not launch. Same with a NoCD.
# - Wine 4.0.1 + game patched to 'sacred_fra_1.8.2.6_full.exe' : same as above. NoCD : better (screen goes black).
# ADD resolution check ?
# - Wine 4.0.1: Config.exe does crash when quitting it.
# - Wine 4.0.1, 2.22: No movies. when launching a game session, characters are squelettons, then when launching the game the sreen goes blacks.
#
[ -z "$PLAYONLINUX" ] && exit 0
source "$PLAYONLINUX/lib/sources"
TITLE="Sacred"
PREFIX="Sacred"
WORKING_WINE_VERSION="4.0.1"
AUTHOR="Dadu042"
EDITOR="Ascaron"
GAME_URL="https://en.wikipedia.org/wiki/Ascaron"
POL_SetupWindow_Init
POL_Debug_Init
POL_SetupWindow_presentation "$TITLE" "$EDITOR" "$GAME_URL" "$AUTHOR" "$PREFIX"
POL_RequiredVersion "4.2.12" || POL_Debug_Fatal "$APPLICATION_TITLE $VERSION is required to install $TITLE"
POL_Wine_SelectPrefix "$PREFIX"
POL_System_SetArch "x86"
POL_Wine_PrefixCreate "$WORKING_WINE_VERSION"
# POL_Wine_PrefixCreate
POL_System_TmpCreate "$TITLE"
Set_OS "winxp"
# POL_Call POL_Install_corefonts
POL_Call POL_Install_amstream
POL_Call POL_Install_devenum
POL_Call POL_Install_quartz
POL_Call POL_Install_riched20
POL_Call POL_Install_wmp9
POL_SetupWindow_InstallMethod "LOCAL,STEAM,CD"
if [ "$INSTALL_METHOD" == "LOCAL" ]; then
cd "$HOME"
POL_SetupWindow_browse "$(eval_gettext 'Please select the setup file to run:')" "$TITLE"
SETUP_EXE="$APP_ANSWER"
POL_SetupWindow_message "Warning: do not install 'Windows Media 9 Codecs' when asked." "$TITLE"
POL_Wine start /unix "$SETUP_EXE"
POL_Wine_WaitExit "$TITLE"
elif [ "$INSTALL_METHOD" == "STEAM" ];then
POL_Call POL_Install_steam
cd "$WINEPREFIX/drive_c/$PROGRAMFILES/Steam"
POL_Wine "steam.exe" steam://install/12320
POL_Wine_WaitBefore "$TITLE"
elif [ "$INSTALL_METHOD" == "CD" ];then
POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom "Sacred.ico"
POL_SetupWindow_message "Warning: do not install 'Windows Media 9 Codecs' when asked." "$TITLE"
POL_Wine start /unix "$CDROM/setup.exe" /silent
POL_Wine_WaitExit "setup.exe"
cd "$POL_System_TmpDir"
fi
if [ "$INSTALL_METHOD" == "STEAM" ]; then
POL_Shortcut "steam.exe" "$TITLE" "" "steam://rungameid/12320"
else
POL_Shortcut "sacred.exe" "$TITLE" "" "" "Game;RolePlaying;"
POL_Shortcut_Document "$TITLE" "readme.html"
POL_Shortcut "config.exe" "$TITLE Config" "" "" "Game;RolePlaying;"
fi
# GPU selection. Useful when there is 2 GPU on the same computer (ie: Intel HD + Nvidia).
POL_Call POL_Install_VideoDriver
POL_SetupWindow_VMS "16"
POL_System_TmpDelete
POL_SetupWindow_Close
exit 0