Open Shad000w opened 1 year ago
A lot of those are virtual/overridden functions and those don't work correctly when hooked using ClassName::FunctionName, you'll need to hook the mangled name instead, a bunch of them are defined in FunctionsLinux.hpp already, the others you can grab from the server binary using nm
Here is an example: https://github.com/nwnxee/unified/blob/master/Plugins/Events/Events/EffectEvents.cpp#L23
Ok I see,
Maybe I am doing it wrong, but nm reports "no symbols". Can you be a bit more specific how can I grab the addresses from binary?
Ok I see,
Maybe I am doing it wrong, but nm reports "no symbols". Can you be a bit more specific how can I grab the addresses from binary?
nm -D
. e.g.:
~/.steam/debian-installation/steamapps/common/Neverwinter Nights/bin/linux-x86$ nm -D nwserver-linux | grep UpdateAttributesOnEffect
00000000003b8650 W _ZN10CNWSObject24UpdateAttributesOnEffectEP11CGameEffecti
000000000033f390 T _ZN12CNWSCreature24UpdateAttributesOnEffectEP11CGameEffecti
I see. I was trying it on dedicated server which is probably compiled in a way to hide it.
When I used that on development full install binary it worked. Thanks.
So I guess this solved all my problems.
These functions throw segfault at startup when hooked:
CNWSObjectGetDamageImmunity CNWSObjectDoDamageImmunity CNWSObjectDoDamageResistance CNWSObjectDoDamageReduction CNWSCreatureEventHandler CNWSTriggerEventHandler CNWSDoorEventHandler CNWSCreatureGetMaxHitPoints CNWSEffectListHandlerOnEffectApplied CNWSEffectListHandlerOnEffectRemoved
I updated the API and changed the respective argument variable types, but only a few of these functions had a change in arguments so I don't think it is error on my side. I tried to add one more argument to GetDamageImmunity to see if anything changes, but it didn't work either.
Additionally there are 3 functions that are causing segmentation failure, but not crashing the server. These were doing it in previous NWN-EE versions as well, however in previous versions I could simply edit the function address and fix the issue.
CNWSCreatureUpdateAttributesOnEffect +28 CNWSEffectListHandlerOnApplyWounding +10 CNWSCreature__ActivityManager +16
The number behind the function is the value I added to the previous function address to make it work properly. Without that, the hook didn't fire. I have no idea how to do this in this new hooking style though.