Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 54 55 [56] 57 58 ... 192

Author Topic: Dwarf Therapist (LATEST 0.6.12 5/23/12 see first post)  (Read 870788 times)

stevedore

  • Bay Watcher
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.10 3/15/11 see first post)
« Reply #825 on: February 14, 2012, 07:23:07 pm »

Nice find on the dwarf_race_index!  How did you get 0x015cbe9c ?  I was able to get the creature vector but got lost as to the next step.

I was having a look at http://code.google.com/p/dwarftherapist/source/browse/inc/dwarfraceindexsearchjob.h (god, that's an ugly filename), and it prints out potential values when searching for it through the memory scanner. I looked in run.log, and it had three or four potential matches that were all the same value, but got rejected for some reason or another. I just tried one of them (I may have had to correct the address, as it prints the absolute, not relative). Because I picked an address more-or-less at random, I suspect that I may just have stumbled upon a spot in code that happens to have that value, but may not be guaranteed to. I didn't really feel like searching through the entire memory of DF looking for 0x000001d1 (don't forget to convert to little-endian if you're using a memory inspection tool, if you're searching for it) and finding which one was the constant value.

Correcting the address:

look for this line in run.log:
2012-Feb-14 17:51:04.872 DEBUG   core   memory correction: "0x00ab0000" [../dwarftherapist/src/dfinstancewindows.cpp:259] (find_running_copy)

Subtract that value from any absolute address to get the relative address.
« Last Edit: February 14, 2012, 08:16:27 pm by stevedore »
Logged

Carnes

  • Bay Watcher
  • Near a good old-time canteen.
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.10 3/15/11 see first post)
« Reply #826 on: February 14, 2012, 08:13:22 pm »

Is there a reason why using the BruteForce (raw output) section on say 0x0213be9c (dwarf_race_index) reveals garbage instead of strings?  Shouldn't the name & nick be viewable?  There is data there and it appears to be structured, but just not in a human readable format.
Logged
You call that breaking my spine?! You Forgotten Beast ladies wouldn't know how to break a spine if-
SNAP
AUGHHH! MY SPINE!

stevedore

  • Bay Watcher
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.10 3/15/11 see first post)
« Reply #827 on: February 14, 2012, 08:29:47 pm »

Is there a reason why using the BruteForce (raw output) section on say 0x0213be9c (dwarf_race_index) reveals garbage instead of strings?  Shouldn't the name & nick be viewable?  There is data there and it appears to be structured, but just not in a human readable format.

Keep in mind that that should be dumping the raw hex values from memory - 0x41424344 is equivalent to the character values 'ABCD' for instance. (forgive me if you know this already)

Additionally, the only data that should be at that pointer (if it's valid for dwarf_race_index) is a four-byte integer that's the index of "DWARF" within the list of races (as far as I understand). (e.g., if the list is { elf, elephant, goblin, dwarf, dog }, dwarf_race_index would be an int * pointing to the value 3)

Even in the creatures vector, if you're looking at the entry for a particular dwarf, there may be no human readable data available, or there may be. Consider the following two examples:

Example A:
Code: [Select]
struct dwarf {
    char firstName[16];
    char lastName[16];
}

Example B:
Code: [Select]
struct dwarf {
    char *firstName;
    char *lastName;
}

If we have a dwarf "Urist McUrist", and we want to represent him with these structures, he would have two very different representations in memory, looking at those structures specifically:

A:
Code: [Select]
55 72 69 73 74 00 00 00    00 00 00 00 00 00 00 00
4D 63 55 72 69 73 74 00    00 00 00 00 00 00 00 00

B:
Code: [Select]
AA BB AA BB CC DD CC DD

In the case of A, we have stored: "Urist\0\0\0\0\0\0\0\0\0\0\0" followed by "McUrist\0\0\0\0\0\0\0\0\0", whereas B is two pointers (0xAABBAABB and 0xCCDDCCDD) that are the addresses of "Urist" and "McUrist" in memory elsewhere.

Depending how a dwarf, or any creature, is implemented in DF's code, we could see either of these being the case. Especially since all of the names are from a preset library (and not procedurally generated, as far as I know), I could definitely see first name and last name both being pointers. Some others are index values (profession appears to be, race certainly is).

I believe that the custom nickname and profession names are also dynamically allocated, and thus you'll just see pointer values rather than the actual string values. At least, as far as I can tell, they are.
« Last Edit: February 14, 2012, 08:32:40 pm by stevedore »
Logged

Gearheart

  • Bay Watcher
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.10 3/15/11 see first post)
« Reply #828 on: February 14, 2012, 08:46:40 pm »

So I am about as oblivious as physically possible to the arcane workings of programming, do the posts in the last couple pages represent significant headway towards getting it working properly, or is it just dabbling in interesting notes?
Logged

