logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
nwnx_funcs - SetTAG Crash
Goto page 1, 2  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows technical support
View previous topic :: View next topic  
Author Message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Tue Jun 12, 2012 2:18    Post subject: nwnx_funcs - SetTAG Crash Reply with quote

Quote:

[06/12/2012 01:00:33] - StrReq: "SETTAG" Params: "ThryndirJungle1_spec"


Its being called on an Area object, the area was generated by nwnx_areas.
The Tag change is being called 5 seconds after the area is generated.

Code:

void SetSpectralSettings(object oSpectral)
{
    int iFogDone = GetLocalInt(oSpectral,"SETTINGS");
    if(!iFogDone)
    {
        SetFogColor(FOG_TYPE_ALL,0x2211EE,oSpectral);
        SetFogAmount(FOG_TYPE_ALL, GetFogAmount(FOG_TYPE_SUN,oSpectral)+20,oSpectral);
        //Set Music of the Area
        MusicBackgroundChangeDay(oSpectral,116);
        MusicBackgroundChangeNight(oSpectral,116);
        MusicBattleChange(oSpectral,99);

        SetLocalInt(oSpectral,"SETTINGS",1);
        //Now we remove all objects we dont want to be accessible in the Spectral Realm.
        ProcessSpectralRealm(oSpectral);
        NWNXFuncs_SetEventScript(oSpectral,"spectral_hb",EVENT_AREA_HEARTBEAT);
        NWNXFuncs_SetEventScript(oSpectral,"spectral_exit",EVENT_AREA_EXIT);
        //NWNXFuncs_SetEventScript(oSpectral,"spectral_enter",EVENT_AREA_ENTER);
        SetWeather(oSpectral,WEATHER_CLEAR);
        SetLocalInt(oSpectral,"SPECTRAL",1);
        AssignCommand(oSpectral,DelayCommand(5.00,NWNXFuncs_SetTag(oSpectral,GetLocalString(OBJECT_SELF,"NEW_TAG"))));
    }

}

I've tried all sorts of variations.
Delays, Assigning the command to other objects, doing it linear etc.

This one area in my module - and some others, doesnt like having its Tag Changed.

Any ideas?

I know SetTag is meant to work for areas... cause the c++ code says so.

Code:
int CNssObject::SetTag(CGameObject *oObject, char *Params) {
   CExoString sNewTag(Params);

   CGameObject *obj = oObject->AsNWSObject();
   if (obj->obj_type2 >= OBJECT_TYPE2_AREA) {
      uint32_t oID = obj->obj_id;

      CNWSModule *Mod = ((*NWN_AppManager)->app_server->srv_internal)->GetModule();
      Mod->RemoveObjectFromLookupTable(obj->obj_tag, oID);
      Mod->AddObjectToLookupTable(sNewTag, oID);

      if (obj->obj_type2 == OBJECT_TYPE2_AREA) {
         CNWSArea *Area = obj->AsNWSArea();
         Area->are_tag = sNewTag;
      }
      else {
         obj->obj_tag = sNewTag;
      }
   }
   return 1;
}


Is there any way of getting some sort of error handling in place, to find out whats causing the crash?

Faulting application nwserver.exe, version 1.6.9.0, faulting module nwnx_funcs.dll, version 0.0.9.4, fault address 0x00002e60.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Tue Jun 12, 2012 2:26    Post subject: Reply with quote

Code:

CNWSArea *CGameObject_s::AsNWSArea() {
   if (obj_type2 == OBJECT_TYPE2_AREA)
      return ((CNWSArea*)((char*)this-0xC4));
   return NULL;
}


Noticing that there is a specific function for returning objects as Area type objects.
Perhaps because this isnt being done in the SetTag function, the Tag modification isnt working because it isnt taking into consideration the -0xC4 offset?

Grasping?
Back to top
View user's profile Send private message
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Wed Jun 13, 2012 7:07    Post subject: Reply with quote

Does it only crash with dynamically created areas? And are they copies of an existing area or loaded through resman?
I'm not sure how stable the areas plugin is; actually I can't even get it to load for some reason
Code:

* An error occured while loading extension areas (14001: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. )

Also my resman plugin has some memory leaks; I'm using the one which can work with subdirectories but I don't have any sourcecode for it.

Quote:

Noticing that there is a specific function for returning objects as Area type objects.
Perhaps because this isnt being done in the SetTag function, the Tag modification isnt working because it isnt taking into consideration the -0xC4 offset?

Actually this part in SetTag should take care of that
Code:

if (obj->obj_type2 == OBJECT_TYPE2_AREA) {
         CNWSArea *Area = obj->AsNWSArea();
         Area->are_tag = sNewTag;
      }
Back to top
View user's profile Send private message Send e-mail MSN Messenger
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Wed Jun 13, 2012 7:22    Post subject: Reply with quote

I've uploaded a version of funcs to sourceforge with the debug symbols intact. Much easier to pin down the error in IDA that way.
Could you use it and let me know the faulting address?
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Wed Jun 13, 2012 17:36    Post subject: I will have a go Reply with quote

I will give the debug symbols version a try

The SetTag function works with like 95% of the areas in my module.
There is no pattern as to generated or non-generated areas.
But I have noticed that this area, Thryndir Jungle (tag Thryndir001) - fails 100% of the time.

I am wondering if I could export the area to erf, and send to you, and see if you get the same issues?

