Server Totals
Mikona - (1)
Le'Or - (1)
Elysia - (1)
Ferrell - (0)
M'Chek - (0)
Deglos - (0)
Wilderness - (0)
Visimontium - (0)
Underdark - (0)
Total players: 3
Gallery

Links Menu

Installing NWN on Linux

General discussion about Avlis

Moderators: Nighthawk4, Dungeon Masters

Re: Installing NWN on Linux

PostAuthor: Nighthawk4 » Mon Oct 22, 2012 8:56 pm

It seems Linux now does not like USB devices on my laptop. I unplugged the USB mouse and it booted into Ubuntu. Never had any problems before on the laptop, even with Linux. Odd X:|

Unfortunately, the Wireless Connection does not work. I edited the settings and created a Wireless Connection and added the SSID and password, but it still doesn't connect. Still working on that. Didn't have any problem with that on PCLinuxOS either. It seems Ubuntu is not quite as wonderful and user-friendly as advertised :wink:
Life is never as bad as you think it is, although that doesn't help at the time.

Orleron wrote:I think it's a fun idea if you can idiot-proof it. Problem is God always builds a better idiot. :P


Please visit:
Avlis UK, ACE Forum and SATF Forum

Image
User avatar
Nighthawk4
Eldest DM
Eldest DM
 
Posts: 23898
Images: 2
Joined: Fri Feb 07, 2003 8:32 pm
Location: The Home of the Bard of Avon
Timezone: GMT
DM Avatar: DruEl

Re: Installing NWN on Linux

PostAuthor: Faeldridge » Tue Oct 23, 2012 9:47 pm

What kind of wireless chip is it? Some of the odd ones (like broadcom or nvidia chips) require some linux firmware to run properly. It is just another package to install, basically, if it is required. Sounds worse than it is.
User avatar
Faeldridge
Scholar of Fools
 
Posts: 451
Joined: Tue May 24, 2005 11:47 pm

Re: Installing NWN on Linux

PostAuthor: Nighthawk4 » Tue Oct 23, 2012 10:48 pm

Think it is this - Broadcom 802.11g BCM4318

I seem to recall using ndiswrapper before, but that was with PCLinuxOS long ago X:|
Life is never as bad as you think it is, although that doesn't help at the time.

Orleron wrote:I think it's a fun idea if you can idiot-proof it. Problem is God always builds a better idiot. :P


Please visit:
Avlis UK, ACE Forum and SATF Forum

Image
User avatar
Nighthawk4
Eldest DM
Eldest DM
 
Posts: 23898
Images: 2
Joined: Fri Feb 07, 2003 8:32 pm
Location: The Home of the Bard of Avon
Timezone: GMT
DM Avatar: DruEl

Re: Installing NWN on Linux

PostAuthor: S_N » Sat Oct 27, 2012 8:04 pm

Linux tweaks? Well, that prompted me to clean up my nwn startup script, and it's got a log rotator even if you don't use any of the plugins.
Everything after a # is a comment, and if you look trough it, you can see some commented stuff I only use when testing freshly compiled drivers.

It might be a bit daunting if you are new to bash scripts, or not at all. Let me know which it is, and I'll tailor the explanation. :-)

Code: Select all
#!/bin/bash
# This script runs Neverwinter Nights from the current directory

#### This is afaik lecacy junk ####
#export SDL_VIDEO_X11_DGAMOUSE=0
###################################

#### Sound variables for SDL ######
#export SDL_AUDIODRIVER=alsa
export SDL_AUDIODRIVER=pulse
###################################

#### nwmouse.so specific ##########
export SDL_MOUSE_RELATIVE=0
export XCURSOR_PATH=`pwd`
export XCURSOR_THEME=nwmouse
###################################

#### Plugins to use ###############
#PLUGINS="nwmouse.so:vidmode.so:noshader.so"
PLUGINS="nwmouse.so:vidmode.so"
###################################

