Skip to content

nwnlinux/nwuser

Repository files navigation

Various bits of public info:

This wraps LOTS of file and directory functions to impliment per user settings inside of NWN.

All "written" files get relocated from ~nwn/dir1/dir2/file to $HOME/.nwn/dir1/dir2/file

If a file exists in $HOME/.nwn/dir/file, then that file is used in preference to the real file in ~nwn.

Theoretically you could burn a copy of a fresh NWN install to DVD, use this library, and play straight from DVD, however, I have not verified this. (If you do, please let me know one way or the other)

This too is very much a kludge. (IMHO) With the actual source, I'm sure I could do better, but as I'm not a Bioware employee, I find that highly unlikely.

Standard Legal Shtuff:

I do not guarentee this to work on any computer, except my own. If it should some how allow all the magic smoke to escape your computer, well tough. You were warned. Avoid swimming for at least three hours after using this product.

What little bit of this that is copyrightable is copywritten: David Holland [email protected].
You may do what you wish with this code so long as some credit is given to me, and the copyright is maintained.

If someone would like to send me better installation instructions, I'll gladly update the package with them. Along with any code updates.

Flames will be redirected to /dev/null. As will testy bug reports. Friendly bug reports will be examined as time permits.

----> enough disclaimers <----

Things required: gcc, Perl, if building on x86_64, you will need 32bit development libraries.

  1. Unpack the tarball in your NWN directory.

  2. execute ./nwuser/nwuser_install.pl

  3. modify your 'nwn' startup script to include the following line:

export LD_PRELOAD=./nwuser.so

You will also need ./nwuser64 if on 64bits (x86_64) ex: export LD_PRELOAD=./nwuser.so:./nwuser64.so

before executing nwmain

If your using nwmovies, the line should look something like so:

export LD_PRELOAD=./nwmovies.so:./nwuser.so:./nwuser64.so

  1. You may wish to do something similar for the dmclient startup script.

  2. Enjoy..

  3. There is a bit of a log file in $HOME/.nwn/nwuser.log. You may wish to modify your nwn startup script to remove it occasionally.

    It is only created if you turn on some debugging cruft I left in the source code by setting NWU_VERBOSE.

    The various logging levels correspond to: (from code.h - See the code for more details. )

#define NWU_LOG_OPENDIR 0x01 /* opendir/readdir/closedir / #define NWU_LOG_OPEN 0x02 / open/fopen / #define NWU_LOG_MKDIR 0x04 / mkdir / #define NWU_LOG_RMDIR 0x08 / rmdir / #define NWU_LOG_UNLINK 0x10 / unlink / #define NWU_LOG_STAT 0x20 / xstat/lxstat / #define NWU_LOG_CHDIR 0x40 / chdir / #define NWU_DEBUG_OPENDIR 0x80 / debug out of opendir() replacement / #define NWU_DEBUG_PATHING 0x100 / debugging of pathing changes */

So to log rmdirs, and open's, one would set NWU_VERBOSE=10 (0x8 + 0x2)

----> Known Issues <-----

None known.

10/14/2024 START NOTES

Code updates to quiet warnings when building on more modern distributions. There are no functionality changes.

I will caution this has VERY MINIMAL testing, please use the v1.0 release, ignore the warnings while building, and submit an issue via GitHub if this does not work for you.

10/14/2024 END NOTES

08/02/2004 START NOTES

Updates to call the initialization function, should one of NWUsers override functions be called before complete initialization occurs. This is known to affect SuSE 9.1, and probably anything else that uses that SELinux stuff. (whatever it is.)

08/02/2004 END NOTES

09/07/2004 START NOTES

Nasty bug found WRT chapter changes, and the way NWN opens its databases w/ absolute pathing. (Thanks to Belegdol for finding it. - I think :) ) Apparently nobody's using this code, as its been out for quite some time, and nboody's noticed this till now.

09/07/2004 END NOTES

10/04/2004 START NOTES

Sigh, the 09/07/2004 updates broke something that I've yet to see myself, nor be able to track down. This release is to let loose some debugging code to hopefully track the problem down.

See nwuser.DEBUG.txt for more details.

10/04/2004 END NOTES

10/05/2004 START NOTES

With the help of 'alanswanson' from the forum's I've tracked down a logic error inside of NWUser that would cause a crash during NWN startup. This code contains the fix.

10/05/2004 END NOTES

05/24/2006 START NOTES

Added more debugging stuff

05/24/2006 END NOTES

01/23/2008 START NOTES

This code also has debugging to log the various reads/writes if you're attempting ot modify the code for other purposes.

Verified against 1.67&1.69b2, and updated for x86_64.

My thanks to Erydan and Skildron for their help getting this to work on x86_64.

On x86_64, you will get various errors out of ld.so stating things like:

ERROR: ld.so: object './nwmovies.so' from LD_PRELOAD cannot be preloaded: ignored.

It has to do w/ ld.so only has one LD_PRELOAD variable for both 32bit, and 64bit if your running a 64bit binary, you can't use a 32bit preload, and vice versa. Ignore them.

01/23/2008 END NOTES

David Holland 01/23/08 [email protected]