Wanting to read NCS files more easily has driven me to begin this project to decompile NCS bytecode. I present the NCS Decompiler.
I have not even nearly completed this project, but it does exist in such a form to produce some code output to give a general sense of the code.
I have written this from scratch, so it doesn't yet have the libraries to extract from the NWN game files. It uses Python 2, but with Python 2's End-of-Life approaching in 2020, we will eventually upgrade to Python 3.
To run:
python 'NCS Decompile.py' -n path/to/nwscript.nss < path/to/input.ncs > path/to/output.nss
Attachment | Size |
---|---|
![]() | 17.24 KB |
Hello I have an error when I try to decompile a script :
File "NCS decompile.py", line 137, in <module>
main(fIn, fOut, (-1 if args.nwsfile == '-' else args.nwsfile))
File "NCS decompile.py", line 48, in main
routines = routine_start.all_subroutines(map_lines)
File "/home/clement/Téléchargements/ncs_decompilation_0/nwscript/routine.py", line 161, in all_subroutines
inst.apply(tracker, lambda s: s) # For 'emit', do nothing
File "/home/clement/Téléchargements/ncs_decompilation_0/nwscript/instructions.py", line 343, in apply
args.append(tracker.pop())
File "/home/clement/Téléchargements/ncs_decompilation_0/nwscript/instructions.py", line 101, in pop
t, v = self.stack_local.pop()
IndexError: pop from empty list
How to use that,i don't know anything about coding。
@zjkingmask are you qzpm on Steam?
yep.