diff --git a/nwn-gog/.SRCINFO b/nwn-gog/.SRCINFO
new file mode 100644
index 0000000..aca1eff
--- /dev/null
+++ b/nwn-gog/.SRCINFO
@@ -0,0 +1,69 @@
+pkgbase = nwn-gog
+ pkgdesc = Neverwinter Nights is an RPG from Bioware. This requires the GOG version.
+ pkgver = 2.1.0.21
+ pkgrel = 7
+ url = https://www.gog.com/game/neverwinter_nights_enhanced_edition_pack
+ install = nwn.install
+ arch = i686
+ arch = x86_64
+ license = custom
+ makedepends = git
+ makedepends = innoextract
+ makedepends = p7zip
+ makedepends = perl
+ makedepends = unzip
+ makedepends = unrar
+ makedepends = rsync
+ depends = binkplayer-bin
+ depends = perl
+ depends = elfutils
+ depends = icoutils
+ optdepends = xdg-utils: xdg .desktop file support
+ provides = nwn
+ conflicts = nwn
+ noextract = nwclientgold.tar.gz
+ noextract = nwclienthotu.tar.gz
+ noextract = English_linuxclient169_xp2.tar.gz
+ noextract = setup_nwn_diamond_2.1.0.21-1.bin
+ noextract = nvn_KingmakerSetup.zip
+ source = setup_nwn_diamond_2.1.0.21.exe::gogdownloader://neverwinter_nights_diamond_edition/en1installer0
+ source = setup_nwn_diamond_2.1.0.21-1.bin::gogdownloader://neverwinter_nights_diamond_edition/en1installer1
+ source = nvn_KingmakerSetup.zip::gogdownloader://neverwinter_nights_diamond_edition/9213
+ source = https://lutris.net/files/games/neverwinter-nights/nwclientgold.tar.gz
+ source = https://lutris.net/files/games/neverwinter-nights/nwclienthotu.tar.gz
+ source = https://lutris.net/files/games/neverwinter-nights/English_linuxclient169_xp2.tar.gz
+ source = libz.patch
+ source = nwn.launcher
+ source = nwn.desktop
+ source = git+https://github.com/nwnlinux/nwmouse.git
+ source = git+https://github.com/nwnlinux/nwuser.git
+ source = git+https://github.com/nwnlinux/nwlogger.git
+ source = git+https://github.com/nwnlinux/nwmovies.git
+ md5sums = cd809b9d22022adb01b0d1d70c5afa8e
+ md5sums = ce60bf104cc6082fe79d6f0bd7b48f51
+ md5sums = 57be8c593db88db6b6ee78ba9201ec53
+ md5sums = 0a059d55225fc32f905e86191d88a11f
+ md5sums = 376cdece07106ea058d42b531f3146bb
+ md5sums = b021f0da3b3e00848521926716fdf487
+ md5sums = d0a157cefe55daa9d06e9803ade22fdc
+ md5sums = 966641dc9bfd49ff56bf1dac9fe00c3c
+ md5sums = 3a7fa617a2aa8d324bb4d57dcf84cf8c
+ md5sums = SKIP
+ md5sums = SKIP
+ md5sums = SKIP
+ md5sums = SKIP
+ depends_i686 = libgl
+ depends_i686 = glu
+ depends_i686 = libstdc++5
+ depends_i686 = libxcursor
+ depends_i686 = sdl_mixer
+ depends_x86_64 = lib32-libelf
+ depends_x86_64 = lib32-libstdc++5
+ depends_x86_64 = lib32-libgl
+ depends_x86_64 = lib32-glu
+ depends_x86_64 = lib32-libxcursor
+ depends_x86_64 = lib32-libxdamage
+ depends_x86_64 = lib32-sdl_mixer
+ depends_x86_64 = gcc-multilib
+
+pkgname = nwn-gog
diff --git a/nwn-gog/PKGBUILD b/nwn-gog/PKGBUILD
new file mode 100644
index 0000000..73acf74
--- /dev/null
+++ b/nwn-gog/PKGBUILD
@@ -0,0 +1,181 @@
+#Maintainer: ubervison <vis0n at protonmail dot com>
+# Contributor: Stephen Baker <baker dot stephen dot e at gmail dot com>
+# Contributor: Slash <demodevil5[at]yahoo[dot]com>
+# Contributor: Adam Griffiths <adam_griffithsAATTdart.net.au>
+
+pkgname=nwn-gog
+pkgver=2.1.0.21
+pkgrel=8
+pkgdesc="Neverwinter Nights is an RPG from Bioware. This requires the GOG version."
+url="https://www.gog.com/game/neverwinter_nights_enhanced_edition_pack"
+license=('custom')
+arch=('i686' 'x86_64')
+depends=('binkplayer-bin' 'perl' 'elfutils' 'icoutils')
+depends_x86_64=('lib32-libelf' 'lib32-libstdc++5' 'lib32-libgl' 'lib32-glu' 'lib32-libxcursor' 'lib32-libxdamage' 'lib32-sdl_mixer' 'gcc-multilib')
+depends_i686=('libgl' 'glu' 'libstdc++5' 'libxcursor' 'sdl_mixer')
+makedepends=('git' 'innoextract' 'p7zip' 'perl' 'unzip' 'unrar' 'rsync')
+optdepends=('xdg-utils: xdg .desktop file support')
+provides=('nwn')
+conflicts=('nwn')
+install=nwn.install
+
+PKGEXT='.pkg.tar'
+
+source=("setup_nwn_diamond_$pkgver.exe::gogdownloader://neverwinter_nights_diamond_edition/en1installer0" \
+ "setup_nwn_diamond_$pkgver-1.bin::gogdownloader://neverwinter_nights_diamond_edition/en1installer1" \
+ "nvn_KingmakerSetup.zip::gogdownloader://neverwinter_nights_diamond_edition/9213" \
+ "https://lutris.net/files/games/neverwinter-nights/nwclientgold.tar.gz" \
+ "https://lutris.net/files/games/neverwinter-nights/nwclienthotu.tar.gz" \
+ "https://lutris.net/files/games/neverwinter-nights/English_linuxclient169_xp2.tar.gz" \
+ "nwn.launcher" \
+ "nwn.desktop" \
+ "nwmouse_install.pl.patch" \
+ "git+https://github.com/nwnlinux/nwmouse.git" \
+ "git+https://github.com/nwnlinux/nwuser.git" \
+ "git+https://github.com/nwnlinux/nwlogger.git" \
+ "git+https://github.com/nwnlinux/nwmovies.git" \
+ "git+https://gist.github.com/6e6ef32c9903d403f12bba063f5b9176.git")
+noextract=("nwclientgold.tar.gz" "nwclienthotu.tar.gz" "English_linuxclient169_xp2.tar.gz" "setup_nwn_diamond_$pkgver-1.bin" "nvn_KingmakerSetup.zip")
+
+DLAGENTS+=('gogdownloader::/usr/bin/lgogdownloader --download-file=%u -o %o')
+
+md5sums=('cd809b9d22022adb01b0d1d70c5afa8e'
+ 'ce60bf104cc6082fe79d6f0bd7b48f51'
+ '57be8c593db88db6b6ee78ba9201ec53'
+ '0a059d55225fc32f905e86191d88a11f'
+ '376cdece07106ea058d42b531f3146bb'
+ 'b021f0da3b3e00848521926716fdf487'
+ 'SKIP'
+ '3a7fa617a2aa8d324bb4d57dcf84cf8c'
+ 'SKIP'
+ 'SKIP'
+ 'SKIP'
+ 'SKIP'
+ 'SKIP'
+ 'SKIP')
+
+prepare()
+{
+ # Extract gog setup
+ innoextract -e $srcdir/setup_nwn_diamond_${pkgver}.exe -d $srcdir --gog || return 1
+
+ # Extract Kingmaker installer
+ unzip -o $srcdir/nvn_KingmakerSetup.zip -d $srcdir || return 1
+
+ # Extract game icons
+ if [ -d $srcdir/icons ]; then
+ rm -r $srcdir/icons
+ fi
+ mkdir $srcdir/icons
+ icotool -x -p 0 $srcdir/game/goggame-1207658890.ico -o $srcdir/icons
+
+ # Extract Kingmaker files
+ 7z x -y $srcdir/KingmakerSetup.exe -xr'!$PLUGINSDIR' -xr'!*.exe' -xr'!*.dat' -o$srcdir/kingmakertmp/ || return 1
+
+ # Patch nwlogger so that it finds sys/user.h
+ /bin/sed -i 's|linux/user.h|sys/user.h|1' $srcdir/nwlogger/nwlogger/nwlogger_cookie.c
+
+ cp nwmouse_install.pl.patch $srcdir/nwmouse/nwmouse
+ cd $srcdir/nwmouse/nwmouse
+ patch < nwmouse_install.pl.patch
+}
+
+build()
+{
+ # Compile mwmovies
+ cd $srcdir/nwmovies
+ ./nwmovies_install.pl build
+
+ # Compile nwuser
+ cd $srcdir/nwuser
+ ./nwuser_install.pl
+
+ # Compile nwmouse
+ cd $srcdir/nwmouse
+ ./nwmouse_install.pl
+
+ # Compile nwlogger
+ cd $srcdir/nwlogger
+ ./nwlogger_install.pl
+
+ cd $srcdir/6e6ef32c9903d403f12bba063f5b9176
+ gcc -m32 -fPIC -shared -o nwmain-list-modes.so nwmain-list-modes.c
+}
+
+package()
+{
+ cd $srcdir
+
+ # Create final directory
+ install -d $pkgdir/opt/nwn
+
+ # Move game files to directory
+ cd game
+ rsync -aR ambient data dmvault hak localvault modules movies music nwm texturepacks premium chitin.key dialog.tlk xp1.key xp2.key $pkgdir/opt/nwn
+
+ # Extract linux clients
+ tar zxfv $srcdir/nwclientgold.tar.gz --directory $pkgdir/opt/nwn
+ tar zxvf $srcdir/nwclienthotu.tar.gz --directory $pkgdir/opt/nwn
+
+ # Install Kingmaker files
+ rsync -av $srcdir/kingmakertmp/\$0/ $pkgdir/opt/nwn
+
+ # Extract latest patch
+ tar zxvf $srcdir/English_linuxclient169_xp2.tar.gz --directory $pkgdir/opt/nwn
+
+ # Check installation
+ cd $pkgdir/opt/nwn
+ ./fixinstall
+
+ # Included SDL is old and buggy. Get rid of it.
+ rm -r $pkgdir/opt/nwn/SDL-1.2.5/
+
+ # Install nwmovies binaries
+ install -D -m 755 $srcdir/nwmovies.so $pkgdir/opt/nwn/nwmovies.so
+ # Install libdis binaries
+ install -D -m 755 $srcdir/nwmovies/libdis/libdisasm.so $pkgdir/opt/nwn/libdis/libdisasm.so
+
+ # Install nwuser binaries
+ install -D -m 755 $srcdir/nwuser.so $pkgdir/opt/nwn/nwuser.so
+ if [ "$CARCH" = "x86_64" ]; then
+ install -D -m 755 $srcdir/nwuser64.so $pkgdir/opt/nwn/nwuser64.so
+ fi
+
+ # Install nwmouse binaries
+ install -D -m 755 $srcdir/nwmouse/nwmouse.so $pkgdir/opt/nwn/nwmouse.so
+ # Install libdis binaries
+ install -D -m 755 $srcdir/nwmouse/nwmouse/libdis/libdisasm.so $pkgdir/opt/nwn/nwmouse/libdis/libdisasm.so
+
+ # Install nwlogger binaries
+ install -D -m 755 $srcdir/nwlogger/nwlogger.so $pkgdir/opt/nwn/nwlogger.so
+ # Install libdis binaries
+ install -D -m 755 $srcdir/nwlogger/nwlogger/libdis/libdisasm.so $pkgdir/opt/nwn/nwlogger/libdis/libdisasm.so
+
+ install -D -m 755 $srcdir/6e6ef32c9903d403f12bba063f5b9176/nwmain-list-modes.so $pkdir/opt/nwn/nwmain-list-modes.so
+
+ # Copy cdkey
+ cp $srcdir/support/app/nwncdkey.ini $pkgdir/opt/nwn
+
+ # Copy custom license
+ install -D -m 644 $srcdir/game/docs/readme.txt $pkgdir/usr/share/licenses/$pkgname/PLATINUM_LICENSE.txt
+ install -D -m 644 $srcdir/game/docs/HotUreadme.txt $pkgdir/usr/share/licenses/$pkgname/HOTU_LICENSE.txt
+ install -D -m 644 $srcdir/game/docs/SoUreadme.txt $pkgdir/usr/share/licenses/$pkgname/SOU_LICENSE.txt
+
+ # Install .desktop file
+ install -D -m 644 $srcdir/nwn.desktop $pkgdir/usr/share/applications/nwn.desktop
+
+ # Install launcher
+ install -D -m 755 $srcdir/nwn.launcher $pkgdir/opt/nwn/nwn.sh
+ install -D -m 755 $srcdir/nwn.launcher $pkgdir/usr/bin/nwn
+
+ # Install icons files
+ install -D -m 644 $srcdir/icons/goggame-1207658890_6_256x256x32.png $pkgdir/usr/share/icons/hicolor/256x256/apps/nwn.png
+ install -D -m 644 $srcdir/icons/goggame-1207658890_7_48x48x32.png $pkgdir/usr/share/icons/hicolor/48x48/apps/nwn.png
+ install -D -m 644 $srcdir/icons/goggame-1207658890_8_32x32x32.png $pkgdir/usr/share/icons/hicolor/32x32/apps/nwn.png
+ install -D -m 644 $srcdir/icons/goggame-1207658890_9_16x16x32.png $pkgdir/usr/share/icons/hicolor/16x16/apps/nwn.png
+
+ # Fix Permissions, just to be sure
+ chown -R $USER:$USER $pkgdir
+ chmod -R 755 $pkgdir
+}
+
diff --git a/nwn-gog/nwmouse_install.pl.patch b/nwn-gog/nwmouse_install.pl.patch
new file mode 100644
index 0000000..7aef238
--- /dev/null
+++ b/nwn-gog/nwmouse_install.pl.patch
@@ -0,0 +1,13 @@
+diff --git a/nwmouse_install.pl b/nwmouse_install.pl
+index 51b0988..44ca784 100755
+--- a/nwmouse_install.pl
++++ b/nwmouse_install.pl
+@@ -54,7 +54,7 @@ $command = sprintf("%s %s %s -I%s/libdis -g -fPIC -shared -Wl,-soname,libdisasm.
+ printf("NOTICE: NWMouse: Executing: %s\n", $command);
+ system($command);
+
+-$command = sprintf("%s %s %s -shared -g -I/usr/include/libelf -I%s/libdis -o %s/nwmouse.so %s/nwmouse_cookie.c %s/nwmouse_link.S %s/nwmouse_link2.S %s/nwmouse.c %s -ldl -lelf -Xlinker -L/usr/X11R6/lib -lXcursor -lSDL",
++$command = sprintf("%s %s %s -shared -g -I/usr/include/libelf -I%s/libdis -o %s/nwmouse.so %s/nwmouse_cookie.c %s/nwmouse_link.S %s/nwmouse_link2.S %s/nwmouse.c %s -ldl -lelf -Xlinker -L/usr/X11R6/lib -lXcursor -lSDL -Wno-error=incompatible-pointer-types",
+ $gcc, $cflags, $x86_64, $ndir, $ndir, $ndir, $ndir, $ndir, $ndir, $ldflags );
+
+ printf("NOTICE: NWMouse: Executing: %s\n", $command);
diff --git a/nwn-gog/nwn.desktop b/nwn-gog/nwn.desktop
new file mode 100644
index 0000000..265b7f1
--- /dev/null
+++ b/nwn-gog/nwn.desktop
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Categories=Game;
+Comment=A Forgotten Realms CRPG
+Exec=/usr/bin/nwn
+Icon=nwn
+Name=Neverwinter Nights
+NoDisplay=false
+StartupNotify=true
+Terminal=false
+Type=Application
diff --git a/nwn-gog/nwn.install b/nwn-gog/nwn.install
new file mode 100644
index 0000000..a8a06af
--- /dev/null
+++ b/nwn-gog/nwn.install
@@ -0,0 +1,31 @@
+post_install() {
+ if [ -x usr/bin/xdg-icon-resource ]; then
+ usr/bin/xdg-icon-resource forceupdate --theme hicolor 2> /dev/null
+ fi
+
+ echo "The first few times nwn is run will configure the various linux modules"
+ echo "Keep running the game until you see the Atari logo."
+ echo ""
+ echo "Game state and any saved games are stored in ~/.nwn. This is also where"
+ echo "you should store any mods that you download."
+ echo ""
+ echo "Please note that the gamespy master server for online multiplayer is down."
+ echo "To bypass the master server timeout when opening the multiplayer menu, edit your hosts file like so:"
+ echo " echo '199.193.152.27 nwmaster.bioware.com # SkywingL\'s substitute listing server' >> /etc/hosts"
+ echo " echo '198.23.165.35 nwn.master.gamespy.com # Visavent\'s gamespy replacement' >> /etc/hosts"
+ echo "Visit http://www.neverwinternights.info/builders_hosts.htm and http://www.nwnlist.com for details."
+}
+
+post_upgrade() {
+ post_install
+}
+
+post_remove() {
+ rm -rf /opt/nwn
+ if [ -x usr/bin/xdg-icon-resource ]; then
+ usr/bin/xdg-icon-resource forceupdate --theme hicolor 2> /dev/null
+ fi
+
+ echo "When nwn is run many files are stored in ~/.nwn including any save games."
+ echo "That folder can be removed manually."
+}
diff --git a/nwn-gog/nwn.launcher b/nwn-gog/nwn.launcher
new file mode 100644
index 0000000..57c02ce
--- /dev/null
+++ b/nwn-gog/nwn.launcher
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# Create user directory if it doesn't exist
+if [ ! -d "$HOME/.nwn/" ]; then
+ mkdir $HOME/.nwn/
+fi
+
+cd "/opt/nwn"
+
+# Uncomment to make SDL sound work on software mixers
+#export SDL_AUDIODRIVER=esd
+export SDL_MOUSE_RELATIVE=0
+export SDL_VIDEO_X11_DGAMOUSE=0
+
+# Hardware mouse cursor
+export XCURSOR_PATH=/opt/nwn
+export XCURSOR_THEME=nwmouse
+
+# Enable AA on NVidia cards
+# 3 = 1.5 x 1.5 super sampling
+# 4 = 2x2 super sampling
+export __GL_FSAA_MODE=4
+
+export LD_PRELOAD=./nwuser.so:./nwuser64.so:./nwmouse.so:./nwmovies.so:./nwlogger.so:./nwmain-list-modes.so
+
+export LD_LIBRARY_PATH=./miles:$LD_LIBRARY_PATH
+#run the game, allowing for executable flags
+./nwmain $@
|