Forums

Black Mesa Source

Auteur Réponses
Grubshka Jeudi 11 Octobre 2012 à 0:47
GrubshkaAnonymous

http://appdb.winehq.org/objectManager.php?sClass=version&iId=26648

Mon premier script playonlinux, pour installer Black Mesa Source.
Je me suis un inspiré du script d'installation de Half-Life 2 pour certaines parties.

Le jeu n'est pas encore très stable pour moi sous Wine, je soumettrai l'installeur quand ça sera le cas (et quand quelqu'un aura validé mon script!)

Je ne suis pas sûr que le Steam ID du jeu soit toujours le même? (Ça a été le cas pour toutes mes installations, mais je ne sais pas d'où il sort).

Merci.


#!/bin/bash
# Date : (2012-10-10 09-00)
# Last revision : (2012-10-11 00-01)
# Wine version used : 1.5.9
# Distribution used to test : Debian x86_64
# Author : grubshka
# Licence : Free
# Only For : http://www.playonmac.com
 
[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"
 
TITLE="Black Mesa Source"
PREFIX="Black_Mesa_Source"
EDITOR="Black Mesa Modification Team"
GAME_URL="http://www.blackmesasource.com"
GAME_DOWNLOAD_URL="http://www.blackmesasource.com/download.html"
STEAM_ID="13540830642081628378"
AUTHOR="grubshka"
# "No text" bug in Steam since Wine 1.5.10, see http://bugs.winehq.org/show_bug.cgi?id=31374
WORKING_WINE_VERSION="1.5.9"
GAME_VMS="1024"

# Starting script
POL_SetupWindow_Init

# Starting debugging API
POL_Debug_Init

POL_SetupWindow_presentation "$TITLE" "$EDITOR" "$GAME_URL" "$AUTHOR" "$PREFIX"

# Checking if a "Steam" prefix already exists (taken from hl2 script)
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"
  
# Setting prefix path
POL_Wine_SelectPrefix "$PREFIX"
 
if [ "$STEAM_USE" == "0" ]; then
    # Downloading wine if necessary and creating prefix
    POL_System_SetArch "x86"
    POL_Wine_PrefixCreate "$WORKING_WINE_VERSION"
fi

# Installing mandatory dependencies
if [ "$STEAM_USE" == "0" ]; then
    POL_Call POL_Install_steam
    # Shortcut for Steam
    POL_Shortcut "steam.exe" "Steam ($TITLE)" "" ""
fi

# Mandatory pre-install fix for steam
#POL_Call POL_Install_steam_flags "$STEAM_ID"

# Asking about memory size of graphic card
POL_SetupWindow_VMS $GAME_VMS
 
## Fix for this game
# Sound problem fix - pulseaudio related
[ "$POL_OS" = "Linux" ] && Set_SoundDriver "alsa"
[ "$POL_OS" = "Linux" ] && Set_SoundEmulDriver "Y"
## End Fix

# Installing Source SDK 2007
# XXX REMOVED: This is now automatically done by Steam after game installation
#SOURCE_SDK_NAME="Source SDK Base 2007"
#SOURCE_SDK_STEAM_ID="218"
#POL_SetupWindow_message "The installation script will now install $SOURCE_SDK_NAME threw Steam.\\n\\nPlease close COMPLETELY the Steam interface When download by is finished, to let the installation script continue." "$TITLE"
#
#POL_Call POL_Install_steam_flags "$SOURCE_SDK_STEAM_ID"
#cd "$WINEPREFIX/drive_c/$PROGRAMFILES/Steam"
#POL_Wine start /unix "steam.exe" steam://install/$SOURCE_SDK_STEAM_ID
#POL_Wine_WaitExit "$TITLE"

# Installing the game
POL_SetupWindow_InstallMethod "LOCAL,DOWNLOAD"
if [ "$INSTALL_METHOD" = "DOWNLOAD" ]; then
    # Ask to download the file...
    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

# Select the file on the disk
# The game needs a 7z file, and a exe installer, and depending of the mirror
# the user can download them separately, or in a big zip file
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"

# Check which file the user gave us
if [ "$EXTENSION" = "zip" ]; then
    # It's the zip file, containing the exe and the 7z, unzip in temp dir
    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
    # It's the exe file, look for the 7z
    cd $DIR
    # Link exe file in temp
    ln -sf $APP_ANSWER $POL_System_TmpDir/
    EXE=$FILENAME
    # Guess 7z file
    ARC=$(ls | grep -i blackmesa.7z)
    if [ -f "$ARC" ]; then
        # We found the 7z in the same directory, link it in temp dir
        ln -sf $DIR/$ARC $POL_System_TmpDir/
    else
        # We didn't find it, ask the user for it
        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
    # It's the 7z file, look for the exe
    cd $DIR
    # Link exe file in temp
    ln -sf $APP_ANSWER $POL_System_TmpDir/
    ARC=$FILENAME
    # Guess 7z file
    EXE=$(ls | grep -i blackmesa-setup.exe)
    if [ -f "$EXE" ]; then
        # We found the exe in the same directory, link it in temp dir
        ln -sf $DIR/$EXE $POL_System_TmpDir/
    else
        # We didn't find it, ask the user for it
        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

# Install game from exe in temp dir
cd $POL_System_TmpDir
POL_Wine start /unix "$EXE"
POL_Wine_WaitExit "$TITLE"

POL_Shortcut "steam.exe" "$TITLE" "" "steam://rungameid/$STEAM_ID"

POL_System_TmpDelete

POL_SetupWindow_Close
exit

Edité par Grubshka

mistermasque Mercredi 8 Mai 2013 à 14:26
mistermasqueAnonymous

Exactement ce que je cherchais. Super merci.
Alors j'ai testé le script :
Il faut penser à lancer black mesa 1 première fois pour que ça marche.
Pour ma part, j'ai dû réinstaller Black Mesa à partir de steam (dans le même préfixe).

Sinon, le raccourci fonctionne parfaitement.