Hi, I am a c# developer with an interest in NWN/NWN2. I want to try and decompile/recompile the toolset - and maybe fix some bugs, etc along the way. I’ve had some success with deobfuscation and decompiling the nwn2toolset.dll as well as the launcher.dll, fixing up compile errors and building without error.
However, I get a crash (Access violation) when calling into the nwn2renderer.dll to run the renderer - this assembly contains both c# and c++ code so will not decompile in the same way (I’ve been using dotpeek and de4dot so far). My c++ knowledge is basically zero.
Is there anyone out there with the skills/knowledge to either help or tell me that what I’m trying is impossible?
9 Likes
Remember that old NWN2 toolset is a 32bit software and all the dll are compiled this way. Maybe using a 64bit compiler you try too pass a buffer to the DLL and then the DLL overwrites the boundaries of the memory (32/64 bit address location or maybe int32 vs int64 and so on). .NET will detect this condition and throw an access violation exception. This happens when the DLL makes some assumptions about the size of the memory being passed to it.
2 Likes
Have you resolved the problem? If not maybe you could post in same github repository your project and someone could help in same way. Could be awesome to have a customizable/patched toolset to work with … is a great opportunity.
2 Likes
@_jimmy1976, that’s great! I am also a C# developer. I had tried to decompile them long ago, but I wasn’t able to get something with so few missing pieces that I could fix it and compile it. What are you using to decompile those C++ dlls?
1 Like
In my opinion you don’t need to decompile the c++ dll because in NWN2 toolset the c++ dll contains the stab to the rendering engine, the rules engine that should not be touched. I will focus on decompile the C# parts only and link the old dll with that functions. When all works and you could run the decompiled toolset i will touch only the C# elements to patch it or add new functions and nothing more.
I mean, if it was possible to update the game in this way - about the memory boundaries, I mean - then that would solve a lot of issues I have sometimes, I think (crashes and whatnot). Others have claimed this is impossible…I don’t know since I’m not a programmer myself.
You could do this but you must recompile all the DLL in 64bit and without the source code is very difficult.
Compiled C# code could be decompiled in a simply way because .NET/C# use a VM not machine code to run and many software like de4dot could do this easily. Decompile a C++ DLL is a different problem because the compiled DLL is written is machine code … like assembler … and return from assembler to C++ is impossible without the symbol map.
So Maybe changing only the C# code (the toolset) without touch the DLL (the render engine) could improve the stability of the software or patch some error that use too many memory and optimize it. Another way could be use multiple 32bit thread that could access more memory … rember than NWN2 Toolset was made when multiple cores or CPU was rare and so the developer use that kind of hardware now is different …
1 Like
What type of things would people want to change in the Toolset?
I curse it daily; I could fill a book with my toolset issues.
But I wonder what you are hoping to change?
1 Like
Probably not related but I keep bumping into feats and special abilities left in the toolset from NWN1 that show badresref in-game or just don’t do anything. Even a couple items in the official content have this problem. I don’t think there is a simple way to cull these items from the toolset but I’m putting it out there just in case.
A simple improvment that i do will be create a singleton thread for every area open so the toolset is not blocked and i can create simple refer from area1 and area2 without break the toolset. Another good improvment could be a safe background process to bake the not open area so i could work to an area meanwhile the system bake the others. Other cool stuff could be a better implementation of finding an item/object by resref and so on.
2 Likes
If OP or other interested people are still there. I have started this some times ago. Some first success, just not have time to finish it currently. I will be happy to share and help though !
2 Likes
Just making it run on modern processors would be nice. Brand new out of the box i7 with an NVIDIA graphics card and the toolset won’t run.
Turned out I needed to redownload DirectX which is probably something we can’t fix in the game engine itself.