PDA

View Full Version : [K1] Script Decompile Request


rgdelta
07-28-2007, 09:38 AM
I am working on my mod and I was wondering if anyone has or can do decompile all the scripts on the Endar Spire. DeNCS does not seem to fully decompile them (only get a partial on those ones).

rgdelta
07-28-2007, 11:43 AM
Sorry for the double post ignore this thread I figured out what I did wrong dencs is working right I was just being stupid :-)

I might use this threads if I find any scripts I cannot decompile

Like this one Dencs won't open just says failure the script is k_pend_traskdl31.ncs, k_pend_trastk_en.ncs, k_pend_trig03.ncs, and k_pend_trig04.ncs from the end_m01aa module

Can't put the byte code in here says it is too long

stoffe
07-28-2007, 04:09 PM
Like this one Dencs won't open just says failure the script is k_pend_traskdl31.ncs, k_pend_trastk_en.ncs, k_pend_trig03.ncs, and k_pend_trig04.ncs from the end_m01aa module

Can't put the byte code in here says it is too long

Scripts that are very long and DeNCS fails to re-create properly are in 90% of the cases including k_inc_generic.nss, the main combat AI script, in my experience. There is a fair chance that any global variables and custom functions declared in the script originates from this include file or any of its sub-includes, and thus won't need to be recreated. You'll just need to figure out which custom function is being called. In most cases it is GN_DetermineCombatRound().

You can find k_inc_generic.nss and its includes in scripts.bif with KotorTool.

rgdelta
07-28-2007, 08:27 PM
Thanks Stoffe the ones I posted the only one that would not open at all in DENCS was k_pend_traskdl31.ncs the rest had a byte code comparison issue. I am trying to read the k_pend_traskdl31.ncs and compare it with the nss/compiled of k_pend_traskdl30.ncs/nss that dencs was able to decompile but I am not good with the byte code. I did this early in the morning so I might have missed somethings. As with most of the endar spire scripts there are alot of variables/constants but no includes that I can find yet but I am still looking at it.

stoffe
07-28-2007, 08:38 PM
As with most of the endar spire scripts there are alot of variables/constants but no includes that I can find yet but I am still looking at it.

Include files only exist in the source code end of things. When a script with include files gets compiled into NCS, all the globals, and any called custom functions, from the include are compiled into the NCS script directly.

As such there is no way for DeNCS to know that the code was using include files when it reads the bytecode and re-constructs source code from it. As such all the custom functions from the include will be added as non-descript sub#() functions in the script itself.

Most of those sub#() functions are not necessary to restore since the original source code for them is already available in the game data (scripts.bif) in the form of generic include files.

Then when restoring scripts it's usually enough to try to determine if the script has any custom functions of its own, and then locate the source include file for the rest of them, delete the decompiled ones and include the include file instead.

rgdelta
07-29-2007, 02:28 AM
ok not sure what I was smoking when I said that now that you mention that I remember that lol thanks stoffe

Ok looking at what you said I understand. My problem is I cannot read byte code worth anything so that script I mentioned I am having problems trying to get I know it uses the k_inc_end include file (which has sub includes like utility and generic) so if someone could look at the byte code and see if they can decompile it would be great. I will continue to try myself but not holding my breath lol.