Fora

Two Worlds: Epic Edition (GoG)

Autor Odpowiedzi
petch Sunday 11 December 2011 at 1:37
petch
Developer

Okay, new script to install Two Worlds: Epic Edition this time.
I tried to enable videos, and I succeeded but videos playback seems to conflict with in-game sound, so you have to choose :devil:
I created a configurator to enable or disable videos. They're few videos, but the introduction one when you start a new game is interesting, so check it out, then disable videos to get sound...
Hopefully this will be fixed some day!

Optionally you can also install the Two Worlds Control Panel from InsideTwoWorlds community, a launcher that allows you to tweak settings and manage mods.
Enjoy!

https://raw.github.com/petchema/playonlinux/master/twoworlds-gog
#!/bin/bash
# Date : (2012-12-09 20-31)
# Last revision : (2011-12-10 22-16)
# Wine version used : 1.3.34
# Distribution used to test : Debian Sid (Unstable)
# Author : Pierre Etchemaite petchema@concept-micro.com
# Script licence : GPL v.2
# Program licence : Retail
# Depend :

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

check_install_archive () {
    FILE="$1"
    EXPECTED_NAME="$2"
    EXPECTED_SIZE="$3"
    EXPECTED_MD5="$4"

    POL_SetupWindow_wait "$(eval_gettext 'Checking install archive...')" "$TITLE"
    # Temporarily prevent word splitting
    OLDIFS="$IFS"
    IFS=''
    NAME="$(basename $FILE)"
    SIZE="$(stat -c%s $FILE)"
    MD5="$(POL_MD5_file $FILE)"
    IFS="$OLDIFS"

    if [ $SIZE -ne $EXPECTED_SIZE -o "$MD5" != "$EXPECTED_MD5" ]; then
        POL_Debug_Error "$(eval_gettext 'Install archive mismatch.\\nEither your install archive is corrupted, or is not the expected version.\\nThis script cannot guarantee that installation will work correctly. Please report success or failure to PlayOnLinux forums.')\\n$(eval_gettext 'Name:') $NAME ($(eval_gettext 'expected') $EXPECTED_NAME)\\n$(eval_gettext 'Size:') $SIZE ($(eval_gettext 'expected') $EXPECTED_SIZE)\\n$(eval_gettext 'MD5:') $MD5\\n     ($(eval_gettext 'expected') $EXPECTED_MD5)"
        POL_SetupWindow_question "$(eval_gettext 'Continue?')" "$TITLE"
        [ "$APP_ANSWER" != "TRUE" ] && POL_Debug_Fatal "$(eval_gettext 'Not the expected archive')"
    fi
}


PREFIX="2Worlds_gog"
WORKING_WINE_VERSION="1.3.34"

TITLE="$(eval_gettext 'Two Worlds: Epic Edition (GoG release)')"
SHORTCUT_NAME="Two worlds"
SHORTCUT_DOC="$SHORTCUT_NAME - $(eval_gettext 'User manual')"

POL_SetupWindow_Init
POL_Debug_Init

POL_SetupWindow_presentation "$TITLE" "Reality Pump Studios / Topware Interactive" "http://www.gog.com/en/gamecard/two_worlds" "Pierre Etchemaite" "$PREFIX"

POL_SetupWindow_message "$(eval_gettext 'Major caveat to date about running Two Wolds under Wine:\\n\\nEnabling introduction and (the few) interlude videos breaks the sound for\\nthe rest of the game!\\nThey will be enabled at first, since introduction video helps understanding\\ngame background, but you will be able to disable or reenable videos\\nfrom within the configurator at any time.\\n\\nAlso note that online gaming has not been tested.')" "$TITLE"

POL_Wine_SelectPrefix "$PREFIX"
POL_Wine_PrefixCreate "$WORKING_WINE_VERSION"

cd $HOME
POL_SetupWindow_browse "$(eval_gettext 'Please select the setup file to run.')" "$TITLE"
ARCHIVE="$APP_ANSWER"