I think there are areas in my module, that continuously dont work, At first, I thought maybe the string length of the tag was too long, but then I noticed that im not breeching hte 32 character length in this instance.
I am elsewhere, and not causing crashes.
Because I have 700 areas, and this code only fires when a player dies and respawns to the spirit realm, which then copies the area, and sets its tag, I just dont know all the areas that it fails on.
I do know the Thryndir Jungle area is one that fails 100% of the time, so I can use it for testing.
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Wed Jun 13, 2012 17:39    Post subject: Reply with quote

MaxRock wrote:
Does it only crash with dynamically created areas? And are they copies of an existing area or loaded through resman?
I'm not sure how stable the areas plugin is; actually I can't even get it to load for some reason
Code:

* An error occured while loading extension areas (14001: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. )

Also my resman plugin has some memory leaks; I'm using the one which can work with subdirectories but I don't have any sourcecode for it.

Quote:

Noticing that there is a specific function for returning objects as Area type objects.
Perhaps because this isnt being done in the SetTag function, the Tag modification isnt working because it isnt taking into consideration the -0xC4 offset?

Actually this part in SetTag should take care of that
Code:

if (obj->obj_type2 == OBJECT_TYPE2_AREA) {
         CNWSArea *Area = obj->AsNWSArea();
         Area->are_tag = sNewTag;
      }



I managed to fix the
Quote:

* An error occured while loading extension areas (14001: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. )


I had to put some files local to my nwnx installation.
two folders I had to drag to my nwn directory to resolve the areas issue were named

x86_Microsoft.VC90.CRT_alotofhexcharactershere
x86_policy.9.0.Microsoft.VC90.CRT_alotofhexcharactershere

I think these were in the windows directory - cant remember exactly where.
But once I put these folders local to nwnx, it fixed the same message u were seeing.
Back to top
View user's profile Send private message
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Thu Jun 14, 2012 0:46    Post subject: Reply with quote

Quote:

am wondering if I could export the area to erf, and send to you, and see if you get the same issues?

You can email it to me if you want.

Quote:

I had to put some files local to my nwnx installation.
two folders I had to drag to my nwn directory to resolve the areas issue were named

x86_Microsoft.VC90.CRT_alotofhexcharactershere
x86_policy.9.0.Microsoft.VC90.CRT_alotofhexcharactershere

I think these were in the windows directory - cant remember exactly where.
But once I put these folders local to nwnx, it fixed the same message u were seeing.

Thanks for the tip
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Fri Jun 15, 2012 11:35    Post subject: Reply with quote

it will be a while before I can try this.

I busted the network capability of my new motherboard, so its gonna be a day or so before I can get round to installing my old motherboard, and hoping that it works.
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Sun Jun 17, 2012 2:26    Post subject: Reply with quote

Quote:

Faulting application nwserver.exe, version 1.6.9.0, faulting module nwnx_funcs.dll, version 0.0.9.5, fault address 0x000038c0.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.


Managed to replicate the crash using your debug symbols inclusive dll.

The details up above was in the windows event viewer.
I will work on getting a copy of the area to you tomorrow, incase that helps with tracking the source of the problem.
Back to top
View user's profile Send private message
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Mon Jun 18, 2012 1:34    Post subject: Reply with quote

The problem seems to be in my implementation of CExoString

I wasn't able to really pinpoint the problem, but I've made a few changes (after discovering a few new things about copy consturctors) and added a few more debug messages.
The nwnx_funcs in the debug directory on sourceforge is updated with these.

Make sure the funcs' debuglevel is set to 4 or higher.
Can you use it to run your module again? And post the nwnx_funcs log?
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Mon Jun 18, 2012 2:12    Post subject: cool Reply with quote

Cool,
Its just after 1 am here, and I have a player online at the moment.

I will update my funcs to match the source forge copy tomorrow, and send you the result.
I also got the area exported for you.
I will PM a link to it for you.

I tried to trim down the scripts attached to it, but some are still in the package.

To reproduce the issue,
Duplicate / Load a new area using this area
Then set tag on the new area.
Back to top
View user's profile Send private message
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Mon Jun 18, 2012 5:41    Post subject: Reply with quote

Got the area. And the "good" news is it crashes for me too.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Mon Jun 18, 2012 6:09    Post subject: Reply with quote

I think I got it.

v 0.0.941
Fixed a bug in SetTag where RemoveObjectFromLookupTable was using the gameobjects tag instead of the area's tag
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Mon Jun 18, 2012 8:56    Post subject: Reply with quote

Awesome.
My players will b glad to find that they can make more frequent use of the spectral realm now.
Thx again for the debug.

Wonder why other people didnt see the issue, and why it only happened on some areas?
I was starting to worry the area was corrupt.
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Mon Jun 18, 2012 13:03    Post subject: Im having difficulty Reply with quote

Im having trouble compiling the latest sources.

Quote:

1> StdAfx.cpp
1> CNWNXCreature.cpp
1>CNWNXCreature.cpp(41): error C3861: 'GetIsPossessedFamiliar': identifier not found
1>CNWNXCreature.cpp(51): error C2039: 'GetLevelStats' : is not a member of 'CNWSCreatureStats_s'
1> c:\users\n0202869\documents\nwnx2-win32\branches\maxrock\include\.\CNWSCreatureStats.h(6) : see declaration of 'CNWSCreatureStats_s'


Best I can tell, the function for GetLevelStats exists in the Utility class, but I cant find any definition of GetIsPossessedFamiliar.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows technical support All times are GMT + 2 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group