For the OS X users:
If you right-click the app and click "Show Package Contents", you can click through to Contents\Resources\etc. The ini files for the offsets live there. Unfortunately I'm in the middle of a sprint at work, so I probably won't have time to test offsets on the OS X side until after work tonight.
See - I knew there was an easy answer and I was just dumb.
is there a doc someplace on the structure of ini files for DT? I observe that the structure of the ini files are different for windows vs osx.
Windows:
a <version>_legacy.ini and a <version>_graphics.ini file for each release
osx:
just a single <version>.ini file for each release.
Is the windows structure to support legacy versions of DT, or do I somehow need to have both?
Also - I've got a mac (clearly), and I can read hex - so I'm happy to go looking for the mac-specific offsets myself if someone can point me to a guide for how you identify what you're looking for in the core...surely you're not just randomly guessing memory addresses....
Yes, the Windows structure is for side-by-side support of legacy and SDL versions.
As for finding the offsets... some of it has been guesswork, some more deterministic. There's a wiki post on the google code site (
http://code.google.com/p/dwarftherapist/wiki/MappingNewVersions) that describes it, but it's quite outdated so only gives you a very rough idea.
Here's a quick guide to how I figured out some values:
modify DwarfTherapist\etc\game_data.ini, and change the following values:
total_words_per_table = 2173
expected_dwarf_race = 465
I don't know for sure that expected_dwarf_race should be changed; it's just a guess. I'm thinking it will probably have the same index in windows and on mac, but it might not. Worst case, this won't be any more incorrect than the value from the old version.
Generate a new world. When you go to embark, give your first dwarf the nickname "this_is_a_long_name" and custom profession "0123456789abcdef".
Once you're in game, just pause.
If you start dwarf therapist and click "connect to DF", it should say "connected to unknown version" in the status bar. Look for run.log (I assume it's within the package, maybe? Not absolutely sure) and look for a line where it says that it can't find a memory layout for checksum 0xXXXXXXXX - copy this hex value.
Close down DT, and copy v0.31.25.ini to v0.34.01.ini. Change the first two sections to look like (copying the checksum value you got from run.log):
[info]
checksum=0xXXXXXXXX
version_name=v0.34.01 (graphics)
complete=false
[addresses]
translation_vector=0x0
language_vector=0x0
creature_vector=0x0
dwarf_race_index=0x0
squad_vector=0x0
You can start DT again and connect to DF. Now, hit "Scan Memory". In this dialog, you want to try the four buttons on the right for finding creature vector, dwarf race index, translation vector, and squad vector. If they work, they'll print out some values that you can put into your .ini file, then restart DT and see if it's starting to read anything.
If it's reading the dwarves, you can right click on them and select Dump Memory to get, surprise surprise, a dump of the memory pertaining to that dwarf. From here it's been a bit more guess-work for me, but mostly I was looking at the offsets in my .ini file and trying to determine if the values at those offsets made sense. If DT finds your dwarf race index (more on that a bit later), for instance, that's an easy one to verify, since you just look for a specific hex value at an offset (remembering that it will be in little-endian representation). The labour offset is another semi-easy one; you'll be looking for a large area of repeated bytes that are either 01 or 00. Mining has index 0, so if you go in game and toggle it, you should see one byte going from 00 to 01 and back, etc, and the address of that byte is your labour offset.
on the dwarf race index:
DT didnt' find this value for me. I found that if I looked in run.log, I saw some lines like this after running the search for it:
2012-Feb-15 15:30:51.231 DEBUG core PTR 13734bf "" [bin/release/../../../dwarftherapist/inc/dwarfraceindexsearchjob.h:77] (go)
2012-Feb-15 15:30:51.231 DEBUG core MATCH! offset 46 2e [bin/release/../../../dwarftherapist/inc/dwarfraceindexsearchjob.h:80] (go)
2012-Feb-15 15:30:51.231 DEBUG core READ ADDR FROM 13734ed = 252be9c [bin/release/../../../dwarftherapist/inc/dwarfraceindexsearchjob.h:82] (go)
2012-Feb-15 15:30:51.231 DEBUG core RACE VALUE 465 HEX 1d1 [bin/release/../../../dwarftherapist/inc/dwarfraceindexsearchjob.h:84] (go)
2012-Feb-15 15:30:51.231 DEBUG core PTR 13736eb "" [bin/release/../../../dwarftherapist/inc/dwarfraceindexsearchjob.h:77] (go)
2012-Feb-15 15:30:51.231 DEBUG core MATCH! offset 31 1f [bin/release/../../../dwarftherapist/inc/dwarfraceindexsearchjob.h:80] (go)
2012-Feb-15 15:30:51.231 DEBUG core READ ADDR FROM 137370a = 252be9c [bin/release/../../../dwarftherapist/inc/dwarfraceindexsearchjob.h:82] (go)
2012-Feb-15 15:30:51.231 DEBUG core RACE VALUE 465 HEX 1d1 [bin/release/../../../dwarftherapist/inc/dwarfraceindexsearchjob.h:84] (go)
2012-Feb-15 15:30:51.231 DEBUG core PTR 15558c6 "" [bin/release/../../../dwarftherapist/inc/dwarfraceindexsearchjob.h:77] (go)
2012-Feb-15 15:30:51.231 DEBUG core MATCH! offset 28 1c [bin/release/../../../dwarftherapist/inc/dwarfraceindexsearchjob.h:80] (go)
2012-Feb-15 15:30:51.231 DEBUG core READ ADDR FROM 15558e2 = 252be9c [bin/release/../../../dwarftherapist/inc/dwarfraceindexsearchjob.h:82] (go)
2012-Feb-15 15:30:51.231 DEBUG core RACE VALUE 465 HEX 1d1 [bin/release/../../../dwarftherapist/inc/dwarfraceindexsearchjob.h:84] (go)
2012-Feb-15 15:30:51.231 DEBUG core PTR 19b0537 "" [bin/release/../../../dwarftherapist/inc/dwarfraceindexsearchjob.h:77] (go)
2012-Feb-15 15:30:51.231 DEBUG core MATCH! offset 25 19 [bin/release/../../../dwarftherapist/inc/dwarfraceindexsearchjob.h:80] (go)
2012-Feb-15 15:30:51.231 DEBUG core READ ADDR FROM 19b0550 = 252be9c [bin/release/../../../dwarftherapist/inc/dwarfraceindexsearchjob.h:82] (go)
2012-Feb-15 15:30:51.231 DEBUG core RACE VALUE 465 HEX 1d1 [bin/release/../../../dwarftherapist/inc/dwarfraceindexsearchjob.h:84] (go)
If you're seeing several lines like this that all have a matching race value pop up, then just try one of the addresses from one of these lines (the address is in red)
2012-Feb-15 15:30:51.231 DEBUG core READ ADDR FROM 19b0550 = [color=red]252be9c[/color][bin/release/../../../dwarftherapist/inc/dwarfraceindexsearchjob.h:82] (go)
You'll have to subtract the appropriate offset from it first, however, before it's appropriate for putting into your .ini file. Look for this value (again, red) in run.log:
2012-Feb-15 15:30:49.001 DEBUG core base address: "0x01360000" [../dwarftherapist/src/dfinstancewindows.cpp:258] (find_running_copy)
2012-Feb-15 15:30:49.001 DEBUG core memory correction: "[color=red]0x00f60000[/color]" [../dwarftherapist/src/dfinstancewindows.cpp:259] (find_running_copy)
And subtract that value from the address you got a step before. That's what you'll put in your .ini file.
I hope that gives you at least somewhere to start.