View | Details | Raw Unified | Return to bug 252747
Collapse All | Expand All

(-)Makefile (-29 / +31 lines)
Lines 3-18 Link Here
3
3
4
PORTNAME=	nwnclient
4
PORTNAME=	nwnclient
5
PORTVERSION=	1.69
5
PORTVERSION=	1.69
6
PORTREVISION=	5
6
PORTREVISION=	6
7
CATEGORIES=	games linux
7
CATEGORIES=	games linux
8
NWN_SITE_1=	http://na.llnet.bioware.cdn.ea.com/u/f/eagames/bioware/neverwinternights/updates/linux/
9
NWN_SITE_2=	http://lvlt.bioware.cdn.ea.com/bioware/u/f/eagames/bioware/neverwinternights/updates/linux/
10
MASTER_SITES=	${NWN_SITE_1}${PORTVERSION:S/.//}/:CLIENT \
8
MASTER_SITES=	${NWN_SITE_1}${PORTVERSION:S/.//}/:CLIENT \
11
		${NWN_SITE_2}${PORTVERSION:S/.//}/:CLIENT \
9
		${NWN_SITE_2}${PORTVERSION:S/.//}/:CLIENT \
12
		${NWN_SITE_1}:ORIG,GOLD,HOTU \
10
		${NWN_SITE_1}:ORIG,GOLD,HOTU \
13
		${NWN_SITE_2}:ORIG,GOLD,HOTU \
11
		${NWN_SITE_2}:ORIG,GOLD,HOTU \
14
		https://github.com/nwnlinux/nwmovies/raw/master/:NWMOVIES \
12
		https://github.com/nwnlinux/nwmovies/raw/master/:NWMOVIES
15
		http://www.radgametools.com/down/Bink/:BINK
16
PKGNAMEPREFIX=	linux-
13
PKGNAMEPREFIX=	linux-
17
DISTFILES=	${CLIENT_FILES} \
14
DISTFILES=	${CLIENT_FILES} \
18
		${CLIENT_NWMOVIES}
15
		${CLIENT_NWMOVIES}
Lines 21-26 Link Here
21
MAINTAINER=	scf@FreeBSD.org
18
MAINTAINER=	scf@FreeBSD.org
22
COMMENT=	Neverwinter Nights Linux (x86) Client
19
COMMENT=	Neverwinter Nights Linux (x86) Client
23
20
21
# NOTE:  nwndata is not actually used to fetch anything.  Since nwndata
22
# determines the version of the client, force it to be installed prior to
23
# poudriere performing its placement of DISTFILES into /portdistfiles.
24
FETCH_DEPENDS=	${LOCALBASE}/share/nwndata/docs/readme.txt:games/nwndata
25
BUILD_DEPENDS=	${LOCALBASE}/share/nwndata/docs/readme.txt:games/nwndata
24
RUN_DEPENDS=	${LOCALBASE}/share/nwndata/docs/readme.txt:games/nwndata
26
RUN_DEPENDS=	${LOCALBASE}/share/nwndata/docs/readme.txt:games/nwndata
25
27
26
NO_BUILD=	yes
28
NO_BUILD=	yes
Lines 27-39 Link Here
27
RESTRICTED=	Distribution not allowed
29
RESTRICTED=	Distribution not allowed
28
USES=		linux
30
USES=		linux
29
USE_LINUX=	dri sdl12 xorglibs
31
USE_LINUX=	dri sdl12 xorglibs
30
NWNDATADIR=	${LOCALBASE}/share/nwndata
32
USE_LDCONFIG=	yes
31
33
32
OPTIONS_DEFINE=	NWMOVIES
34
OPTIONS_DEFINE=	NWMOVIES
33
NWMOVIES_DESC=	Support for movies using BinkPlayer (experimental!)
35
NWMOVIES_DESC=	In-game support for Bink format movies
34
36
35
.include <bsd.port.options.mk>
37
.include <bsd.port.options.mk>
36
38
39
NWN_SITE_1=	http://na.llnet.bioware.cdn.ea.com/u/f/eagames/bioware/neverwinternights/updates/linux/
40
NWN_SITE_2=	http://lvlt.bioware.cdn.ea.com/bioware/u/f/eagames/bioware/neverwinternights/updates/linux/
41
42
SUB_FILES=	nwn
43
SUB_LIST=	LINUXBASE=${LINUXBASE} NWNCLIENTDIR=${DATADIR} \
44
		NWNDATADIR=${LOCALBASE}/share/nwndata
45
37
# Client detection.  Currently, detects only original and Diamond editions.
46
# Client detection.  Currently, detects only original and Diamond editions.
38
.if exists(${LOCALBASE}/share/nwndata/xp2.key)
47
.if exists(${LOCALBASE}/share/nwndata/xp2.key)
39
CLIENT_FILES=	nwclientgold.tar.gz:GOLD \
48
CLIENT_FILES=	nwclientgold.tar.gz:GOLD \
Lines 40-50 Link Here
40
		nwclienthotu.tar.gz:HOTU \
49
		nwclienthotu.tar.gz:HOTU \
41
		English_linuxclient169_xp2.tar.gz:CLIENT
50
		English_linuxclient169_xp2.tar.gz:CLIENT
42
.if ${PORT_OPTIONS:MNWMOVIES}
51
.if ${PORT_OPTIONS:MNWMOVIES}
43
NWMOVIESFILE=	nwmovies-v4-public.20090223.080954.tar.gz
52
NWMOVIESFILES=	nwmovies/libdis/libdisasm.so \
44
BINKPLAYERFILE=	BinkLinuxPlayer.7z
53
		nwmovies/nwmovies.so
45
CLIENT_NWMOVIES=${NWMOVIESFILE}:NWMOVIES \
54
CLIENT_NWMOVIES=${NWMOVIESFILES:S/$/:NWMOVIES/}
46
		${BINKPLAYERFILE}:BINK
55
RUN_DEPENDS+=	mpv:multimedia/mpv
47
USE_LINUX+=	sdlmixer
56
SUB_FILES+=	nwmovies.sh
48
PLIST_SUB+=	NWMOVIES=""
57
PLIST_SUB+=	NWMOVIES=""
49
.else
58
.else
50
PLIST_SUB+=	NWMOVIES="@comment "
59
PLIST_SUB+=	NWMOVIES="@comment "
Lines 58-74 Link Here
58
67
59
do-extract:
68
do-extract:
60
	${MKDIR} ${WRKSRC}
69
	${MKDIR} ${WRKSRC}
61
.for _distfile in ${CLIENT_FILES:C/:.*$//g} ${BINKPLAYERFILE}
70
.for _distfile in ${CLIENT_FILES:C/:.*$//g}
62
	(cd ${WRKSRC} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} \
71
	(cd ${WRKSRC} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} \
63
		${_DISTDIR}/${_distfile} ${EXTRACT_AFTER_ARGS})
72
		${_DISTDIR}/${_distfile} ${EXTRACT_AFTER_ARGS})
64
.endfor
73
.endfor
65
.if defined(BINKPLAYERFILE)
66
	(cd ${WRKSRC} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} \
67
		${_DISTDIR}/${NWMOVIESFILE} ${EXTRACT_AFTER_ARGS} \
68
		nwmovies/binklib.so nwmovies/libdis/libdisasm.so \
69
		nwmovies/nwmovies.so)
70
	(cd ${WRKSRC} && ${MV} BinkPlayer nwmovies)
71
.endif
72
	${RM} ${WRKSRC}/lib/libSDL* ${WRKSRC}/fixinstall ${WRKSRC}/nwn
74
	${RM} ${WRKSRC}/lib/libSDL* ${WRKSRC}/fixinstall ${WRKSRC}/nwn
73
	if [ -d ${WRKSRC}/SDL-1.2.5 ]; then \
75
	if [ -d ${WRKSRC}/SDL-1.2.5 ]; then \
74
		${RM} ${WRKSRC}/SDL-1.2.5/*; \
76
		${RM} ${WRKSRC}/SDL-1.2.5/*; \
Lines 76-94 Link Here
76
	fi
78
	fi
77
	@${FIND} ${WRKSRC} -type f -name ".*" -delete
79
	@${FIND} ${WRKSRC} -type f -name ".*" -delete
78
80
79
do-configure:
80
	${SED} -e 's|%%NWNDATADIR%%|${NWNDATADIR}|' \
81
		-e 's|%%NWNCLIENTDIR%%|${DATADIR}|' \
82
		<${FILESDIR}/nwn.sh >${WRKDIR}/nwn
83
84
do-install:
81
do-install:
85
	${MKDIR} ${STAGEDIR}${DATADIR}
82
	${MKDIR} ${STAGEDIR}${DATADIR}
86
	(cd ${WRKSRC} && ${COPYTREE_SHARE} . ${STAGEDIR}${DATADIR})
83
	(cd ${WRKSRC} && ${COPYTREE_SHARE} . ${STAGEDIR}${DATADIR})
87
	(cd ${STAGEDIR}${DATADIR} && ${CHMOD} 0755 dmclient nwmain nwserver)
84
	(cd ${STAGEDIR}${DATADIR} && ${CHMOD} 0755 dmclient nwmain nwserver)
88
.if defined(BINKPLAYERFILE)
85
.if !empty(PORT_OPTIONS:MNWMOVIES)
89
	(cd ${STAGEDIR}${DATADIR} && ${CHMOD} 0755 nwmovies/BinkPlayer)
86
	${MKDIR} ${STAGEDIR}${DATADIR}/nwmovies/libdis
90
	(cd ${STAGEDIR}${DATADIR}/nwmovies && ${LN} -s /compat/linux/usr/lib/libX11.so.6 libX11.so)
87
.for _distfile in ${NWMOVIESFILES}
91
	${INSTALL_SCRIPT} ${FILESDIR}/nwmovies.pl ${STAGEDIR}${DATADIR}
88
	${INSTALL_DATA} ${_DISTDIR}/${_distfile} \
89
		${STAGEDIR}${DATADIR}/${_distfile}
90
.endfor
91
	(cd ${STAGEDIR}${DATADIR}/nwmovies && \
92
		${LN} -s /compat/linux/usr/lib/libX11.so.6 libX11.so)
93
	${INSTALL_SCRIPT} ${WRKDIR}/nwmovies.sh ${STAGEDIR}${DATADIR}
92
.endif
94
.endif
93
	${INSTALL_SCRIPT} ${WRKDIR}/nwn ${STAGEDIR}${PREFIX}/bin/
95
	${INSTALL_SCRIPT} ${WRKDIR}/nwn ${STAGEDIR}${PREFIX}/bin/
94
96
(-)distinfo (-5 / +5 lines)
Lines 1-4 Link Here
1
TIMESTAMP = 1510192086
1
TIMESTAMP = 1610685800
2
SHA256 (linux-nwnclient/English_linuxclient169_orig.tar.gz) = 50932f9647ea7968dbb8f7ab1fc6478035fff0826379a45762c1de8e46d1d2b0
2
SHA256 (linux-nwnclient/English_linuxclient169_orig.tar.gz) = 50932f9647ea7968dbb8f7ab1fc6478035fff0826379a45762c1de8e46d1d2b0
3
SIZE (linux-nwnclient/English_linuxclient169_orig.tar.gz) = 473297170
3
SIZE (linux-nwnclient/English_linuxclient169_orig.tar.gz) = 473297170
4
SHA256 (linux-nwnclient/English_linuxclient169_xp2.tar.gz) = 09715e2b95c025ef7f00d218deec1b1edce501530d8cba51d61097c69699763f
4
SHA256 (linux-nwnclient/English_linuxclient169_xp2.tar.gz) = 09715e2b95c025ef7f00d218deec1b1edce501530d8cba51d61097c69699763f
Lines 9-15 Link Here
9
SIZE (linux-nwnclient/nwclientgold.tar.gz) = 7559227
9
SIZE (linux-nwnclient/nwclientgold.tar.gz) = 7559227
10
SHA256 (linux-nwnclient/nwclienthotu.tar.gz) = 0a4ace1aacd69fb166d09bd249ce5ae98dd28f580765f52e0147bb85f7dfcfd7
10
SHA256 (linux-nwnclient/nwclienthotu.tar.gz) = 0a4ace1aacd69fb166d09bd249ce5ae98dd28f580765f52e0147bb85f7dfcfd7
11
SIZE (linux-nwnclient/nwclienthotu.tar.gz) = 39611339
11
SIZE (linux-nwnclient/nwclienthotu.tar.gz) = 39611339
12
SHA256 (linux-nwnclient/nwmovies-v4-public.20090223.080954.tar.gz) = 4ce60791183a0623d09b37c9f00ba42a2f7e7d953eba35b090a96cc891254f14
12
SHA256 (linux-nwnclient/nwmovies/libdis/libdisasm.so) = aee223fd7a0a0bce9bf3bba462c926c5bd2d44d5ab8897821dc95f975dbce774
13
SIZE (linux-nwnclient/nwmovies-v4-public.20090223.080954.tar.gz) = 137697
13
SIZE (linux-nwnclient/nwmovies/libdis/libdisasm.so) = 100560
14
SHA256 (linux-nwnclient/BinkLinuxPlayer.7z) = 055c9cc22acad954962159c1c5963772cb82a3c3b4a024659c20a027cbad24e1
14
SHA256 (linux-nwnclient/nwmovies/nwmovies.so) = 21b3afba081ce28b0c0cd7e7568cb053fd3cd752369cad7ef594c99e72a9c397
15
SIZE (linux-nwnclient/BinkLinuxPlayer.7z) = 826686
15
SIZE (linux-nwnclient/nwmovies/nwmovies.so) = 121744
(-)files/nwmovies.pl (-76 lines)
Lines 1-76 Link Here
1
#!/bin/sh
2
#
3
# $FreeBSD$
4
#
5
6
# There is a Perl script that accompanies the NWMovies distfile, however, it
7
# would require Linux Perl to be installed when a simple shell script will
8
# suffice.  Since the name of the Perl script is hardcoded into the binary, this
9
# file has a .pl extension even though it is Bourne shell.
10
11
# Initialization.
12
NWNUSERDIR="${HOME}/.nwn"
13
NWNSKIPFILE=${NWNUSERDIR}/nwmovies.skip
14
NWNMOVIEDIR=${NWNUSERDIR}/movies
15
NWNMOVIES=${NWNUSERDIR}/nwmovies
16
NWNINI=${NWNUSERDIR}/nwn.ini
17
18
# Print arguments in lowercase
19
tolower() {
20
	set -e
21
	echo "$@" | tr '[:upper:]' '[:lower:]'
22
}
23
24
# Determine case-insensitive movie name to play prior to setting LD_PRELOAD.
25
reqmovie="$(tolower ${NWNMOVIEDIR}/${1}).bik"
26
for m in ${NWNMOVIEDIR}/*
27
do
28
	if [ ${reqmovie} = $(tolower ${m}) ]
29
	then
30
		movie="${m}"
31
		break
32
	fi
33
done
34
if [ -z "${movie}" ]
35
then
36
	echo "${reqmovie} not found"
37
	exit 1
38
fi
39
40
# Skip movies request by user.
41
if [ -e ${NWNSKIPFILE} ]
42
then
43
	reqmovie="$(tolower ${1})"
44
	for m in `cat ${NWNSKIPFILE}`
45
	do
46
		if [ ${reqmovie} = $(tolower ${m}) ]
47
		then
48
			echo "Skipping ${1} as requested"
49
			exit 0
50
		fi
51
	done
52
fi
53
54
# Prevent core files from BinkPlayer.
55
ulimit -c 0
56
57
# Configure movie display (default to 800x600 if not in .ini file).
58
BINK_WIDTH=`grep -i width ${NWNINI} | cut -f 2 -d '='` 2> /dev/null
59
export BINK_WIDTH=${BINK_WIDTH:-800}
60
BINK_HEIGHT=`grep -i height ${NWNINI} | cut -f 2 -d '='` 2> /dev/null
61
export BINK_HEIGHT=${BINK_HEIGHT:-600}
62
export BINK_FULLSCREEN=1
63
64
# Silence warnings from SDL.
65
export SDL_AUDIODRIVER=${SDL_AUDIODRIVER:-"dsp"}
66
67
# Configure for needed libraries (some are only needed if running standalone).
68
if [ ! -e ${NWNMOVIES}/libX11.so ]
69
then
70
	ln -sf /compat/linux/usr/lib/libX11.so.6 ${NWNMOVIES}/libX11.so
71
fi
72
export LD_LIBRARY_PATH=${NWNUSERDIR}/nwmovies:${LD_LIBRARY_PATH}
73
export LD_PRELOAD=./nwmovies/binklib.so
74
75
# Play movie.
76
./nwmovies/BinkPlayer ${movie}
(-)files/nwmovies.sh.in (-68 / +11 lines)
Lines 3-76 Link Here
3
# $FreeBSD$
3
# $FreeBSD$
4
#
4
#
5
5
6
# There is a Perl script that accompanies the NWMovies distfile, however, it
6
# Prevent saving core files.
7
# would require Linux Perl to be installed when a simple shell script will
8
# suffice.  Since the name of the Perl script is hardcoded into the binary, this
9
# file has a .pl extension even though it is Bourne shell.
10
11
# Initialization.
12
NWNUSERDIR="${HOME}/.nwn"
13
NWNSKIPFILE=${NWNUSERDIR}/nwmovies.skip
14
NWNMOVIEDIR=${NWNUSERDIR}/movies
15
NWNMOVIES=${NWNUSERDIR}/nwmovies
16
NWNINI=${NWNUSERDIR}/nwn.ini
17
18
# Print arguments in lowercase
19
tolower() {
20
	set -e
21
	echo "$@" | tr '[:upper:]' '[:lower:]'
22
}
23
24
# Determine case-insensitive movie name to play prior to setting LD_PRELOAD.
25
reqmovie="$(tolower ${NWNMOVIEDIR}/${1}).bik"
26
for m in ${NWNMOVIEDIR}/*
27
do
28
	if [ ${reqmovie} = $(tolower ${m}) ]
29
	then
30
		movie="${m}"
31
		break
32
	fi
33
done
34
if [ -z "${movie}" ]
35
then
36
	echo "${reqmovie} not found"
37
	exit 1
38
fi
39
40
# Skip movies request by user.
41
if [ -e ${NWNSKIPFILE} ]
42
then
43
	reqmovie="$(tolower ${1})"
44
	for m in `cat ${NWNSKIPFILE}`
45
	do
46
		if [ ${reqmovie} = $(tolower ${m}) ]
47
		then
48
			echo "Skipping ${1} as requested"
49
			exit 0
50
		fi
51
	done
52
fi
53
54
# Prevent core files from BinkPlayer.
55
ulimit -c 0
7
ulimit -c 0
56
8
57
# Configure movie display (default to 800x600 if not in .ini file).
9
# Run FreeBSD movie player binary without Linux libraries.
58
BINK_WIDTH=`grep -i width ${NWNINI} | cut -f 2 -d '='` 2> /dev/null
10
unset LD_PRELOAD
59
export BINK_WIDTH=${BINK_WIDTH:-800}
11
unset LD_LIBRARY_PATH
60
BINK_HEIGHT=`grep -i height ${NWNINI} | cut -f 2 -d '='` 2> /dev/null
61
export BINK_HEIGHT=${BINK_HEIGHT:-600}
62
export BINK_FULLSCREEN=1
63
12
64
# Silence warnings from SDL.
13
# Play movie using the installed mpv with default options but allow them to be
65
export SDL_AUDIODRIVER=${SDL_AUDIODRIVER:-"dsp"}
14
# changed if needed.
66
15
player=${NWN_PLAYER:-%%PREFIX%%/bin/mpv}
67
# Configure for needed libraries (some are only needed if running standalone).
16
player_opts=${NWN_PLAYER_OPTS:-"--ontop --fullscreen --keep-open=no \
68
if [ ! -e ${NWNMOVIES}/libX11.so ]
17
	--no-terminal --no-config --no-input-cursor --hr-seek=yes \
69
then
18
	--no-border --no-osc --osd-level=0"}
70
	ln -sf /compat/linux/usr/lib/libX11.so.6 ${NWNMOVIES}/libX11.so
19
${player} ${player_opts} "${HOME}/.nwn/${1}"
71
fi
72
export LD_LIBRARY_PATH=${NWNUSERDIR}/nwmovies:${LD_LIBRARY_PATH}
73
export LD_PRELOAD=./nwmovies/binklib.so
74
75
# Play movie.
76
./nwmovies/BinkPlayer ${movie}
(-)files/nwn.in (-45 / +41 lines)
Lines 3-13 Link Here
3
# $FreeBSD$
3
# $FreeBSD$
4
#
4
#
5
5
6
NWNDATADIR="%%NWNDATADIR%%"
6
nwn_datadir="%%NWNDATADIR%%"
7
NWNCLIENTDIR="%%NWNCLIENTDIR%%"
7
nwn_clientdir="%%NWNCLIENTDIR%%"
8
NWNUSERDIR="${HOME}/.nwn"
8
nwn_userdir=${NWN_USERDIR:-"${HOME}/.nwn"}
9
NWNMOVIEDIR="${NWNUSERDIR}/nwmovies"
9
nwn_moviedir="${nwn_userdir}/nwmovies"
10
LCDIRS="ambient data dmvault hak localvault music override portraits"
10
lc_dirs="ambient data dmvault hak localvault music override portraits"
11
11
12
set -e
12
set -e
13
13
Lines 30-46 Link Here
30
	set -e
30
	set -e
31
	cd "$1"
31
	cd "$1"
32
	find . -type d | cut -c 3- | while read dir ; do
32
	find . -type d | cut -c 3- | while read dir ; do
33
		[ -d "${NWNUSERDIR}/${dir}" ] ||
33
		[ -d "${nwn_userdir}/${dir}" ] ||
34
			mkdir "${NWNUSERDIR}/${dir}"
34
			mkdir "${nwn_userdir}/${dir}"
35
	done
35
	done
36
	find . -type l | cut -c 3- | while read file ; do
36
	find . -type l | cut -c 3- | while read file ; do
37
		[ -L "${NWNUSERDIR}/${file}" ] ||
37
		[ -L "${nwn_userdir}/${file}" ] ||
38
			cp -R "${file}" "${NWNUSERDIR}/${file}"
38
			cp -R "${file}" "${nwn_userdir}/${file}"
39
	done
39
	done
40
	find . -type f | cut -c 3- | while read file ; do
40
	find . -type f | cut -c 3- | while read file ; do
41
		[ -e "${NWNUSERDIR}/${file}" -o \
41
		[ -e "${nwn_userdir}/${file}" -o \
42
		-e "$(tolower ${NWNUSERDIR}/${file})" ] ||
42
		-e "$(tolower ${nwn_userdir}/${file})" ] ||
43
			ln -s "${1}/${file}" "${NWNUSERDIR}/${file}"
43
			ln -s "${1}/${file}" "${nwn_userdir}/${file}"
44
	done
44
	done
45
}
45
}
46
46
Lines 47-75 Link Here
47
# Create user directory.  Will also update a user directory if anything is
47
# Create user directory.  Will also update a user directory if anything is
48
# different due to running NWN with different versions of the game.
48
# different due to running NWN with different versions of the game.
49
rebuilduserdir() {
49
rebuilduserdir() {
50
	# Copy ${NWNCLIENTDIR} first since it may contain files which
50
	# Copy ${nwn_clientdir} first since it may contain files which
51
	# override parts of ${NWNDATADIR}
51
	# override parts of ${nwn_datadir}
52
	copydir "${NWNCLIENTDIR}"
52
	copydir "${nwn_clientdir}"
53
	copydir "${NWNDATADIR}"
53
	copydir "${nwn_datadir}"
54
54
55
	# Some files need to have their names converted to lowercase.  Create
55
	# Some files need to have their names converted to lowercase.  Create
56
	# the directories if missing due to differences between versions of NWN.
56
	# the directories if missing due to differences between versions of NWN.
57
	cd "${NWNUSERDIR}"
57
	cd "${nwn_userdir}"
58
	mkdir -p ${LCDIRS}
58
	mkdir -p ${lc_dirs}
59
	lowerdir ${LCDIRS}
59
	lowerdir ${lc_dirs}
60
}
60
}
61
61
62
if [ ! -d "${NWNUSERDIR}" ] ; then
62
if [ ! -d "${nwn_userdir}" ] ; then
63
	echo "Creating user directory"
63
	echo "Creating user directory"
64
	mkdir "${NWNUSERDIR}"
64
	mkdir "${nwn_userdir}"
65
65
66
	# Copy the ini file so the user can tweak it
66
	# Copy the ini file so the user can tweak it
67
	cp "${NWNCLIENTDIR}/nwn.ini" "${NWNUSERDIR}"
67
	cp "${nwn_clientdir}/nwn.ini" "${nwn_userdir}"
68
68
69
	# Create a non-empty CD key file to work around a bug in the
69
	# Create a non-empty CD key file to work around a bug in the
70
	# client: it will ask for the key twice if the file is
70
	# client: it will ask for the key twice if the file is
71
	# initally empty or missing
71
	# initally empty or missing
72
	echo '[CDKEY]' >"${NWNUSERDIR}/nwncdkey.ini"
72
	echo '[CDKEY]' >"${nwn_userdir}/nwncdkey.ini"
73
73
74
	rebuilduserdir
74
	rebuilduserdir
75
75
Lines 79-100 Link Here
79
else
79
else
80
	# Remove dead links from different versions (e.g., original versus
80
	# Remove dead links from different versions (e.g., original versus
81
	# Diamond Edition) of NWN as they could confuse the game.
81
	# Diamond Edition) of NWN as they could confuse the game.
82
	find -L ${NWNUSERDIR} -type l -exec rm -- {} +
82
	find -L ${nwn_userdir} -type l -exec rm -- {} +
83
83
84
	rebuilduserdir
84
	rebuilduserdir
85
fi
85
fi
86
86
87
echo "Saved games will be stored in ${NWNUSERDIR}/saves/"
87
echo "Saved games will be stored in ${nwn_userdir}/saves/"
88
88
89
cd "${NWNUSERDIR}"
89
cd "${nwn_userdir}"
90
90
91
# Remove old movie log file.
91
# Remove old movie log file.
92
rm -f ${NWNUSERDIR}/nwmovies.log
92
rm -f ${nwn_userdir}/nwmovies.log
93
93
94
# Prevent flickering at beginning and ending of playing a movie.
95
# NOTE: this breaks using an external player (i.e., ffplay, mpv).
96
#export NWMOVIES_GRAB_HACK=1
97
98
# SDL settings
94
# SDL settings
99
export SDL_MOUSE_RELATIVE=0
95
export SDL_MOUSE_RELATIVE=0
100
export SDL_VIDEO_X11_DGAMOUSE=0
96
export SDL_VIDEO_X11_DGAMOUSE=0
Lines 101-128 Link Here
101
export SDL_AUDIODRIVER=${SDL_AUDIODRIVER:-"dsp"}
97
export SDL_AUDIODRIVER=${SDL_AUDIODRIVER:-"dsp"}
102
98
103
# Library locations
99
# Library locations
104
export LD_LIBRARY_PATH="${NWNUSERDIR}/lib:${NWNUSERDIR}/miles"
100
export LD_LIBRARY_PATH="${nwn_userdir}/lib:${nwn_userdir}/miles"
105
101
106
# Prevent core files from NWN.
102
# Prevent saving core files from NWN.
107
ulimit -c 0
103
ulimit -c 0
108
104
109
echo "Starting Neverwinter Nights..."
105
echo "Starting Neverwinter Nights..."
110
if [ -e ${NWNMOVIEDIR}/nwmovies.so ] ; then
106
if [ -e ${nwn_moviedir}/nwmovies.so ] ; then
111
	if [ ! -e ${NWNUSERDIR}/lib/libdisasm.so ]
107
	if [ ! -e ${nwn_userdir}/lib/libdisasm.so ]
112
	then
108
	then
113
		# Needed for generation of nwmovies.ini.  Linked here since the code
109
		# Needed for generation of nwmovies.ini.  Linked here since the
114
		# calls dlopen() from the user directory.
110
		# code calls dlopen() from the user directory.
115
		ln -sf ${NWNMOVIEDIR}/libdis/libdisasm.so \
111
		ln -sf ${nwn_moviedir}/libdis/libdisasm.so \
116
			${NWNUSERDIR}/lib/libdisasm.so
112
			${nwn_userdir}/lib/libdisasm.so
117
	fi
113
	fi
118
114
119
	export LD_PRELOAD=${NWNMOVIEDIR}/nwmovies.so
115
	export LD_PRELOAD=${nwn_moviedir}/nwmovies.so:%%LINUXBASE%%/lib/libz.so.1
120
	export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${NWNMOVIEDIR}"
116
	export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${nwn_moviedir}"
121
117
122
	# Support for newer nwmovies.so that can use an external application.
118
	# Support for newer nwmovies.so that can use an external application.
123
	# Does not work all that well at the moment.
119
	# It requires LD_PRELOAD to be removed else the player will fail when it
124
	export NWMOVIES_PLAY_COMMAND="mpv --fullscreen --keep-open=no" \
120
	# attempts to preload any Linux libraries.  To make it easier, use a
125
		"--no-config --no-input-cursor --no-osc --no-terminal" \
121
	# script that removes it instead of changing the movie playing library.
126
		"--osd-level=0"
122
	export NWMOVIES_PLAY_COMMAND="${nwn_userdir}/nwmovies.sh"
127
fi
123
fi
128
./nwmain "${@}"
124
./nwmain "${@}"
(-)files/nwn.sh (-128 lines)
Lines 1-128 Link Here
1
#!/bin/sh
2
#
3
# $FreeBSD$
4
#
5
6
NWNDATADIR="%%NWNDATADIR%%"
7
NWNCLIENTDIR="%%NWNCLIENTDIR%%"
8
NWNUSERDIR="${HOME}/.nwn"
9
NWNMOVIEDIR="${NWNUSERDIR}/nwmovies"
10
LCDIRS="ambient data dmvault hak localvault music override portraits"
11
12
set -e
13
14
# Print arguments in lowercase
15
tolower() {
16
	set -e
17
	echo "$@" | tr '[:upper:]' '[:lower:]'
18
}
19
20
# Rename all files in a directory to lowercase
21
lowerdir() {
22
	set -e
23
	find "$@" -name '*[A-Z]*' | while read name ; do
24
		mv -v "${name}" "$(tolower ${name})"
25
	done
26
}
27
28
# Copy a directory structure and symlink its contents
29
copydir() {
30
	set -e
31
	cd "$1"
32
	find . -type d | cut -c 3- | while read dir ; do
33
		[ -d "${NWNUSERDIR}/${dir}" ] ||
34
			mkdir "${NWNUSERDIR}/${dir}"
35
	done
36
	find . -type l | cut -c 3- | while read file ; do
37
		[ -L "${NWNUSERDIR}/${file}" ] ||
38
			cp -R "${file}" "${NWNUSERDIR}/${file}"
39
	done
40
	find . -type f | cut -c 3- | while read file ; do
41
		[ -e "${NWNUSERDIR}/${file}" -o \
42
		-e "$(tolower ${NWNUSERDIR}/${file})" ] ||
43
			ln -s "${1}/${file}" "${NWNUSERDIR}/${file}"
44
	done
45
}
46
47
# Create user directory.  Will also update a user directory if anything is
48
# different due to running NWN with different versions of the game.
49
rebuilduserdir() {
50
	# Copy ${NWNCLIENTDIR} first since it may contain files which
51
	# override parts of ${NWNDATADIR}
52
	copydir "${NWNCLIENTDIR}"
53
	copydir "${NWNDATADIR}"
54
55
	# Some files need to have their names converted to lowercase.  Create
56
	# the directories if missing due to differences between versions of NWN.
57
	cd "${NWNUSERDIR}"
58
	mkdir -p ${LCDIRS}
59
	lowerdir ${LCDIRS}
60
}
61
62
if [ ! -d "${NWNUSERDIR}" ] ; then
63
	echo "Creating user directory"
64
	mkdir "${NWNUSERDIR}"
65
66
	# Copy the ini file so the user can tweak it
67
	cp "${NWNCLIENTDIR}/nwn.ini" "${NWNUSERDIR}"
68
69
	# Create a non-empty CD key file to work around a bug in the
70
	# client: it will ask for the key twice if the file is
71
	# initally empty or missing
72
	echo '[CDKEY]' >"${NWNUSERDIR}/nwncdkey.ini"
73
74
	rebuilduserdir
75
76
	echo "Your Neverwinter Nights directory (~/.nwn) has now been"
77
	echo "created and populated.  Press ENTER to start the game."
78
	read dummy
79
else
80
	# Remove dead links from different versions (e.g., original versus
81
	# Diamond Edition) of NWN as they could confuse the game.
82
	find -L ${NWNUSERDIR} -type l -exec rm -- {} +
83
84
	rebuilduserdir
85
fi
86
87
echo "Saved games will be stored in ${NWNUSERDIR}/saves/"
88
89
cd "${NWNUSERDIR}"
90
91
# Remove old movie log file.
92
rm -f ${NWNUSERDIR}/nwmovies.log
93
94
# Prevent flickering at beginning and ending of playing a movie.
95
# NOTE: this breaks using an external player (i.e., ffplay, mpv).
96
#export NWMOVIES_GRAB_HACK=1
97
98
# SDL settings
99
export SDL_MOUSE_RELATIVE=0
100
export SDL_VIDEO_X11_DGAMOUSE=0
101
export SDL_AUDIODRIVER=${SDL_AUDIODRIVER:-"dsp"}
102
103
# Library locations
104
export LD_LIBRARY_PATH="${NWNUSERDIR}/lib:${NWNUSERDIR}/miles"
105
106
# Prevent core files from NWN.
107
ulimit -c 0
108
109
echo "Starting Neverwinter Nights..."
110
if [ -e ${NWNMOVIEDIR}/nwmovies.so ] ; then
111
	if [ ! -e ${NWNUSERDIR}/lib/libdisasm.so ]
112
	then
113
		# Needed for generation of nwmovies.ini.  Linked here since the code
114
		# calls dlopen() from the user directory.
115
		ln -sf ${NWNMOVIEDIR}/libdis/libdisasm.so \
116
			${NWNUSERDIR}/lib/libdisasm.so
117
	fi
118
119
	export LD_PRELOAD=${NWNMOVIEDIR}/nwmovies.so
120
	export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${NWNMOVIEDIR}"
121
122
	# Support for newer nwmovies.so that can use an external application.
123
	# Does not work all that well at the moment.
124
	export NWMOVIES_PLAY_COMMAND="mpv --fullscreen --keep-open=no" \
125
		"--no-config --no-input-cursor --no-osc --no-terminal" \
126
		"--osd-level=0"
127
fi
128
./nwmain "${@}"
(-)pkg-message (-2 / +2 lines)
Lines 4-11 Link Here
4
If the game is installed with movie support (NWMovies), there is a way
4
If the game is installed with movie support (NWMovies), there is a way
5
to skip various movies, especially the five introduction movies at the
5
to skip various movies, especially the five introduction movies at the
6
start of the game:  create a skip file ($HOME/.nwn/nwmovies.skip) and
6
start of the game:  create a skip file ($HOME/.nwn/nwmovies.skip) and
7
list the movies (case-insensitive) you wish to skip.  The following
7
list the movies (case-insensitive, no extension) you wish to skip.  The
8
are the introduction movies, at least in the Diamond edition:
8
following are the introduction movies, at least in the Diamond edition:
9
AtariLogo
9
AtariLogo
10
BiowareLogo
10
BiowareLogo
11
WotcLogo
11
WotcLogo
(-)pkg-plist (-3 / +1 lines)
Lines 57-65 Link Here
57
%%DIAMOND%%%%DATADIR%%/nwm/XP2_Chapter2.nwm
57
%%DIAMOND%%%%DATADIR%%/nwm/XP2_Chapter2.nwm
58
%%DIAMOND%%%%DATADIR%%/nwm/XP2_Chapter3.nwm
58
%%DIAMOND%%%%DATADIR%%/nwm/XP2_Chapter3.nwm
59
%%DATADIR%%/nwmain
59
%%DATADIR%%/nwmain
60
%%NWMOVIES%%%%DATADIR%%/nwmovies.pl
60
%%NWMOVIES%%%%DATADIR%%/nwmovies.sh
61
%%NWMOVIES%%%%DATADIR%%/nwmovies/BinkPlayer
62
%%NWMOVIES%%%%DATADIR%%/nwmovies/binklib.so
63
%%NWMOVIES%%%%DATADIR%%/nwmovies/libX11.so
61
%%NWMOVIES%%%%DATADIR%%/nwmovies/libX11.so
64
%%NWMOVIES%%%%DATADIR%%/nwmovies/libdis/libdisasm.so
62
%%NWMOVIES%%%%DATADIR%%/nwmovies/libdis/libdisasm.so
65
%%NWMOVIES%%%%DATADIR%%/nwmovies/nwmovies.so
63
%%NWMOVIES%%%%DATADIR%%/nwmovies/nwmovies.so

Return to bug 252747