#!/bin/bash
[ -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"
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_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"
check_install_archive
"$ARCHIVE"
setup_two_worlds.exe 2314533 f59283baad1d482806a4302c6a105c66
POL_SetupWindow_wait
"$(eval_gettext 'Please wait while $TITLE is installed.')"
"$TITLE"
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_devenum
POL_Call
POL_Install_quartz
POL_Call
POL_Install_xact
POL_Call
POL_Install_d3dx9
POL_Call
POL_Install_wmp10
cd
"$REPERTOIRE/tmp/"
|| POL_Debug_Fatal
"$(eval_gettext 'temp directory missing')"
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
Set_OS winxp
POL_SetupWindow_VMS
"128"
[ -n
"$PLAYONMAC"
] && Set_SoundDriver
"alsa"
[ -n
"$PLAYONMAC"
] || Set_Managed
"Off"
POL_Wine_X11Drv
"DXGrab"
"Y"
POL_Wine_X11Drv
"GrabFullScreen"
"Y"
POL_Wine_DirectSound
"DefaultSampleRate"
"48000"
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'"
if
[
"$APP_ANSWER"
=
"TRUE"
];
then
cd
"$REPERTOIRE/tmp/"
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
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"
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"
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
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_
cp
"$SHORTCUT_NAME"
"$SHORTCUT_NAME (Radeon)"
exit