stevedore

  • Bay Watcher
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.10 3/15/11 see first post)
« Reply #829 on: February 14, 2012, 08:50:12 pm »

So I am about as oblivious as physically possible to the arcane workings of programming, do the posts in the last couple pages represent significant headway towards getting it working properly, or is it just dabbling in interesting notes?

Well, for reference, the total that I was able to get working in DT over about 4 hours of effort this afternoon (not knowing anything about the inner workings of DT or DF before about 1pm today):

- DT could read all of my dwarves, but only the following attributes
    - first name
    - nickname
    - custom profession name
    - gender

So, I'd say it leans somewhat towards "dabbling". I'd say DwarfEngineer's estimate of the end of the weekend at best still holds pretty strongly.
Logged

Xelanthol

  • Bay Watcher
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.10 3/15/11 see first post)
« Reply #830 on: February 14, 2012, 09:11:47 pm »

I need this for my dwarfing ;-;
Logged

Jon-Ace

  • Bay Watcher
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.10 3/15/11 see first post)
« Reply #831 on: February 14, 2012, 09:57:43 pm »

I'll be working on DT for 2012 as soon as I get a chance. It's highly likely that a number of the structures and offsets have changed, so I'm not optimistic that this will go quickly. Add on the fact that today is Valentine's day, and we're looking at end of the weekend as the earliest I'll have something.

Sorry there hasn't been much activity lately - I can't promise that I'll get to many features, but I'll do what I can to add support for the new version.

Welcome back! Take your time as I'm sure there will be at least one inevitable bug fix release to mess everything up again.
« Last Edit: February 14, 2012, 10:00:35 pm by Jon-Ace »
Logged

DwarfEngineer

  • Bay Watcher
  • Grumble Grumble...
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.10 3/15/11 see first post)
« Reply #832 on: February 14, 2012, 09:59:33 pm »

For what little help it is to DwarfEngineer, I've been mucking around with DT and a memory viewer all afternoon and have been able to figure out the following:

checksum is 0x4f391a33
creature_vector is 0x0179f728
dwarf_race_index seems to be 465/0x1d1 (value in the .ini I've used is 0x015cbe9c, but I don't quite understand how it's determined where this value specifically comes from)

With these, DT is able to read all of my dwarves and their first names or nicknames correctly, last names still show up as "Unknownunknown". Sex appears to read correctly (all of my dwarves are correct, at least), and custom professions are read properly too.

I haven't been able to figure out any other values, hopefully these can make it at least a bit easier.

I can confirm these values. I only had a few minutes to look so far, but at a minimum, some of the offsets have changed (as expected) but also, the way language and translation is handled appears to have changed. Take a look at the generic language raw.
Logged
Current Dwarf Therapist Maintainer - Tips

Neyvn

  • Bay Watcher
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.10 3/15/11 see first post)
« Reply #833 on: February 14, 2012, 10:01:01 pm »

I would kill for even a basic Therapist right now... I just got a wave of 30 Dwarves!!!
Logged
Quote from: Ubiq
Broker: Wasn't there an ambush squad here just a second ago?
Merchant: I don't know what you're talking about. Do you want this goblin ankle bone amulet or not?
My LIVESTREAM. I'm Aussie, so not everything is clean. Least it works...

Molay

  • Bay Watcher
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.10 3/15/11 see first post)
« Reply #834 on: February 14, 2012, 10:05:36 pm »

I would kill for even a basic Therapist right now... I just got a wave of 30 Dwarves!!!

Hah! You unlucky bastard! I must admit, I already surrendered after a wave of 20. One really realizes what he misses most when it's not available anymore :(
But I'm optimistic DwarfEngineer will not let us down, sadly that doesn't mean it will be fixed immediately :/

Wish I knew more about that stuff... I never bothered with memory reading - I just did coding. Now I regret I never got into that :(
Logged
The best alternative to having a functional steel industry is to have a really, really, really good hospital. And a lot of coffins.

Seiteki

  • Escaped Lunatic
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.10 3/15/11 see first post)
« Reply #835 on: February 14, 2012, 10:23:10 pm »

I'm glad I didn't find out about DT until after playing for a while.

I can manage, but the faster you update it, the less pain I'll go through in the end!
Logged

DwarfEngineer

  • Bay Watcher
  • Grumble Grumble...
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.10 3/15/11 see first post)
« Reply #836 on: February 14, 2012, 11:52:54 pm »

Got a little bit more time to work on it, but I'm done for the night now.

So far:

In game_data.ini:
Code: [Select]
total_words_per_table = 2173
expected_dwarf_race = 465

With those settings, you can find the translation vectors as well:
Code: [Select]
[info]
checksum=0x4f391a33
version_name=v0.34.01 (graphics)

