Merge branch 'master' of git://github.com/peterix/dfhack into belal

develop
belal 2010-09-22 10:42:22 -04:00
commit 026a2eb94e
12 changed files with 417 additions and 115 deletions

@ -45,11 +45,12 @@ Windows
fix it :)
0.31.01 - 0.31.03 legacy
0.31.04 - 0.31.12 SDL
0.31.04 - 0.31.13 SDL
There are missing offsets but Map tools should be OK. Wait for updates...
Linux
=====
0.31.05 - 0.31.12 native.
0.31.05 - 0.31.13 native.
There are missing offsets but Map tools should be OK. Linux support is
a bit lacking, I'm working on it. All supported Windows versions
running in wine can be used with native DFHack binaries.
@ -128,6 +129,11 @@ dfcleartask
===========
Solves the problem of unusable items after reclaim by clearing the 'in_job' bit of all items.
dfweather
===========
Lets you change the current weather to 'clear sky', 'rainy' or 'snowing'. Fill those ponds without mucking around with dfliquids
:D Rain can also stop brush fires.
Your tool here
==============
Write one ;)

@ -338,35 +338,37 @@ allow for easier development of new tools.</p>
<li><a class="reference internal" href="#dfliquids" id="id9">dfliquids</a></li>
<li><a class="reference internal" href="#dfposition" id="id10">dfposition</a></li>
<li><a class="reference internal" href="#dfprospector" id="id11">dfprospector</a></li>
<li><a class="reference internal" href="#dfreveal" id="id12">dfreveal</a></li>
<li><a class="reference internal" href="#dfunstuck" id="id13">dfunstuck</a></li>
<li><a class="reference internal" href="#dfvdig" id="id14">dfvdig</a></li>
<li><a class="reference internal" href="#dfflows" id="id15">dfflows</a></li>
<li><a class="reference internal" href="#dfattachtest" id="id16">dfattachtest</a></li>
<li><a class="reference internal" href="#dfsuspend" id="id17">dfsuspend</a></li>
<li><a class="reference internal" href="#dfexpbench" id="id18">dfexpbench</a></li>
<li><a class="reference internal" href="#dfdoffsets" id="id19">dfdoffsets</a></li>
<li><a class="reference internal" href="#dfcleartask" id="id20">dfcleartask</a></li>
<li><a class="reference internal" href="#your-tool-here" id="id21">Your tool here</a></li>
<li><a class="reference internal" href="#dfprobe" id="id12">dfprobe</a></li>
<li><a class="reference internal" href="#dfreveal" id="id13">dfreveal</a></li>
<li><a class="reference internal" href="#dfunstuck" id="id14">dfunstuck</a></li>
<li><a class="reference internal" href="#dfvdig" id="id15">dfvdig</a></li>
<li><a class="reference internal" href="#dfflows" id="id16">dfflows</a></li>
<li><a class="reference internal" href="#dfattachtest" id="id17">dfattachtest</a></li>
<li><a class="reference internal" href="#dfsuspend" id="id18">dfsuspend</a></li>
<li><a class="reference internal" href="#dfexpbench" id="id19">dfexpbench</a></li>
<li><a class="reference internal" href="#dfdoffsets" id="id20">dfdoffsets</a></li>
<li><a class="reference internal" href="#dfcleartask" id="id21">dfcleartask</a></li>
<li><a class="reference internal" href="#dfweather" id="id22">dfweather</a></li>
<li><a class="reference internal" href="#your-tool-here" id="id23">Your tool here</a></li>
</ul>
</li>
<li><a class="reference internal" href="#using-the-library-as-a-developer" id="id22">Using the library as a developer</a><ul>
<li><a class="reference internal" href="#contributing-to-dfhack" id="id23">Contributing to DFHack</a><ul>
<li><a class="reference internal" href="#coding-style" id="id24">Coding style</a></li>
<li><a class="reference internal" href="#how-to-get-new-code-into-dfhack" id="id25">How to get new code into DFHack</a></li>
<li><a class="reference internal" href="#layout-for-tools" id="id26">Layout for tools</a></li>
<li><a class="reference internal" href="#modules-what-are-they" id="id27">Modules - what are they?</a></li>
<li><a class="reference internal" href="#dependencies" id="id28">Dependencies</a><ul>
<li><a class="reference internal" href="#current-internal-dependencies" id="id29">Current internal dependencies</a></li>
<li><a class="reference internal" href="#current-external-dependencies" id="id30">Current external dependencies</a></li>
<li><a class="reference internal" href="#build-time-dependencies" id="id31">Build-time dependencies</a></li>
<li><a class="reference internal" href="#using-the-library-as-a-developer" id="id24">Using the library as a developer</a><ul>
<li><a class="reference internal" href="#contributing-to-dfhack" id="id25">Contributing to DFHack</a><ul>
<li><a class="reference internal" href="#coding-style" id="id26">Coding style</a></li>
<li><a class="reference internal" href="#how-to-get-new-code-into-dfhack" id="id27">How to get new code into DFHack</a></li>
<li><a class="reference internal" href="#layout-for-tools" id="id28">Layout for tools</a></li>
<li><a class="reference internal" href="#modules-what-are-they" id="id29">Modules - what are they?</a></li>
<li><a class="reference internal" href="#dependencies" id="id30">Dependencies</a><ul>
<li><a class="reference internal" href="#current-internal-dependencies" id="id31">Current internal dependencies</a></li>
<li><a class="reference internal" href="#current-external-dependencies" id="id32">Current external dependencies</a></li>
<li><a class="reference internal" href="#build-time-dependencies" id="id33">Build-time dependencies</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#memory-offset-definitions" id="id32">Memory offset definitions</a></li>
<li><a class="reference internal" href="#memory-offset-definitions" id="id34">Memory offset definitions</a></li>
</ul>
</div>
</div>
@ -395,11 +397,12 @@ functionality. If you know how to easily suspend processes, you can
fix it :)</p>
</div>
<p>0.31.01 - 0.31.03 legacy
0.31.04 - 0.31.12 SDL</p>
0.31.04 - 0.31.13 SDL
There are missing offsets but Map tools should be OK. Wait for updates...</p>
</div>
<div class="section" id="linux">
<h2><a class="toc-backref" href="#id6">Linux</a></h2>
<p>0.31.05 - 0.31.12 native.
<p>0.31.05 - 0.31.13 native.
There are missing offsets but Map tools should be OK. Linux support is
a bit lacking, I'm working on it. All supported Windows versions
running in wine can be used with native DFHack binaries.</p>
@ -433,53 +436,62 @@ temperatures (creating heat traps). You've been warned.</p>
<h2><a class="toc-backref" href="#id11">dfprospector</a></h2>
<p>Lists all available minerals on the map and how much of them there is.</p>
</div>
<div class="section" id="dfprobe">
<h2><a class="toc-backref" href="#id12">dfprobe</a></h2>
<p>Can be used to determine tile properties.</p>
</div>
<div class="section" id="dfreveal">
<h2><a class="toc-backref" href="#id12">dfreveal</a></h2>
<h2><a class="toc-backref" href="#id13">dfreveal</a></h2>
<p>Reveals the whole map, waits for input and hides it again. If you close
the tool while it waits, the map remains revealed.</p>
</div>
<div class="section" id="dfunstuck">
<h2><a class="toc-backref" href="#id13">dfunstuck</a></h2>
<h2><a class="toc-backref" href="#id14">dfunstuck</a></h2>
<p>Use if you prematurely close any of the tools and DF appears to be
stuck.</p>
</div>
<div class="section" id="dfvdig">
<h2><a class="toc-backref" href="#id14">dfvdig</a></h2>
<h2><a class="toc-backref" href="#id15">dfvdig</a></h2>
<p>Designates a whole vein for digging. Point the cursor at a vein and run
this thing :)</p>
</div>
<div class="section" id="dfflows">
<h2><a class="toc-backref" href="#id15">dfflows</a></h2>
<h2><a class="toc-backref" href="#id16">dfflows</a></h2>
<p>A tool for checking how many liquid tiles are actively checked for
flows.</p>
</div>
<div class="section" id="dfattachtest">
<h2><a class="toc-backref" href="#id16">dfattachtest</a></h2>
<h2><a class="toc-backref" href="#id17">dfattachtest</a></h2>
<p>Test of the process attach/detach mechanism.</p>
</div>
<div class="section" id="dfsuspend">
<h2><a class="toc-backref" href="#id17">dfsuspend</a></h2>
<h2><a class="toc-backref" href="#id18">dfsuspend</a></h2>
<p>Test of the process suspend/resume mechanism.</p>
</div>
<div class="section" id="dfexpbench">
<h2><a class="toc-backref" href="#id18">dfexpbench</a></h2>
<h2><a class="toc-backref" href="#id19">dfexpbench</a></h2>
<p>Just a simple benchmark of the data export speed.</p>
</div>
<div class="section" id="dfdoffsets">
<h2><a class="toc-backref" href="#id19">dfdoffsets</a></h2>
<h2><a class="toc-backref" href="#id20">dfdoffsets</a></h2>
<p>Dumps the offsets for the currently running DF version into the terminal.</p>
</div>
<div class="section" id="dfcleartask">
<h2><a class="toc-backref" href="#id20">dfcleartask</a></h2>
<h2><a class="toc-backref" href="#id21">dfcleartask</a></h2>
<p>Solves the problem of unusable items after reclaim by clearing the 'in_job' bit of all items.</p>
</div>
<div class="section" id="dfweather">
<h2><a class="toc-backref" href="#id22">dfweather</a></h2>
<p>Lets you change the current weather to 'clear sky', 'rainy' or 'snowing'. Fill those ponds without mucking around with dfliquids
:D Rain can also stop brush fires.</p>
</div>
<div class="section" id="your-tool-here">
<h2><a class="toc-backref" href="#id21">Your tool here</a></h2>
<h2><a class="toc-backref" href="#id23">Your tool here</a></h2>
<p>Write one ;)</p>
</div>
</div>
<div class="section" id="using-the-library-as-a-developer">
<h1><a class="toc-backref" href="#id22">Using the library as a developer</a></h1>
<h1><a class="toc-backref" href="#id24">Using the library as a developer</a></h1>
<p>The library is compilable under Linux with GCC and under Windows with
MinGW32 and MSVC compilers. It is using the cmake build system. See
COMPILE for details.</p>
@ -490,17 +502,17 @@ the dfhack repository is welcome and the right thing to do :)</p>
code does have a lot of comments though (and getting better all the
time).</p>
<div class="section" id="contributing-to-dfhack">
<h2><a class="toc-backref" href="#id23">Contributing to DFHack</a></h2>
<h2><a class="toc-backref" href="#id25">Contributing to DFHack</a></h2>
<p>Several things should be kept in mind when contributing to DFHack.</p>
<div class="section" id="coding-style">
<h3><a class="toc-backref" href="#id24">Coding style</a></h3>
<h3><a class="toc-backref" href="#id26">Coding style</a></h3>
<p>DFhack uses ANSI formatting and four spaces as indentation. Line
endings are UNIX. The files use UTF-8 encoding. Code not following this
won't make me happy, because I'll have to fix it. There's a good chance
I'll make <em>you</em> fix it ;)</p>
</div>
<div class="section" id="how-to-get-new-code-into-dfhack">
<h3><a class="toc-backref" href="#id25">How to get new code into DFHack</a></h3>
<h3><a class="toc-backref" href="#id27">How to get new code into DFHack</a></h3>
<p>You can send patches or make a clone of the github repo and ask me on
the IRC channel to pull your code in. I'll review it and see if there
are any problems. I'll fix them if they are minor.</p>
@ -510,7 +522,7 @@ this is also a good place to dump new ideas and/or bugs that need
fixing.</p>
</div>
<div class="section" id="layout-for-tools">
<h3><a class="toc-backref" href="#id26">Layout for tools</a></h3>
<h3><a class="toc-backref" href="#id28">Layout for tools</a></h3>
<p>Tools live in the tools/ folder. There, they are split into three
categories.</p>
<dl class="docutils">
@ -531,7 +543,7 @@ nasty business.</dd>
</dl>
</div>
<div class="section" id="modules-what-are-they">
<h3><a class="toc-backref" href="#id27">Modules - what are they?</a></h3>
<h3><a class="toc-backref" href="#id29">Modules - what are they?</a></h3>
<p>DFHack uses modules to partition sets of features into manageable
chunks. A module can have both client and server side.</p>
<p>Client side is the part that goes into the main library and is
@ -548,7 +560,7 @@ server, it allows accelerating the reading of map blocks.</p>
pretty fast, but needs quite a bit of care to not break.</p>
</div>
<div class="section" id="dependencies">
<h3><a class="toc-backref" href="#id28">Dependencies</a></h3>
<h3><a class="toc-backref" href="#id30">Dependencies</a></h3>
<dl class="docutils">
<dt>Internal</dt>
<dd>either part of the codebase or statically linked.</dd>
@ -560,7 +572,7 @@ dependencies for core dfhack should be either public domain or require
attribution at most. External dependencies for tools can be either
that, or any Free Software licenses.</p>
<div class="section" id="current-internal-dependencies">
<h4><a class="toc-backref" href="#id29">Current internal dependencies</a></h4>
<h4><a class="toc-backref" href="#id31">Current internal dependencies</a></h4>
<dl class="docutils">
<dt>tinyxml</dt>
<dd>used by core dfhack to read offset definitions from Memory.xml</dd>
@ -572,7 +584,7 @@ DF binaries on Linux.</dd>
</dl>
</div>
<div class="section" id="current-external-dependencies">
<h4><a class="toc-backref" href="#id30">Current external dependencies</a></h4>
<h4><a class="toc-backref" href="#id32">Current external dependencies</a></h4>
<dl class="docutils">
<dt>wide-character ncurses</dt>
<dd>used for the veinlook tool on Linux.</dd>
@ -581,7 +593,7 @@ DF binaries on Linux.</dd>
</dl>
</div>
<div class="section" id="build-time-dependencies">
<h4><a class="toc-backref" href="#id31">Build-time dependencies</a></h4>
<h4><a class="toc-backref" href="#id33">Build-time dependencies</a></h4>
<dl class="docutils">
<dt>cmake</dt>
<dd>you need cmake to generate the build system and some configuration
@ -592,7 +604,7 @@ headers</dd>
</div>
</div>
<div class="section" id="memory-offset-definitions">
<h1><a class="toc-backref" href="#id32">Memory offset definitions</a></h1>
<h1><a class="toc-backref" href="#id34">Memory offset definitions</a></h1>
<p>The files with memory offset definitions used by dfhack can be found in the
data folder.</p>
</div>

