From 2a47275fd55f140631f01b612e7c93d5d28ced85 Mon Sep 17 00:00:00 2001 From: belal Date: Mon, 8 Mar 2010 21:40:14 -0500 Subject: [PATCH 1/9] updated addresses for 40d, offsets still wrong --- output/Memory.xml | 75 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 61 insertions(+), 14 deletions(-) diff --git a/output/Memory.xml b/output/Memory.xml index 959d80083..490fb3b19 100644 --- a/output/Memory.xml +++ b/output/Memory.xml @@ -745,22 +745,38 @@ W I N E - - 0x48C330DF + 0x48c330df 2c686c26307dcccd7c36cc79737ebe4f - - -
0x015C4D58
-
0x0156F8B0
0x015838a0
-
0x01587A24
-
0x01583224
- - -
0x015c6ef0
+
0x0156f8b0
+
0x01583234
+
0x0fffffff
+
0x01393260
+
0x009fc294
+
0x01392fb8
+
0x0156f980
0x015c6ed0
- 0x3C - +
0x015c4d58
+
0x015c6d70
+
0x01392f5c
+
0x0138147f
+
0x015c4d88
+
0x015c4d8c
+
0x015c4d90
+
0x015c6a58
+
0x015c69cc
+
0x015c6ef0
+
0x01587a24
+
0x013a12a0
+
0x0138f68c
+
0x00d457f4
+
0x00d73868
+
0x00d73844
+
0x015c6388
+
0x015c4d70
+
0x015c4d74
+
0x015c4d78
+ 0x08 @@ -805,7 +821,7 @@ 0x474 0x520 0x5D0 - + 0x70 @@ -836,6 +852,37 @@
0xd73868
0xd73844
0x1706d4c
+ 0x08 + 0x2C + 0x0062 + 0x0264 + 0x0664 + 0x1D64 + + 0x54 + + 0x2 + 0x4 + 0x8 + 0x24 + + 0x1C + 0x20 + + 0x38 + 0x7a + 0x100 + + 0x68 + 0x24 + 0x1C + 0x28 + 0x24 + 0x24 + 0x24 + 0x5C + 0x94 + 0xB0
From 3ae8b56a494280fe3d2d309eaada40459fa0bc8c Mon Sep 17 00:00:00 2001 From: belal Date: Tue, 9 Mar 2010 22:05:31 -0500 Subject: [PATCH 2/9] Addresses all the way back to 173.38a, not checked yet, and offsets may have changed in the versions, but it is a start! Also changing the current_creature offset, have to make sure what I changed it to is in the d# releases, but I think it is This branch is still a work in progress --- library/DFHackAPI.cpp | 17 +-- output/Memory.xml | 258 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 259 insertions(+), 16 deletions(-) diff --git a/library/DFHackAPI.cpp b/library/DFHackAPI.cpp index 161e1311c..bffe0c730 100644 --- a/library/DFHackAPI.cpp +++ b/library/DFHackAPI.cpp @@ -331,23 +331,12 @@ bool API::WriteTileTypes (uint32_t x, uint32_t y, uint32_t z, uint16_t *buffer) return false; } -bool API::getCurrentCursorCreatures (vector &addresses) +bool API::getCurrentCursorCreatures (uint32_t & creature_index) { - if(d->cursorWindowInited) return false; - DfVector creUnderCursor = d->p->readVector (d->current_cursor_creature_offset, 4); - if (creUnderCursor.getSize() == 0) - { - return false; - } - addresses.clear(); - for (uint32_t i = 0;i < creUnderCursor.getSize();i++) - { - uint32_t temp = * (uint32_t *) creUnderCursor.at (i); - addresses.push_back (temp); - } + if(!d->cursorWindowInited) return false; + creature_index = g_pProcess->readDWord(d->current_cursor_creature_offset); return true; } - // 256 * sizeof(uint32_t) bool API::WriteDesignations (uint32_t x, uint32_t y, uint32_t z, uint32_t *buffer) { diff --git a/output/Memory.xml b/output/Memory.xml index 490fb3b19..d81f9b503 100644 --- a/output/Memory.xml +++ b/output/Memory.xml @@ -743,8 +743,261 @@ W I N D O W S and W I N E - - + + 0x47b6fac2 + 48c831b6f3950913b8e1aeada563d2db +
0x014639f4
+
0x01463288
+
0x01463388
+
0x00c7bc00
+
0x01287d14
+
0x00941288
+
0x01287a9c
+
0x01463358
+
0x014a6994
+
0x014a4eac
+
0x014a6834
+
0xffffffff
+
0x8b010127
+
0x014a4edc
+
0x014a4ee0
+
0x014a4ee4
+
0x014a6680
+
0x014a671c
+
0x014a69b4
+
0x01467b78
+
0x01295d58
+
0x01284184
+
0x00941288
+
0x00c2358c
+
0x00c68350
+
0x014a64dc
+
0x014a4ec4
+
0x014a4ec8
+
0x014a4ecc
+ + 0x47c12f36 + 8bd90fb6db8388f129fde224a35459de +
0x01463bec
+
0x01463480
+
0x01463580
+
0x00c7bc04
+
0x01287d14
+
0x0094128c
+
0x01287a9c
+
0x01463550
+
0x014a6c60
+
0x014a50a4
+
0x014a6b00
+
0xffffffff
+
0x8b010127
+
0x014a50d4
+
0x014a50d8
+
0x014a50dc
+
0x014a694c
+
0x014a69e8
+
0x014a6c80
+
0x01467d70
+
0x01295d58
+
0x01284184
+
0x00c68354
+
0x00c23594
+
0x00c68354
+
0x014a66d4
+
0x014a50bc
+
0x014a50c0
+
0x014a50c4
+
+ + 0x47c29583 + 9147b5e922a30873fd1a742b1dea1724 +
0xffffffff
+
0x8b010127
+
+ + 0x487b4e8b + 4b3857a05590b9d9488900e575079e9d +
0x01512b70
+
0x014feb80
+
0x01512504
+
0x00d16c20
+
0x01322d58
+
0x009d6284
+
0x01322adc
+
0x014fec50
+
0x01555f88
+
0x01554028
+
0x01555e28
+
0xffffffff
+
0x8b010131
+
0x01554058
+
0x0155405c
+
0x01554060
+
0x01555ce8
+
0x01555c6c
+
0x01555fa8
+
0x01516cf4
+
0x01330d98
+
0x0131f1b4
+
0x00cd5398
+
0x00cb8dec
+
0x00d03370
+
0x01555658
+
0x01554040
+
0x01554044
+
0x01554048
+
+ + 0x487c9338 + 52155dea390c2080fc16e4bbeb077164 +
0xffffffff
+
0x8b010131
+
+ + 0x487f2f30 + 8f8cf06b1cd5ea102881a7cced767d4f +
0x01513b90
+
0x014ffba0
+
0x01513524
+
0x00d17c44
+
0x01323d78
+
0x009d7284
+
0xffffffff
+
0x014ffc70
+
0x01556fa8
+
0x01555048
+
0x01556e48
+
0xffffffff
+
0x8b010131
+
0x01555078
+
0x0155507c
+
0x01555080
+
0x01556d08
+
0x01556c8c
+
0x01556fc8
+
0x01517d14
+
0x01331db8
+
0x013201d4
+
0x00cd63bc
+
0x00cb9dec
+
0x00d04394
+
0x01556678
+
0x01555060
+
0x01555064
+
0x01555068
+
+ + 0x48873bc3 + 8614a01593baef6e4a341e2f1a92ba06 +
0x0151ffb8
+
0x0150bfc8
+
0x0151f94c
+
0x00d23c4c
+
0x0132fdb0
+
0x009e3284
+
0x0132fb34
+
0x0150c098
+
0x015635cc
+
0x01561470
+
0x0156346c
+
0x0132faac
+
0x8b010131
+
0x015614a0
+
0x015614a4
+
0x015614a8
+
0x01563154
+
0x015630d8
+
0x015635ec
+
0x0152413c
+
0x0133ddf0
+
0x0132c1dc
+
0x00ce23c4
+
0x00cc5df4
+
0x00d1039c
+
0x01562aa0
+
0x01561488
+
0x0156148c
+
0x01561490
+
+ + 0x4888672c + 32f68422f5b4d938549eed0565bcfb92 + + + 0x489d8c7f + 33db0401081058fb54252210bf371344 +
0x01576468
+
0x01562478
+
0x01575dfc
+
0x00d7a0fc
+
0x01386260
+
0x009ef294
+
0x01385fe4
+
0x01562548
+
0x015b9a7c
+
0x015b7920
+
0x015b991c
+
0x01385f5c
+
0x5f010137
+
0x015b7950
+
0x015b7954
+
0x015b7958
+
0x015b9604
+
0x015b9588
+
0x015b9a9c
+
0x0157a5ec
+
0x013942a0
+
0x0138268c
+
0x00d387fc
+
0x00d66870
+
0x00d6684c
+
0x015b8f50
+
0x015b7938
+
0x015b793c
+
0x015b7940
+
+ + 0x48a9727f + 441c76f45cfffc6abc6548e41c7e2218 +
0x015828a8
+
0x0156e8b8
+
0x0158223c
+
0x00d860fc
+
0x01392268
+
0x009fb294
+
0x01391fc0
+
0x0156e988
+
0x015c5ecc
+
0x015c3d60
+
0x015c5d6c
+
0x01391f64
+
0x5f010138
+
0x015c3d90
+
0x015c3d94
+
0x015c3d98
+
0x015c5a54
+
0x015c59c8
+
0x015c5eec
+
0x01586a2c
+
0x013a02a8
+
0x0138e694
+
0x00d447fc
+
0x00d72870
+
0x00d7284c
+
0x015c5390
+
0x015c3d78
+
0x015c3d7c
+
0x015c3d80
+
+ + 0x48ad547a + 65b4fa339d4081e934c1297d2a22234a + + + 0x48ad802b + 15e95727019e76aa653538618c7e0cfd + + 0x48c330df 2c686c26307dcccd7c36cc79737ebe4f
0x015838a0
@@ -818,6 +1071,7 @@ 0x43C 0x440 0x444 + 0x458 0x474 0x520 0x5D0 From b702d53641de803abaae73e44e17a0ef036a50e6 Mon Sep 17 00:00:00 2001 From: belal Date: Wed, 10 Mar 2010 16:01:00 -0500 Subject: [PATCH 3/9] updated Memory.xml with current_cursor_creature for the creature index, which seems to exist in all versions, whereas the old vector did not. --- output/Memory.xml | 61 ++++++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/output/Memory.xml b/output/Memory.xml index d81f9b503..b8259b985 100644 --- a/output/Memory.xml +++ b/output/Memory.xml @@ -862,12 +862,12 @@
0x00d17c44
0x01323d78
0x009d7284
-
0xffffffff
+
0xffffffff
0x014ffc70
0x01556fa8
0x01555048
0x01556e48
-
0xffffffff
+
0xffffffff
0x8b010131
0x01555078
0x0155507c
@@ -1003,7 +1003,7 @@
0x015838a0
0x0156f8b0
0x01583234
-
0x0fffffff
+
0x00D870F4
0x01393260
0x009fc294
0x01392fb8
@@ -1141,11 +1141,11 @@ 0x4953556c - B1A8CA1F91734EB492B7F54F6823CDDB + b1a8ca1f91734eb492b7f54f6823cddb
0x014d1db0
0x014bda18
0x014d1404
-
0x014d1de4
+
0x00cd4c3c
0x0165b5a8
0x0094b27c
0x012e101c
@@ -1251,7 +1251,8 @@
0x4957716f - 9B6DA355562A4CDD345EA3046290499B + 9b6da355562a4cdd345ea3046290499b +
0x00cd6c3c
0x0094d27c
0x012d0fbf
0x00c9533c
@@ -1260,11 +1261,12 @@
0x4957a0a2 - B77759DB7A6DD787BF98953FC5749D81 + b77759db7a6dd787bf98953fc5749d81 0x495991c3 - A0792B81E5B8EC1DBDD627643E93B40D + a0792b81e5b8ec1dbdd627643e93b40d +
0xcd8c34
0x0094f27c
0x012d2fbb
0x00c97334
@@ -1273,7 +1275,8 @@
0x495cafd2 - D09E88A32FE57DE5973F78EF213271B6 + d09e88a32fe57de5973f78ef213271b6 +
0xcefc68
0x009662a4
0x012e9fef
0x00cae368
@@ -1282,7 +1285,8 @@
0x495fcfef - 8E8E2A83D421E356A8047DC8830A7426 + 8e8e2a83d421e356a8047dc8830a7426 +
0xcefc68
0x009662a4
0x012e9fef
0x00cae368
@@ -1291,19 +1295,19 @@
0x4963c928 - 32253BEE114DD25EBBAA50D90B5C0A2A + 32253bee114dd25ebbaa50d90b5c0a2a 0x4967c2e0 - AEA5A207B8B1CDA942502F97A429F6C3 + aea5a207b8b1cda942502f97a429f6c3 0x49c59b94 - 193193D8624F2F3F6D9D556FAB09B122 + 193193d8624f2f3f6d9d556fab09b122
0x0151bd00
0x01507968
0x0151b354
-
0x0151bd34
+
0x00d20ed8
0x016a54f8
0x009652a4
0x0132e574
@@ -1332,15 +1336,15 @@
0x49c82d3f - 6F81231B845E9C9DC29AAF57705CCC7C + 6f81231b845e9c9dc29aaf57705ccc7c 0x4a3ccb7f - 6EA1DE36AF8E1666BD6478736E298C4C + 6ea1de36af8e1666bd6478736e298c4c
0x015b7750
0x015a33b8
0x015b6da4
-
0x01750e7c
+
0x00ddaed8
0x0095f410
0x0095f2b4
0x013e8574
@@ -1369,7 +1373,8 @@
0x4a51c26e - 04A8D8CE311D8AC75E4241BEF68D3147 + 04a8d8ce311d8ac75e4241bef68d3147 +
0x00ddff38
0x00964430
0x009642b4
0x013da2bf
@@ -1379,7 +1384,8 @@
0x4a8623d2 - 781A2E51BE4056A7320108F8F0DF8A13 + 781a2e51be4056a7320108f8f0df8a13 +
0x00de1f44
0x00966430
0x009662b4
0x013dc2c7
@@ -1389,11 +1395,11 @@
0x4a9a6090 - 12CC4A3DBB6E6DFD7BC7AEE458B9471A + 12cc4a3dbb6e6dfd7bc7aee458b9471a
0x015be808
0x015aa470
0x015bde5c
-
0x01757f3c
+
0x00de1f54
0x00966430
0x009662b4
0x013ef62c
@@ -1422,15 +1428,15 @@
0x4a9b1a72 - 59AB29021ACA9F3C66B1AB102FB3CEEA + 59ab29021aca9f3c66b1ab102fb3ceea - + 0x4b6b7879 - DE66405F54D98297303D439B3B7AA30E + de66405f54d98297303d439b3b7aa30e
0x015f3260
0x015deec8
0x015f28b4
-
0x0178c994
+
0x00e16924
0x0099ae08
0x0099ac88
0x014240dc
@@ -1463,6 +1469,7 @@ 0x4b81b00d 5cdc6f4804809f4d5cacdb66785e8cda +
0x00df2ebc
0x00977438
0x009772b8
0x014ad278
@@ -1472,11 +1479,11 @@
0x4b90268a - 13640A273D90AF39425B798AE9823757 + 13640a273d90af39425b798ae9823757
0x01512898
0x014fe500
0x01511eec
-
0x016abfcc
+
0x00d35b68
0x016ac1a0
0x0097a2b8
0x01343714
From e500b13533d94d4a602c02cd62e18f17710bfe17 Mon Sep 17 00:00:00 2001 From: belal Date: Wed, 10 Mar 2010 21:24:31 -0500 Subject: [PATCH 4/9] offsets are all correct for 40d, creature offsets are not constant all the way back to 38.a, so more work needs to be done there This could probably be used in stonesense as it is though, all the map data is correct --- library/DFHackAPI.cpp | 2 +- library/DFHackAPI.h | 3 +- output/Memory.xml | 207 ++++++++++++++++++++---------------------- 3 files changed, 98 insertions(+), 114 deletions(-) diff --git a/library/DFHackAPI.cpp b/library/DFHackAPI.cpp index bffe0c730..a69c4f951 100644 --- a/library/DFHackAPI.cpp +++ b/library/DFHackAPI.cpp @@ -331,7 +331,7 @@ bool API::WriteTileTypes (uint32_t x, uint32_t y, uint32_t z, uint16_t *buffer) return false; } -bool API::getCurrentCursorCreatures (uint32_t & creature_index) +bool API::getCurrentCursorCreature (uint32_t & creature_index) { if(!d->cursorWindowInited) return false; creature_index = g_pProcess->readDWord(d->current_cursor_creature_offset); diff --git a/library/DFHackAPI.h b/library/DFHackAPI.h index 77d75f9da..71fcfb50d 100644 --- a/library/DFHackAPI.h +++ b/library/DFHackAPI.h @@ -199,8 +199,7 @@ namespace DFHack bool getCursorCoords (int32_t &x, int32_t &y, int32_t &z); bool setCursorCoords (const int32_t x, const int32_t y, const int32_t z); - /// This returns false if there is nothing under the cursor, it puts the addresses in a vector if there is - bool getCurrentCursorCreatures(std::vector &addresses); + bool API::getCurrentCursorCreature (uint32_t & creature_index); bool InitViewSize(); bool getWindowSize(int32_t & width, int32_t & height); diff --git a/output/Memory.xml b/output/Memory.xml index b8259b985..5957d7327 100644 --- a/output/Memory.xml +++ b/output/Memory.xml @@ -744,6 +744,7 @@ and W I N E + 0x47b6fac2 48c831b6f3950913b8e1aeada563d2db
0x014639f4
@@ -775,6 +776,98 @@
0x014a4ec4
0x014a4ec8
0x014a4ecc
+ + + 0x08 + + + 0x08 + 0x2C + 0x0062 + 0x0264 + 0x0664 + 0x1D64 + + + 0x00 + 0x1C + 0x38 + 0x6c + 0x88 + 0x8C + 0x94 + 0xE4 + 0xE8 + 0xF2 + 0xF4 + 0x1A4 + 0x228 + 0x2F8 + 0x2AC + 0x438 + 0x43C + 0x440 + 0x444 + 0x454 + 0x474 + 0x520 + 0x5D0 + + + 0x70 + + + 0x84 + 0x86 + 0x684 + 0x6B4 + + + 0x5C + 0x58 + + + 0x4 + + + 0x10 + + + 0x84 + 0x60 + + 0x08 + 0x2C + 0x0062 + 0x0264 + 0x0664 + 0x1D64 + + 0x3C + + 0x2 + 0x4 + 0x8 + 0x24 + + 0x1C + 0x20 + + 0x38 + 0x7a + 0x100 + + 0x68 + 0x24 + 0x1C + 0x28 + 0x24 + 0x24 + 0x24 + 0x5C + 0x94 + 0xB0 +
0x47c12f36 8bd90fb6db8388f129fde224a35459de @@ -800,9 +893,9 @@
0x01467d70
0x01295d58
0x01284184
-
0x00c68354
+
0x00c3fb40
0x00c23594
-
0x00c68354
+
0x00c68354
0x014a66d4
0x014a50bc
0x014a50c0
@@ -923,7 +1016,7 @@ 0x4888672c 32f68422f5b4d938549eed0565bcfb92
- + 0x489d8c7f 33db0401081058fb54252210bf371344
0x01576468
@@ -1029,114 +1122,6 @@
0x015c4d70
0x015c4d74
0x015c4d78
- - - 0x08 - - -
0x015C4D70
-
0x015C4D74
-
0x015C4D78
- - -
0x015C4D88
-
0x015C4D8C
-
0x015C4D90
- - - 0x08 - 0x2C - 0x0062 - 0x0264 - 0x0664 - 0x1D64 - - - 0x00 - 0x1C - 0x38 - 0x6c - 0x88 - 0x8C - 0x94 - 0xE4 - 0xE8 - 0xF2 - 0xF4 - 0x1A4 - 0x228 - 0x2F8 - 0x2AC - 0x438 - 0x43C - 0x440 - 0x444 - 0x458 - 0x474 - 0x520 - 0x5D0 - - - 0x70 - - -
0x015C6388
- 0x84 - 0x86 - 0x684 - 0x6B4 - - - 0x5C - 0x58 - - - 0x4 - - -
0x015C6D70
- 0x10 - - - 0x84 - 0x60 - -
0x9fc294
-
0xd457f4
-
0xd73868
-
0xd73844
-
0x1706d4c
- 0x08 - 0x2C - 0x0062 - 0x0264 - 0x0664 - 0x1D64 - - 0x54 - - 0x2 - 0x4 - 0x8 - 0x24 - - 0x1C - 0x20 - - 0x38 - 0x7a - 0x100 - - 0x68 - 0x24 - 0x1C - 0x28 - 0x24 - 0x24 - 0x24 - 0x5C - 0x94 - 0xB0
From ed386d3fd30dc5c09fa5de0db080ba40e059aff7 Mon Sep 17 00:00:00 2001 From: belal Date: Thu, 11 Mar 2010 21:25:07 -0500 Subject: [PATCH 5/9] linux addresses back to 40d2 --- output/Memory.xml | 767 +++++++++++++++++++--------------------------- 1 file changed, 311 insertions(+), 456 deletions(-) diff --git a/output/Memory.xml b/output/Memory.xml index 5957d7327..fcdb900f4 100644 --- a/output/Memory.xml +++ b/output/Memory.xml @@ -1518,37 +1518,40 @@ |__ |--""___| ,-' `"--...,+"""" `._,.-' - - - - 992afd73855e787860277f53d18afcbb - - -
0x09372FC0
-
0x0931ED38
- - -
0x09332B60
- - - -
0x09335CB0
-
0x093326AC
- -
0x8877634
-
0x8d17ff4
-
0x8d17ff8
-
0x8d17ffC
-
0x95327b0
+ + 7a0859795e972574e80fa3cebc9fcf85 +
0x093154e0
+
0x093016b8
+
0x09314ff0
+
0x09314ffc
+
0x09301560
+
0x08859fc0
+
0x0930140c
+
0x09356fd0
+
0x09314ffc
+
0x09355964
+
0x09357808
+
0x093013e4
+
0x092f0580
+
0x0935596c
+
0x09355970
+
0x09355974
+
0x0935754c
+
0x093574e0
+
0x09357928
+
0x09318630
+
0x08b36c80
+
0x09355968
+
0x08b36c84
+
0x08cfa978
+
0x08cfa97c
+
0x09356f6c
+
0x09355954
+
0x09355958
+
0x0935595c
- -
0x09374FA8
-
0x09374F90
0x1C - -
0x91631f0
- 0x08 @@ -1579,17 +1582,7 @@ 0x40 - - -
0x09372FD4
-
0x09372FD8
-
0x09372FDC
- - -
0x09372FEC
-
0x09372FF0
-
0x09372FF4
- + 0x08 0x2C @@ -1599,7 +1592,6 @@ 0x1D54 -
0x093745EC
0x54 0x56 0x5A4 @@ -1613,461 +1605,324 @@ 0x4 -
0x9374E88
0xC 0x24 0x18 - -
0x0931EA64
0x2 0x4 0x8 0xC -
0x0931EA8C
0x4 0x8 0x14 - -
0x09374BCC
-
0x09374B60
- + 0x08 0x4a 0x94 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + 0x50 + 0x0C + 0x20 + + 0xC + 0x4 + 0x10 + 0xC + 0xC + 0xC + 0x14 + 0x1C + 0x20
- - + + 51c73ff46b2688aafaee0204efe91a94 +
0x09315f00
+
0x093020d8
+
0x09315a10
+
0x09315a1c
+
0x09301f80
+
0x0885a9e4
+
0x09301e2c
+
0x093579f0
+
0x09315a1c
+
0x09356384
+
0x09358228
+
0x09301e04
+
0x092f0fa0
+
0x0935638c
+
0x09356390
+
0x09356394
+
0x09357f6c
+
0x09357f00
+
0x09358348
+
0x09319050
+
0x08b376a0
+
0x09356388
+
0x08b376a4
+
0x08cfb398
+
0x08cfb39c
+
0x0935798c
+
0x09356374
+
0x09356378
+
0x0935637c
+
+ + c1eb408868c80fd1c726d2a917cd1b9a +
0x0885ad54
+
+ + 59d497bfc3a523f0f40f34283ad59796 +
0x0885bbf0
+
+ + f756194db073f05b98fc6ce872c8757d +
0x09333e00
+
0x0931ffd8
+
0x09333910
+
0x0933391c
+
0x0931fe80
+
0x088788e4
+
0x0931fd2c
+
0x093758f0
+
0x0933391c
+
0x09374284
+
0x09376128
+
0x0931fd04
+
0x0930eea0
+
0x0937428c
+
0x09374290
+
0x09374294
+
0x09375e6c
+
0x09375e00
+
0x09376248
+
0x09336f50
+
0x08b555a0
+
0x09374288
+
0x08b555a4
+
0x08d19298
+
0x08d1929c
+
0x0937588c
+
0x09374274
+
0x09374278
+
0x0937427c
+
+ + b004b3876193633875956af752663f26 + + + c8616fc74d79b3c8c40bbc1182fbd61c +
0x088786a0
+
+ + 992afd73855e787860277f53d18afcbb +
0x08877630
+
+ + cba6354000ec54865a161627605c3837 +
0x092bf340
+
0x092ab518
+
0x092bee50
+
0x0929a3c8
+
0x092ab3c0
+
0x088073d4
+
0x092ab26c
+
0x092beecc
+
0x09301770
+
0x092ff7a0
+
0x09301668
+
0x092ab244
+
0x0929a3e0
+
0x092ff7cc
+
0x092ff7d0
+
0x092ff7d4
+
0x093013ac
+
0x09301340
+
0x09301788
+
0x092c2490
+
0x08ae40a0
+
0x09510050
+
0x08ca47d4
+
0x08ca47d8
+
0x08ca47dc
+
0x09300dcc
+
0x092ff7b4
+
0x092ff7b8
+
0x092ff7bc
+
+ fb8ecac8a12af5d0d7b1707078985d0d - - -
0x88073d4
-
0x9510050
- -
0x092AB244
- - - + 4367c59934cbcf14f43fd3af6444c455 - - -
0x08F95BBC
-
0x08F41918
-
0x08F55740
-
0x08F58890
-
0x08F55250
- -
0x0877B33C
-
0x893ABD4
-
0x893ABD8
-
0x893ABDC
+
0x08f55740
+
0x08f41918
+
0x08f55250
+
0x08f307c8
+
0x08f417c0
+
0x0877b33c
+
0x08f4166c
+
0x08f552cc
+
0x08f97b8c
+
0x08f95bbc
+
0x08f97a84
+
0x08f41644
+
0x08f307e0
+
0x08f95be8
+
0x08f95bec
+
0x08f95bf0
+
0x08f977c8
+
0x08f9775c
+
0x08f97ba4
+
0x08f58890
+
0x0877f8e0
0x091a647c
- - -
0x08F97BA4
-
0x08F97B8C
- - -
0x08F95BD0
-
0x08F95BD4
-
0x08F95BD8
- - -
0x08F95BE8
-
0x08F95BEC
-
0x08F95BF0
- - -
0x08F971E8
- - -
0x08F97A84
- - - -
0x08F41644
-
0x08F4166C
- -
0x08F977C8
-
0x08F9775C
- - - - - +
0x0893abd4
+
0x0893abd8
+
0x0893abdc
+
0x08f971e8
+
0x08f95bd0
+
0x08f95bd4
+
0x08f95bd8
- 2f3cb9d720e9fe8844c02c72a2b20bbd - - -
0x8780354
- -
0x091ab49c
+
0x08780344
- dab3ce6bc074529706a1e5fe1273108c - - - +
0x08f5a760
+
0x08f46938
+
0x08f5a270
+
0x08f357e8
+
0x08f467e0
+
0x08780354
+
0x08f4668c
+
0x08f5a2ec
+
0x08f9cbac
+
0x08f9abdc
+
0x08f9caa4
+
0x08f46664
+
0x08f35800
+
0x08f9ac08
+
0x08f9ac0c
+
0x08f9ac10
+
0x08f9c7e8
+
0x08f9c77c
+
0x08f9cbc4
+
0x08f5d8b0
+
0x08784900
+
0x091ab49c
+
0x0893fbf4
+
0x0893fbf8
+
0x0893fbfc
+
0x08f9c208
+
0x08f9abf0
+
0x08f9abf4
+
0x08f9abf8
- - + 4f55a1dcc326786271f221de23c425b5 - - - - - + 022b933926e08da49c6df8649295f2b7 - - -
0x91ab420
-
0x8F5A2EC
- 0x50 -
0x8F35800
-
0x878493c
-
0x8f467e0
- -
0x8f468c0
- 0x0C - 0x20 - - 0xC - 0x4 - 0x10 - 0xC - 0xC - 0xC - 0x14 - 0x1C - 0x20
- - + 8f55a6250f2550e28535b79db43d5f1a - - -
0x878c340
-
0x8947d54
-
0x8947d58
-
0x8947d5c
-
0x91b35fc
- - -
0x08FA2D3C
- - -
0x08FA4C04
- -
0x08FA4368
- - -
0x8FA2D50
-
0x8FA2D54
-
0x8FA2D58
- - -
0x8FA2D68
-
0x8FA2D6C
-
0x8FA2D70
- - -
0x08F4EA98
-
0x08F65A10
-
0x08F628C0
-
0x08F623D0
-
0x08F6244C
- - -
0x08FA4D24
-
0x08FA4D0C
- - -
0x91b3580
-
0x8f3d960
-
0x878caa4
-
0x8f4e940
- -
0x08F4E7C4
-
0x08F4E7EC
- -
0x08FA4948
-
0x08FA48DC
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
0x08f628c0
+
0x08f4ea98
+
0x08f623d0
+
0x08f3d948
+
0x08f4e940
+
0x0878c340
+
0x08f4e7ec
+
0x08f6244c
+
0x08fa4d0c
+
0x08fa2d3c
+
0x08fa4c04
+
0x08f4e7c4
+
0x660008f3
+
0x08fa2d68
+
0x08fa2d6c
+
0x08fa2d70
+
0x08fa4948
+
0x08fa48dc
+
0x08fa4d24
+
0x08f65a10
+
0x0878caa0
+
0x091b35fc
+
0x08947d54
+
0x08947d58
+
0x08947d5c
+
0x08fa4368
+
0x08fa2d50
+
0x08fa2d54
+
0x08fa2d58
- - - 777e7d674d8908042307994cb75250ff - -
0x8833324
-
0x89eecf4
-
0x89eecf8
-
0x89eecfC
-
0x925a59c
- - -
0x09049CDC
- - -
0x0904BBA4
- - -
0x0904B308
- - -
0x09049CF0
-
0x09049CF4
-
0x09049CF8
- - -
0x09049D08
-
0x09049D0C
-
0x09049D10
- -
0x08FF5A38
- -
0x0900C9B0
+ 777e7d674d8908042307994cb75250ff
0x09009860
+
0x08ff5a38
0x09009370
- -
0x90093EC
- - - -
0x0904BCC4
-
0x0904BCAC
- - - -
0x91b3580
- -
0x08fe4900
-
0x08833A40
+
0x08fe48e8
0x08ff58e0
- -
0x08FF5764
-
0x08FF578C
- -
0x0904B8E8
-
0x0904B87C
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
0x08833324
+
0x08f4e7ec
+
0x090093ec
+
0x0904bcac
+
0x09049cdc
+
0x0904bba4
+
0x08ff5764
+
0x08fe4900
+
0x09049d08
+
0x09049d0c
+
0x09049d10
+
0x0904b8e8
+
0x0904b87c
+
0x0904bcc4
+
0x0900c9b0
+
0x08833a40
+
0x0925a59c
+
0x089eecf4
+
0x089eecf8
+
0x089eecfc
+
0x0904b308
+
0x09049cf0
+
0x09049cf4
+
0x09049cf8
- + 04c3ad13c657f59ba6fc135e156d721d -
0x8832328
-
0x9189534
- -
0x9199580
- +
0x09008880
+
0x08ff4a58
+
0x09008390
+
0x08fe3908
+
0x08ff4900
+
0x08832328
+
0x08ff47ac
+
0x0900840c
+
0x0904accc
+
0x09048cfc
+
0x0904abc4
+
0x08ff4784
+
0xc60008fe
+
0x09048d28
+
0x09048d2c
+
0x09048d30
+
0x0904a908
+
0x0904a89c
+
0x0904ace4
+
0x0900b9d0
+
0x08832a60
+
0x091995fc
+
0x089edd14
+
0x089edd18
+
0x089edd1c
+
0x0904a328
+
0x09048d10
+
0x09048d14
+
0x09048d18
From 791ac8dd757a5159d494a9149006f8f3efbd2f2f Mon Sep 17 00:00:00 2001 From: belal Date: Fri, 12 Mar 2010 09:21:45 -0500 Subject: [PATCH 6/9] modify the renamer and creature dump to output the new current cursor creature code --- examples/creaturedump.cpp | 314 ++++++++++++++++++++------------------ examples/renamer.cpp | 12 +- library/DFHackAPI.cpp | 2 +- library/DFHackAPI.h | 4 +- 4 files changed, 177 insertions(+), 155 deletions(-) diff --git a/examples/creaturedump.cpp b/examples/creaturedump.cpp index 77743cc63..338148b8b 100644 --- a/examples/creaturedump.cpp +++ b/examples/creaturedump.cpp @@ -35,6 +35,12 @@ enum likeType ITEM = 2, FOOD = 3 }; + +vector creaturestypes; +matGlosses mat; +vector< vector > itemTypes; +map > names; +DFHack::memory_info *mem; likeType printLike(DFHack::t_like like, const matGlosses & mat,const vector< vector > & itemTypes) { // The function in DF which prints out the likes is a monster, it is a huge switch statement with tons of options and calls a ton of other functions as well, @@ -141,9 +147,154 @@ likeType printLike(DFHack::t_like like, const matGlosses & mat,const vector< vec } +void printCreature(DFHack::API & DF, const DFHack::t_creature & creature) +{ + if(string(creaturestypes[creature.type].id) == "DWARF") + { + cout << "address: " << creature.origin << " creature type: " << creaturestypes[creature.type].id << ", position: " << creature.x << "x " << creature.y << "y "<< creature.z << "z" << endl; + bool addendl = false; + if(creature.first_name[0]) + { + cout << "first name: " << creature.first_name; + addendl = true; + } + if(creature.nick_name[0]) + { + cout << ", nick name: " << creature.nick_name; + addendl = true; + } + string transName = DF.TranslateName(creature.last_name,names,creaturestypes[creature.type].id); + if(!transName.empty()) + { + cout << ", trans name: " << transName; + addendl=true; + } + //cout << ", generic name: " << DF.TranslateName(creature.last_name,names,"GENERIC"); + /* + if(!creature.trans_name.empty()){ + cout << ", trans name: " << creature.trans_name; + addendl =true; + } + if(!creature.generic_name.empty()){ + cout << ", generic name: " << creature.generic_name; + addendl=true; + } + */ + cout << ", likes: "; + for(uint32_t i = 0;igetProfession(creature.profession) << "(" << (int) creature.profession << ")"; + if(creature.custom_profession[0]) + { + cout << ", custom profession: " << creature.custom_profession; + } + if(creature.current_job.active) + { + cout << ", current job: " << mem->getJob(creature.current_job.jobId); + } + cout << endl; + cout << "happiness: " << creature.happiness << ", strength: " << creature.strength << ", agility: " + << creature.agility << ", toughness: " << creature.toughness << ", money: " << creature.money << ", id: " << creature.id; + if(creature.squad_leader_id != -1) + { + cout << ", squad_leader_id: " << creature.squad_leader_id; + } + cout << ", sex: "; + if(creature.sex == 0) + { + cout << "Female"; + } + else + { + cout <<"Male"; + } + cout << endl; + /* + //skills + for(unsigned int i = 0; i < creature.skills.size();i++){ + if(i > 0){ + cout << ", "; + } + cout << creature.skills[i].name << ": " << creature.skills[i].rating; + } + */ + /* + * FLAGS 1 + */ + cout << "flags1: "; + print_bits(creature.flags1.whole, cout); + cout << endl; + if(creature.flags1.bits.dead) + { + cout << "dead "; + } + if(creature.flags1.bits.on_ground) + { + cout << "on the ground, "; + } + if(creature.flags1.bits.skeleton) + { + cout << "skeletal "; + } + if(creature.flags1.bits.zombie) + { + cout << "zombie "; + } + if(creature.flags1.bits.tame) + { + cout << "tame "; + } + if(creature.flags1.bits.royal_guard) + { + cout << "royal_guard "; + } + if(creature.flags1.bits.fortress_guard) + { + cout << "fortress_guard "; + } + /* + * FLAGS 2 + */ + cout << endl << "flags2: "; + print_bits(creature.flags2.whole, cout); + cout << endl; + if(creature.flags2.bits.killed) + { + cout << "killed by kill function, "; + } + if(creature.flags2.bits.resident) + { + cout << "resident, "; + } + if(creature.flags2.bits.gutted) + { + cout << "gutted, "; + } + if(creature.flags2.bits.slaughter) + { + cout << "marked for slaughter, "; + } + if(creature.flags2.bits.underworld) + { + cout << "from the underworld, "; + } + cout << endl << endl; + } +} + + int main (void) { - vector creaturestypes; DFHack::API DF("Memory.xml"); if(!DF.Attach()) { @@ -151,25 +302,24 @@ int main (void) return 1; } - vector< vector > itemTypes; + DF.ReadItemTypes(itemTypes); - matGlosses mat; + DF.ReadPlantMatgloss(mat.plantMat); DF.ReadWoodMatgloss(mat.woodMat); DF.ReadStoneMatgloss(mat.stoneMat); DF.ReadMetalMatgloss(mat.metalMat); DF.ReadCreatureMatgloss(mat.creatureMat); - DFHack::memory_info *mem = DF.getMemoryInfo(); + mem = DF.getMemoryInfo(); // get stone matgloss mapping if(!DF.ReadCreatureMatgloss(creaturestypes)) { cerr << "Can't get the creature types." << endl; return 1; } - - map > names; + if(!DF.InitReadNameTables(names)) { cerr << "Can't get name tables" << endl; @@ -181,152 +331,20 @@ int main (void) cerr << "Can't get creatures" << endl; return 1; } + DF.InitViewAndCursor(); for(uint32_t i = 0; i < numCreatures; i++) { DFHack::t_creature temp; - DF.ReadCreature(i, temp); - if(string(creaturestypes[temp.type].id) == "DWARF") - { - cout << "address: " << temp.origin << " creature type: " << creaturestypes[temp.type].id << ", position: " << temp.x << "x " << temp.y << "y "<< temp.z << "z" << endl; - bool addendl = false; - if(temp.first_name[0]) - { - cout << "first name: " << temp.first_name; - addendl = true; - } - if(temp.nick_name[0]) - { - cout << ", nick name: " << temp.nick_name; - addendl = true; - } - string transName = DF.TranslateName(temp.last_name,names,creaturestypes[temp.type].id); - if(!transName.empty()) - { - cout << ", trans name: " << transName; - addendl=true; - } - //cout << ", generic name: " << DF.TranslateName(temp.last_name,names,"GENERIC"); - /* - if(!temp.trans_name.empty()){ - cout << ", trans name: " << temp.trans_name; - addendl =true; - } - if(!temp.generic_name.empty()){ - cout << ", generic name: " << temp.generic_name; - addendl=true; - } - */ - cout << ", likes: "; - for(uint32_t i = 0;igetProfession(temp.profession) << "(" << (int) temp.profession << ")"; - if(temp.custom_profession[0]) - { - cout << ", custom profession: " << temp.custom_profession; - } - if(temp.current_job.active) - { - cout << ", current job: " << mem->getJob(temp.current_job.jobId); - } - cout << endl; - cout << "happiness: " << temp.happiness << ", strength: " << temp.strength << ", agility: " - << temp.agility << ", toughness: " << temp.toughness << ", money: " << temp.money << ", id: " << temp.id; - if(temp.squad_leader_id != -1) - { - cout << ", squad_leader_id: " << temp.squad_leader_id; - } - cout << ", sex: "; - if(temp.sex == 0) - { - cout << "Female"; - } - else - { - cout <<"Male"; - } - cout << endl; - /* - //skills - for(unsigned int i = 0; i < temp.skills.size();i++){ - if(i > 0){ - cout << ", "; - } - cout << temp.skills[i].name << ": " << temp.skills[i].rating; - } - */ - /* - * FLAGS 1 - */ - cout << "flags1: "; - print_bits(temp.flags1.whole, cout); - cout << endl; - if(temp.flags1.bits.dead) - { - cout << "dead "; - } - if(temp.flags1.bits.on_ground) - { - cout << "on the ground, "; - } - if(temp.flags1.bits.skeleton) - { - cout << "skeletal "; - } - if(temp.flags1.bits.zombie) - { - cout << "zombie "; - } - if(temp.flags1.bits.tame) - { - cout << "tame "; - } - if(temp.flags1.bits.royal_guard) - { - cout << "royal_guard "; - } - if(temp.flags1.bits.fortress_guard) - { - cout << "fortress_guard "; - } - /* - * FLAGS 2 - */ - cout << endl << "flags2: "; - print_bits(temp.flags2.whole, cout); - cout << endl; - if(temp.flags2.bits.killed) - { - cout << "killed by kill function, "; - } - if(temp.flags2.bits.resident) - { - cout << "resident, "; - } - if(temp.flags2.bits.gutted) - { - cout << "gutted, "; - } - if(temp.flags2.bits.slaughter) - { - cout << "marked for slaughter, "; - } - if(temp.flags2.bits.underworld) - { - cout << "from the underworld, "; - } - cout << endl << endl; - } + DF.ReadCreature(i,temp); + printCreature(DF,temp); } + uint32_t currentIdx; + DFHack::t_creature currentCreature; + DF.getCurrentCursorCreature(currentIdx); + cout << "current creature" << endl; + + DF.ReadCreature(currentIdx, currentCreature); + printCreature(DF,currentCreature); DF.FinishReadCreatures(); DF.Detach(); #ifndef LINUX_BUILD diff --git a/examples/renamer.cpp b/examples/renamer.cpp index 4c8e94290..6d1e33cfc 100644 --- a/examples/renamer.cpp +++ b/examples/renamer.cpp @@ -364,16 +364,18 @@ start: { DF.Suspend(); DF.setCursorCoords(toChange.x, toChange.y,toChange.z); - vector underCursor; - while (!DF.getCurrentCursorCreatures(underCursor)) + uint32_t underCursor; + DF.getCurrentCursorCreature(underCursor); + while (underCursor != toChangeNum) { DF.Resume(); - w->TypeSpecial(DFHack::WAIT,1,100); + w->TypeStr("v",100); DF.Suspend(); DF.setCursorCoords(toChange.x, toChange.y,toChange.z); DF.ReadCreature(toChangeNum,toChange); + DF.getCurrentCursorCreature(underCursor); } - //CurrentCursorCreatures gives the creatures in the order that you see them with the 'k' cursor. + /*//CurrentCursorCreatures gives the creatures in the order that you see them with the 'k' cursor. //The 'v' cursor displays them in the order of last, then first,second,third and so on //Pretty weird, but it works //The only place that seems to display which creature is currently selected is on the stack, whose location is likely not static, so not usable @@ -388,7 +390,7 @@ start: break; } } - } + }*/ DF.Resume(); w->TypeStr(commandString.c_str()); if (waitTillScreenState(DF,"viewscreen_customize_unit")) diff --git a/library/DFHackAPI.cpp b/library/DFHackAPI.cpp index a69c4f951..90e071ed6 100644 --- a/library/DFHackAPI.cpp +++ b/library/DFHackAPI.cpp @@ -331,7 +331,7 @@ bool API::WriteTileTypes (uint32_t x, uint32_t y, uint32_t z, uint16_t *buffer) return false; } -bool API::getCurrentCursorCreature (uint32_t & creature_index) +bool API::getCurrentCursorCreature(uint32_t & creature_index) { if(!d->cursorWindowInited) return false; creature_index = g_pProcess->readDWord(d->current_cursor_creature_offset); diff --git a/library/DFHackAPI.h b/library/DFHackAPI.h index 71fcfb50d..e4470677c 100644 --- a/library/DFHackAPI.h +++ b/library/DFHackAPI.h @@ -199,7 +199,9 @@ namespace DFHack bool getCursorCoords (int32_t &x, int32_t &y, int32_t &z); bool setCursorCoords (const int32_t x, const int32_t y, const int32_t z); - bool API::getCurrentCursorCreature (uint32_t & creature_index); + /// This returns false if there is nothing under the cursor, it puts the addresses in a vector if there is + bool getCurrentCursorCreature (uint32_t & creature_index); + bool InitViewSize(); bool getWindowSize(int32_t & width, int32_t & height); From 17e81ddcce2b9f166fddb227d9278605521da4bb Mon Sep 17 00:00:00 2001 From: belal Date: Sat, 13 Mar 2010 09:09:14 -0500 Subject: [PATCH 7/9] fixed merge for creaturedump.cpp --- examples/creaturedump.cpp | 161 +++----------------------------------- 1 file changed, 10 insertions(+), 151 deletions(-) diff --git a/examples/creaturedump.cpp b/examples/creaturedump.cpp index e91ae4c8e..7804e1b14 100644 --- a/examples/creaturedump.cpp +++ b/examples/creaturedump.cpp @@ -39,8 +39,9 @@ enum likeType vector creaturestypes; matGlosses mat; vector< vector > itemTypes; -map > names; DFHack::memory_info *mem; +vector< vector > englishWords; +vector< vector > foreignWords; likeType printLike(DFHack::t_like like, const matGlosses & mat,const vector< vector > & itemTypes) { // The function in DF which prints out the likes is a monster, it is a huge switch statement with tons of options and calls a ton of other functions as well, @@ -149,21 +150,21 @@ likeType printLike(DFHack::t_like like, const matGlosses & mat,const vector< vec void printCreature(DFHack::API & DF, const DFHack::t_creature & creature) { - if(string(creaturestypes[creature.type].id) == "DWARF") + if(string(creaturestypes[creature.type].id) == "DWARF") { cout << "address: " << creature.origin << " creature type: " << creaturestypes[creature.type].id << ", position: " << creature.x << "x " << creature.y << "y "<< creature.z << "z" << endl; bool addendl = false; - if(creature.first_name[0]) + if(creature.name.first_name[0]) { - cout << "first name: " << creature.first_name; + cout << "first name: " << creature.name.first_name; addendl = true; } - if(creature.nick_name[0]) + if(creature.name.nickname[0]) { - cout << ", nick name: " << creature.nick_name; + cout << ", nick name: " << creature.name.nickname; addendl = true; } - string transName = DF.TranslateName(creature.last_name,names,creaturestypes[creature.type].id); + string transName = DF.TranslateName(creature.name,englishWords,foreignWords,false); if(!transName.empty()) { cout << ", trans name: " << transName; @@ -320,8 +321,6 @@ int main (void) return 1; } - vector< vector > englishWords; - vector< vector > foreignWords; if(!DF.InitReadNameTables(englishWords,foreignWords)) { cerr << "Can't get name tables" << endl; @@ -337,148 +336,8 @@ int main (void) for(uint32_t i = 0; i < numCreatures; i++) { DFHack::t_creature temp; - DF.ReadCreature(i, temp); - if(string(creaturestypes[temp.type].id) == "DWARF") - { - cout << "address: " << temp.origin << " creature type: " << creaturestypes[temp.type].id << ", position: " << temp.x << "x " << temp.y << "y "<< temp.z << "z" << endl; - bool addendl = false; - if(temp.name.first_name[0]) - { - cout << "first name: " << temp.name.first_name; - addendl = true; - } - if(temp.name.nickname[0]) - { - cout << ", nick name: " << temp.name.nickname; - addendl = true; - } - string transName = DF.TranslateName(temp.name,englishWords,foreignWords,false); - if(!transName.empty()) - { - cout << ", trans name: " << transName; - addendl=true; - } - //cout << ", generic name: " << DF.TranslateName(temp.last_name,names,"GENERIC"); - /* - if(!temp.trans_name.empty()){ - cout << ", trans name: " << temp.trans_name; - addendl =true; - } - if(!temp.generic_name.empty()){ - cout << ", generic name: " << temp.generic_name; - addendl=true; - } - */ - cout << ", likes: "; - for(uint32_t i = 0;igetProfession(temp.profession) << "(" << (int) temp.profession << ")"; - if(temp.custom_profession[0]) - { - cout << ", custom profession: " << temp.custom_profession; - } - if(temp.current_job.active) - { - cout << ", current job: " << mem->getJob(temp.current_job.jobId); - } - cout << endl; - cout << "happiness: " << temp.happiness << ", strength: " << temp.strength << ", agility: " - << temp.agility << ", toughness: " << temp.toughness << ", money: " << temp.money << ", id: " << temp.id; - if(temp.squad_leader_id != -1) - { - cout << ", squad_leader_id: " << temp.squad_leader_id; - } - cout << ", sex: "; - if(temp.sex == 0) - { - cout << "Female"; - } - else - { - cout <<"Male"; - } - cout << endl; - /* - //skills - for(unsigned int i = 0; i < temp.skills.size();i++){ - if(i > 0){ - cout << ", "; - } - cout << temp.skills[i].name << ": " << temp.skills[i].rating; - } - */ - /* - * FLAGS 1 - */ - cout << "flags1: "; - print_bits(temp.flags1.whole, cout); - cout << endl; - if(temp.flags1.bits.dead) - { - cout << "dead "; - } - if(temp.flags1.bits.on_ground) - { - cout << "on the ground, "; - } - if(temp.flags1.bits.skeleton) - { - cout << "skeletal "; - } - if(temp.flags1.bits.zombie) - { - cout << "zombie "; - } - if(temp.flags1.bits.tame) - { - cout << "tame "; - } - if(temp.flags1.bits.royal_guard) - { - cout << "royal_guard "; - } - if(temp.flags1.bits.fortress_guard) - { - cout << "fortress_guard "; - } - /* - * FLAGS 2 - */ - cout << endl << "flags2: "; - print_bits(temp.flags2.whole, cout); - cout << endl; - if(temp.flags2.bits.killed) - { - cout << "killed by kill function, "; - } - if(temp.flags2.bits.resident) - { - cout << "resident, "; - } - if(temp.flags2.bits.gutted) - { - cout << "gutted, "; - } - if(temp.flags2.bits.slaughter) - { - cout << "marked for slaughter, "; - } - if(temp.flags2.bits.underworld) - { - cout << "from the underworld, "; - } - cout << endl << endl; - } + DF.ReadCreature(i,temp); + printCreature(DF,temp); } uint32_t currentIdx; DFHack::t_creature currentCreature; From 12abef8ace1361d45a2d66236563f1736d807c12 Mon Sep 17 00:00:00 2001 From: belal Date: Sun, 14 Mar 2010 13:21:26 -0400 Subject: [PATCH 8/9] used different creature vector than before, this is the correct one, the old one was missing some creatures, and the current_creature index was not right, also found the offsets for mood and artifacts for 40d Everything should work now from 40d,40d2->40d19 on windows, linux was already done before I also modified creaturedump.cpp to show mood and aritifacts if a creature has one, also the mood is now a int rather than a uint, as we check for -1 --- examples/creaturedump.cpp | 15 ++++++++++++--- library/DFHackAPI.cpp | 2 +- library/DFTypes.h | 2 +- output/Memory.xml | 22 +++++++++++++++------- 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/examples/creaturedump.cpp b/examples/creaturedump.cpp index 7804e1b14..c049d9635 100644 --- a/examples/creaturedump.cpp +++ b/examples/creaturedump.cpp @@ -150,7 +150,7 @@ likeType printLike(DFHack::t_like like, const matGlosses & mat,const vector< vec void printCreature(DFHack::API & DF, const DFHack::t_creature & creature) { - if(string(creaturestypes[creature.type].id) == "DWARF") + if(string(creaturestypes[creature.type].id) == "DWARF") { cout << "address: " << creature.origin << " creature type: " << creaturestypes[creature.type].id << ", position: " << creature.x << "x " << creature.y << "y "<< creature.z << "z" << endl; bool addendl = false; @@ -210,6 +210,9 @@ void printCreature(DFHack::API & DF, const DFHack::t_creature & creature) { cout << ", squad_leader_id: " << creature.squad_leader_id; } + if(creature.mood != -1){ + cout << ", mood: " << creature.mood << " "; + } cout << ", sex: "; if(creature.sex == 0) { @@ -289,8 +292,13 @@ void printCreature(DFHack::API & DF, const DFHack::t_creature & creature) { cout << "from the underworld, "; } - cout << endl << endl; + cout << endl; + if(creature.flags1.bits.had_mood && (creature.mood == -1 || creature.mood == 8 ) ){ + string artifact_name = DF.TranslateName(creature.artifact_name,englishWords,foreignWords,false); + cout << "artifact: " << artifact_name << endl; + } } + cout << endl; } @@ -337,12 +345,13 @@ int main (void) { DFHack::t_creature temp; DF.ReadCreature(i,temp); + cout << "index " << i << " "; printCreature(DF,temp); } uint32_t currentIdx; DFHack::t_creature currentCreature; DF.getCurrentCursorCreature(currentIdx); - cout << "current creature" << endl; + cout << "current creature at index " << currentIdx << endl; DF.ReadCreature(currentIdx, currentCreature); printCreature(DF,currentCreature); diff --git a/library/DFHackAPI.cpp b/library/DFHackAPI.cpp index 2ae2e2c43..5eacbfaf2 100644 --- a/library/DFHackAPI.cpp +++ b/library/DFHackAPI.cpp @@ -1247,7 +1247,7 @@ bool API::ReadCreature (const int32_t index, t_creature & furball) g_pProcess->read(temp2,sizeof(t_like),(uint8_t *) &furball.likes[i]); } - g_pProcess->readWord (temp + d->creature_mood_offset, furball.mood); + furball.mood = (int16_t) g_pProcess->readWord (temp + d->creature_mood_offset); g_pProcess->readDWord (temp + d->creature_happiness_offset, furball.happiness); diff --git a/library/DFTypes.h b/library/DFTypes.h index d478bcb4a..bc369bb3e 100644 --- a/library/DFTypes.h +++ b/library/DFTypes.h @@ -545,7 +545,7 @@ struct t_creature uint8_t numLikes; t_like likes[32]; t_job current_job; - uint16_t mood; + int16_t mood; uint32_t happiness; uint32_t id; uint32_t agility; diff --git a/output/Memory.xml b/output/Memory.xml index 34999b2f0..efc07d3ef 100644 --- a/output/Memory.xml +++ b/output/Memory.xml @@ -787,6 +787,12 @@ 0x0264 0x0664 0x1D64 + + + 0x0 + 0x1C + 0x38 + 0x1C 0x00 @@ -799,9 +805,11 @@ 0xF2 0xF4 0x1A4 + 0x1F8 0x228 0x2F8 0x2AC + 0x3CC 0x438 0x43C 0x440 @@ -851,7 +859,7 @@ 0x1C 0x20 - 0x38 + 0x00 0x7a 0x100 @@ -1127,7 +1135,7 @@ b1a8ca1f91734eb492b7f54f6823cddb
0x014d1db0
0x014bda18
-
0x014d1404
+
0x014D141C
0x00cd4c3c
0x0165b5a8
0x0094b27c
@@ -1297,7 +1305,7 @@ 193193d8624f2f3f6d9d556fab09b122
0x0151bd00
0x01507968
-
0x0151b354
+
0x0151b36c
0x00d20ed8
0x016a54f8
0x009652a4
@@ -1334,7 +1342,7 @@ 6ea1de36af8e1666bd6478736e298c4c
0x015b7750
0x015a33b8
-
0x015b6da4
+
0x015b6dbc
0x00ddaed8
0x0095f410
0x0095f2b4
@@ -1389,7 +1397,7 @@ 12cc4a3dbb6e6dfd7bc7aee458b9471a
0x015be808
0x015aa470
-
0x015bde5c
+
0x015bde74
0x00de1f54
0x00966430
0x009662b4
@@ -1426,7 +1434,7 @@ de66405f54d98297303d439b3b7aa30e
0x015f3260
0x015deec8
-
0x015f28b4
+
0x015f28cc
0x00e16924
0x0099ae08
0x0099ac88
@@ -1473,7 +1481,7 @@ 13640a273d90af39425b798ae9823757
0x01512898
0x014fe500
-
0x01511eec
+
0x01511f04
0x00d35b68
0x016ac1a0
0x0097a2b8
From 607bad2bf8c80dd9cccde25a130b3435cfa63c5a Mon Sep 17 00:00:00 2001 From: belal Date: Sun, 14 Mar 2010 13:32:19 -0400 Subject: [PATCH 9/9] Fix settlement offsets for 40d, everything should work of 40d now --- output/Memory.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/output/Memory.xml b/output/Memory.xml index efc07d3ef..efc89ee72 100644 --- a/output/Memory.xml +++ b/output/Memory.xml @@ -861,7 +861,7 @@ 0x00 0x7a - 0x100 + 0xD8 0x68 0x24