#!/bin/bash
[
"$PLAYONLINUX"
=
""
] &&
exit
0
source
"$PLAYONLINUX/lib/sources"
TITLE=
"Black Mesa Source"
PREFIX=
"Black_Mesa_Source"
EDITOR=
"Black Mesa Modification Team"
STEAM_ID=
"13540830642081628378"
AUTHOR=
"grubshka"
WORKING_WINE_VERSION=
"1.5.9"
GAME_VMS=
"1024"
POL_SetupWindow_Init
POL_Debug_Init
POL_SetupWindow_presentation
"$TITLE"
"$EDITOR"
"$GAME_URL"
"$AUTHOR"
"$PREFIX"
POL_SetupWindow_checkexist()
{
if
[ -e
"$POL_USER_ROOT/wineprefix/$1"
];
then
STEAM=`
find
$WINEPREFIX -name
"Steam.exe"
`
if
[
"$STEAM"
!=
""
];
then
POL_SetupWindow_menu
"$(eval_gettext 'Steam installation has been detected\\nwould you like to install this game in the same virtual drive?')"
"$TITLE"
"$(eval_gettext 'Yes')~$(eval_gettext 'No')"
"~"
STEAM_USE=$APP_ANSWER
if
[
"$STEAM_USE"
==
"$(eval_gettext 'Yes')"
];
then
STEAM_USE=
"1"
PREFIX=
"Steam"
else
STEAM_USE=
"0"
fi
fi
else
STEAM_USE=
"0"
fi
}
POL_SetupWindow_checkexist
"Steam"
POL_Wine_SelectPrefix
"$PREFIX"
if
[
"$STEAM_USE"
==
"0"
];
then
POL_System_SetArch
"x86"
POL_Wine_PrefixCreate
"$WORKING_WINE_VERSION"
fi
if
[
"$STEAM_USE"
==
"0"
];
then
POL_Call
POL_Install_steam
POL_Shortcut
"steam.exe"
"Steam ($TITLE)"
""
""
fi
POL_SetupWindow_VMS
$GAME_VMS
[
"$POL_OS"
=
"Linux"
] && Set_SoundDriver
"alsa"
[
"$POL_OS"
=
"Linux"
] && Set_SoundEmulDriver
"Y"
POL_SetupWindow_InstallMethod
"LOCAL,DOWNLOAD"
if
[
"$INSTALL_METHOD"
=
"DOWNLOAD"
];
then
POL_SetupWindow_message
"The game can't be downloaded automatically yet, so please download it at $GAME_DOWNLOAD_URL (a browser will open at the right place after clicking on 'Next')."
POL_Browser $GAME_DOWNLOAD_URL
fi
POL_SetupWindow_browse
"$(eval_gettext 'Please select the setup file to run.')\\nYou can select either the complete .zip file, or the .exe or the .7z"
"$TITLE"
DIR=$(
dirname
$APP_ANSWER)
FILENAME=$(
basename
$APP_ANSWER)
EXTENSION=
"${FILENAME##*.}"
POL_System_TmpCreate
"$PREFIX"
if
[
"$EXTENSION"
=
"zip"
];
then
POL_SetupWindow_wait_next_signal
"Please wait while extracting installer archive..."
"$TITLE"
unzip $APP_ANSWER -d $POL_System_TmpDir
cd
$POL_System_TmpDir
EXE=$(
ls
|
grep
-i blackmesa-setup.exe)
ARC=$(
ls
|
grep
-i blackmesa.7z)
elif
[
"$EXTENSION"
=
"exe"
];
then
cd
$DIR
ln
-sf $APP_ANSWER $POL_System_TmpDir/
EXE=$FILENAME
ARC=$(
ls
|
grep
-i blackmesa.7z)
if
[ -f
"$ARC"
];
then
ln
-sf $DIR/$ARC $POL_System_TmpDir/
else
POL_SetupWindow_browse
"Cannot find the .7z file in the same directory, please select it now."
"$TITLE"
ln
-sf $APP_ANSWER $POL_System_TmpDir/
ARC=$(
basename
$APP_ANSWER)
fi
elif
[
"$EXTENSION"
=
"7z"
];
then
cd
$DIR
ln
-sf $APP_ANSWER $POL_System_TmpDir/
ARC=$FILENAME
EXE=$(
ls
|
grep
-i blackmesa-setup.exe)
if
[ -f
"$EXE"
];
then
ln
-sf $DIR/$EXE $POL_System_TmpDir/
else
POL_SetupWindow_browse
"Cannot find the .exe file in the same directory, please select it now."
"$TITLE"
ln
-sf $APP_ANSWER $POL_System_TmpDir/
EXE=$(
basename
$APP_ANSWER)
fi
fi
cd
$POL_System_TmpDir
POL_Wine
start
/unix
"$EXE"
POL_Wine_WaitExit
"$TITLE"
POL_System_TmpDelete
POL_SetupWindow_Close
exit