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 "Memory hacking"
Jump to navigation
Jump to search
m (tagged as stub) |
(creature hacking with DFHack's gui/gm-editor - flags1) |
||
| Line 8: | Line 8: | ||
[[File:Glazing with dfhack 4.png|thumb|600px|center|Job ingredient definition viewed with gui/gm-editor.]] | [[File:Glazing with dfhack 4.png|thumb|600px|center|Job ingredient definition viewed with gui/gm-editor.]] | ||
| + | |||
| + | |||
| + | = Hacking with gui/gm-editor = | ||
| + | |||
| + | == Creature hacking == | ||
| + | |||
| + | === Flags === | ||
| + | Creature flags are [[wikipedia:Boolean data type|boolean]] true/false values, split into four arrays named ``flags1`` - ``flags4``. | ||
| + | |||
| + | {| {{prettytable}} | ||
| + | |- bgcolor="#ddd" | ||
| + | ! width="5%" | Array | ||
| + | ! width="10%" | Name | ||
| + | ! width="50%" | Effect | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``move_state`` | ||
| + | | | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``inactive`` | ||
| + | | Marks the creature as {{dftext|Deceased|5:1}} ([[dead]]) and no longer an active unit. | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``has_mood`` | ||
| + | | | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``had_mood`` | ||
| + | | | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``marauder`` | ||
| + | | | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``drowning`` | ||
| + | | | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``merchant`` | ||
| + | | Set on [[caravan]] {{dftext|Merchant|7:0}}s and their pack animals. | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``forest`` | ||
| + | | The creature is a {{dftext|Friendly|2:1}} npc and not a [[citizen]] of the fortress. Set on caravan guards, for instance. | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``left`` | ||
| + | | | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``rider`` | ||
| + | | | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``incoming`` | ||
| + | | | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``diplomat`` | ||
| + | | | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``temp_flag`` | ||
| + | | | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``check_active_heist`` | ||
| + | | | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``can_swap`` | ||
| + | | | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``on_ground`` | ||
| + | | Whether the creature is {{Tile|☺|7:6:1}} lying prone on the ground. | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``projectile`` | ||
| + | | Used for creatures in {{Tile|☺|7:3:1}} projectile status (thrown, falling, or jumping). | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``active_invader`` | ||
| + | | | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``hidden_in_ambush`` | ||
| + | | The creature is [[ambusher|stealthed]] and not visible until noticed by someone. Used by [[gremlin]]s, [[werebeast]]s, [[ambush]]ing invaders, and [[adventure mode]] sneaking. | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``invader_origin`` | ||
| + | | | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``coward`` | ||
| + | | | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``hidden_ambusher`` | ||
| + | | | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``invades`` | ||
| + | | | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``check_flows`` | ||
| + | | | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``ridden`` | ||
| + | | | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``caged`` | ||
| + | | | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``tame`` | ||
| + | | | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``chained`` | ||
| + | | | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``royal_guard`` | ||
| + | | | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``fortress_guard`` | ||
| + | | | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``supress_wield`` | ||
| + | | | ||
| + | |||
| + | |- | ||
| + | | ``flags1`` | ||
| + | | ``important_historical_figure`` | ||
| + | | | ||
| + | |||
| + | |} | ||
| + | |||
= Legacy hacking = | = Legacy hacking = | ||
Revision as of 18:24, 11 November 2026
v53.17 · v0.47.05 This article is about the current version of DF.Note that some content may still need to be updated. |
| This article is a stub. You can improve the article by expanding it. |
Memory hacking means editing the game's memory data directly, unlike modding. The most prevalent tool for hacking the memory is DFHack, which provides access to internal data in a human-readable form, unlike most utilities which display binary values only.
DFHack offers two primary commands for accessing the memory data, gui/gm-editor which displays and allows editing the data for the selected object (creature, item, job, etc), and gui/gm-editor world which allows editing global variables.
Hacking with gui/gm-editor
Creature hacking
Flags
Creature flags are boolean true/false values, split into four arrays named flags1 - flags4.
| Array | Name | Effect |
|---|---|---|
flags1
|
move_state
|
|
flags1
|
inactive
|
Marks the creature as Deceased (dead) and no longer an active unit. |
flags1
|
has_mood
|
|
flags1
|
had_mood
|
|
flags1
|
marauder
|
|
flags1
|
drowning
|
|
flags1
|
merchant
|
Set on caravan Merchants and their pack animals. |
flags1
|
forest
|
The creature is a Friendly npc and not a citizen of the fortress. Set on caravan guards, for instance. |
flags1
|
left
|
|
flags1
|
rider
|
|
flags1
|
incoming
|
|
flags1
|
diplomat
|
|
flags1
|
temp_flag
|
|
flags1
|
check_active_heist
|
|
flags1
|
can_swap
|
|
flags1
|
on_ground
|
Whether the creature is ☺ lying prone on the ground.
|
flags1
|
projectile
|
Used for creatures in ☺ projectile status (thrown, falling, or jumping).
|
flags1
|
active_invader
|
|
flags1
|
hidden_in_ambush
|
The creature is stealthed and not visible until noticed by someone. Used by gremlins, werebeasts, ambushing invaders, and adventure mode sneaking. |
flags1
|
invader_origin
|
|
flags1
|
coward
|
|
flags1
|
hidden_ambusher
|
|
flags1
|
invades
|
|
flags1
|
check_flows
|
|
flags1
|
ridden
|
|
flags1
|
caged
|
|
flags1
|
tame
|
|
flags1
|
chained
|
|
flags1
|
royal_guard
|
|
flags1
|
fortress_guard
|
|
flags1
|
supress_wield
|
|
flags1
|
important_historical_figure
|
Legacy hacking
The following information is mostly obsolete and superseded by df-structures.
Version identification
| Version | MD5 hash | PE timestamp |
|---|---|---|
| 0.40.01 legacy | ||
| 0.40.01 SDL | ||
| 0.40.02 legacy | ||
| 0.40.02 SDL | 11a7da1fda05dfc826655d8aff4e9f9b | 53BEF285 |
| 0.47.04 SDL x86 | 6df64d9f3b413e6ad436e718ebeee070 | 5E5B11F9 |
General offsets
Legacy versions
| Description | 0.40.01 legacy | 0.40.02 legacy |
|---|---|---|
| cursor_xyz | ||
| mouse_x | ||
| mouse_y | ||
| mouse_z | ||
| window_dims | ||
| window_grid_x | ||
| window_grid_y | ||
| window_x (viewport_x) | ||
| window_y (viewport_y) |
| |
| window_z (viewport_z) |
|
SDL versions
| Description | 0.40.01 SDL | 0.40.02 SDL | 0.47.04 SDL x86 |
|---|---|---|---|
| cursor_xyz | 1D0CD40 | 20f8bc8 | |
| mouse_x | |||
| mouse_y | 1D0CD44 | 20f8bcc | |
| mouse_z | 1D0CD48 | 20f8bd0 | |
| window_dims | 20f8cd0 | ||
| window_grid_x | |||
| window_grid_y | 20f8cd8 | ||
| window_x (viewport_x) | 2a9a2f0 | ||
| window_y (viewport_y) | 2a9a314
| ||
| window_z (viewport_z) | 2976dac
|
Map data
Legacy versions
| Description | 0.40.01 legacy | 0.40.02 legacy |
|---|---|---|
| map_data |
| |
| map_info |
|
SDL versions
| Description | 0.40.01 SDL | 0.40.02 SDL | 0.47.04 SDL x86 |
|---|---|---|---|
| map_data | 2996f24 | 2be609c
| |
| map_info | 2996f3c | ? |
map_info struct
| Type | Name | Description |
|---|---|---|
| int32 | block_count_x | Size of the current map region in 16x16 blocks. |
| int32 | block_count_y | |
| int32 | block_count_z | Should be the same as tile_count_z |
| int32 | tile_count_x | Size of the current map region in tiles. |
| int32 | tile_count_y | |
| int32 | tile_count_z | |
| int32 | region_x | Position of the current map region within the world as a whole. |
| int32 | region_y | |
| int32 | region_z | Base Z-level - add this to Z coordinates to get the Z-level displayed on the screen |
Map block data offsets
| Description | 0.40.01–02 | 0.47.04 SDL x86 |
|---|---|---|
| map_data_map_x_offset | 0060 | 0054 |
| map_data_map_y_offset | 0062 | 0056 |
| map_data_map_z_offset | 0064 | 0058 |
| map_data_tiletype_offset | 006a | 005e |
| map_data_designation_offset | 026c | 0260 |
| map_data_occupancy_offset | 066c | 0660 |
| map_data_0a60_offset | 0A6c | 0A60 |
| map_data_pathfinding_offset | 0D6c | 0D60 |
| map_data_1160_offset | 116c | 1160 |
| map_data_1360_offset | 136c | 1360 |
| map_data_temperature1_offset | 156c | 1560 |
| map_data_temperature2_offset | 176c | 1760 |
| map_data_1960_offset | 196c | 1960 |
| map_data_1b60_offset | 1B6c | 1B60 |