#### Paths where to find stuff ####
#export DRIVER=/opt/projects/mesa/lib  # Testing drivers.
#export LD_LIBRARY_PATH=./miles:$DRIVER:$LD_LIBRARY_PATH  # Testing drivers
export LD_LIBRARY_PATH=./miles:$LD_LIBRARY_PATH #
###################################

#### Date log rotator, part 1 #####
rm logs/nwclientLog*  # Temp. logs
touch logs/nwclientLog{1,2,3,4}.txt
###################################

#### Starting NWN #################
LD_PRELOAD=$PLUGINS force_s3tc_enable=true ./nwmain $@ &
#INTEL_HIZ=0 LIBGL_DRIVERS_PATH=$DRIVER LD_PRELOAD=$PLUGINS force_s3tc_enable=true ./nwmain $@ &
###################################

#### Date log rotator, part 2 #####
sleep 2  # Allow nwmain to start.
tail --pid=$(pidof nwmain) -f -q logs/nwclientLog{1,2,3,4}.txt | python logparse.py >> logs/$(date +%Y-%m-%d).log&
###################################


Basically, what's not included is
logparse.py A python script that prettifies the log output to my liking.

nwmouse.so Using a hardware accelerated mouse pointer was necessary to avoid lag at one point of time. http://home.roadrunner.com/~nwmovies/nwmouse/ for details. I suspect the computers are responsive enough to do the software pointers now, but it's still a nice addition.

noshader.so This started as a hack by me to disable shaders, and then David Greaves improved on it. I don't think it's needed anymore, but Intel drivers has(had?) a tendency to make stuff metallic without it.

