1NCSDIS(1) BSD General Commands Manual NCSDIS(1)
2
4 ncsdis — BioWare NWScript bytecode disassembler
5
7 ncsdis [options] input_file [output_file>]
8
10 ncsdis disassembles NCS files, compiled bytecode of the NWScript script‐
11 ing language used by every single Aurora engine game, except for the Nin‐
12 tendo DS game Sonic Chronicles: The Dark Brotherhood. The output, while
13 not as clear as the C-like source code that produced the bytecode, is
14 human-readable.
15
16 ncsdis is meant as a better maintainable and more complete replacement of
17 the disassembly mode found in the OpenKnights nwnnsscomp tool. As such,
18 it fixes provides these enhancements:
19 · Compilable in 64-bit mode
20 · Out of the box support for all Aurora engine games
21 · Support for array opcodes added in Dragon Age: Origins
22 · Support for reference opcodes added in Dragon Age II
23 · Knowledge of additional variable types
24 · No need to provide an external nwscript.nss file
25
26 Additionally, ncsdis can create a dot file specifying a control flow
27 graph of the disassembly. It can be plotted into a graph by the dot(1)
28 tool of the GraphViz suite.
29
30 WARNING: these graphs can get very large very quickly. To keep the
31 resulting image small, set a small font and font size when calling
32 GraphViz, and decrease the nodesep and ranksep values.
33
34 Since there is no way to automatically detect for which game this script
35 is, this information must be provided on the command. If no game is
36 specified, the ACTION opcode that call an engine function, such as
37 “GetModule” or trigonometry functions, will only display a number instead
38 of a function name.
39
41 -h
42 --help
43 Show a help text and exit.
44 --version
45 Show version information and exit.
46 --list
47 Create a full disassembly listing, including byte addresses and the
48 raw bytecode, similar to the disassembly mode of nwnnsscomp. This
49 is the default mode.
50 --assembly
51 Only create the human-readable mnemonics part of the disassembly
52 listing. Useful for modifying and extending the script.
53 --dot
54 Create a flow control graph in the dot language, to be plotted by
55 the GraphViz suite.
56 --stack
57 Print the stack frame for each instruction. Only available in list
58 or assembly mode, not in dot mode.
59 --control
60 Print detected control structures inside block nodes. Only avail‐
61 able in dot mode.
62 --nwn
63 Use engine function tables of the game Neverwinter Nights.
64 --nwn2
65 Use engine function tables of the game Neverwinter Nights 2.
66 --kotor
67 Use engine function tables of the game Star Wars: Knights of the
68 Old Republic.
69 --kotor2
70 Use engine function tables of the game Star Wars: Knights of the
71 Old Republic II – The Sith Lords.
72 --jade
73 Use engine function tables of the game Jade Empire.
74 --witcher
75 Use engine function tables of the game The Witcher.
76 --dragonage
77 Use engine function tables of the game Dragon Age: Origins.
78 --dragonage2
79 Use engine function tables of the game Dragon Age II.
80 input_file
81 The NCS file to disassemble.
82 output_file
83 The disassembly will be written there. If no output file is speci‐
84 fied, the disassembly will be written to stdout.
85
87 Disassemble the script file.ncs:
88
89 $ ncsdis file.ncs file.lst
90
91 Disassemble the script file.ncs and write the listing to stdout:
92
93 $ ncsdis file.ncs
94
95 Disassemble the Jade Empire script file.ncs:
96
97 $ ncsdis --jade file.ncs file.list
98
99 Disassemble the Jade Empire script file.ncs in pure disassembly mode:
100
101 $ ncsdis --assembly --jade file.ncs file.asm
102
103 Create a dot graph file of the Neverwinter Nights script file.ncs:
104
105 $ ncsdis --dot --nwn file.ncs file.dot
106
107 Create a dot graph file of the Neverwinter Nights script file.ncs and
108 plot it:
109
110 $ ncsdis --dot --nwn file.ncs | dot -Gnodesep=0.1 -Granksep=0.1 \
111 -Gfontname="Courier New" -Nfontname="Courier New" -Gfontsize=10 \
112 -Nfontsize=8 -Earrowsize=0.5 -Tpng > file.png
113
115 dot(1), nwnnsscomp(1)
116
117 More information about the xoreos project can be found on its website:
118 https://xoreos.org/.
119
121 This program is part of the xoreos-tools package, which in turn is part
122 of the xoreos project, and was written by the xoreos team. Please see
123 the AUTHORS file for details.
124
125BSD October 28, 2015 BSD