@ -674,6 +674,22 @@
</Group>
<Group name="string" description="An STL string.">
<HexValue name="sizeof" description="The total size in bytes." />
<Group name="MSVC">
<!--
MSVC++ 9 string
void * allocator
union
{
char[16] start;
char * start_ptr
}
Uint32 length
Uint32 capacity
-->
<Offset name="buffer" description="Where the buffer/pointer starts." />
<Offset name="size" description="Where the number of leters is stored (string length without 0-terminator)." />
<Offset name="capacity" description="Capacity of the buffer in letters (default=15)." />
</Group>
</Group>
<Group name="name" description="A structure used for names all over the place.">
<Offset name="first" description="Lowercase stl string with the first name. For ex. 'urist'" />
@ -885,7 +901,7 @@
<Group name="World">
<Address name="current_tick" description="Current time of the year" />
<Address name="current_year" description="Current year" />
<Address name="current_weather" description="Single byte, 0=clear, 1=raining, 2=snowing" />
<Address name="current_weather" description="5x5 array of bytes for surrounding biomes. For each: 0=clear, 1=raining, 2=snowing." />
</Group>
</Offsets>
</Base>
@ -938,6 +954,11 @@
</Group>
<Group name="string">
<HexValue name="sizeof" value="0x1C" />
<Group name="MSVC">
<Offset name="buffer" value="0x4" />
<Offset name="size" value="0x14" />
<Offset name="capacity" value="0x18" />
</Group>
</Group>
<Group name="name">
<Offset name="first" value="0x0" />
@ -1217,7 +1238,6 @@
</Group>
<Group name="Materials">
<Address name="inorganics" value="0x16B0D4C" /><!--inorganics vector = WORLD + 0x54B7C = 0x16B0D4C-->
<!--<Address name="other" value="0x16BA114" /> --> <!-- stuff like glass, coke, ... -->
<Address name="organics_all" value="0x16B0D64" /><!--WORLD + 0x54B94-->
<Address name="organics_plants" value="0x16B0D7C" /><!--plant matter, WORLD + 0x54BAC-->
<Address name="organics_trees" value="0x16B0DAC" /><!--just wood, WORLD + 0x54BDC-->
@ -1454,7 +1474,164 @@
</Group>
</Offsets>
</Version>
<Version name="v0.31.13 SDL" os="windows" base="v0.31.12 SDL">
<MD5 value="59f194b0b2103ca5df7601a01ce21280" />
<PETimeStamp value="0x4C90ADA8" />
<Offsets>
<Address name="WORLD" value="0x016425A0" />
<Group name="vector">
<HexValue name="sizeof" value="0x10" />
<Offset name="start" value="0x0" />
<!--
Vector layout in MSVC 10:
DWORD Start
DWORD End
DWORD AllocationEnd
DWORD ?
NOT FINAL, needs research
-->
</Group>
<Group name="string">
<HexValue name="sizeof" value="0x1C" />
<Group name="MSVC">
<Offset name="buffer" value="0x0" />
<Offset name="size" value="0x10" />
<Offset name="capacity" value="0x14" />
</Group>
</Group>
0x01482874 - current race
<Group name="Position">
<Address name="cursor_xyz" value="0xac77f0" />
<Address name="window_x" value="0xe42c74" />
<Address name="window_y" value="0xe70d48" />
<Address name="window_z" value="0xe70d24" />
<Address name="screen_tiles_pointer" value="0x01480684" /><!-- BAD, not a pointer! -->
<Address name="window_dims" value="0xac807c" />
</Group>
<Group name="GUI">
<Address name="pause_state" value="0x147E971" />
</Group>
<Group name="World">
<Address name="current_weather" value="0x147E948" />
</Group>
<Group name="Vegetation">
<Address name="vector" value="0x1656EFC" />
</Group>
<Group name="Maps">
<Address name="map_data" value="0x1697bdC" />
<Address name="x_count_block" value="0x1697bf4" />
<Address name="y_count_block" value="0x1697bf8" />
<Address name="z_count_block" value="0x1697bfc" />
<Address name="x_count" value="0x1697c00" />
<Address name="y_count" value="0x1697c04" />
<Address name="z_count" value="0x1697c08" />
<Address name="region_x" value="0x1697c0C" />
<!--WORLD + 0x525C8-->
<Address name="region_y" value="0x1697c10" />
<!--WORLD + 0x525CC-->
<Address name="region_z" value="0x1697c14" />
<!--WORLD + 0x525D0-->
<Address name="world_size_x" value="0x1699290" />
<Address name="world_size_y" value="0x1699292" />
<Group name="block">
<Offset name="vein_vector" value="0x08" />
<Offset name="feature_local" value="0x24 0x2C" />
<Offset name="feature_global" value="0x28 0x30" />
<Offset name="type" value="0x7A 0x009A" />
<Offset name="designation" value="0x27C 0x029C" />
<Offset name="occupancy" value="0x67C 0x069c" />
<Offset name="temperature1" value="0x157C 0x159c" />
<Offset name="temperature2" value="0x177C 0x179c" />
<Offset name="biome_stuffs" value="0x1D7C 0x1D9C" />
<Offset name="pathfinding" value="0x0D7c 0x0D9c" />
</Group>
<Group name="features">
<Group name="global">
<Address name="vector" value="0x16998e0" />
<Offset name="funcptr" value="0xD8" />
<Offset name="material" value="0x2C" />
<Offset name="submaterial" value="0x30" />
</Group>
<Group name="local">
<Address name="start_ptr" value="0x1699974" />
<Offset name="material" value="0x28" />
<Offset name="submaterial" value="0x2C" />
</Group>
</Group>
<Group name="geology">
<Address name="geoblock_vector" value="0x1699900" />
<Address name="ptr2_region_array" value="0x1699930" />
<HexValue name="region_size" value="0x5C" />
<Offset name="region_geo_index_off" value="0x58" />
<Offset name="geolayer_geoblock_offset" value="0x4" /> vector
<Offset name="type_inside_geolayer" value="0x4" /> vector
</Group>
</Group>
<Group name="Materials"> YES
<Address name="inorganics" value="0x1699f18 0x16BD0B0" />
<Address name="organics_all" value="0x1699f28 0x16BD0C8" />
<Address name="organics_trees" value="0x1699f58 0x16bd110" />
<Address name="organics_plants" value="0x1699f38 0x16bd0e0" />
<Address name="creature_type_vector" value="0x1699ffC 0x16BD204" />
<Address name="other" value="0x16C647C" /> NO!
<Group name="creature">
<Offset name="caste_vector" value="0x128" /> YES
<Offset name="extract_vector" value="0x1A08" /> YES
<Offset name="tile" value="0xE0" /> YES
<Offset name="tile_color" value="0xF6" /> YES
<Group name="caste">
<Offset name="bodypart_vector" value="0x51C" /> YES
<Offset name="attributes" value="0x5FC" /> MAYBE
<Offset name="color_modifiers" value="0xA24" /> YES
</Group>
<Group name="caste_color_mods"> YES
<Offset name="part" value="0x50" />
<Offset name="startdate" value="0x44" />
<Offset name="enddate" value="0x48" />
</Group>
<Group name="caste_bodyparts"> YES
<Offset name="id" value="0x0" />
<Offset name="category" value="0x1C" />
<Offset name="layers_vector" value="0x44" />
<Offset name="singular_vector" value="0x70" />
<Offset name="plural_vector" value="0x80" />
</Group>
</Group>
<Group name="descriptors">
<!--<Address name="vectors_start" value="0x16B9780" />--> this is crap it seems
<Offset name="rawname" value="0x0" />
<Offset name="name" value="0x3C" />
<Address name="colors_vector" value="0x169fb2c" />
<Offset name="color_r" value="0x5C" />
<Offset name="color_v" value="0x60" />
<Offset name="color_b" value="0x64" />
<Address name="all_colors_vector" value="0x169fb4c" />
</Group>
</Group>
<Group name="Constructions">
<Address name="vector"/>
<Offset name="sizeof"/>
</Group>
<Group name="Translations">
<Address name="language_vector"/>
<Address name="translation_vector"/>
<Offset name="word_table"/>
</Group>
<Group name="Vegetation">
<Address name="vector"/>
<Offset name="tree_desc_offset"/>
</Group>
<Group name="Buildings">
<Address name="buildings_vector"/>
<Offset name="building_custom_workshop_type"/>
<Address name="custom_workshop_vector"/>
<Offset name="custom_workshop_name"/>
<Offset name="custom_workshop_type"/>
</Group>
</Offsets>
</Version>
31.13 WEATHER_START 0147E94E
.-"""-.
' \
|,. ,-. | _________________________
@ -1693,6 +1870,24 @@
<!-- TODO: fix creature offsets -->
<!-- TODO: small offsets added all over the place, investigate -->
<MD5 value="4f1f988bc1b425d4193d3d8b7b0579a5" />
<Offsets>
<Group name="Creatures">
<Group name="creature" valid="verify" >
<Group name="advanced">
<Offset name="soul_vector" value="0x0524" />
<Offset name="current_soul" value="0x0530" valid="verify" />
<Offset name="labors" value="0x540" />
<Offset name="happiness" value="0x5d0" />
</Group>
</Group>
<Group name="soul" valid="verify">
<Offset name="name" value="0x0" />
<Offset name="mental" value="0x88" />
<Offset name="skills_vector" value="0x1C4" /> CHMOD
<Offset name="traits" value="0x1DC" />
</Group>
</Group>
</Offsets>
</Version>
<Version name="v0.31.10 linux" os="linux" base="v0.31.09 linux">
<MD5 value="3e7bea269018a6fb88ef53715685aa64" />
@ -1731,6 +1926,9 @@
<!-- FIXME: this could be wrong for many other versions. Investigate. -->
<Address name="pause_state" value="0x92ec65c"/>
</Group>
<Group name="Creatures">
<Address name="current_race" value="0x092ee548" />
</Group>
<Group name="Constructions">
<Address name="vector" value="0x92f30a4"/>
<Offset name="sizeof" value="0x14"/>
@ -1747,6 +1945,67 @@
</Group>
</Offsets>
</Version>
<Version name="v0.31.13 linux" os="linux" base="v0.31.12 linux" rebase="-0xB7A8">
<MD5 value="d6307bd39b6271ba89bbdd953d27c84d" />
<Offsets>
<Group name="Buildings">
<Address name="buildings_vector" value="0x92fb8e8" />
</Group>
<Group name="Constructions">
<Address name="vector" value="0x92e7904" />
</Group>
<Group name="Creatures">
<Address name="current_civ" value="0x92e2d9c" />
<Address name="current_race" value="0x92e2da8" />
<Address name="vector" value="0x92fb260" />
</Group>
<Group name="Maps">
<Address name="map_data" value="0x933a4E0" />
<Address name="x_count_block" value="0x933a4F4" />
<Address name="y_count_block" value="0x933a4F8" />
<Address name="z_count_block" value="0x933a4FC" />
<Address name="x_count" value="0x933a500" />
<Address name="y_count" value="0x933a504" />
<Address name="z_count" value="0x933a508" />
<Address name="region_x" value="0x933a50C" />
<Address name="region_y" value="0x933a510" />
<Address name="region_z" value="0x933a514" />
<Address name="world_size_x" value="0x933BB60" />
<Address name="world_size_y" value="0x933BB62" />
<Group name="features">
<Group name="global">
<Address name="vector" value="0x933C0FC" />
</Group>
<Group name="local">
<Address name="start_ptr" value="0x933C174" />
</Group>
</Group>
<Group name="geology">
<Address name="geoblock_vector" value="0x933C114" />
<Address name="ptr2_region_array" value="0x933C138" />
</Group>
</Group>
<Group name="Position">
<Address name="window_x" value="0x8ceb238" />
<Address name="window_y" value="0x8ceb23C" />
<Address name="window_z" value="0x8ceb240" />
<Address name="cursor_xyz" value="0x8b2e740" />
<Address name="window_dims" value="0x8b2ec48" />
<Address name="screen_tiles_pointer" invalid = "true" />
</Group>
<Group name="GUI">
<Address name="pause_state" value="0x92e0e90"/>
</Group>
<Group name="Vegetation">
<Address name="vector" value="0x92fbdc8" />
</Group>
<Group name="World">
<Address name="current_year" value="0x92e0da0" />
<Address name="current_tick" value="0x92e0dc0" />
<Address name="current_weather" value="0x092E0D84" />
</Group>
</Offsets>
</Version>
</DFHack>

@ -53,6 +53,9 @@ class WineProcess::Private
bool attached;
bool suspended;
bool identified;
uint32_t STLSTR_buf_off;
uint32_t STLSTR_size_off;
uint32_t STLSTR_cap_off;
bool validate(char * exe_file, uint32_t pid, char * mem_file, vector <VersionInfo *> & known_versions);
};
@ -155,6 +158,10 @@ bool WineProcess::Private::validate(char* exe_file, uint32_t pid, char* mem_file
// tell WineProcess about the /proc/PID/mem file
memFile = mem_file;
identified = true;
OffsetGroup * strGrp = m->getGroup("string")->getGroup("MSVC");
STLSTR_buf_off = strGrp->getOffset("buffer");
STLSTR_size_off = strGrp->getOffset("size");
STLSTR_cap_off = strGrp->getOffset("capacity");
return true;
}
}
@ -563,21 +570,10 @@ const std::string WineProcess::readCString (uint32_t offset)
size_t WineProcess::readSTLString (uint32_t offset, char * buffer, size_t bufcapacity)
{
/*
MSVC++ string
ptr allocator
union
{
char[16] start;
char * start_ptr
}
Uint32 length
Uint32 capacity
*/
uint32_t start_offset = offset + 4;
size_t length = readDWord(offset + 20);
uint32_t start_offset = offset + d->STLSTR_buf_off;
size_t length = readDWord(offset + d->STLSTR_size_off);
size_t capacity = readDWord(offset + d->STLSTR_cap_off);
size_t capacity = readDWord(offset + 24);
size_t read_real = min(length, bufcapacity-1);// keep space for null termination
// read data from inside the string structure
@ -597,20 +593,10 @@ size_t WineProcess::readSTLString (uint32_t offset, char * buffer, size_t bufcap
const string WineProcess::readSTLString (uint32_t offset)
{
/*
MSVC++ string
ptr allocator
union
{
char[16] start;
char * start_ptr
}
Uint32 length
Uint32 capacity
*/
uint32_t start_offset = offset + 4;
uint32_t length = readDWord(offset + 20);
uint32_t capacity = readDWord(offset + 24);
uint32_t start_offset = offset + d->STLSTR_buf_off;
size_t length = readDWord(offset + d->STLSTR_size_off);
size_t capacity = readDWord(offset + d->STLSTR_cap_off);
char * temp = new char[capacity+1];
// read data from inside the string structure

@ -48,6 +48,9 @@ class NormalProcess::Private
bool attached;
bool suspended;
bool identified;
uint32_t STLSTR_buf_off;
uint32_t STLSTR_size_off;
uint32_t STLSTR_cap_off;
};
NormalProcess::NormalProcess(uint32_t pid, vector <VersionInfo *> & known_versions)
@ -134,7 +137,10 @@ NormalProcess::NormalProcess(uint32_t pid, vector <VersionInfo *> & known_versio
vector<uint32_t> threads;
getThreadIDs( threads );
d->my_main_thread = OpenThread(THREAD_ALL_ACCESS, FALSE, (DWORD) threads[0]);
OffsetGroup * strGrp = m->getGroup("string")->getGroup("MSVC");
d->STLSTR_buf_off = strGrp->getOffset("buffer");
d->STLSTR_size_off = strGrp->getOffset("size");
d->STLSTR_cap_off = strGrp->getOffset("capacity");
found = true;
break; // break the iterator loop
}
@ -430,21 +436,9 @@ const string NormalProcess::readCString (const uint32_t offset)
size_t NormalProcess::readSTLString (uint32_t offset, char * buffer, size_t bufcapacity)
{
/*
MSVC++ string
ptr allocator
union
{
char[16] start;
char * start_ptr
}
Uint32 length
Uint32 capacity
*/
uint32_t start_offset = offset + 4;
size_t length = readDWord(offset + 20);
size_t capacity = readDWord(offset + 24);
uint32_t start_offset = offset + d->STLSTR_buf_off;
size_t length = readDWord(offset + d->STLSTR_size_off);
size_t capacity = readDWord(offset + d->STLSTR_cap_off);
size_t read_real = min(length, bufcapacity-1);// keep space for null termination
// read data from inside the string structure
@ -464,20 +458,9 @@ Uint32 capacity
const string NormalProcess::readSTLString (uint32_t offset)
{
/*
MSVC++ string
ptr allocator
union
{
char[16] start;
char * start_ptr
}
Uint32 length
Uint32 capacity
*/
uint32_t start_offset = offset + 4;
uint32_t length = readDWord(offset + 20);
uint32_t capacity = readDWord(offset + 24);
uint32_t start_offset = offset + d->STLSTR_buf_off;
size_t length = readDWord(offset + d->STLSTR_size_off);
size_t capacity = readDWord(offset + d->STLSTR_cap_off);
char * temp = new char[capacity+1];
// read data from inside the string structure

@ -605,7 +605,7 @@ bool VersionInfoFactory::loadFile(string path_to_xml)
if(name)
{
string str_name = name;
knownVersions[str_name] = v_descr (pMemInfo, NULL);
knownVersions[str_name] = v_descr (pMemInfo, (VersionInfo *) NULL);
v_sEntries.push_back(str_name);
}
}

@ -402,19 +402,23 @@ bool Materials::ReadCreatureTypesEx (void)
p->readSTLString (caste_start + sizeof_string, caste.singular, sizeof(caste.singular));
p->readSTLString (caste_start + 2 * sizeof_string, caste.plural, sizeof(caste.plural));
p->readSTLString (caste_start + 3 * sizeof_string, caste.adjective, sizeof(caste.adjective));
cout << "Caste " << caste.rawname << " " << caste.singular << ": 0x" << hex << caste_start << endl;
if(have_advanced)
{
/* color mod reading */
// Caste + offset > color mod vector
DfVector <uint32_t> p_colormod(p, caste_start + caste_colormod_offset);
sizecolormod = p_colormod.size();
caste.ColorModifier.resize(sizecolormod);
for(uint32_t k = 0; k < sizecolormod;k++)
{
// color mod [0] -> color list
DfVector <uint32_t> p_colorlist(p, p_colormod[k]);
sizecolorlist = p_colorlist.size();
caste.ColorModifier[k].colorlist.resize(sizecolorlist);
for(uint32_t l = 0; l < sizecolorlist; l++)
caste.ColorModifier[k].colorlist[l] = p_colorlist[l];
// color mod [color_modifier_part_offset] = string part
p->readSTLString( p_colormod[k] + color_modifier_part_offset, caste.ColorModifier[k].part, sizeof(caste.ColorModifier[k].part));
caste.ColorModifier[k].startdate = p->readDWord( p_colormod[k] + color_modifier_startdate_offset );
caste.ColorModifier[k].enddate = p->readDWord( p_colormod[k] + color_modifier_enddate_offset );

@ -133,12 +133,22 @@ uint32_t World::ReadCurrentDay()
uint8_t World::ReadCurrentWeather()
{
if (d->Inited && d->StartedWeather)
return(d->owner->readByte(d->weather_offset));
return(d->owner->readByte(d->weather_offset + 12));
return 0;
}
/*
void World::SetCurrentWeather(uint8_t weather)
{
if (d->Inited && d->StartedWeather)
d->owner->writeByte(d->weather_offset,weather);
}
*/
void World::SetCurrentWeather(uint8_t weather)
{
if (d->Inited && d->StartedWeather)
{
uint8_t buf[25];
memset(&buf,weather, sizeof(buf));
d->owner->write(d->weather_offset,sizeof(buf),buf);
}
}

@ -134,7 +134,7 @@ likeType printLike40d(DFHack::t_like like, const matGlosses & mat,const vector<
void printCreature(DFHack::Context * DF, const DFHack::t_creature & creature)
{
uint32_t dayoflife;
cout << "address: " << hex << creature.origin << dec << " creature type: " << Materials->raceEx[creature.race].rawname
cout << "address: " << hex << creature.origin << dec << ", creature race: " << creature.race << "/" << Materials->raceEx[creature.race].rawname
<< "[" << Materials->raceEx[creature.race].tile_character
<< "," << Materials->raceEx[creature.race].tilecolor.fore
<< "," << Materials->raceEx[creature.race].tilecolor.back
@ -172,7 +172,7 @@ void printCreature(DFHack::Context * DF, const DFHack::t_creature & creature)
if(creature.civ)
{
cout << "civilization: " << creature.civ;
cout << ", civilization: " << creature.civ;
addendl = true;
}
@ -191,7 +191,7 @@ void printCreature(DFHack::Context * DF, const DFHack::t_creature & creature)
cout << endl;
addendl = false;
}
cout << "profession: " << mem->getProfession(creature.profession) << "(" << (int) creature.profession << ")";
cout << ", profession: " << mem->getProfession(creature.profession) << "(" << (int) creature.profession << ")";
if(creature.custom_profession[0])
{

@ -311,4 +311,11 @@ bool findString (SegmentedFinder* s, uint32_t *addr, const char * compare )
return false;
}
bool findStrBuffer (SegmentedFinder* s, uint32_t *addr, const char * compare )
{
if(strcmp((const char *)addr, compare) == 0)
return true;
return false;
}
#endif // SEGMENTED_FINDER_H

@ -482,6 +482,22 @@ void FindPtrVectorsByObjectAddress(DFHack::ContextManager & DFMgr, vector <DFHac
}
}
void FindStrBufs(DFHack::ContextManager & DFMgr, vector <DFHack::t_memrange>& ranges)
{
vector <uint64_t> found;
string select;
while (Incremental(found,"buffer",select,"buffer","buffers"))
{
DFMgr.Refresh();
DFHack::Context * DF = DFMgr.getSingleContext();
DF->Attach();
SegmentedFinder sf(ranges,DF);
sf.Find< const char * ,uint32_t>(select.c_str(),1,found, findStrBuffer);
DF->Detach();
}
}
void FindStrings(DFHack::ContextManager & DFMgr, vector <DFHack::t_memrange>& ranges)
{
@ -799,12 +815,13 @@ int main (void)
string prompt =
"Select search type: 1=number(default), 2=vector by length, 3=vector>object>string,\n"
" 4=string, 5=automated offset search, 6=vector by address in its array,\n"
" 7=pointer vector by address of an object, 8=vector>first object>string\n";
" 7=pointer vector by address of an object, 8=vector>first object>string\n"
" 9=string buffers\n";
int mode;
do
{
getNumber(prompt,mode, 1, false);
} while (mode < 1 || mode > 8 );
} while (mode < 1 || mode > 9 );
switch (mode)
{
case 1:
@ -838,6 +855,10 @@ int main (void)
DF->Detach();
FindVectorByFirstObjectRawname(DFMgr, selected_ranges);
break;
case 9:
DF->Detach();
FindStrBufs(DFMgr, selected_ranges);
break;
default:
cout << "not implemented :(" << endl;
}

@ -8,6 +8,20 @@ using namespace std;
#include <DFHack.h>
#include <dfhack/modules/Gui.h>
#ifdef LINUX_BUILD
#include <unistd.h>
void waitmsec (int delay)
{
usleep(delay);
}
#else
#include <windows.h>
void waitmsec (int delay)
{
Sleep(delay);
}
#endif
struct hideblock
{
uint32_t x;
@ -48,7 +62,7 @@ int main (void)
// this here hack sets the pause state, resumes DF, waits a second for it to enter the pause (I know, BS value.) and suspends.
Gui->SetPauseState(true);
DF->Resume();
sleep(1);
waitmsec(1000);
DF->Suspend();
// init the map