vidmode.so This is my own, use-any-resolution, in windowed mode. Want to stretch it over two or more screen? Should work. (Don't remember who tested this) My preferred resolution at the moment is apparently 1202x1200.

There is also a plugin to get the in-game video for single player working, but I could never compile it correctly.
User avatar
S_N
Team Member; Retired with Honors
 
Posts: 452
Joined: Tue Feb 09, 2010 3:21 pm
Location: Scandinavia
Timezone: UTC+1
DM Avatar: Ingoren

Re: Installing NWN on Linux

PostAuthor: S_N » Sat Oct 27, 2012 8:28 pm

This is videomodes.c source to build vidmode.so plugin/hack to NWN.
Code: Select all
/*
 * Linux LD_PRELOAD wrapper for Neverwinter Nights
 *
 * Allows custom windowsize of nwn when running in windowed mode.
 * Use at own risk, written by Joel Forsberg. Permission to spread
 * or modify as per GPLv3 or later. (as if anybody care about such a
 * hack as this =)
 *
 * Contact email joelfo@kth.se or via nwn forums (SubspaceJeol).
 *
 * To compile:
 *   gcc --shared  videomodes.c -lSDL $(pkg-config --cflags --libs glib-2.0) -o vidmode.so
 *
 * To use:
 *   Place the restulting vidmode.so in the same directory as nwmain,
 *   then modify how you call nwmain inside your script to use it with LD_PRELOAD.
 *
 *   Here's an example using both nwmouse and vidmode:
 *   LD_PRELOAD=nwmouse.so:vidmode.so ./nwmain $@
 *
 *   Then lastly, setup nwn.ini under the section Display Options so that:
 *   Fullscreen = 0
 *   AllowWindowedMode = 1
 *   Then modify the values for Heigt and Width to your liking, 1204 x 721 for instance.
 *
 * More info:
 *   Neverwinter night will not accept any resolution more narrow than 600 in heght,
 *   and going below 800 in width is possible, but will cause clipping of the GUI of
 *   the game
 */

#define _GNU_SOURCE
#include <SDL/SDL.h>
#include <dlfcn.h>
#include <stdlib.h>
#include <glib.h>


static SDL_Rect mymode;
static int windowmode = 0;

SDL_Rect** SDL_ListModes(SDL_PixelFormat* fmt, Uint32 flags) {
    void configparse(void);

    SDL_Rect** modes;
    static int firstrun = 1;

    if (firstrun == 1) {
        configparse();
        firstrun = 0;
    }

    mymode.x=0;
    mymode.y=0;

    static void * (*hooked_SDL_ListModes)();
    int i=0; // Override the first, setting any other relies on list being longer.

    hooked_SDL_ListModes = (void *(*)()) dlsym(RTLD_NEXT, "SDL_ListModes");

    if (!hooked_SDL_ListModes) {
        fprintf(stderr,"Whoops, this will not work at all. Exiting. \n");
        exit(1);
    }

    struct SDL_Rect* myptr;

    modes = hooked_SDL_ListModes(fmt, flags);
    if ((int) modes == -1 && windowmode == 1) {}
    else {
        myptr = modes[i];
        myptr->h=mymode.h;
        myptr->w=mymode.w;
    }
    return modes;
}

void configparse()
 {
     int fullscreen, windowed;

  GKeyFile *keyfile;
  GKeyFileFlags flags;
  GError *error = NULL;
  gsize length;
 
  /* From tutorial */
  keyfile = g_key_file_new ();
  flags = G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS ;
 
  if (!g_key_file_load_from_file (keyfile, "nwn.ini", flags, &error))
  {
    g_error (error->message);
    return;
  }
 
  /* Read in data */
  fullscreen = g_key_file_get_integer (keyfile, "Display Options", "Fullscreen", NULL);
  windowed   = g_key_file_get_integer (keyfile, "Display Options", "AllowWindowedMode", NULL);
  if (fullscreen == 0 && windowed == 1) {
      mymode.h = g_key_file_get_integer (keyfile, "Display Options", "Height", NULL);
      mymode.w = g_key_file_get_integer (keyfile, "Display Options", "Width", NULL);
      fprintf(stderr,"Vidmode active, and parsed: FS:%d WM:%d x:%d y:%d \n", fullscreen, windowed, mymode.w ,mymode.h);
      windowmode = 1;
  }
  return;
}


I even attempted to make a build script to it, but it's just two lines that compile the .so. I think the first is using a 64-bit build host. Note: you might need to install additional development packages to compile this.
Code: Select all
gcc -m32  --shared  videomodes.c -lSDL `pkg-config --cflags --libs glib-2.0` -o vidmode.so
gcc --shared  videomodes.c -lSDL $(pkg-config --cflags --libs glib-2.0) -o vidmode.so
User avatar
S_N
Team Member; Retired with Honors
 
Posts: 452
Joined: Tue Feb 09, 2010 3:21 pm
Location: Scandinavia
Timezone: UTC+1
DM Avatar: Ingoren

Re: Installing NWN on Linux

PostAuthor: S_N » Mon Oct 29, 2012 9:26 pm

For instant master server timeouts, add this line to your /etc/hosts
Code: Select all
0.0.0.1         nwmaster.bioware.com
The tip was originally for windows, setting it to 0.0.0.0, but that is a valid address on *nix (and guessing MacOS X too)

(a suitable iptables rule works too)
User avatar
S_N
Team Member; Retired with Honors
 
Posts: 452
Joined: Tue Feb 09, 2010 3:21 pm
Location: Scandinavia
Timezone: UTC+1
DM Avatar: Ingoren

Re: Installing NWN on Linux

PostAuthor: Faeldridge » Tue Oct 30, 2012 2:18 pm

S_N wrote:For instant master server timeouts, add this line to your /etc/hosts
Code: Select all
0.0.0.1         nwmaster.bioware.com
The tip was originally for windows, setting it to 0.0.0.0, but that is a valid address on *nix (and guessing MacOS X too)

(a suitable iptables rule works too)


What a great idea!, now I don't have to hack the Bioware DNS server :wink:
User avatar
Faeldridge
Scholar of Fools
 
Posts: 451
Joined: Tue May 24, 2005 11:47 pm

Previous

Return to The Avlis Project: General Discussion

Who is online

Registered users: Bing [Bot], Google [Bot], l1t3r