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
Line 43: Line 43:
 
|}
 
|}
  
== Working notes ==
+
== Type ID list ==
  
----
+
Hideously incomplete and may be completely wrong.
  
I'm currently trying to figure out the internal representation of the new Dwarf Fortress. I'm putting notes here so if someone else wants to start, they can collaborate instead of duplicating efforts.
+
{|  border="1" cellpadding="2" width="100%"
 +
| ID || Meaning
 +
|-
 +
|0x00 || Miner
 +
|-
 +
|0x04 || Woodcutter
 +
|-
 +
|0x2f || Planter
 +
|-
 +
|0x29 || Cook
 +
|-
 +
|0x31 || Brewer
 +
|-
 +
|0x37 || Mechanic
 +
|-
 +
|0x3e || Architect
 +
|-
 +
|0x6c || Creature
 +
|-
 +
|}
  
Toady has said that the address to the active-creature vector seems to be 0x01415A00. This is indeed a vector, I haven't verified if it's the right one.
 
  
Toady's also using MSVC Express. He tends to use vectors and standard strings. MSVC's string is *weird* and I haven't deciphered it yet.
 
  
Updates as I figure things out. [[User:ZorbaTHut|ZorbaTHut]] 22:10, 29 October 2007 (EDT)
+
== Profession list ==
  
Toady is awesome and has sent me the following table:
+
Obviously could do with some formatting.
  
 
  PROFESSION_MINE,
 
  PROFESSION_MINE,
Line 160: Line 177:
 
  PROFESSION_UNUSED_30,
 
  PROFESSION_UNUSED_30,
 
  PROFESSIONNUM,
 
  PROFESSIONNUM,
 
 
[[User:ZorbaTHut|ZorbaTHut]] 22:22, 29 October 2007 (EDT)
 

Revision as of 03:56, 30 October 2007

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.

Creature Structure

The creature vector is at 0x01415A00, so: List start: 0x01415A04 List end: 0x01415A08

Structure Offsets:

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 These two are wild guesses - I believe they are dwarf types. They appear to be duplicated (I'm told Toady stores the original dwarf type for legends) and I don't know which is the "old" and which is the "new". I've entered the values I've found in the Type ID table below. I may be completely wrong.
0x9a 2 Type ID #2
0x458 104 Labor preferences 104 1 byte bools, corresponding to the profession list.

Type ID list

Hideously incomplete and may be completely wrong.

ID Meaning
0x00 Miner
0x04 Woodcutter
0x2f Planter
0x29 Cook
0x31 Brewer
0x37 Mechanic
0x3e Architect
0x6c Creature


Profession list

Obviously could do with some formatting.

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,