[addresses]
translation_vector=0x017e3638
language_vector=0x017e3618
creature_vector=0x0179f728
dwarf_race_index=0x015cbe9c
squad_vector=0x0000000

This will display your dorfs with last names. Next is finding the dwarf_offsets, etc.
Logged
Current Dwarf Therapist Maintainer - Tips

stevedore

  • Bay Watcher
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.10 3/15/11 see first post)
« Reply #837 on: February 15, 2012, 12:07:49 am »

I, too, found those values (once I found out about game_data.ini - still learning a lot about DT, heh).

I'm working on trying to figure out some of the offsets. From what I can tell, all of the following are definitely correct:

first_name
nick_name
last_name
custom_profession
race
sex

I'm looking to get current_job figured out, at least. profession and happiness would be nice, too.

I'll have to dig through the code to learn how the souls are structured to see if I can figure them out.

Edit: I got enabled labours working. Here's my v0.34.01_graphics.ini file, it will give what I would call a very basic level of actual functionality to DT - you can manage your dwarves' enabled labours, at least, though you cannot see their skill level, current job, or happiness

Code: [Select]
[info]
checksum=0x4f391a33
version_name=v0.34.01 (graphics)

[addresses]
translation_vector=0x017e3638
language_vector=0x017e3618
creature_vector=0x0179f728
dwarf_race_index=0x015cbe9c
squad_vector=0x0

[offsets]
word_table=0x0000003c
string_buffer_offset=0x0000

[word_offsets]
base=0x0000
noun_singular=0x001C
noun_plural=0x0038
adjective=0x0054
verb=0x008C
present_simple_verb=0x00A8
past_simple_verb=0x00C4
past_participle_verb=0x00E0
present_participle_verb=0x00FC

[dwarf_offsets]
first_name=0x0000
nick_name=0x001C
last_name=0x0038
custom_profession=0x006C
profession=0x0088
race=0x008C
flags1=0x00E0
flags2=0x00E4
sex=0x00F8
id=0x00FC
recheck_equipment=0x01BC
birth_year=0x0224
current_job=0x02F4
physical_attrs=0x3C4
states=0x0528
souls=0x0648
likes=0x07A0
labors=0x078C
happiness=0x0710
squad_ref_id=0x790

[soul_details]
skills=0x01F0
traits=0x0214

[job_details]
id=0x0008
on_break_flag=0x0011
sub_job_id=0x0040

[squad_offsets]
id=0x0000
name=0x003C
members=0x0088

[position_offsets]
token=0x0000
flags=0x0020
general_name_singular=0x00E8
general_name_plural=0x0104
male_name_singular=0x0158
male_name_plural=0x0174
female_name_singluar=0x0120
female_name_plural=0x013C
custom_color_red=0x0382
custom_color_green=0x0380

[valid_flags_1]
size=1
1\name=Not from around these parts
1\value=0x80000000

[valid_flags_2]
size=1
1\name=Dead. Deceased. An Undwarf!
1\value=0x02000000

[invalid_flags_1]
size=7
1\name=a zombie
1\value=0x00001000
2\name=a skeleton
2\value=0x00002000
3\name=a merchant or diplomat
3\value=0x00000040
4\name=outpost liason
4\value=0x00000800
5\name=an invader or hostile
5\value=0x00020000
6\name=an invader or hostile
6\value=0x00080000
7\name=an invader or hostile
7\value=0x000C0000

[invalid_flags_2]
size=2
1\name="dead, Jim."
1\value=0x00000080
2\name=from the Underworld. SPOOKY!
2\value=0x00040000
« Last Edit: February 15, 2012, 12:33:42 am by stevedore »
Logged

Azated

  • Bay Watcher
  • ohai der
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.10 3/15/11 see first post)
« Reply #838 on: February 15, 2012, 12:32:20 am »

I'm praying you can get Therapist working sometime soon. I just got a wave of about 20 useless millitary dwarves and have now decided to wall myself off from the world and brutally murder any migrants that come.

It's strange that I'm more scared of migrants than I am of the terrifying creatures sitting in the bottom of my fortress.
Logged
Then it happened. Then I cringed. Then I picked it up and beat him to death with it, and then his buddies, too.
You beat a man to death with his dick?

"I don't feel like myself. Maybe I should have Doc take a look at me" ~ Dreamy
 "You're gonna trust a dwarf that got his medical degree from a pickaxe?" ~ Bossy

dyn

  • Escaped Lunatic
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.10 3/15/11 see first post)
« Reply #839 on: February 15, 2012, 12:50:12 am »

I'm looking to get current_job figured out, at least. profession and happiness would be nice, too.

I believe happiness is 0x082c and current job is 0x030c. I am working on some of the rest, I will keep posting what I find as well
Logged
Pages: 1 ... 54 55 [56] 57 58 ... 192