# Hopefully checking first part is enough to identify uniquely the archive
check_install_archive "$ARCHIVE" setup_two_worlds.exe 2314533 f59283baad1d482806a4302c6a105c66
#check_install_archive "${ARCHIVE%.exe}-1.bin" setup_two_worlds-1.bin 2097685248 d0eab18be86037476a7cd4e47f1afc0a
#check_install_archive "${ARCHIVE%.exe}-2.bin" setup_two_worlds-2.bin 1716047202 eb19df7336379a5b1355354ed69f124e


POL_SetupWindow_wait "$(eval_gettext 'Please wait while $TITLE is installed.')" "$TITLE"

# Associate .PDF with native app
# http://wiki.winehq.org/FAQ#head-91bf3f0a8ccbfab8dee96f82fae2f1a489e0d243
# Do it before installing the game, so you have the possibility to open
# PDFs with Win32 reader if you choose to install it
cat <<'_EOF_' > $REPERTOIRE/tmp/pdfnativereader.reg
[HKEY_CLASSES_ROOT\\.pdf]
@="PDFfile"
"Content Type"="application/pdf"
[HKEY_CLASSES_ROOT\\PDFfile\\Shell\\Open\\command]
@="winebrowser \\"%1\\""
_EOF_
POL_Wine regedit $REPERTOIRE/tmp/pdfnativereader.reg

POL_Wine "$ARCHIVE" || POL_Debug_Fatal "$(eval_gettext 'Error while installing archive')"

POL_Wine_WaitExit "$TITLE"


#POL_Call POL_Install_dsound
POL_Call POL_Install_devenum
POL_Call POL_Install_quartz
POL_Call POL_Install_xact
POL_Call POL_Install_d3dx9
POL_Call POL_Install_wmp10

# WMV9AP VC-1 Codec
cd "$REPERTOIRE/tmp/" || POL_Debug_Fatal "$(eval_gettext 'temp directory missing')"
POL_Download 'http://www-pc.uni-regensburg.de/systemsw/WinMedia/wvc1dmo.exe' "cbbfea5937bebcc8ebf2ff6abfc050bd"
POL_Wine wvc1dmo.exe /C /Q '/T:C:\\windows\\temp'
cp "$WINEPREFIX/drive_c/windows/temp/wvc1dmod.dll" "$WINEPREFIX/drive_c/windows/system32"
POL_Wine regsvr32 wvc1dmod.dll

# Untested
#POL_Call POL_Install_directplay

# GoG work!
Set_OS winxp

POL_SetupWindow_VMS "128"
 
## PlayOnMac Section
[ -n "$PLAYONMAC" ] && Set_SoundDriver "alsa"
[ -n "$PLAYONMAC" ] || Set_Managed "Off"
## End Section

POL_Wine_X11Drv "DXGrab" "Y"
POL_Wine_X11Drv "GrabFullScreen" "Y"

POL_Wine_DirectSound "DefaultSampleRate" "48000"

# Doesn't hurt ;)
POL_Wine_reboot

POL_Shortcut "TwoWorlds.exe" "$SHORTCUT_NAME"
POL_Shortcut "TwoWorlds_RADEON.exe" "$SHORTCUT_NAME (Radeon)"
POL_Shortcut "start.exe" "$SHORTCUT_DOC" "" "'C:/$PROGRAMFILES/GOG.com/Two Worlds/Manual.pdf'"

POL_SetupWindow_question "$(eval_gettext 'Two Worlds Control Panel is a tool from InsideTwoWorlds community,\\nthat allows you to tweak parameters and manage mods\\nfor this game. See\\nhttp://www.insidetwoworlds.com/local_links.php?linkid=21&catid=13 for details.\\nInstall it?')" "$TITLE"
if [ "$APP_ANSWER" = "TRUE" ]; then
  cd "$REPERTOIRE/tmp/" 
  POL_Download 'http://www.insidetwoworlds.com/local_links.php?s=d92f024673ebf64a34a7b47675963c70&action=jump&catid=13&id=21' "d41d8cd98f00b204e9800998ecf8427e"
  mv local_links.php TwoWorldsCP107.zip
  unzip TwoWorldsCP107.zip TwoWorldsCP.exe
  POL_Wine_InstallFonts
  POL_Call POL_Install_dotnet20
  POL_Wine TwoWorldsCP.exe
  if [ $? -eq 0 ]; then
    # CP needs that weird path ending to find TW correctly!
    cat <<'_EOFINI_' > "$REPERTOIRE/tmp/fixtw1path.reg"
