<h2><aclass="toc-backref"href="#id5">How to get the code</a></h2>
<p>DFHack doesn't have any kind of system of code snapshots in place, so you will have to get code from the github repository using git.
Having a 'git' package installed is the minimal requirement, but some sort of git gui or git integration for your favorite text editor/IDE will certainly help.</p>
<p>If you just want to compile DFHack or work on it by contributing patches, it's quite enough to clone from the read-only address:</p>
<preclass="literal-block">
git clone git://github.com/peterix/dfhack.git
cd dfhack
git submodule init
git submodule update
</pre>
<p>If you want to get really involved with the development, create an account on github, make a clone there and then use that as your remote repository instead. Detailed instructions are beyond the scope of this document. If you need help, join us on IRC (#dfhack channel on freenode).</p>
<h2><aclass="toc-backref"href="#id9">How to get the code</a></h2>
<p>DFHack doesn't have any kind of system of code snapshots in place, so you will have to get code from the github repository using git.
You will need some sort of Windows port of git, or a GUI. Some examples:</p>
<blockquote>
<ulclass="simple">
<li><aclass="reference external"href="http://code.google.com/p/msysgit/">http://code.google.com/p/msysgit/</a> - this is a command line version of git for windows. Most tutorials on git usage will apply.</li>
<li><aclass="reference external"href="http://code.google.com/p/tortoisegit/">http://code.google.com/p/tortoisegit/</a> - this puts a pretty, graphical face on top of msysgit :)</li>
<p>If you just want to compile DFHack or work on it by contributing patches, it's quite enough to clone from the read-only address:</p>
<preclass="literal-block">
git clone git://github.com/peterix/dfhack.git
cd dfhack
git submodule init
git submodule update
</pre>
<p>The tortoisegit GUI should have the equivalent options included.</p>
<p>If you want to get really involved with the development, create an account on github, make a clone there and then use that as your remote repository instead. Detailed instructions are beyond the scope of this document. If you need help, join us on IRC (#dfhack channel on freenode).</p>
<p>If you already have a different version of perl (for example the one from cygwin), you can run into some trouble. Either remove the other perl install from PATH, or install libxml and libxslt for it instead. Strawberry perl works though and has all the required packages.</p>
<p>There are several different batch files in the <ttclass="docutils literal">build</tt> folder along with a script that's used for picking the DF path.</p>
<p>First, run set_df_path.vbs and point the dialog that pops up at your DF folder that you want to use for development.
Next, run one of the scripts with <ttclass="docutils literal">generate</tt> prefix. These create the MSVC solution file(s):</p>
<ulclass="simple">
<li><ttclass="docutils literal">all</tt> will create a solution with everything enabled (and the kitchen sink).</li>
<li><ttclass="docutils literal">gui</tt> will pop up the cmake gui and let you pick and choose what to build. This is probably what you want most of the time. Set the options you are interested in, then hit configure, then generate. More options can appear after the configure step.</li>
<li><ttclass="docutils literal">minimal</tt> will create a minimal solution with just the bare necessities - the main library and standard plugins.</li>
</ul>
<p>Then you can either open the solution with MSVC or use one of the msbuild scripts:</p>
<ulclass="simple">
<li>Scripts with <ttclass="docutils literal">build</tt> prefix will only build.</li>
<li>Scripts with <ttclass="docutils literal">install</tt> prefix will build DFHack and install it to the previously selected DF path.</li>
<li>Scripts with <ttclass="docutils literal">package</tt> prefix will build and create a .zip package of DFHack.</li>
</ul>
<p>When you open the solution in MSVC, make sure you never use the Debug builds. Those aren't
<p>The most important parts of DFHack are the Core, Console, Modules and Plugins.</p>
<ulclass="simple">
<li>Core acts as the centerpiece of DFHack - it acts as a filter between DF and SDL and synchronizes the various plugins with DF.</li>
<li>Console is a thread-safe console that can be used to invoke commands exported by Plugins.</li>
<li>Modules actually describe the way to access information in DF's memory. You can get them from the Core. Most modules are split into two parts: high-level and low-level. Higl-level is mostly method calls, low-level publicly visible pointers to DF's data structures.</li>
<li>Plugins are the tools that use all the other stuff to make things happen. A plugin can have a list of commands that it exports and an onupdate function that will be called each DF game tick.</li>
</ul>
<p>Rudimentary API documentation can be built using doxygen (see build options with <ttclass="docutils literal">ccmake</tt> or <ttclass="docutils literal"><spanclass="pre">cmake-gui</span></tt>).</p>
<p>DFHack consists of variously licensed code, but invariably weak copyleft.
The main license is zlib/libpng, some bits are MIT licensed, and some are BSD licensed.</p>
<p>Feel free to add your own extensions and plugins. Contributing back to
<h2><aclass="toc-backref"href="#id14">DF data structure definitions</a></h2>
<p>DFHack uses information about the game data structures, represented via xml files in the library/xml/ submodule.</p>
<p>Data structure layouts are described in files following the df.*.xml name pattern. This information is transformed by a perl script into C++ headers describing the structures, and associated metadata for the Lua wrapper. These headers and data are then compiled into the DFHack libraries, thus necessitating a compatibility break every time layouts change; in return it significantly boosts the efficiency and capabilities of DFHack code.</p>
<p>Global object addresses are stored in symbols.xml, which is copied to the dfhack release package and loaded as data at runtime.</p>
<p>DFHack supports remote access by exchanging Google protobuf messages via a TCP socket. Both the core and plugins can define remotely accessible methods. The <ttclass="docutils literal"><spanclass="pre">dfhack-run</span></tt> command uses this interface to invoke ordinary console commands.</p>
<p>Currently the supported set of requests is limited, because the developers don't know what exactly is most useful.</p>
<p>Protocol client implementations exist for Java and C#.</p>