v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

Difference between revisions of "40d:Memory hacking"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
(Creature vector address)
Line 1: Line 1:
== New string format ==
+
== Versions ==
 +
See the following subpages for version specific information
 +
 
 +
* [[Memory hacking/v0.27.169.33a|v0.27.169.33a]]
 +
 
 +
== Data Types ==
 +
=== New string format ===
  
 
{|  border="1" cellpadding="2" width="100%"
 
{|  border="1" cellpadding="2" width="100%"
Line 15: Line 21:
 
Yes, the first two items overlap. This is correct. This is the MSVC Express string format - Toady appears to be using standard C++ structures pretty much everywhere.
 
Yes, the first two items overlap. This is correct. This is the MSVC Express string format - Toady appears to be using standard C++ structures pretty much everywhere.
  
== Vector format ==
+
=== Vector format ===
  
 
{|  border="1" cellpadding="2" width="100%"
 
{|  border="1" cellpadding="2" width="100%"
Line 25: Line 31:
 
|-
 
|-
 
|0x08 || 4 || Array end || (End - Start)/4 = # of elements
 
|0x08 || 4 || Array end || (End - Start)/4 = # of elements
|}
 
 
== Attention! ==
 
We need to be very clear about what version(s) these addresses apply to.  Please list version numbers along with addresses.
 
 
== Addresses for 27.169.33a ==
 
 
{| border="1" cellpadding="2" width="100%"
 
! width="25%" | Name
 
! width="50%" | Notes
 
! width="25%" | Address
 
 
|-
 
| colspan="3" | '''Useful Variables'''
 
 
|-
 
| Art defacement malus
 
| normally -1000 (18 FC FF FF)
 
| 0079DC2F
 
 
|-
 
| Current Year
 
|
 
| 00C34378
 
 
|-
 
| Dwarf Race ID
 
| As in the race identifier in the [[#Creature Structure]]
 
| 01237AD0 (probably)
 
 
|-
 
| Creature Vector
 
| There are actually multiple creature vectors, but this has all of them.
 
| 01416A3C
 
 
|}
 
 
== Creature Structure ==
 
 
Appears to be still valid in version 27.169.33a (keep this updated when things don't seem to shift around)
 
 
Structure Offsets:
 
{|  border="1" cellpadding="2" width="100%"
 
| Offset || Size || Type || Description
 
|-
 
|0x00 || 4 || Vptr || Virtual function table pointer
 
|-
 
|0x04 || 24 || First name || See above string format
 
|-
 
|0x32 || 4 || Surname word 1 || No part of speech, like in the old structure
 
|-
 
|0x36 || 4 || Surname word 2 ||
 
|-
 
|0x70 || 24 || Custom profession name || See above string format
 
|-
 
|0x88 || 2 || Type ID #1 || rowspan="2"| Dwarf types. 0x88 is the original dwarf type, 0x8a is the current dwarf type (I'm told Toady stores the original dwarf type for legends). The key is in the "Type ID" table, woefully incomplete.
 
|-
 
|0x8a || 2 || Type ID #2
 
|-
 
|0x8C || 4 || Creature Race || A6 is the dwarf default (this may be different if the user has a mod installed)
 
|-
 
|0xAC || 2 || X Coordinate || Cells east of the west side
 
|-
 
|0xAE || 2 || Y Coordinate || Cells south of the north side
 
|-
 
|0xB0 || 2 || Z Coordinate || Levels up from the bottom level
 
|-
 
|0xe4 || 4 || Flags || (1 << 1) Unclear. It is set on dead things. Also, when a merchant caravan arrives, merchants and guards are added to the entity list slightly before they are added to the "u" list - during this period, this bit is set.
 
|-
 
|0xe8 || 4 || Flags || (1 << 7) Appears to be whether or not the creature is dead.
 
(1 << 17) if creature is ready for slaughter
 
|-
 
|0x1F8 || 2 || Strange mood || 0xFFFF means no mood
 
|-
 
|0x41C || 4 || Strength || 0 to 5
 
|-
 
|0x420 || 4 || Agility || 0 to 5
 
|-
 
|0x424 || 4 || Toughness || 0 to 5
 
|-
 
|0x42C || 4 || Skill Start Ptr || Start of skill list
 
|-
 
|0x430 || 4 || Skill End Ptr || End of skill list
 
|-
 
|0x458 || 102 || Labor preferences || 102 1 byte values, corresponding to the profession list. Mostly bools, with notable exceptions of shieldtype,armortype, and weaponnum. I have No idea what the last one means.
 
|-
 
|0x504 || 4 || Happiness level || 0 = miserable, >149 = ecstatic
 
|-
 
 
|}
 
|}
  
Line 122: Line 40:
 
| ID || Meaning
 
| ID || Meaning
 
|-
 
|-
|0x00 || Miner
+
| <code>0x00</code> || Miner
 
|-
 
|-
|0x01 || Woodworker
+
| <code>0x01</code> || Woodworker
 
|-
 
|-
|0x02 || Carpenter
+
| <code>0x02</code> || Carpenter
 
|-
 
|-
|0x03 || Bowyer
+
| <code>0x03</code> || Bowyer
 
|-
 
|-
|0x04 || Woodcutter
+
| <code>0x04</code> || Woodcutter
 
|-
 
|-
|0x05 || Stoneworker
+
| <code>0x05</code> || Stoneworker
 
|-
 
|-
|0x06 || Engraver
+
| <code>0x06</code> || Engraver
 
|-
 
|-
|0x07 || Mason
+
| <code>0x07</code> || Mason
 
|-
 
|-
|0x08 || Ranger
+
| <code>0x08</code> || Ranger
 
|-
 
|-
|0x09 || Animal Caretaker
+
| <code>0x09</code> || Animal Caretaker
 
|-
 
|-
|0x0A || Animal Trainer
+
| <code>0x0A</code> || Animal Trainer
 
|-
 
|-
|0x0B || Hunter
+
| <code>0x0B</code> || Hunter
 
|-
 
|-
|0x0C || Trapper
+
| <code>0x0C</code> || Trapper
 
|-
 
|-
|0x0D || Animal Dissector
+
| <code>0x0D</code> || Animal Dissector
 
|-
 
|-
|0x0E || Metalsmith
+
| <code>0x0E</code> || Metalsmith
 
|-
 
|-
|0x0F || Furnace Operator
+
| <code>0x0F</code> || Furnace Operator
 
|-
 
|-
|0x10 || Weaponsmith
+
| <code>0x10</code> || Weaponsmith
 
|-
 
|-
|0x11 || Armorer
+
| <code>0x11</code> || Armorer
 
|-
 
|-
|0x12 || Blacksmith
+
| <code>0x12</code> || Blacksmith
 
|-
 
|-
|0x13 || Metalcrafter
+
| <code>0x13</code> || Metalcrafter
 
|-
 
|-
|0x14 || Jeweler
+
| <code>0x14</code> || Jeweler
 
|-
 
|-
|0x15 || Gem Cutter
+
| <code>0x15</code> || Gem Cutter
 
|-
 
|-
|0x16 || Gem Setter
+
| <code>0x16</code> || Gem Setter
 
|-
 
|-
|0x17 || Craftsman
+
| <code>0x17</code> || Craftsman
 
|-
 
|-
|0x18 || Woodcrafter
+
| <code>0x18</code> || Woodcrafter
 
|-
 
|-
|0x19 || Stonecrafter
+
| <code>0x19</code> || Stonecrafter
 
|-
 
|-
|0x1A || Leatherworker
+
| <code>0x1A</code> || Leatherworker
 
|-
 
|-
|0x1B || Bone Carver
+
| <code>0x1B</code> || Bone Carver
 
|-
 
|-
|0x1C || Weaver
+
| <code>0x1C</code> || Weaver
 
|-
 
|-
|0x1D || Clothier
+
| <code>0x1D</code> || Clothier
 
|-
 
|-
|0x1E || Glassmaker
+
| <code>0x1E</code> || Glassmaker
 
|-
 
|-
|0x1F || Strand Extractor
+
| <code>0x1F</code> || Strand Extractor
 
|-
 
|-
|0x20 || Queen
+
| <code>0x20</code> || Queen
 
|-
 
|-
|0x21 || Queen Consort
+
| <code>0x21</code> || Queen Consort
 
|-
 
|-
|0x22 || Fishery Worker
+
| <code>0x22</code> || Fishery Worker
 
|-
 
|-
|0x23 || Fisherman
+
| <code>0x23</code> || Fisherman
 
|-
 
|-
|0x24 || Fish Dissector
+
| <code>0x24</code> || Fish Dissector
 
|-
 
|-
|0x25 || Fish Cleaner
+
| <code>0x25</code> || Fish Cleaner
 
|-
 
|-
|0x26 || Farmer
+
| <code>0x26</code> || Farmer
 
|-
 
|-
|0x27 || Cheese Maker
+
| <code>0x27</code> || Cheese Maker
 
|-
 
|-
|0x28 || Milker
+
| <code>0x28</code> || Milker
 
|-
 
|-
|0x29 || Cook
+
| <code>0x29</code> || Cook
 
|-
 
|-
|0x2A || Thresher
+
| <code>0x2A</code> || Thresher
 
|-
 
|-
|0x2B || Miller
+
| <code>0x2B</code> || Miller
 
|-
 
|-
|0x2C || Butcher
+
| <code>0x2C</code> || Butcher
 
|-
 
|-
|0x2D || Tanner
+
| <code>0x2D</code> || Tanner
 
|-
 
|-
|0x2E || Dyer
+
| <code>0x2E</code> || Dyer
 
|-
 
|-
|0x2F || Planter
+
| <code>0x2F</code> || Planter
 
|-
 
|-
|0x30 || Herbalist
+
| <code>0x30</code> || Herbalist
 
|-
 
|-
|0x31 || Brewer
+
| <code>0x31</code> || Brewer
 
|-
 
|-
|0x32 || Soap Maker
+
| <code>0x32</code> || Soap Maker
 
|-
 
|-
|0x33 || Potash Maker
+
| <code>0x33</code> || Potash Maker
 
|-
 
|-
|0x34 || Lye Maker
+
| <code>0x34</code> || Lye Maker
 
|-
 
|-
|0x35 || Wood Burner
+
| <code>0x35</code> || Wood Burner
 
|-
 
|-
|0x36 || Engineer
+
| <code>0x36</code> || Engineer
 
|-
 
|-
|0x37 || Mechanic
+
| <code>0x37</code> || Mechanic
 
|-
 
|-
|0x38 || Seige Engineer
+
| <code>0x38</code> || Seige Engineer
 
|-
 
|-
|0x39 || Seige Operator
+
| <code>0x39</code> || Seige Operator
 
|-
 
|-
|0x3A || Pump Operator
+
| <code>0x3A</code> || Pump Operator
 
|-
 
|-
|0x3B || Clerk
+
| <code>0x3B</code> || Clerk
 
|-
 
|-
|0x3C || Administrator
+
| <code>0x3C</code> || Administrator
 
|-
 
|-
|0x3D || Trader
+
| <code>0x3D</code> || Trader
 
|-
 
|-
|0x3E || Architect
+
| <code>0x3E</code> || Architect
 
|-
 
|-
|0x3F || Alchemist
+
| <code>0x3F</code> || Alchemist
 
|-
 
|-
|0x40 || Tax Collector
+
| <code>0x40</code> || Tax Collector
 
|-
 
|-
|0x41 || Hammerer
+
| <code>0x41</code> || Hammerer
 
|-
 
|-
|0x42 || Baroness
+
| <code>0x42</code> || Baroness
 
|-
 
|-
|0x43 || Countess
+
| <code>0x43</code> || Countess
 
|-
 
|-
|0x44 || Duchess
+
| <code>0x44</code> || Duchess
 
|-
 
|-
|0x45 || Baroness Consort
+
| <code>0x45</code> || Baroness Consort
 
|-
 
|-
|0x46 || Countess Consort
+
| <code>0x46</code> || Countess Consort
 
|-
 
|-
|0x47 || Duchness Consort
+
| <code>0x47</code> || Duchness Consort
 
|-
 
|-
|0x48 || Philosopher
+
| <code>0x48</code> || Philosopher
 
|-
 
|-
|0x49 || Advisor
+
| <code>0x49</code> || Advisor
 
|-
 
|-
|0x4A || Dungeon Master
+
| <code>0x4A</code> || Dungeon Master
 
|-
 
|-
|0x4B || Merchant
+
| <code>0x4B</code> || Merchant
 
|-
 
|-
|0x4C || Diplomat
+
| <code>0x4C</code> || Diplomat
 
|-
 
|-
|0x4D || Guild Representative
+
| <code>0x4D</code> || Guild Representative
 
|-
 
|-
|0x4E || Merchant Baroness
+
| <code>0x4E</code> || Merchant Baroness
 
|-
 
|-
|0x4F || Merchant Princes
+
| <code>0x4F</code> || Merchant Princes
 
|-
 
|-
|0x50 || Outpose Liason
+
| <code>0x50</code> || Outpose Liason
 
|-
 
|-
|0x51 || Druid
+
| <code>0x51</code> || Druid
 
|-
 
|-
|0x52 || Champion
+
| <code>0x52</code> || Champion
 
|-
 
|-
|0x53 || Hammerman
+
| <code>0x53</code> || Hammerman
 
|-
 
|-
|0x54 || Hammer Lord
+
| <code>0x54</code> || Hammer Lord
 
|-
 
|-
|0x55 || Spearman
+
| <code>0x55</code> || Spearman
 
|-
 
|-
|0x56 || Spearmaster
+
| <code>0x56</code> || Spearmaster
 
|-
 
|-
|0x57 || Crossbowman
+
| <code>0x57</code> || Crossbowman
 
|-
 
|-
|0x58 || Elite Crossbowman
+
| <code>0x58</code> || Elite Crossbowman
 
|-
 
|-
|0x59 || Wrestler
+
| <code>0x59</code> || Wrestler
 
|-
 
|-
|0x5A || Elite Wrestler
+
| <code>0x5A</code> || Elite Wrestler
 
|-
 
|-
|0x5B || Axeman
+
| <code>0x5B</code> || Axeman
 
|-
 
|-
|0x5C || Axe Lord
+
| <code>0x5C</code> || Axe Lord
 
|-
 
|-
|0x5D || Swordsman
+
| <code>0x5D</code> || Swordsman
 
|-
 
|-
|0x5E || Swordmaster
+
| <code>0x5E</code> || Swordmaster
 
|-
 
|-
|0x5F || Maceman
+
| <code>0x5F</code> || Maceman
 
|-
 
|-
|0x60 || Mace Lord
+
| <code>0x60</code> || Mace Lord
 
|-
 
|-
|0x61 || Pikeman
+
| <code>0x61</code> || Pikeman
 
|-
 
|-
|0x62 || Pikemaster
+
| <code>0x62</code> || Pikemaster
 
|-
 
|-
|0x63 || Bowman
+
| <code>0x63</code> || Bowman
 
|-
 
|-
|0x64 || Elite Bowman
+
| <code>0x64</code> || Elite Bowman
 
|-
 
|-
|0x65 || Blowgunner
+
| <code>0x65</code> || Blowgunner
 
|-
 
|-
|0x66 || Elite Blowgunner
+
| <code>0x66</code> || Elite Blowgunner
 
|-
 
|-
|0x67 || Recruit
+
| <code>0x67</code> || Recruit
 
|-
 
|-
|0x68 || Hunting creature
+
| <code>0x68</code> || Hunting creature
 
|-
 
|-
|0x69 || War creature
+
| <code>0x69</code> || War creature
 
|-
 
|-
|0x6A || Master Thief
+
| <code>0x6A</code> || Master Thief
 
|-
 
|-
|0x6B || Thief
+
| <code>0x6B</code> || Thief
 
|-
 
|-
|0x6C || Peasant or creature
+
| <code>0x6C</code> || Peasant or creature
 
|-
 
|-
|0x6D || Child
+
| <code>0x6D</code> || Child
 
|-
 
|-
|0x6E || Baby
+
| <code>0x6E</code> || Baby
 
|-
 
|-
|0x6F || Drunk
+
| <code>0x6F</code> || Drunk
 
|-
 
|-
|0x70 || Lasher
+
| <code>0x70</code> || Lasher
|-
 
|0x71 || Master Lasher
 
 
|-
 
|-
 +
| <code>0x71</code> || Master Lasher
 
|}
 
|}
  
 
== Profession list ==
 
== Profession list ==
 
Obviously could do with some formatting.
 
 
 
  PROFESSION_MINE,
 
  PROFESSION_MINE,
 
  PROFESSION_HAUL_STONE,
 
  PROFESSION_HAUL_STONE,

Revision as of 23:28, 4 November 2007

Versions

See the following subpages for version specific information

Data Types

New string format

Offset Size Type Description
0x00 16 Character buffer Holds the string data if capacity < 16
0x00 4 Character pointer Points to the string data if capacity >= 16
0x10 4 Length Current length of the string
0x14 4 Capacity Current capacity of the string buffer (also indicates which mode the string is in)

Yes, the first two items overlap. This is correct. This is the MSVC Express string format - Toady appears to be using standard C++ structures pretty much everywhere.

Vector format

Offset Size Type Description
0x00 4 vtable (not useful)
0x04 4 Array start
0x08 4 Array end (End - Start)/4 = # of elements

Type ID list

Most likely incomplete, but this was all that could be found so far.

ID Meaning
0x00 Miner
0x01 Woodworker
0x02 Carpenter
0x03 Bowyer
0x04 Woodcutter
0x05 Stoneworker
0x06 Engraver
0x07 Mason
0x08 Ranger
0x09 Animal Caretaker
0x0A Animal Trainer
0x0B Hunter
0x0C Trapper
0x0D Animal Dissector
0x0E Metalsmith
0x0F Furnace Operator
0x10 Weaponsmith
0x11 Armorer
0x12 Blacksmith
0x13 Metalcrafter
0x14 Jeweler
0x15 Gem Cutter
0x16 Gem Setter
0x17 Craftsman
0x18 Woodcrafter
0x19 Stonecrafter
0x1A Leatherworker
0x1B Bone Carver
0x1C Weaver
0x1D Clothier
0x1E Glassmaker
0x1F Strand Extractor
0x20 Queen
0x21 Queen Consort
0x22 Fishery Worker
0x23 Fisherman
0x24 Fish Dissector
0x25 Fish Cleaner
0x26 Farmer
0x27 Cheese Maker
0x28 Milker
0x29 Cook
0x2A Thresher
0x2B Miller
0x2C Butcher
0x2D Tanner
0x2E Dyer
0x2F Planter
0x30 Herbalist
0x31 Brewer
0x32 Soap Maker
0x33 Potash Maker
0x34 Lye Maker
0x35 Wood Burner
0x36 Engineer
0x37 Mechanic
0x38 Seige Engineer
0x39 Seige Operator
0x3A Pump Operator
0x3B Clerk
0x3C Administrator
0x3D Trader
0x3E Architect
0x3F Alchemist
0x40 Tax Collector
0x41 Hammerer
0x42 Baroness
0x43 Countess
0x44 Duchess
0x45 Baroness Consort
0x46 Countess Consort
0x47 Duchness Consort
0x48 Philosopher
0x49 Advisor
0x4A Dungeon Master
0x4B Merchant
0x4C Diplomat
0x4D Guild Representative
0x4E Merchant Baroness
0x4F Merchant Princes
0x50 Outpose Liason
0x51 Druid
0x52 Champion
0x53 Hammerman
0x54 Hammer Lord
0x55 Spearman
0x56 Spearmaster
0x57 Crossbowman
0x58 Elite Crossbowman
0x59 Wrestler
0x5A Elite Wrestler
0x5B Axeman
0x5C Axe Lord
0x5D Swordsman
0x5E Swordmaster
0x5F Maceman
0x60 Mace Lord
0x61 Pikeman
0x62 Pikemaster
0x63 Bowman
0x64 Elite Bowman
0x65 Blowgunner
0x66 Elite Blowgunner
0x67 Recruit
0x68 Hunting creature
0x69 War creature
0x6A Master Thief
0x6B Thief
0x6C Peasant or creature
0x6D Child
0x6E Baby
0x6F Drunk
0x70 Lasher
0x71 Master Lasher

Profession list

PROFESSION_MINE,
PROFESSION_HAUL_STONE,
PROFESSION_HAUL_WOOD,
PROFESSION_HAUL_BODY,
PROFESSION_HAUL_FOOD,
PROFESSION_HAUL_REFUSE,
PROFESSION_HAUL_ITEM,
PROFESSION_HAUL_FURNITURE,
PROFESSION_HAUL_ANIMALS,
PROFESSION_CLEAN,
PROFESSION_CUTWOOD,
PROFESSION_CARPENTER,
PROFESSION_DETAIL,
PROFESSION_MASON,
PROFESSION_ARCHITECT,
PROFESSION_ANIMALTRAIN,
PROFESSION_ANIMALCARE,
PROFESSION_HEALTHCARE,
PROFESSION_BUTCHER,
PROFESSION_TRAPPER,
PROFESSION_DISSECT_VERMIN,
PROFESSION_LEATHER,
PROFESSION_TANNER,
PROFESSION_BREWER,
PROFESSION_ALCHEMIST,
PROFESSION_SOAP_MAKER,
PROFESSION_WEAVER,
PROFESSION_CLOTHESMAKER,
PROFESSION_MILLER,
PROFESSION_PROCESS_PLANT,
PROFESSION_MAKE_CHEESE,
PROFESSION_MILK,
PROFESSION_COOK,
PROFESSION_PLANT,
PROFESSION_HERBALIST,
PROFESSION_FISH,
PROFESSION_CLEAN_FISH,
PROFESSION_DISSECT_FISH,
PROFESSION_HUNT,
PROFESSION_SMELT,
PROFESSION_FORGE_WEAPON,
PROFESSION_FORGE_ARMOR,
PROFESSION_FORGE_FURNITURE,
PROFESSION_METAL_CRAFT,
PROFESSION_CUT_GEM,
PROFESSION_ENCRUST_GEM,
PROFESSION_WOOD_CRAFT,
PROFESSION_STONE_CRAFT,
PROFESSION_BONE_CARVE,
PROFESSION_GLASSMAKER,
PROFESSION_EXTRACT_STRAND,
PROFESSION_AXE,
PROFESSION_SWORD,
PROFESSION_MACE,
PROFESSION_HAMMER,
PROFESSION_SPEAR,
PROFESSION_DAGGER,
PROFESSION_CROSSBOW,
PROFESSION_BOW,
PROFESSION_BLOWGUN,
PROFESSION_PIKE,
PROFESSION_WHIP,
PROFESSION_SHIELDLEVEL,
PROFESSION_ARMORLEVEL,
PROFESSION_SIEGECRAFT,
PROFESSION_SIEGEOPERATE,
PROFESSION_BOWYER,
PROFESSION_MECHANIC,
PROFESSION_WEAPONNUMBER,
PROFESSION_POTASH_MAKING,
PROFESSION_LYE_MAKING,
PROFESSION_DYER,
PROFESSION_BURN_WOOD,
PROFESSION_OPERATE_PUMP,
PROFESSION_UNUSED_3,
PROFESSION_UNUSED_4,
PROFESSION_UNUSED_5,
PROFESSION_UNUSED_6,
PROFESSION_UNUSED_7,
PROFESSION_UNUSED_8,
PROFESSION_UNUSED_9,
PROFESSION_UNUSED_10,
PROFESSION_UNUSED_11,
PROFESSION_UNUSED_12,
PROFESSION_UNUSED_13,
PROFESSION_UNUSED_14,
PROFESSION_UNUSED_15,
PROFESSION_UNUSED_16,
PROFESSION_UNUSED_17,
PROFESSION_UNUSED_18,
PROFESSION_UNUSED_19,
PROFESSION_UNUSED_20,
PROFESSION_UNUSED_21,
PROFESSION_UNUSED_22,
PROFESSION_UNUSED_23,
PROFESSION_UNUSED_24,
PROFESSION_UNUSED_25,
PROFESSION_UNUSED_26,
PROFESSION_UNUSED_27,
PROFESSION_UNUSED_28,
PROFESSION_UNUSED_29,
PROFESSION_UNUSED_30,
PROFESSIONNUM,