REGEDIT4

[HKEY_LOCAL_MACHINE\\Software\\Reality Pump\\TwoWorlds\\FileSystem]
"DataPath"="C:\\\\Program Files\\\\GOG.com\\\\Two Worlds/>"
"OutputDir"="C:\\\\Program Files\\\\GOG.com\\\\Two Worlds"
_EOFINI_
    POL_Wine regedit "$REPERTOIRE/tmp/fixtw1path.reg"
    rm "$REPERTOIRE/tmp/fixtw1path.reg"

    # On my computer, subpixel aa makes CP fonts look like crap @96dpi,
    # and "ok" @100dpi...
    cat <<'_EOFINI_' > "$REPERTOIRE/tmp/100dpi.reg"
REGEDIT4

[HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Hardware Profiles\\Current\\Software\\Fonts]
"LogPixels"=dword:00000064
_EOFINI_
    POL_Wine regedit "$REPERTOIRE/tmp/100dpi.reg"
    rm "$REPERTOIRE/tmp/100dpi.reg"

    # Create a shortcut, since the CP behaves more like a launcher than a
    # configurator
    POL_Shortcut "TwoWorldsCP.exe" "$SHORTCUT_NAME - $(eval_gettext 'Control Panel')"
  fi
fi

POL_SetupWindow_Close


cd "$REPERTOIRE/configurations/configurators" || exit

cat <<_EOF_ > "$SHORTCUT_NAME"
#!/bin/bash
[ -z "\\$PLAYONLINUX" ] && exit 0
source "\\$PLAYONLINUX/lib/sources"
export WINEPREFIX="$REPERTOIRE/wineprefix/$PREFIX"
export WINEDEBUG=""

POL_LoadVar_PROGRAMFILES

cd "\\$WINEPREFIX/drive_c/\\$PROGRAMFILES/GOG.com/Two Worlds/" || exit 1

TITLE="$TITLE"

POL_SetupWindow_Init
POL_Debug_Init

LNG_VIDEOS_ENABLED="\\$(eval_gettext 'Enable videos, no in-game sound!')"
LNG_VIDEOS_DISABLED="\\$(eval_gettext 'Disable videos, in-game sound working')"

if [ -d Video ]; then
    DEFAULT="\\$LNG_VIDEOS_ENABLED"
elif [ -d Video.disabled ]; then
    DEFAULT="\\$LNG_VIDEOS_DISABLED"
else
    # Do'h!
    exit
fi

POL_SetupWindow_menu_list "\\$(eval_gettext 'Enable videos or in-game sound?')" "\\$TITLE" "\\$LNG_VIDEOS_ENABLED~\\$LNG_VIDEOS_DISABLED" "~" "\\$DEFAULT"

if [ "\\$APP_ANSWER" != "\\$DEFAULT" ]; then
    case "\\$APP_ANSWER" in
        "\\$LNG_VIDEOS_ENABLED")
            mv Video.disabled Video
            ;;
        "\\$LNG_VIDEOS_DISABLED")
            mv Video Video.disabled
            ;;
    esac
fi

POL_SetupWindow_Close
exit
_EOF_

# Use the same configurator for both shortcuts, in case the user removes the
# one (s)he doesn't use
cp "$SHORTCUT_NAME" "$SHORTCUT_NAME (Radeon)"

exit
petch Saturday 31 December 2011 at 11:49
petch
Developer

The sound problem seems to be fixed in 1.3.36!