Changeset View
Changeset View
Standalone View
Standalone View
head/games/linux-nwnclient/files/nwn.sh
#!/bin/sh | #!/bin/sh | ||||
# | # | ||||
# $FreeBSD$ | # $FreeBSD$ | ||||
# | # | ||||
NWNDATADIR="%%NWNDATADIR%%" | NWNDATADIR="%%NWNDATADIR%%" | ||||
NWNCLIENTDIR="%%NWNCLIENTDIR%%" | NWNCLIENTDIR="%%NWNCLIENTDIR%%" | ||||
NWNUSERDIR="${HOME}/.nwn" | NWNUSERDIR="${HOME}/.nwn" | ||||
NWNMOVIEDIR="${NWNUSERDIR}/nwmovies" | |||||
LCDIRS="ambient data dmvault hak localvault music override portraits" | LCDIRS="ambient data dmvault hak localvault music override portraits" | ||||
set -e | set -e | ||||
# Print arguments in lowercase | # Print arguments in lowercase | ||||
tolower() { | tolower() { | ||||
set -e | set -e | ||||
echo "$@" | tr '[:upper:]' '[:lower:]' | echo "$@" | tr '[:upper:]' '[:lower:]' | ||||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | |||||
echo "Saved games will be stored in ${NWNUSERDIR}/saves/" | echo "Saved games will be stored in ${NWNUSERDIR}/saves/" | ||||
cd "${NWNUSERDIR}" | cd "${NWNUSERDIR}" | ||||
# Remove old movie log file. | # Remove old movie log file. | ||||
rm -f ${NWNUSERDIR}/nwmovies.log | rm -f ${NWNUSERDIR}/nwmovies.log | ||||
# Prevent flickering at beginning and ending of playing a movie. | # Prevent flickering at beginning and ending of playing a movie. | ||||
export NWMOVIES_GRAB_HACK=1 | # NOTE: this breaks using an external player (i.e., ffplay, mpv). | ||||
#export NWMOVIES_GRAB_HACK=1 | |||||
# SDL settings | # SDL settings | ||||
export SDL_MOUSE_RELATIVE=0 | export SDL_MOUSE_RELATIVE=0 | ||||
export SDL_VIDEO_X11_DGAMOUSE=0 | export SDL_VIDEO_X11_DGAMOUSE=0 | ||||
export SDL_AUDIODRIVER=${SDL_AUDIODRIVER:-"dsp"} | export SDL_AUDIODRIVER=${SDL_AUDIODRIVER:-"dsp"} | ||||
# Library locations | # Library locations | ||||
export LD_LIBRARY_PATH="${NWNUSERDIR}/lib:${NWNUSERDIR}/miles" | export LD_LIBRARY_PATH="${NWNUSERDIR}/lib:${NWNUSERDIR}/miles" | ||||
# Prevent core files from NWN. | # Prevent core files from NWN. | ||||
ulimit -c 0 | ulimit -c 0 | ||||
echo "Starting Neverwinter Nights..." | echo "Starting Neverwinter Nights..." | ||||
if [ -e ./nwmovies/nwmovies.so ] ; then | if [ -e ${NWNMOVIEDIR}/nwmovies.so ] ; then | ||||
export LD_PRELOAD=./nwmovies/nwmovies.so | if [ ! -e ${NWNUSERDIR}/lib/libdisasm.so ] | ||||
then | |||||
# Needed for generation of nwmovies.ini. Linked here since the code | |||||
# calls dlopen() from the user directory. | |||||
ln -sf ${NWNMOVIEDIR}/libdis/libdisasm.so \ | |||||
${NWNUSERDIR}/lib/libdisasm.so | |||||
fi | |||||
export LD_PRELOAD=${NWNMOVIEDIR}/nwmovies.so | |||||
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${NWNMOVIEDIR}" | |||||
# Support for newer nwmovies.so that can use an external application. | |||||
# Does not work all that well at the moment. | |||||
export NWMOVIES_PLAY_COMMAND="mpv --fullscreen --keep-open=no" \ | |||||
"--no-config --no-input-cursor --no-osc --no-terminal" \ | |||||
"--osd-level=0" | |||||
fi | fi | ||||
./nwmain "${@}" | ./nwmain "${@}" |