Bay 12 Games Forum

Dwarf Fortress => DF Modding => Topic started by: peterix on June 07, 2010, 09:37:16 am

Title: DFHack 0.5.15 (legacy)
Post by: peterix on June 07, 2010, 09:37:16 am
DFHack is an attempt to unite the various ways hack tools access DF memory and allow for easier development of new tools (and of course, make the game more enjoyable for players). It comes with some useful tools that can fix your fort and make things easier to handle.

It includes tools like:
'reveal'     - reveals the map or portions of it.
'prospector' - counts available raw materials - mostly minerals.
'cleanmap'   - removes nasty bloodstains and other such materials from the map.

And many more...

Read the README (https://github.com/peterix/dfhack/blob/legacy/README.rst) for the full list of tools and their usage :)

This is the legacy branch of DFHack, meant for older DF releases. For the new DFHack, visit the NEW THREAD (http://www.bay12forums.com/smf/index.php?topic=91166.0).

Packages (for DF 31.xx):
Windows tools release (http://dethware.org/dfhack/download/dfhack-0.5.15-2-Windows-x86.zip)
Ubuntu 10.10 32bit (http://dethware.org/dfhack/download/dfhack_0.5.15-1_ubuntu-10.10-i386.deb)
Ubuntu 10.10 64bit (http://dethware.org/dfhack/download/dfhack_0.5.15-1_ubuntu-10.10-amd64.deb)

Old Windows package for DF 40dxx: 0.2.1 (http://dethware.org/dfhack/download/dfhack-bin-0.2.1.zip)

The source is available from github (https://github.com/peterix/dfhack), please read the Compile (https://github.com/peterix/dfhack/blob/legacy/COMPILE.rst) document before building.

Bugs should be reported here: Issues tracker (http://github.com/peterix/dfhack/issues).

There's an IRC channel on freenode: #dfhack (irc://irc.freenode.net/dfhack (http://irc::://irc.freenode.net/dfhack) or web client (http://webchat.freenode.net/?channels=dfhack&uio=d4))
Title: Version history
Post by: peterix on June 07, 2010, 09:40:43 am
Changelog
0.5.15
0.5.14
0.5.13
0.5.12
0.5.11
0.5.10
0.5.9
0.5.8
0.5.7
0.5.6
0.5.5
0.5.4
0.5.3
0.5.2
0.5.0.2
0.5.0.1
0.5.0.0
0.4.0.7
0.4.0.5
0.4.0.2
0.4.0.1
Title: Re: DFHack 0.4.0.0 - tools and memory access library
Post by: peterix on June 07, 2010, 09:54:55 am
Another placeholder, should it ever be necessary.
Title: Re: DFHack 0.4.0.0 - tools and memory access library
Post by: mumblerit on June 09, 2010, 04:33:02 pm
update for 31.06?
Title: Re: DFHack 0.4.0.0 - tools and memory access library
Post by: peterix on June 09, 2010, 05:55:30 pm
update for 31.06?
Certainly, when I get to it. Right now I'm preparing for CS final exam... lots of fun stuff, but not of the DFHack kind.
I'll see if the changes are minimal enough and if there's no problem, release. Otherwise it could take a few days.
Title: Re: DFHack 0.4.0.0 - tools and memory access library
Post by: Waladil on June 10, 2010, 05:15:55 am
Gah. How dare you spend time working on school when you could be helping us have irresponsible fun? You're such a bad person roflmao.

Btw, CS = Computer Science?
That reminds me, I need to get the AP board to send my APCS scores to my college... free college credit, eh?
Title: Re: DFHack 0.4.0.0 - tools and memory access library
Post by: Rose on June 10, 2010, 05:18:30 am
don't worry, he's already done it. just hasn't posted here yet.
Title: Re: DFHack 0.4.0.0 - tools and memory access library
Post by: Jiri Petru on June 10, 2010, 10:37:35 am
Obviously it's even available for download here (http://github.com/peterix/dfhack/downloads).
Thanks Peterix for your hard work, and good luck with your exams!

EDIT: Or not, sorry for the confusion. It's just the source.
Title: Re: DFHack 0.4.0.0 - tools and memory access library
Post by: wurli on June 10, 2010, 11:03:15 am
EDIT: Or not, sorry for the confusion. It's just the source.

that is enough for me
as a linux user i'm happy about that

the missing memory definitions are another topic ;)

"terminate called after throwing an instance of 'DFHack::Error::MissingMemoryDefinition'
  what():  memory definition missing: type address key map_data
Aborted"
Title: Re: DFHack 0.4.0.1 - tools and memory access library
Post by: Jiri Petru on June 10, 2010, 03:57:17 pm
Now  :)
Title: Re: DFHack 0.4.0.1 - tools and memory access library
Post by: Urist McFumbler on June 10, 2010, 11:55:13 pm
Thank you very much for the quick adaptation to .06.

DFHack has become really important in my recent games (since the .31 series started) due to the blood and vomit fest.  :P

Title: Re: DFHack 0.4.0.1 - tools and memory access library
Post by: Gabriel A. Zorrilla on June 14, 2010, 11:28:26 am
Mmmph! I'm not C proficient. I'd like to make a little dwarf manager ala Dwarf Therapist, but in Java (for cross platform).

This library is very hacky, any example about how to access dwarve's info? Or at least, a tool that does that in the CLI so i check the code?

Thanks!
Title: Re: DFHack 0.4.0.1 - tools and memory access library
Post by: sizeak on June 14, 2010, 04:34:18 pm
Try the creature dump example...
Title: Re: DFHack 0.4.0.1 - tools and memory access library
Post by: Ratbert_CP on June 14, 2010, 04:47:57 pm
Mmmph! I'm not C proficient. I'd like to make a little dwarf manager ala Dwarf Therapist, but in Java (for cross platform).

This library is very hacky, any example about how to access dwarve's info? Or at least, a tool that does that in the CLI so i check the code?

Thanks!

I spent a couple of days trying to learn JNI to better use dfhack in Java.  I think my brain melted...  :)
Title: Re: DFHack 0.4.0.1 - tools and memory access library
Post by: peterix on June 14, 2010, 05:41:16 pm
Mmmph! I'm not C proficient. I'd like to make a little dwarf manager ala Dwarf Therapist, but in Java (for cross platform).

This library is very hacky, any example about how to access dwarve's info? Or at least, a tool that does that in the CLI so i check the code?

Thanks!

I spent a couple of days trying to learn JNI to better use dfhack in Java.  I think my brain melted...  :)
It should be simpler to make bindings for other languages now, because there's a C version of the DFHack API available. With the C++ stuff out of the way, you should be able to make just about any kind of bindings ... Java, C#, etc.


Also, my brain is melting from information overload =D
Title: Re: DFHack 0.4.0.1 - tools and memory access library
Post by: Gabriel A. Zorrilla on June 15, 2010, 12:25:31 pm
Crap (or should i say, carp? :D ) Cant figure out the C API. Don't you have at least a draft document about it?
Title: Re: DFHack 0.4.0.1 - tools and memory access library
Post by: Rakis on June 15, 2010, 03:11:49 pm
So I downloaded it, but how do I actually run it?  Or do I just run the tools by themselves?  There doesn't seem to be an executable, and the tools don't some to be .exes either.  The readme also didn't cover this as near as I could tell.  I'm not a programmer, so forgive my ignorance.
Title: Re: DFHack 0.4.0.1 - tools and memory access library
Post by: zxcvmnb on June 16, 2010, 08:30:18 am
So I downloaded it, but how do I actually run it?  Or do I just run the tools by themselves?  There doesn't seem to be an executable, and the tools don't some to be .exes either.  The readme also didn't cover this as near as I could tell.  I'm not a programmer, so forgive my ignorance.
What exactly did you download? If you're not a programmer and you're on Windows, you'll probably want the binaries (dfhack-bin). (Binaries as in executables, as opposed to text, i.e. source code.) If you're on Linux, I think you'll have to compile them yourself. Instructions are in COMPILE.
Run the exes from command line/terminal. (run -> cmd (I think), cd C:\[location of exes], dir, [tool name].exe) You'll also need to copy over SDL.dll (if you're running the SDL version of DF), replacing one already there.Nope. Sorry, it's been a while since I used DF on Windows. See Peterix's post below.
Title: Re: DFHack 0.4.0.1 - tools and memory access library
Post by: peterix on June 16, 2010, 09:04:25 am
So I downloaded it, but how do I actually run it?  Or do I just run the tools by themselves?  There doesn't seem to be an executable, and the tools don't some to be .exes either.  The readme also didn't cover this as near as I could tell.  I'm not a programmer, so forgive my ignorance.
What exactly did you download? If you're not a programmer and you're on Windows, you'll probably want the binaries (dfhack-bin). (Binaries as in executables, as opposed to text, i.e. source code.) If you're on Linux, I think you'll have to compile them yourself. Instructions are in COMPILE.
Run the exes from command line/terminal. (run -> cmd (I think), cd C:\[location of exes], dir, [tool name].exe) You'll also need to copy over SDL.dll (if you're running the SDL version of DF), replacing one already there.
1. yes. you want the binaries
2. on linux, compiling is required. packaging is a bit more complicated, but dfhack should be prepared for that :)
3. there's no need to run stuff from cmd. just double-click the binary.
4. Replacing SDL.dll is not a good idea (copying over it). You have to rename the one that comes with DF to SDLreal.dll and then add the one from DFHack. Otherwise, you'll get non-working DF. The DFHack SDL.dll acts as a thin layer between DF and the real SDL.dll... adds a few things to it to make DF play nicer with DFHack.
Title: Re: DFHack 0.4.0.1 - tools and memory access library
Post by: Gabriel A. Zorrilla on June 16, 2010, 11:11:16 am
What about a little API reference?
Title: Re: DFHack 0.4.0.1 - tools and memory access library
Post by: sizeak on June 16, 2010, 11:18:38 am
Look at the creature dump example source code, its under tool/example/creaturedump.cpp. It's fairly clear, from the names of things and the text being written to the console, what's going.
Title: Re: DFHack 0.4.0.1 - tools and memory access library
Post by: Gabriel A. Zorrilla on June 16, 2010, 11:48:22 am
Good tip, i'll give it a look. Thanks.
Title: Re: DFHack 0.4.0.1 - tools and memory access library
Post by: Inspiration on June 16, 2010, 07:51:35 pm
<
Noob here.

Running on Vista, and the exe's tell me they couldn't find a suitable process. It's worth noting that they used to work in .6, with an fort genned in a previous version.
Title: Re: DFHack 0.4.0.1 - tools and memory access library
Post by: Gabriel A. Zorrilla on June 16, 2010, 10:16:26 pm
It should be simpler to make bindings for other languages now, because there's a C version of the DFHack API available. With the C++ stuff out of the way, you should be able to make just about any kind of bindings ... Java, C#, etc.


Also, my brain is melting from information overload =D

Could you explain how DFHack works? Perhaps i can find out a workaround of using it and implement some of the funtionality natively in Java. Sorry if im being naive here...
Title: Re: DFHack 0.4.0.1 - tools and memory access library
Post by: huhu on June 17, 2010, 03:20:04 am
Perhaps i can find out a workaround of using it and implement some of the funtionality natively in Java.

The python bindings have had a lot of work put into them by doomchild. If you really want to, you could use those through jython to get it execute in the JVM. I'm not sure if that helps with any problem you have. Other than that, someone with the necessary knowledge has to take the time to write the Java bindings from scratch, resulting in a DFHack library you could just import into java code and use as such.

Edit: It needs to be maintained too. So writing the bindings isn't a one-time deal. Judging from the questions you presented, I'd say the path of least resistance for you is to learn python and use the python bindings already there. :) But if you really like Java and don't want to switch, then if you manage to get DFHack do something, anything, through Java, there's always the chance other people interested in the same thing will pop up and help. I'd certainly help with the python bindings if I had any kind of idea what's supposed to be done with them.
Title: Re: DFHack 0.4.0.1 - tools and memory access library
Post by: Gabriel A. Zorrilla on June 17, 2010, 11:28:36 am
Hum, i'm thinking about looking into the code and customize a little bit the tools to export the data extracted to a text file for later read and parsing. I have some experience with Python and I know whatever i have to learn is easy.

BTW, when i try to execute a command in the Linux's CLI, it says that dwarffortress.exe file is missing... :O
Title: Re: DFHack 0.4.0.1 - tools and memory access library
Post by: huhu on June 17, 2010, 12:46:27 pm
Without having investigated the matter at all, I immediately thought that maybe you don't have DF and a fort running on the background?
Title: Re: DFHack 0.4.0.1 - tools and memory access library
Post by: peterix on June 17, 2010, 02:48:51 pm
Hum, i'm thinking about looking into the code and customize a little bit the tools to export the data extracted to a text file for later read and parsing. I have some experience with Python and I know whatever i have to learn is easy.

BTW, when i try to execute a command in the Linux's CLI, it says that dwarffortress.exe file is missing... :O
Man. I have no idea.

If you come to the #dfhack irc channel on freenode, I'll try to help you.
Title: Re: DFHack 0.4.0.1 - tools and memory access library
Post by: The Grim Sleeper on June 19, 2010, 06:23:11 am
I've got a problem trying to run the .exe thingies, and I couldn't find a better place to post my question.

When I run any of them, I get this error:
"Application could not be started because the configuration of the Application is incorrect. Re-installing might solve this problem."

I've tried downloading the .zip again, if there was some sort of corruption in the first one, but that didn't help.
Any thoughts?
Title: Re: DFHack 0.4.0.1 - tools and memory access library
Post by: peterix on June 19, 2010, 06:36:46 am
I've got a problem trying to run the .exe thingies, and I couldn't find a better place to post my question.

When I run any of them, I get this error:
"Application could not be started because the configuration of the Application is incorrect. Re-installing might solve this problem."

I've tried downloading the .zip again, if there was some sort of corruption in the first one, but that didn't help.
Any thoughts?
Yes. I think you need this: http://www.microsoft.com/downloads/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2&displaylang=en (http://www.microsoft.com/downloads/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2&displaylang=en)
Title: Re: DFHack 0.4.0.1 - tools and memory access library
Post by: The Grim Sleeper on June 19, 2010, 09:29:13 am
I've got a problem trying to run the .exe thingies, and I couldn't find a better place to post my question.

When I run any of them, I get this error:
"Application could not be started because the configuration of the Application is incorrect. Re-installing might solve this problem."

I've tried downloading the .zip again, if there was some sort of corruption in the first one, but that didn't help.
Any thoughts?
Yes. I think you need this: http://www.microsoft.com/downloads/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2&displaylang=en (http://www.microsoft.com/downloads/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2&displaylang=en)
Worked like a charm. Thanks!
Title: Re: DFHack 0.4.0.1 - tools and memory access library
Post by: Gabriel A. Zorrilla on June 19, 2010, 08:55:28 pm
Peterix, could you post in http://pastebin.com/ how a dfcreaturedump looks like?

Thanks! :D
Title: Re: DFHack 0.4.0.1 - tools and memory access library
Post by: SirBruce on June 20, 2010, 05:10:20 am
Update for 31.08?
Title: Re: DFHack 0.4.0.1 - tools and memory access library
Post by: peterix on June 20, 2010, 06:41:25 pm
Peterix, could you post in http://pastebin.com/ (http://pastebin.com/) how a dfcreaturedump looks like?

Thanks! :D
http://pastebin.com/wZyuBAfb (http://pastebin.com/wZyuBAfb)
It's a bit mangled because of text encoding problems with the creature symbols and names.

Anyway, you can still use dfhack together with the windows version of DF running in wine until I resolve the linux offset problem.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: Gabriel A. Zorrilla on June 20, 2010, 10:53:20 pm
mmmh, I think I'll touch a little bit the script to make the output in xml.

Edit: its working with DF under wine (which BTW, is utterly slow compared to native). I'll modify the program to dump into a more structured file and pickup the data from there. I saw there is no creaturedump program in the compiled windows version, can i just compile it in windows (as your COMPILE instructions) and will work?

Edit2: 4:39 am here, trying to modify and shorten the creaturedump.cpp. I dont understand a shit. Back to bed.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: Askot Bokbondeler on June 21, 2010, 09:04:29 am
posting to follow the thread
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: Gabriel A. Zorrilla on June 21, 2010, 12:59:50 pm
Downloaded latest master and when running a tool in .08 with WINE (or .06) i get:

couldn't find a suitable process

Linux.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: wurli on June 21, 2010, 01:35:37 pm
Downloaded latest master and when running a tool in .08 with WINE (or .06) i get:

couldn't find a suitable process

Linux.


Have you tried to compile the 0.4.0.2 version? Works for me with the native Linux Version of DF. No need to use wine.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: Gabriel A. Zorrilla on June 21, 2010, 01:39:27 pm
I need to use creaturedump which currently does not work under native linux :(
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: ohgoditburns on June 22, 2010, 10:59:03 am
I didn't see it in the list of dependencies for compiling in linux... but you need to have the x11 dev installed (libx11-dev I think). It took me about 2 hours to figure it out since I'm still a bit newbish with linux. Might want to add that to the compile instructions.

Meanwhile...
Is there any kind of documentation to assist with writing new tools? I'd be interested in writing a tool that scans below revealed floor tiles, and channels out the floor if it finds a mineral.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: Gabriel A. Zorrilla on June 22, 2010, 11:23:13 am
There is no API, you just have the c++ examples. For me is a headache, as i'm not proficient in C++ and want to program a JAVA software.

I believe if peterix wants to standarize this library and allow other developers to do stuff with it, will have to write proper documentation. In the meantime, he will be more than willing to help you out, but that's not efficient.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: peterix on June 22, 2010, 02:34:46 pm
OK. Seems like I can't put this documentation stuff off any longer ;)

I should have the basics done soon-ish.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: Gabriel A. Zorrilla on June 22, 2010, 08:25:43 pm
Yay! Lets kick some ass!
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: Urist McPenguin on June 23, 2010, 03:27:13 am
4. Replacing SDL.dll is not a good idea (copying over it). You have to rename the one that comes with DF to SDLreal.dll and then add the one from DFHack. Otherwise, you'll get non-working DF. The DFHack SDL.dll acts as a thin layer between DF and the real SDL.dll... adds a few things to it to make DF play nicer with DFHack.
I'm using DF 31.08 and DFHack 0.4.0.2 on Windows 7, without having done the SDL switch. So far I've had no issues at all, is there anything I should be watching out for?
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: alset85 on June 25, 2010, 08:25:38 am
Hey, I just wanted to jump in and show my support for this util. Also if it isn't too much trouble could you add an "enable magma buildings" option? Because that would go well with the liquid editor.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: smjjames on June 25, 2010, 02:13:05 pm
Just a slight word of warning, if you open one of the stuff (DFflows in my case) while the world is genning, I think it may cause it to wierd out and lock up cause my errorlog got a spam of random buffer overload and DF stopped responding.

The worldgen settings I use occasionally spawn one which gives buffer overload error in the errorlog while genning, so it could just be a fluke of timing and the RNG. No actual harm was done to the game though.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: darius on June 27, 2010, 05:50:05 pm
Not sure if you know this already or not (too lazy to checkout the repo) but i found few offsets:
Code: [Select]
In creature gloss:
276 bytes from beginning -> pref list ( cows for hounting moos)
324 bytes  -> caste list (pointers to caste struct)
Caste struct:
0-> std::string token
28-> std::string name
56-> std::string name_plural
84-> std::string adjective
0x510 -> ptr to flag array 
0x514 -> flag array size or similar
yes last two are in hex all other are in base 10
and last one:
in caste flags offset 7 byte value 02 is can_work, or intelligent or something that enables labour menu.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: jaked122 on June 27, 2010, 06:30:07 pm
does the java virtual machine really allow memory of other processes to be edited? this would seem like a bad idea.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: peterix on June 27, 2010, 07:25:31 pm
does the java virtual machine really allow memory of other processes to be edited? this would seem like a bad idea.
No, the OS can do that for you. You have to deal with the OS-level stuff... or DFHack. I'd say dealing with DFHack would be easier than rewriting it from scratch in Java... or whatever other language.
Not sure if you know this already or not (too lazy to checkout the repo) but i found few offsets ...
Hmm.. the caste flags and pref list stuff seems to be new. Added to my TODO list :) I assume this is for the SDL 0.31.08 version?
Just a slight word of warning, if you open one of the stuff (DFflows in my case) while the world is genning, I think it may cause it to wierd out and lock up cause my errorlog got a spam of random buffer overload and DF stopped responding.
I'll take a look at that. But yeah... those tools aren't meant to be used outside of the 'game' mode. I honestly have no idea how the memory looks during worldgen...
Hey, I just wanted to jump in and show my support for this util. Also if it isn't too much trouble could you add an "enable magma buildings" option? Because that would go well with the liquid editor.
This needs some more infrastructure that's not currently there yet. See issue 22 (http://github.com/peterix/dfhack/issues#issue/22)

I'm currently learning how to use Doxygen properly... stuff went a bit slower than I'd like. I got stung by some insect in my leg and can't walk now, so I should have some time for DFHack again... although it hurts like hell :P
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: Snook on June 28, 2010, 01:15:18 pm
For casting obsidian, I run into some annoying issues sometimes. I'll put down a block of magma and then try to go up a level and put down a block of water. Sometimes it works, sometimes it doesn't, saying "invalid block location" or something like that. Any reason why?
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: peterix on June 28, 2010, 06:09:31 pm
For casting obsidian, I run into some annoying issues sometimes. I'll put down a block of magma and then try to go up a level and put down a block of water. Sometimes it works, sometimes it doesn't, saying "invalid block location" or something like that. Any reason why?
Are you building towers with this?
In that case, the reason is that DF doesn't have the map entirely 'created' at all times. You can't place anything in those 'not created' places.

Otherwise it could be a bug.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: 0x517A5D on June 29, 2010, 04:09:50 pm
I agree.  You may have to make a construction that enters that 16x16 map block -- e.g. a ramp from the Z level below or a pair of stairways.  It is possible that a constructed wall might do as well, given that it creates a sort of floor above it.

Alternately... what happens if you save and reload the game?  That might force the map to be recomputed.  There ought to be a fully allocated and populated map block containing only air above every map block containing something solid.

Eventually I hope that DFHack will be able to reach inside DF and call its subroutines.  Then it would be possible (though hard) to populate map blocks as needed.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: peterix on June 29, 2010, 04:43:29 pm
Eventually I hope that DFHack will be able to reach inside DF and call its subroutines.  Then it would be possible (though hard) to populate map blocks as needed.
Well, I hope so too... it needs a layer of abstraction on top of it and a way to make it maintainable. People tried to add this already, but it was only for a single version of DF on one OS. Not very useful. I remove hacks like that eventually.

Similar approach is employed for manipulating STL strings inside DF. Code is sneaked into DF using the SDL library and DF's STL strings are accessed normally (something equivalent to std::string * name = 0x12345678). This is very low-cost when it comes to maintenance and survived... unlike the other stuff.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: Brillig on June 30, 2010, 08:54:04 am
Great utility

An 'enable magma buildings' utility would be very useful I believe. I spent ages making a nice volcano for my map so I wouldn't have to search for magma in the world gen for ages, then I couldn't use it :(

Edit: I just read back and noticed that someone already said the same thing :D
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: UristMcStudent on July 02, 2010, 05:05:39 am
Is it possible to write something like "tile edit" and "for each tile" from gibbed's DF tweak for now?
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: peterix on July 02, 2010, 05:15:53 am
Is it possible to write something like "tile edit" and "for each tile" from gibbed's DF tweak for now?
That would be actually trivial.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: UristMcStudent on July 02, 2010, 05:49:22 am
That would be actually trivial.
Sounds easy, but I never worked with DF memory before :\ Where can I found some tips?
I mean i have no idea about how and where in memory DF stores tile data.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: peterix on July 02, 2010, 12:51:10 pm
That would be actually trivial.
Sounds easy, but I never worked with DF memory before :\ Where can I found some tips?
I mean i have no idea about how and where in memory DF stores tile data.
You don't have to.

One possibility is to update the addresses used by tweak. You won't be able to work with any of the coverings like mud/snow in new DF versions. Get offsets from DFHack, feed them to tweak, done. I tried to use it with 40d under win7 and got only errors back though :/
Second possibility is recreating those things on top of DFHack. This requires actual work. With tweak's sources nowhere to be found, I see no other way than this one.

You should be able to use DFHack for the actual 'hacking' part and just create a GUI on top of that. Looking at the wiki page of ForEachTile (http://df.magmawiki.com/index.php/Utility:For_Each_Tile), it will need some bits a compiler would have -- lexical and syntactic analysis of expressions. Some other thing could be salvaged to create this... I have some code like that laying around in my uni projects folder :) Of course, you could cut some features and remove the text parsing part.

About tile edit: quite simple
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: UristMcStudent on July 02, 2010, 01:38:31 pm
You don't have to.
One possibility is to update the addresses used by tweak.
I dunno why, but tweak with hashes and other stuff rewrited for 0.31.08 does not see the game launched. Neither sdl nor legacy. (dtil sees "legacy", but hangs after any action);
You won't be able to work with any of the coverings like mud/snow in new DF versions.
I won't be able to work with them in tweak or at all? If second, then how "cleanmap" works?
Well, for now i don't ever know C#, only delphi :\ But i have some books and manuals on it, and wish to do something   ::)
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: peterix on July 02, 2010, 02:27:15 pm
I dunno why, but tweak with hashes and other stuff rewrited for 0.31.08 does not see the game launched. Neither sdl nor legacy. (dtil sees "legacy", but hangs after any action);
Well, as I said, I can't get it to work with 40d under Win7. There must be some bugs in it or I'm doing it wrong... Without the source, it's hard to tell.
I won't be able to work with them in tweak or at all? If second, then how "cleanmap" works?
Well, for now i don't ever know C#, only delphi :\ But i have some books and manuals on it, and wish to do something   ::)
In tweak. It won't understand the changes. For how it works, you can look at the source. But basically, every 16x16 block of tiles has a bunch of bitmaps. Some are default and part of the 'block' structure, and some are treated as special objects. In 31.0x, the splatter bits were moved from one of the default bitmaps to special objects to add support for all the /fun/ stuff like poisons. I just set the 'opacity' of those bitmap objects to zero, which means they don't show up in the map (and more importantly, don't interact with your dwarves).

For working with DFhack, you need C++ (or possibly Python, but that part isn't ready for general use I think).
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: profit on July 02, 2010, 09:44:11 pm
Ahh excellent, I am glad to see Mcstudent found his way here.  I hope you can help him.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: keda on July 04, 2010, 07:00:36 pm
pread failed: can't read 0x30 bytes at address 0xafbbbc60
errno: 16
SHM ACCESS DENIED

So... how do I get past this?
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: doomchild on July 06, 2010, 11:14:18 am
Sorry about the lack of documentation in the C API.  I need to write up some of the basic pieces, because a couple of things might not make sense at first glance (especially the allocator callbacks).  In general, I tried to do as little actual work in the wrapper, so the vast majority of the thing is just making the interface valid C that looks more or less like the C++ API.  My interest has always been in a set of Python bindings (because I despise C++ to an unreasonable degree), but I wanted to allow other bindings to be written as well.

Do we have a place where the documentation is going?  Possibly something wiki-oriented in nature?

DC
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: Master on July 07, 2010, 03:14:53 pm
I have a question/suggestion on the dfliquids.exe.

Is there any way to delete the obsidian blocks you create? I am using them to damn up a major river so I can construct a real damn system. I want to later remove them. I can do that with channeling but that leaves a ramp in this version which I do not want.

I noticed you can create an delete water and magma. Is there any way to do so with the obsidian blocks you create? If not is it possible in a future version?
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: ohgoditburns on July 10, 2010, 01:01:59 am
EDIT: It looks like this is actually in the COMPILE readme under the * to be installed into the system header. I'll just leave this here in case anyone else is as blind :)

I want to set up an OpenBox hotkey to run dfvdig for me. When I try to run the program without actually being in the output directory, I get

Code: [Select]
terminate called after throwing an instance of 'DFHack::Error::MemoryXmlParse'
  what():  error 2: Failed to open file, at row 0 col 0
Aborted

Any idea how I can avoid this problem? Some way of putting the programs in /usr/games/ might help me out.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: peterix on July 10, 2010, 06:43:02 pm
Is there any way to delete the obsidian blocks you create? I am using them to damn up a major river so I can construct a real damn system. I want to later remove them. I can do that with channeling but that leaves a ramp in this version which I do not want.
Not really. Sorry. dfliquids is a quick hack I made to have something that uses some of the features of the maps module... and it's far from useless :)

Anyway, my idea for this is to create a proper map editor eventually. I'm thinking about using libtcod as the base for such a tool and making basically a mouse painting tool with brushes and a way to copy&paste stuff around. Still in the planning stage and unlikely to change for a month or so though.

EDIT: It looks like this is actually in the COMPILE readme under the * to be installed into the system header. I'll just leave this here in case anyone else is as blind :)

I want to set up an OpenBox hotkey to run dfvdig for me. When I try to run the program without actually being in the output directory, I get

Code: [Select]
terminate called after throwing an instance of 'DFHack::Error::MemoryXmlParse'
  what():  error 2: Failed to open file, at row 0 col 0
Aborted

Any idea how I can avoid this problem? Some way of putting the programs in /usr/games/ might help me out.
The easiest thing to do here is to wrap what you want to run using a script like this:
Code: [Select]
#!/bin/bash
cd /whatever/path/
./dfvdig

Otherwise, you could use a CMake variable for the search path of memory.xml which I added specifically for the purpose of *packaging* on linux.
It's name is MEMXML_DATA_PATH. This will make DFHack search for the offset file in a specific place first.
I never really tried to use a packaged dfhack before, even though there is a makepkg script for it in archlinux. You can find it here: http://aur.archlinux.org/packages/dfhack-git/dfhack-git/PKGBUILD (http://aur.archlinux.org/packages/dfhack-git/dfhack-git/PKGBUILD) and it contains a good example on how to use this variable.

Note that this package makes use of the shared memory library and is dependent on how DF is packaged in the arch-games repository, so those three lines don't really apply:
Code: [Select]
install -Dm755 output/libdfconnect.so "$pkgdir/usr/lib/libdfconnect.so"
install -Dm755 "$srcdir/dwarffortress-hacked" "$pkgdir/usr/bin/dwarffortress-hacked"
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/dfhack/LICENCE"
What you're looking for is just the CMake variable. The script way could be easier though :)

Archlinux packages are made with the build stage described in the MAKEPKG script essentially putting everything into a folder as if it was /. Then this folder is packed into a simple tar.gz or tar.xz archive.
Code: [Select]
cmake .. -DCMAKE_BUILD_TYPE:string=Release -DCMAKE_INSTALL_PREFIX=$pkgdir/usr -DMEMXML_DATA_PATH:path=/usr/share/dfhack|| return 1 then means, that DFhack will be installed into /usr/ and Memory.xml will be loaded from /usr/share/dfhack. Normally MEMXML_DATA_PATH is set to '.' and DFhack is treated as a 'portable' app, not installed at all.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: cephalo on July 10, 2010, 09:05:27 pm
Anyway, my idea for this is to create a proper map editor eventually. I'm thinking about using libtcod as the base for such a tool and making basically a mouse painting tool with brushes and a way to copy&paste stuff around. Still in the planning stage and unlikely to change for a month or so though.

If you do something like that, can you make it obvious in some way that it was used? It greatly cheapens the idea of a megaproject when you use a map editor instead of dwarven hard labor. I like seeing huge projects that people put a ton of work into, but what makes it special is that in most cases you have to have mastered the game to do that sort of thing.

Why should I spend two months making Hoover Dam with all the mishaps, little repairs, failled experiments, dwarves encased in magma and goblin junk mucking things up, when someone with a map editor could do the same thing in an evening on a pristine map without any mistakes? How do I know that what I see on DFMA is a real fortress or some cheap knockoff with no history? There are plenty of ways to cheat in DF for your own enjoyment of the game, but this is something that could impact the community by causing a loss of interest in other people's creations. Nobody wants to see anyone's fake fortress.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: Master on July 10, 2010, 09:40:53 pm
I hear what you are saying but I completely disagree. Most of the mega projects give you a save file anyways which will show that there either was not enough time, material or they violated a law of dwarf fortress physics. You dont need to add in something that blatantly shows they used an editor. The community will weed those people out and humiliate them on their own.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: mnjiman on July 11, 2010, 12:05:45 am
I hear what you are saying but I completely disagree. Most of the mega projects give you a save file anyways which will show that there either was not enough time, material or they violated a law of dwarf fortress physics. You dont need to add in something that blatantly shows they used an editor. The community will weed those people out and humiliate them on their own.

Humiliate? That is a under exaggeration.

They will be ripped to shreds, never to be trusted again. Their name will be horribly foiled and when Dwarfs do use their name in their conversations, it will be used to describe Elves and that water that crap leaves behind.

Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: smjjames on July 11, 2010, 12:57:00 pm
Any idea when a new version will be up that is compatible with .10?
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: Master on July 11, 2010, 01:59:33 pm
Im waiting on this too. Already got all my mods working and found the proper location. Now I just need to damn up the river so my FPS dont go to the crapper.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: Passive Fist on July 11, 2010, 06:02:50 pm
Not having dfvdig.exe makes me feel powerless and sad. I eagerly await an update. Great work here!
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: smjjames on July 11, 2010, 06:13:46 pm
Me too, I like using DFreveal when looking for a good site.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: darius on July 12, 2010, 03:27:13 am
Hey peterix, how hard would it be to add function calling? I'm thinking of adding a stack of function pointers with arguments. Yeah i'm too lazy to write my own interprocess comunication thingy...
Oh and could you direct me to that part of dfHack that i need to dig. I tried once but lost interest very fast
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: Master on July 12, 2010, 01:28:54 pm
So all we need is the new offsets and we can plug in a 31.10 entry into the memory area and get it working again right? I already tried using the DFT offsets but they didnt work. Is there a hack program for getting those values or do you just need to hex edit and find them?

Spoiler (click to show/hide)
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: heywheresmysnack on July 12, 2010, 02:46:37 pm
I would do it if I had any idea how. I do know how to hex edit, but I don't know what memory entry I would be looking for.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: clc02 on July 12, 2010, 03:08:19 pm
Just going to throw this out there, dwarf therapist has the offsets for .10, if you find and replace the .08 with the ones with .10 it should work. (Some of them are called different names for the same pointers)  What I was trying to do but I got myself hopelessly confuzzled with the word wall notepad presents
EDIT: And here it is:

Code: [Select]
[info]
checksum                = 0x4c398089
version_name            = v0.31.10 (graphics)

[addresses]
translation_vector      = 0x016d3404
language_vector         = 0x016d33d4
creature_vector         = 0x0168e744
dwarf_race_index        = 0x014b9f1c

[offsets]
word_table              = 0x0058

[dwarf_offsets]
first_name              = 0x0000
nick_name               = 0x001C
last_name               = 0x0038
custom_profession       = 0x006c
profession              = 0x0088
race                    = 0x008C
flags1                  = 0x00F8
flags2                  = 0x00FC
sex                     = 0x0110
id                      = 0x0114
recheck_equipment       = 0x021C
birth_year              = 0x0298
current_job             = 0x0390
physical_attrs          = 0x0464
states                  = 0x0684
souls = 0x0790
likes                   = 0x07A0
labors = 0x07BC
happiness               = 0x087C

[soul_details]
skills                  = 0x01FC
traits                  = 0x0224

[job_details]
id                      = 0x0008
on_break_flag           = 0x0011

[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
# 2 bytes each...
custom_color_red        = 0x037E
custom_color_green      = 0x0380
custom_color_red        = 0x0382

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

[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
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: smjjames on July 12, 2010, 04:02:43 pm
I wonder if the other guys on Peterix's site can do it? No idea when he'll release it and understandably its like 10 PM where he is in the Czech Republic.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: peterix on July 12, 2010, 07:36:40 pm
Relax, I'm working on it :)
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: peterix on July 12, 2010, 07:38:37 pm
What I was trying to do but I got myself hopelessly confuzzled with the word wall notepad presents
Don't use notepad. It's practically useless in comparison with a real text editor ;)

OK. I have a version out that should be 31.10 compatible to some extent. It's missing a lot of the creature stuff but I'll try to get that from the DT people. They seem to have put a lot of work into those already :)

I'm not putting it into the first post yet... at least until it can be confirmed that everything's fine with the new versions :)
You can get it here: http://github.com/downloads/peterix/dfhack/dfhack-bin-0.4.0.3b.zip (http://github.com/downloads/peterix/dfhack/dfhack-bin-0.4.0.3b.zip)

Also ZOMG 3AM!

Edit: fixed for good. github file caching was getting in the way.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: smjjames on July 12, 2010, 09:10:52 pm
Thank you!

And yea I was wondering what you were doing up so late your time.

Edit: Got a 'This application has requested the Runtime to terminate it in an unusual way' error for DFliquid. I'll check some of the others.

Edit2: I'm getting the error for everything that I try to run. Maybe you need to get some sleep, lol
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: MaximumZero on July 12, 2010, 09:13:30 pm
Woo, go peterix! I wonder if this will make DFHack dependent utilities (like Runesmith) work now?
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: smjjames on July 12, 2010, 09:17:37 pm
Woo, go peterix! I wonder if this will make DFHack dependent utilities (like Runesmith) work now?

Its not actually working atm, see my previous post.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: MaximumZero on July 12, 2010, 09:21:09 pm
You hadn't edited that post yet. :P I know better now, though, thanks. I'll keep holding my breath.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: Mechanoid on July 12, 2010, 09:24:36 pm
Got a 'This application has requested the Runtime to terminate it in an unusual way' error for DFliquid. I'm getting the error for everything that I try to run.

It looks like he forgot to put in the memory.xml
dfposition.exe, dfXvdig.bat and dfoffsets.exe are also missing.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: MaximumZero on July 12, 2010, 09:29:20 pm
Would there need to be any super major changes to that file? If not, we can get it from previous versions. Please forgive the noob question.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: Mechanoid on July 12, 2010, 09:33:54 pm
Would there need to be any super major changes to that file?
Yes, yes there would be.
It is the missing xml file that is causing the fault; putting in the old .2 one stops the program from crashing but gives the error 'couldn't find a suitable process' in the window
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: smjjames on July 12, 2010, 09:36:45 pm
Got a 'This application has requested the Runtime to terminate it in an unusual way' error for DFliquid. I'm getting the error for everything that I try to run.

It looks like he forgot to put in the memory.xml
dfposition.exe, dfXvdig.bat and dfoffsets.exe are also missing.

He was up at 3 AM local time for him.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: peterix on July 12, 2010, 10:05:37 pm
Should be fixed now...

http://github.com/downloads/peterix/dfhack/dfhack-bin-0.4.0.3b.zip
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: Urist McFumbler on July 12, 2010, 10:35:36 pm
Should be fixed now...

http://github.com/downloads/peterix/dfhack/dfhack-bin-0.4.0.3b.zip

Thanks peterix.

If it was possible I would like to volunteer my services in updating DFHack during the various DF updates, as I am residing on GMT +8 which means I can work while you are asleep. :P

However I am quite illiterate (I only have 1 year course in C++ programming 10 years ago) when it comes to programming and hacking, if you have the time, I can get together with you on irc  or whereever you choose and learn the steps to help you out or at least do the preliminary work for you to just add in.

PM me if you are interested
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: Master on July 12, 2010, 11:03:12 pm
Should be fixed now...

http://github.com/downloads/peterix/dfhack/dfhack-bin-0.4.0.3b.zip

5am... :)

Salute!
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: smjjames on July 12, 2010, 11:03:57 pm
Should be fixed now...

http://github.com/downloads/peterix/dfhack/dfhack-bin-0.4.0.3b.zip

Thanks, and you really should get some sleep man. Unless you have a wierd sleep schedule like Toady does.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: diriel on July 13, 2010, 01:12:53 am
Thank you Peterix you rock!
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: Mechanoid on July 13, 2010, 01:23:44 am
Should be fixed now...

http://github.com/downloads/peterix/dfhack/dfhack-bin-0.4.0.3b.zip
jawsome
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: HeliumFreak on July 13, 2010, 02:31:13 am
Should be fixed now...

http://github.com/downloads/peterix/dfhack/dfhack-bin-0.4.0.3b.zip

Thanks, much appreciated
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: MaximumZero on July 14, 2010, 01:03:48 am
Since Runesmith is DFHack reliant, Runesmith is probably the one that needs to update the offsets, not DFHack. I, however, am a total noob when it comes to this stuff, and could very well be wrong, but that's what makes sense to me.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: Brandon816 on July 14, 2010, 04:04:18 am
As long as DFhack keeps its current functionality intact, even if it changes in implementation, it shouldn't affect other programs like runesmith. DFhack is there so that you have a frontend for other programs to more easily access the memory, so only DFhack needs to have the offsets updated. The only problem is that, like mentioned already, if "certain software tries to access things that *aren't [in DFhack] anymore*".
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: MaximumZero on July 14, 2010, 09:34:34 am
Huh. Nice to know.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: MaximumZero on July 14, 2010, 11:27:38 pm
It looks to me like there are two files in the Runesmith folder:

QtCore4.dll
QtGui4.dll

that aren't in the DFHack folder. Perhaps they're looking for something that moved? (I don't know how to get them open, and even if I could, I wouldn't know what I was looking at. I'm just hypothesizing, here.)

Anyway, sizeak was looking for offsets of some sort. Not sure if he's seen this thread.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: Urist McFumbler on July 14, 2010, 11:31:04 pm
Hmm...

What would it take for you guys to set it up so that future versions of dfhack.dll are compatible with previous versions of software such as Runesmith?

There might be bugs when certain software tries to access things that *aren't there anymore*, but if all that's changing is memory offsets, shouldn't that only need to be updated once?

As far as I can understand it

If Toady does not do any drastic changes in the raws, I believe this would be no problem.

Unfortunately, drastic changes will happen so everything has to be checked and rediscovered.

Hence the delay.

Runesmith relies on the same offsets as DFHack.

DFHack uses some of the same offsets as DT.

There is interdependency and reliance but they are all unique.

But then again I might be wrong again. :P
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: Haelfix on July 15, 2010, 09:50:51 am
Is there any chance that in the flow utility, that there could be some sort of option for making permanent water or magma generators?  Eg i'd like to make a river or brook.  In 40d at least, there were 'generator' tiles that you could hack in with various utilities.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: jaked122 on July 15, 2010, 07:38:58 pm
EDIT: fixed itself, seems to only happen on one save
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: Shaostoul on July 16, 2010, 11:32:38 pm
I was wondering, can you stop all water in motion with one of that hacks? I know the fluids? one can place water that is static, but can it or one of the others freeze it... and can someone explain the 'flowbits' dealio?
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: peterix on July 17, 2010, 03:29:13 pm
I was wondering, can you stop all water in motion with one of that hacks? I know the fluids? one can place water that is static, but can it or one of the others freeze it... and can someone explain the 'flowbits' dealio?
Well, flowbits. There are some flowbits for each 16x16 block of tiles and also for each tile. In dfliquids, you can choose if you want to make the spawned liquid flow or not.
So 'f+' makes stuff flow.
'f-' makes stuff not flow.
'f.' doesn't change flow bits.

If you don't want to spawn liquids, but only change the flow state, use 'f'lowbits instead of 'w'ater or 'm'agma.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: peterix on July 17, 2010, 03:30:06 pm
EDIT: fixed itself, seems to only happen on one save
Can I have the save?
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: darius on July 19, 2010, 09:30:14 am
peterix i want to add function calling to SHM. Is it better to add it to core or as  a diffrent module? What commands to implement?
I was thinking something like:
Code: [Select]
enum FUNCTION_COMMAND
{
    FUNCTION_INIT = 0, // initialization
    FUNCTION_CALL_PASCAL,
    FUNCTION_CALL_THISCALL,
    FUNCTION_CALL_...etc...
    FUNCTION_GETRESULT,
    NUM_FUNCTION_CMDS
};

although i used something different in my programs (also heavy use of debugger...)
it was like:
Code: [Select]
SetReg(REG_EAX,0);
Push(0);
Push(1);
Call(FUNC_PRINT);
GetRes();
Maybe this is better?

Edit: ugh... digging through code... Correct me if i'm wrong but it seems that SHM starts on any SDL call and really does something only when SDL_NumJoysticks is called? (is it called often?)
Edit2: also very usefull core commands could be: ALLOC_MEM, DEALLOC_MEM (in main DF thread, when function calls are implemented e.g. simple print call needs a pointer to string, so it would be ALLOC_MEM, write string into that mem, FUNCT_CALL,DEALLOC_MEM)
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: peterix on July 19, 2010, 11:01:22 am
peterix i want to add function calling to SHM. Is it better to add it to core or as  a diffrent module?
If you want to change the core, only add new commands to the end. Every change should be also reflected in the version number of the module. I'd like to keep the core module intact though.

What commands to implement?
I was thinking something like:
Code: [Select]
enum FUNCTION_COMMAND
{
    FUNCTION_INIT = 0, // initialization
    FUNCTION_CALL_PASCAL,
    FUNCTION_CALL_THISCALL,
    FUNCTION_CALL_...etc...
    FUNCTION_GETRESULT,
    NUM_FUNCTION_CMDS
};
This looks pretty much OK to me, good enough for a low-level access to the process. Also, what about the differences in how compilers work here? I don't think GCC on Linux will produce functions that can be called the same way as MSVC on Windows.
although i used something different in my programs (also heavy use of debugger...)
it was like:
Code: [Select]
SetReg(REG_EAX,0);
Push(0);
Push(1);
Call(FUNC_PRINT);
GetRes();
Maybe this is better?
Maybe too low-level? It could be useful, but note that the more granularity you add, the slower the results. Each such call requires a context switch on a single-core CPU (under ideal conditions. if there's a third CPU-bound process, it can easily degrade the connection). Ideally, there would be pre-made SHM commands for the most used calls, possibly hiding the differences produced by DF's compiler. If the symbols were exported, at least there would be some sure way to call them... this probably isn't easy.
Edit: ugh... digging through code... Correct me if i'm wrong but it seems that SHM starts on any SDL call and really does something only when SDL_NumJoysticks is called? (is it called often?)
SDL_NumJoysticks is called by DF after (or before, same thing) each simulation frame. That means that with a fort that gets 100FPS, SDL_NumJoysticks will be called at the same rate. At that point DF's memory should be in a consistent state for the game thread. A similar outcome could be achieved by placing a breakpoint.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: ASnogarD on July 19, 2010, 04:22:32 pm
Peterix, I was just curious on how difficult it would be to use DFHack to pull up 'events' for the Soundsense program to utilise as audio cues ?

I am not knowledgeble in the whole programming but as I understand it, your program scans the memory of the machine as DF is running and can monitor changes in the variables in memory and relay a trigger to the program thats is using DFHack.
Could a person use this to look for variable that may indicate a event so as to act as a cue for the audio to play ?

I am just curious so theres no urgency, thanks for taking the time to read my question .
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: devek on July 20, 2010, 08:23:17 am
The source was easy to understand, thank you for writing this.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: devek on July 20, 2010, 09:57:29 am
Ok..

I can add up the different types of items I have.

I can find the workshops available to make those items if I need more.

I can't figure out how to see what a workshop is working on or how to give it something to work on.

If I get that last part done, I should have a pretty good dwarf forman program going on here.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: devek on July 20, 2010, 11:07:01 pm
Memory hacking is so hard for me :( I didn't get as much time today on it as I wanted but here is what I have so far..

Each building has a job list, which is 10 pointers.

The pointer to the front of the list is +0x58 from the building structure, and +0x5c is the current position in the list.

The actual job structure first starts with its ID, the ID is an incrementing value like.. 20,21,22,23... the counter for 31.10 is static at 0x00DE1A20.....
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: Esa94 on July 21, 2010, 05:48:30 am
There still seem to be some problems with Linux memory addresses in 0.31.10. I tried launching Stonesense and it crashed with the following DFHack error:
Code: [Select]
terminate called after throwing an instance of 'DFHack::Error::MissingMemoryDefinition'
  what():  memory definition missing: type address key current_menu_state
Aborted
(Apparently the Windows version works, though.)

Used the latest Memory.xml and libdfhack compiled from the git repository.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: smjjames on July 23, 2010, 01:48:30 pm
*bumpage* since .11 is out and waiting for a DFHack update.

Wish updating DFHack was as easy as getting some vectors and whatever like with DFTherapist.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: Ratbert_CP on July 23, 2010, 01:50:46 pm
*bumpage* since .11 is out and waiting for a DFHack update.

Wish updating DFHack was as easy as getting some vectors and whatever like with DFTherapist.

But it is!  The issue is that DFHack needs more vectors and offsets than DT.  :)
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: smjjames on July 23, 2010, 02:02:37 pm
*bumpage* since .11 is out and waiting for a DFHack update.

Wish updating DFHack was as easy as getting some vectors and whatever like with DFTherapist.

But it is!  The issue is that DFHack needs more vectors and offsets than DT.  :)

Well okay, but how do you get them and apply them? DT has it easier on that front.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: Ratbert_CP on July 23, 2010, 02:26:57 pm
*bumpage* since .11 is out and waiting for a DFHack update.

Wish updating DFHack was as easy as getting some vectors and whatever like with DFTherapist.

But it is!  The issue is that DFHack needs more vectors and offsets than DT.  :)

Well okay, but how do you get them and apply them? DT has it easier on that front.

Aye.  There's the rub.  DT needs much fewer memory locations than DFHack.  That's because it's only dealing with the Dwarves themselves, not all the other stuff (tiles, materials, etc.).  Sadly, the tools aren't available to speed up the search for the more esoteric vectors/offsets, so we need to wait for peterix or another memhacking guru to find them.  DT provides tools to find the few offsets it needs.  Before anyone gets too bent out of shape, I think the values DT needs have pretty well-defined and static landmark string nearby, whereas DFHack requires values that may be based on other values that need to be found first, etc.  i.e., Not quite so simple.

Of course I could be wrong, but it helps me sleep at night... ;)
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: sizeak on July 23, 2010, 02:42:40 pm
You can *borrow* the DT offsets, you just have to adjust them. Vectors from DT need 0x8 subtracting from them to get them to work with DFHack. Sadly they haven't found material addresses, which is what RS is currently failing on :(
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: SeveQ on July 23, 2010, 03:07:41 pm
DF itself should be able to determine the needed offsets. I wonder if Toady was willing to add a feature that would log some offsets somewhere. Just my two cents...
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: devek on July 23, 2010, 07:30:03 pm
http://www.bay12forums.com/smf/index.php?topic=43260.msg1425561#msg1425561

Copy that file into your dfhack directory and it should work(if you're using windows-sdl lol).

On a side note, I finally figured out how to create jobs from dfhack lol.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: smjjames on July 23, 2010, 10:29:11 pm
http://www.bay12forums.com/smf/index.php?topic=43260.msg1425561#msg1425561

Copy that file into your dfhack directory and it should work(if you're using windows-sdl lol).

On a side note, I finally figured out how to create jobs from dfhack lol.

It works now, thank you! :)
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: MaximumZero on July 23, 2010, 11:31:28 pm
I uploaded an actual XML file to dffd for those who can't or don't know how to make XML files.

Find it here: http://dffd.wimbli.com/file.php?id=2795 (http://dffd.wimbli.com/file.php?id=2795)
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: SeveQ on July 24, 2010, 10:47:09 am
It's probably considered cheating, I know, but do you think there is a way to use DFHack to add plants and/or trees to a running fortress, to "reforest" its surroundings? I'm running out of wood...  :'(
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: devek on July 24, 2010, 11:05:25 am
There is more wood in the caverns :P
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: jaked122 on July 24, 2010, 12:30:03 pm
DF itself should be able to determine the needed offsets. I wonder if Toady was willing to add a feature that would log some offsets somewhere. Just my two cents...
it'd be nice if people stopped asking for toady to change the application to support this third party project. I mean, I doubt he'd want to anyways...
this is a cheating application, therefore it can and will not be supported by the developer.
I use this tool myself, but I don't thing it would be a good idea to do something such as this, changing the engine to support a utility designed to alter the engine? doesn't sound like it would be safe.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: sizeak on July 24, 2010, 01:39:09 pm
Err not really. Writing the offset's of various data structures used by the game to a file is hardly dangerous, nor would it be particularly difficult
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: devek on July 24, 2010, 02:36:53 pm
Ok.. I need help.

I just started learning C++ a few days ago. My program works now and when you get below a specified amount of potash or ash it queues the creation of more for you automatically, it just leaks 1 meg of ram each time it loops. :(

It doesn't leak a single byte of ram in the loop if this line is taken out....
Code: [Select]
item = items->getItemDescription(p_items[i], Materials).c_str();




Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: soul4hdwn on July 24, 2010, 03:20:29 pm
Ok.. I need help.

I just started learning C++ a few days ago. My program works now and when you get below a specified amount of potash or ash it queues the creation of more for you automatically, it just leaks 1 meg of ram each time it loops. :(

It doesn't leak a single byte of ram in the loop if this line is taken out....
Code: [Select]
item = items->getItemDescription(p_items[i], Materials).c_str();

ahh the pitfalls of C
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: sizeak on July 24, 2010, 03:56:57 pm
It's all good practice
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: peterix on July 24, 2010, 04:45:41 pm
Ok.. I need help.

I just started learning C++ a few days ago. My program works now and when you get below a specified amount of potash or ash it queues the creation of more for you automatically, it just leaks 1 meg of ram each time it loops. :(

It doesn't leak a single byte of ram in the loop if this line is taken out....
Code: [Select]
item = items->getItemDescription(p_items[i], Materials).c_str();
Amazing. And I thought I should rip that part of DFHack out and rewrite it... or spend much more time and document what's it actually doing ~_~
/me is amazed it works.

Also, I should have 31.11 supported shortly... seems like other people did most of the work already :) Just needs a bit of testing and doing the same for Maps stuff support on Linux.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: Kadath on July 24, 2010, 05:21:01 pm
Quote
Also, I should have 31.11 supported shortly...
Excellent.
(http://www.cio.com/images/content/articles/body/2008/10/Mr_Burns_150x176.jpg)
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: marcusbjol on July 24, 2010, 06:10:00 pm
DF itself should be able to determine the needed offsets. I wonder if Toady was willing to add a feature that would log some offsets somewhere. Just my two cents...
it'd be nice if people stopped asking for toady to change the application to support this third party project. I mean, I doubt he'd want to anyways...
this is a cheating application, therefore it can and will not be supported by the developer.
I use this tool myself, but I don't thing it would be a good idea to do something such as this, changing the engine to support a utility designed to alter the engine? doesn't sound like it would be safe.
This is sorta in/correct.  Dwarf Therapist is a memory hack, but is almost required to play the larger fortresses.  Abstracting the UI would fall under this category.
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: MaximumZero on July 24, 2010, 06:12:17 pm
You know what would be awesome? A way to attach all the modding tools to the UI. Could you imagine being able to use DT or DFHack or Runesmith or whatever from INSIDE Dwarf Fortress? That would be awesome. (I know, department of redundancy department, but still. It would be.)
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: devek on July 24, 2010, 08:57:45 pm
Amazing. And I thought I should rip that part of DFHack out and rewrite it... or spend much more time and document what's it actually doing ~_~
/me is amazed it works.

Also, I should have 31.11 supported shortly... seems like other people did most of the work already :) Just needs a bit of testing and doing the same for Maps stuff support on Linux.

Oh ok.. hrm. Well, all I am really needing to do is count the amount of certain types of items, not dump them. Gonna try looking at how the stocks screen does its job now I guess. Was hoping I would get lucky, the stock screen doesn't seem to keep a running total :P
Title: Re: DFHack 0.4.0.2 - tools and memory access library
Post by: xDarkz on July 24, 2010, 10:13:51 pm
Can't wait for for new version :].
Title: Re: DFHack 0.4.0.4 - tools and memory access library
Post by: devek on July 25, 2010, 05:04:31 am
Ya, looks like the way to count items with DFhack and not leak memory is something like..

Code: [Select]
    ash = 0;
    logs = 0;
    potash = 0;
    DFHack::DfVector <uint32_t> p_items (p, p->getDescriptor()->getAddress ("items_vector"));
    uint32_t size = p_items.size();
    DFHack::Items *items = DF->getItems();
    for (unsigned int i=0;i<size;i++)
    {
        uint32_t vtable = p->readDWord(p_items[i]);
        if(p->readClassName(vtable).compare("item_woodst") == 0 ) { logs++; continue; }
        if((p->readClassName(vtable).compare("item_barst") == 0) &&
           (p->readWord(p_items[i]+138) == 9))  { ash++; continue; }
        if((p->readClassName(vtable).compare("item_barst") == 0) &&
           (p->readWord(p_items[i]+138) == 8))  { potash++; continue; }
    }
    items->Finish();

Works pretty fast, and I have had my program on an infinite loop the last hour without it gaining a byte.
Title: Re: DFHack 0.4.0.4 - tools and memory access library
Post by: soul4hdwn on July 25, 2010, 10:20:54 am
that is honestly impressive!  it is one thing for something to work, then it is another for it to work with the least "cost" on processing (this doesn't necessarily mean speed but it end result is speed), but it is fantastic not to waste anything in the act!
Title: Re: DFHack 0.4.0.4 - tools and memory access library
Post by: smjjames on July 25, 2010, 10:29:05 am
Has anybody been able to get new offsets and stuff for .12? There shouldn't be too many changes between .11 and .12 as far as offsets and vectors go.
Title: Re: DFHack 0.4.0.4 - tools and memory access library
Post by: soul4hdwn on July 25, 2010, 11:26:45 am
Has anybody been able to get new offsets and stuff for .12? There shouldn't be too many changes between .11 and .12 as far as offsets and vectors go.
http://www.bay12forums.com/smf/index.php?topic=39229.msg1429753#msg1429753 here is it/one for .12
Title: Re: DFHack 0.4.0.4 - tools and memory access library
Post by: smjjames on July 25, 2010, 11:29:18 am
Thats for DT, DFHack needs more than just that.
Title: Re: DFHack 0.4.0.4 - tools and memory access library
Post by: daego on July 25, 2010, 11:40:57 am
http://pastebin.com/JL6RQmZa

I've only tested a few tools, but it seems to work OK for dfreveal and dfcleanmap at least -- and only for Windows. The only things I added were a new md5 and PE timestamp (552cfa417fd131204ebfee66aefc4adb and 0x4C4C32E7 respectively). Hopefully it helps until someone else can do better than I.
Title: Re: DFHack 0.4.0.4 - tools and memory access library
Post by: LucasUP on July 25, 2010, 12:32:14 pm
EDIT:
Daego, your .xml works as far as I can tell. Also tested the vein digger.

There's also this .12 one for Stonesense:
Spoiler (click to show/hide)
Title: Re: DFHack 0.4.0.4 - tools and memory access library
Post by: xDarkz on July 25, 2010, 11:35:31 pm
EDIT:
Daego, your .xml works as far as I can tell. Also tested the vein digger.

There's also this .12 one for Stonesense:
Spoiler (click to show/hide)

Thanks Lucas and Daego! Both work for my Windows Vista and XP.
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: Haelfix on July 27, 2010, 08:11:42 pm
Does anyone know how DF actually spawns rivers or brooks?  Are there special tiles somewhere like in the old version, or is it something else entirely. 

I know that a lot of the old covering (mud, snow etc) is different now.

Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: peterix on July 28, 2010, 04:39:00 am
Does anyone know how DF actually spawns rivers or brooks?  Are there special tiles somewhere like in the old version, or is it something else entirely. 
Needs research I'd guess. There's nothing easier than looking at those rivers with a tool like dfprobe.
/me now wonders if it is in the 'supported' folder...
I know that a lot of the old covering (mud, snow etc) is different now.
Coverings are well-understood. At least for the more conventional materials like the mud and snow you mention. Forgotten beast extracts are a bit different story tho :P
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: devek on July 28, 2010, 06:56:16 am
There is a water source tile in .31. I can't remember what it says, but it is different when you look at it with K.

The one I saw was right by the ocean.. The river didn't drain into the ocean, it wasn't even connected to the ocean. It was a spring right by the ocean that flowed away from it...

The spring source looks all spidery. That would be kind of awesome if dfliquids could spawn one of those type of titles... :)  You could make a waterfall that started from nowhere...

Edit: and wow, I didn't notice dfprobe. It is in the supported folder but it doesn't get compiled to output. I never looked at the supported folder closely cause I assumed it had the same stuff that was compiled...
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: necrodoom on July 31, 2010, 03:10:30 pm
is there anything i can do to revive my dead dwarfs? all i can do is to use runesmith to remove his dead tag and turn him zombie or skeleton, but that turns them hostile, even when i added tame tag to them. did anybody managed to program a utility that puts back the missing upper body yet?
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: Dreen on July 31, 2010, 04:36:28 pm
nevermind
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: snooptodd on August 01, 2010, 12:32:04 am
31.12, linux, git pull about 3hrs ago
Is this what happens when the memory layouts are incorrect? Or is something else wrong?
Code: [Select]
~/src/dfhack/output$ ./dfvdig
pread failed: can't read 0x18 bytes at address 0xb1836198
errno: 16
terminate called after throwing an instance of 'DFHack::Error::MemoryAccessDenied'
  what():  SHM ACCESS DENIED
Aborted
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: peterix on August 01, 2010, 08:15:33 am
31.12, linux, git pull about 3hrs ago
Is this what happens when the memory layouts are incorrect? Or is something else wrong?
Code: [Select]
~/src/dfhack/output$ ./dfvdig
pread failed: can't read 0x18 bytes at address 0xb1836198
errno: 16
terminate called after throwing an instance of 'DFHack::Error::MemoryAccessDenied'
  what():  SHM ACCESS DENIED
Aborted
Normally, yes. But I know that the 31.12 linux version should be OK. I tested the tool just now and it works.

Could be something unexpected happening. Can you pack your DF folder and put it online? Just make a copy of it and delete all saves except for the one where you got this error. Those things can be quite big. I'll look at it when I have some time.
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: zwei on August 02, 2010, 08:04:00 am
How hard it is to make DFhack based utility that would do basically this:

detect that workshop of type X with task in progress is visible on screen/just entered view.

detect that there is workshop of type X with task in progress is no longer visible on screen/just left view

edit: and in same vein, that cut-down-tree action in visible area just started.
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: zwei on August 02, 2010, 08:10:58 am
wrong button indeed :(
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: Askot Bokbondeler on August 02, 2010, 08:59:12 am
wrong button
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: devek on August 02, 2010, 10:17:35 am
edit: and in same vein, that cut-down-tree action in visible area just started.

When a tree is starting to be cut down its designation to be cut down is removed and there is a job assigned to the dwarf. The code I use to tell what trees are actively being cut down is...

Code: [Select]
DFHack::Process * p = DF->getProcess();
DFHack::Creatures * Creatures = DF->getCreatures();
uint32_t numCreatures;
Creatures->Start(numCreatures);

for(uint32_t i = 0; i < numCreatures; i++)

    DFHack::t_creature temp;
    Creatures->ReadCreature(i,temp);
    if((temp.race == 200) && temp.current_job.active && ((temp.current_job.jobType == 9) || (temp.current_job.jobType == 10)))
    {
        uint32_t job = p->readDWord(temp.origin + 0x390);
        printf("Tree being cut at [%hd,%hd,%hd]\n", p->readWord(job+16), p->readWord(job+18), p->readWord(job+20));
    }
}

ReadCreature is really slow though, like around 40 milliseconds to call.
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: TroZ_shack on August 02, 2010, 12:58:33 pm
Wow, DFHack looks great.

I'm a Java developer mostly, but I do know C/C++ a bit.

I'm attempting to write a program that will convert a DF fortress to a Minecraft map by converting each 'square' in DF to a 3x3x3 area in Minecraft using appropriate material. This should work for all terrain, keeping nearly everything that was accessible in DF still be accessible in Minecraft (except for hallways that rely on diagonals being traversable - up-down stairs will need to use a different 3x3x3 setup for even and odd layers but will work).

I'm a noob at this though, and I've downloaded the DFHack source and I'm trying to compile the 'prospector' example as a test and to figure out how to start, but I'm running into some trouble.
I'm on windows, and I downloaded Microsoft Visual C++ Express 2010, and setup a project. The project compiles (the porspector.cpp and DFHack.h file), but it doesn't link.  The linker seems to want a .lib file for the DFHack.dll, but I don't see one provided.  I attempted to compile the DFHack project myself using VS Express, but that turned into a disaster that I couldn't get working.

Does anyone have a .lib for the DFHack.dll, or can talk me through setting up the project in VS Express, or am I going about this all wrong and there is something else I should be doing?

Thanks for your help.
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: devek on August 02, 2010, 05:13:37 pm
I don't know about visual stupio, but to compile it with qt creator is pretty simple. And since you are a java developer you really should use qt because a lot of the api is exactly the same between java and qt.

1) install qt creator
2) add c:\qt\2010.04\mingw\bin to your system path
3) install git (make sure c:\program files\git\cmd is in your system path)
4) install cmake (make sure c:\program files\cmake 2.8\bin is in your system path)
5) make a new project in qt creator that imports from git http://github.com/peterix/dfhack.git
6) when it asks for the build directory, select c:\qt\2010.04\peterix-dfhack\build'
7) when it asks for the cmake args use -G"MinGW Makefiles" -DCMAKE_BUILD_TYPE:string=Release
8) compile dfhack
9) make yourself your own project and open up the .pro file for your project and add these two lines
LIBS += -L"C:\Qt\2010.04\peterix-dfhack\output" -ldfhack
INCLUDEPATH += "C:\Qt\2010.04\peterix-dfhack\library\include"
10) make sure that when your program runs that memory.xml is in the run path and it should just work :D

 
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: peterix on August 02, 2010, 07:18:19 pm
Or even simpler:
Get the 2005 or 2008 express version of MSVC. 2010 is too new and doesn't work right with cmake (AFAIK).

1. Install MSVC (or MinGW)
2. Install cmake
3. go into dfhack's build folder, run the right script for your MSVC version.
4. open the build-real folder that will be generated and open the MSVC project file.

After you've built dfhack, go into the output folder and copy Memory.xml into Debug or Release folders, depending on the type of build.

Also, it seems there will be Java bindings for dfhack eventually :)
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: zwei on August 03, 2010, 02:11:35 am
edit: and in same vein, that cut-down-tree action in visible area just started.

When a tree is starting to be cut down its designation to be cut down is removed and there is a job assigned to the dwarf. The code I use to tell what trees are actively being cut down is...

Code: [Select]
DFHack::Process * p = DF->getProcess();
DFHack::Creatures * Creatures = DF->getCreatures();
uint32_t numCreatures;
Creatures->Start(numCreatures);

for(uint32_t i = 0; i < numCreatures; i++)

    DFHack::t_creature temp;
    Creatures->ReadCreature(i,temp);
    if((temp.race == 200) && temp.current_job.active && ((temp.current_job.jobType == 9) || (temp.current_job.jobType == 10)))
    {
        uint32_t job = p->readDWord(temp.origin + 0x390);
        printf("Tree being cut at [%hd,%hd,%hd]\n", p->readWord(job+16), p->readWord(job+18), p->readWord(job+20));
    }
}

ReadCreature is really slow though, like around 40 milliseconds to call.

Thank you for this.

I wonder if checking currently if currently visible rectangle and creatures in those tiles would be faster than looping throught all creatues because that is all waht i need (how is getCreatures implemented anyway, speed suggests that it checks whole embark cuboid?)
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: peterix on August 03, 2010, 08:08:13 am
Thank you for this.

I wonder if checking currently if currently visible rectangle and creatures in those tiles would be faster than looping throught all creatues because that is all waht i need (how is getCreatures implemented anyway, speed suggests that it checks whole embark cuboid?)
getCreatures gives you the module for working with creatures.

There's a simple call meant to detect creatures in a cube defined by the programmer:
Code: [Select]
// returns index of creature actually read or -1 if no creature can be found
int32_t Creatures::ReadCreatureInBox (int32_t index, t_creature & furball,
                                const uint16_t x1, const uint16_t y1, const uint16_t z1,
                                const uint16_t x2, const uint16_t y2, const uint16_t z2)
This scans the creatures only for their x,y,z coords and gives you the first one that fits in. index is the starting index into the creature vector where the search begins. The method returns the creature found (furball) and its index. x1,y1,z1 are supposed to be smaller or equal to x2,y2,z2.
So, to scan all creatures, you call it with index=0 at first and then feed it the returned index + 1 until you get -1 back. This will give you only the creatures in the defined box.
It's used by stonesense and should be stable.

You can combine this with the methods for getting screen coords and size from the Position module (getViewCoords and getWindowSize).
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: keda on August 03, 2010, 08:57:18 am
A couple of question peterix, btw I appreciate all the work you are doing, what is the rating in t_skill and does it have anything to do with the experience in the skill?

Edit: nvm figured it out
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: keda on August 03, 2010, 04:54:10 pm
I have another, hopefully a less stupid question, is there a way to increase the size of the skill vector?
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: devek on August 03, 2010, 05:19:13 pm
The way I increase a vector is to allocate memory in the process and copy it over to it.

VirtualAllocEX is what I use, but it would be cool if dfhack had a function that worked on linux too.
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: keda on August 03, 2010, 06:17:25 pm
The way I increase a vector is to allocate memory in the process and copy it over to it.

VirtualAllocEX is what I use, but it would be cool if dfhack had a function that worked on linux too.
Cool, thanks a lot. I think I know what you mean, having the vector point at that newly allocated memory instead? I wonder though if theres an equivalent function for linux as well...
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: peterix on August 03, 2010, 06:47:21 pm
The way I increase a vector is to allocate memory in the process and copy it over to it.

VirtualAllocEX is what I use, but it would be cool if dfhack had a function that worked on linux too.
That is a horrible idea. Also, there are proper functions for this already, called vector::push_back and malloc. DFHack can do something like this by sneaking in some extra code into SDL. It's just for std::string right now, but could be extended to vectors.
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: devek on August 03, 2010, 07:25:40 pm
The way I increase a vector is to allocate memory in the process and copy it over to it.

VirtualAllocEX is what I use, but it would be cool if dfhack had a function that worked on linux too.
That is a horrible idea. Also, there are proper functions for this already, called vector::push_back and malloc. DFHack can do something like this by sneaking in some extra code into SDL. It's just for std::string right now, but could be extended to vectors.

I think you misunderstood me. push_back and malloc won't work.

If my program tries to use push_back on a vector that exists in DF's memory it will (likely) crash since the memory addresses in DF won't exist in my program. If I use malloc and try to write to that address in DF's memory, it will fail because that memory address probably won't exist in DF and only in my process.

In my program I only allocate one chunk of memory in DF and I manage it myself and have my own code to work with vectors and strings in a different context. It doesn't fail because DF can always move the vector somewhere else if it wants to and I can roll with that.

Of course it is possible I misunderstood and df hack has a malloc and push_back function that runs inside of DF's process and not mine lol.
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: peterix on August 03, 2010, 08:53:05 pm
In my program I only allocate one chunk of memory in DF and I manage it myself and have my own code to work with vectors and strings in a different context. It doesn't fail because DF can always move the vector somewhere else if it wants to and I can roll with that.
And it won't crash when the memory is freed by DF's allocator? I had enough problems with that to write off any such easy hacks as rubbish :)
Of course it is possible I misunderstood and df hack has a malloc and push_back function that runs inside of DF's process and not mine lol.
Yes, it's there, just not for vectors yet and it requires hooking a few SDL functions to get code in. No code caves, no assembly and no messing with virtual memory involved :)  You just need to make sure you're using the same C and STL libraries as DF for the fake SDL.
A bit of example code:
Code: [Select]
std::string * to_set = (std::string *) offset;
to_set->assign("string assigned by dfhack...");

This is the code that goes into the fake SDL: http://github.com/peterix/dfhack/tree/master/library/shm/ (http://github.com/peterix/dfhack/tree/master/library/shm/)
The client uses the SHM versions of the Process class to talk to it.
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: devek on August 03, 2010, 10:02:41 pm
And it won't crash when the memory is freed by DF's allocator? I had enough problems with that to write off any such easy hacks as rubbish :)

DF's allocator physically can't free the memory so it won't crash my program. Why DF doesn't crash trying to free it, I honestly don't know yet. I do other fun hacks too like store data in the first byte of a vector/string. I noticed Toady was doing it for the custom reactions structure and it worked so lol. Good thing too, or I wouldn't be able to find the memory I had previously allocated when my program was restarted and would have to start over and allocate more.
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: snooptodd on August 06, 2010, 12:32:12 am
31.12, linux, git pull about 3hrs ago
Is this what happens when the memory layouts are incorrect? Or is something else wrong?
Code: [Select]
~/src/dfhack/output$ ./dfvdig
pread failed: can't read 0x18 bytes at address 0xb1836198
errno: 16
terminate called after throwing an instance of 'DFHack::Error::MemoryAccessDenied'
  what():  SHM ACCESS DENIED
Aborted
Normally, yes. But I know that the 31.12 linux version should be OK. I tested the tool just now and it works.

Could be something unexpected happening. Can you pack your DF folder and put it online? Just make a copy of it and delete all saves except for the one where you got this error. Those things can be quite big. I'll look at it when I have some time.
it might be something wrong on my end. As a test I stuck the df and dfhack/output folders on a usb drive and tried them on another computer running ubuntu lucid and it worked fine.

here is the df folder. (http://ubuntuone.com/p/BoH/)
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: peterix on August 06, 2010, 01:53:03 am
it might be something wrong on my end. As a test I stuck the df and dfhack/output folders on a usb drive and tried them on another computer running ubuntu lucid and it worked fine.

here is the df folder. (http://ubuntuone.com/p/BoH/)
Well, looks like it works all right over here. What's the system on the first computer? I've had a lot of problems with older kernels (anything older than 2.6.32 was bad I think)... Also, having something like this (http://en.wikipedia.org/wiki/Address_space_layout_randomization#Linux) enabled could break things.
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: keda on August 06, 2010, 05:53:19 am
Yes, it's there, just not for vectors yet and it requires hooking a few SDL functions to get code in. No code caves, no assembly and no messing with virtual memory involved :)  You just need to make sure you're using the same C and STL libraries as DF for the fake SDL.
A bit of example code:
Code: [Select]
std::string * to_set = (std::string *) offset;
to_set->assign("string assigned by dfhack...");

This is the code that goes into the fake SDL: http://github.com/peterix/dfhack/tree/master/library/shm/ (http://github.com/peterix/dfhack/tree/master/library/shm/)
The client uses the SHM versions of the Process class to talk to it.
I just had a look at the code and couldn't make head or tail out of it. Are you going to do this for vectors too any time soon? I'd hope so and appreciate it, since that is way over my head.
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: Shukaro on August 06, 2010, 12:36:26 pm
Sorry if this is a bit of a derailing, but the 4.0.5 download is missing the dfposition and dfoffsets tools. Sorry if this has already been said before.
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: s20dan on August 06, 2010, 12:49:11 pm
Sorry if this is a bit of a derailing, but the 4.0.5 download is missing the dfposition and dfoffsets tools. Sorry if this has already been said before.

 You can just use the tools that come with the older versions.
http://github.com/downloads/peterix/dfhack/dfhack-bin-0.4.0.2.zip (http://github.com/downloads/peterix/dfhack/dfhack-bin-0.4.0.2.zip)
That one has them.
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: Shukaro on August 06, 2010, 12:51:59 pm
Yeah, but they won't work with 31.12, even dfoffsets.

Edit: Just swapped out the memory.xml, and it worked, so it's all good now.

Edit: Hmm, the mouse xy tile coordinates would be very helpful as well.
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: peterix on August 06, 2010, 01:22:31 pm
Yeah, but they won't work with 31.12, even dfoffsets.

Edit: Just swapped out the memory.xml, and it worked, so it's all good now.

Edit: Hmm, the mouse xy tile coordinates would be very helpful as well.
Wow. There are mouse coords available? I'll have to add that :)
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: Shukaro on August 06, 2010, 01:27:07 pm
Yeah, DF stores the X/Y position of the tile the mouse is over. And, it's relative to the screen, not the world.
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: snooptodd on August 06, 2010, 09:57:43 pm
it might be something wrong on my end. As a test I stuck the df and dfhack/output folders on a usb drive and tried them on another computer running ubuntu lucid and it worked fine.

here is the df folder. (http://ubuntuone.com/p/BoH/)
Well, looks like it works all right over here. What's the system on the first computer? I've had a lot of problems with older kernels (anything older than 2.6.32 was bad I think)... Also, having something like this (http://en.wikipedia.org/wiki/Address_space_layout_randomization#Linux) enabled could break things.
both computers are current with 32bit Ubuntu lucid. That got me thinking, the one that works is running the pae enabled kernel.
I installed the pae kernel and it appears to work. More testing is required :)

thanks for the help.
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: Quietust on August 06, 2010, 10:51:26 pm
The naked_itemflags struct in library/include/dfhack/DFTypes.h appears to have some flags in the wrong positions - it claims to be the same as what's in 40d, yet in_inventory is the 3rd bit instead of the 4th bit (Rick's table skips 0x4 entirely).

Also, I'm fairly certain that Rick's assessment of 0x100000 being "item shows wear" is incorrect (item wear is actually an integer value stored elsewhere, 1 for "x", 2 for "X", 3 for "XX") - nearly all of these flags match exactly what I've personally reverse-engineered from version 0.23.130.23a (for some retro-tools I wrote), and in that version said flag indicated that the object was owned by a dwarf and thus shouldn't be touched by anyone else (except when clearing away debris for constructing a building). A quick check against 0.31.12 confirms that this is still the case - while clearing the flag won't clear the "Owned by:" in the item description (that's stored in a vector within the item object, the same vector that keeps track of where the item is physically located), clearing the flag does allow the item to be picked up by other dwarves and stored in a stockpile or taken to a garbage dump zone (which would have been ideal back in 40d for removing clothing from the floors of cluttered barracks) or possibly even to be claimed by another dwarf.

Similarly, the "narrow" flag (0x4000) doesn't actually mean "narrow" - it means "produced offsite" (i.e. shows up with parentheses around the name), while 0x8000 was (and probably still is) used for items being sold by a caravan (never completely figured out that flag).

Another side note - the dfhack sources come with batch files to generate project files for MSVC 2002 and 2003, but it won't actually compile with them because they don't have "intrin.h".
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: peterix on August 07, 2010, 08:38:19 am
The naked_itemflags struct in library/include/dfhack/DFTypes.h appears to have some flags in the wrong positions - it claims to be the same as what's in 40d, yet in_inventory is the 3rd bit instead of the 4th bit (Rick's table skips 0x4 entirely).

Also, I'm fairly certain that Rick's assessment of 0x100000 being "item shows wear" is incorrect (item wear is actually an integer value stored elsewhere, 1 for "x", 2 for "X", 3 for "XX") - nearly all of these flags match exactly what I've personally reverse-engineered from version 0.23.130.23a (for some retro-tools I wrote), and in that version said flag indicated that the object was owned by a dwarf and thus shouldn't be touched by anyone else (except when clearing away debris for constructing a building). A quick check against 0.31.12 confirms that this is still the case - while clearing the flag won't clear the "Owned by:" in the item description (that's stored in a vector within the item object, the same vector that keeps track of where the item is physically located), clearing the flag does allow the item to be picked up by other dwarves and stored in a stockpile or taken to a garbage dump zone (which would have been ideal back in 40d for removing clothing from the floors of cluttered barracks) or possibly even to be claimed by another dwarf.

Similarly, the "narrow" flag (0x4000) doesn't actually mean "narrow" - it means "produced offsite" (i.e. shows up with parentheses around the name), while 0x8000 was (and probably still is) used for items being sold by a caravan (never completely figured out that flag).
Yes, item support is still pretty much broken. There's something in place, but it's currently Windows only and reads *code*. From the flags, only a few were ever used. Mostly for things like setting dwarven pants on fire and vaporizing stone :)
/me adds a task into the bugtracker
Another side note - the dfhack sources come with batch files to generate project files for MSVC 2002 and 2003, but it won't actually compile with them because they don't have "intrin.h".
Then it's probably a very bad idea to use those versions. I'll remove the scripts.
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: mLegion on August 07, 2010, 03:42:39 pm
I noticed dfprobe can get the outside/inside light/dark aboveground/subterranean would it be possible to modify that so we can set tiles back to being dark subterranean?
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: peterix on August 07, 2010, 04:33:08 pm
I noticed dfprobe can get the outside/inside light/dark aboveground/subterranean would it be possible to modify that so we can set tiles back to being dark subterranean?
I want to make a good editor kind of application with a graphical user interface first. Something that shows the map very much like DF does, but also lets you make changes. Of course, changing a few flags is very simple and could be tacked onto the dfliquids tool for example.

I'll think about it.
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: mLegion on August 08, 2010, 05:38:58 am
My mistake, didn't realize dfliquids already does that :(
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: omglazers on August 08, 2010, 10:38:30 pm
Creating 'Rivers'.. is it possible?

Is there any way to create a water source 'tile' ? Similar to how streams and rivers create water at one edge of the map in a tile which then flows forward and off the map at another point.

I am looking to widen the river or create underground water sources and a similar source would be nice.

DF liquids allows me to create blocks and levels of liquids but not flowing rivers [say, to power water wheels!]
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: devek on August 09, 2010, 01:48:17 am
Actually, it is possible to create a river source. There is a tiletype that generates water. You run into the sometimes, it will be listed as a "spring" or something and it will look kind of like a spider web. Usually they are up in the mountains, so you would have to use embark anywhere to find one.

Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: Reverb on August 09, 2010, 03:28:26 pm
Can someone shed some knowledge on accessing item data such as container contents and whether the item has been built, being traded, brought in to trade, carried, dumped, etc? I'm mostly just interested in how to access what a container is holding.

UPDATE: I couldn't find anything on container contents so I had to poke around with the disassembler.
Let me set up an example. Items all are assigned ids which are at offset 0x14 or p->readDWord(p_item + 0x14). I read where this was a long http://df.magmawiki.com/index.php/User:Rick/Memory_research (http://df.magmawiki.com/index.php/User:Rick/Memory_research) but in the assembly used in the container code, it looks to be a signed integer but in this code I'll use an unsigned int.
I found the offsets for finding a containers contents and they can be accessed with the following code:
Code: [Select]
vector<uint32_t> items;

uint32_t start = p->readDWord(p_item[i] + 0x3C);
uint32_t end = p->readDWord(p_item[i] + 0x40);

for (uint32_t curAddr = start; curAddr < end; curAddr += 4) {
uint32_t contentAddr = p->readDWord(curAddr);
uint32_t itemID = p->readDWord(contentAddr + 4);
items.push_back(itemID);
}


Anyways back to the example. I have bin with id=10 which I'll denote bin(10) and it contains 3 items: hat(11), shirt(12), and pants(13). So bin(10) would generate a vector containing {11, 12, 13} and hat(11), shirt(12), pants(13) would all generate a vector containing {10}.

Also I found the flags I needed at DFHack::t_itemflags. Not sure which correspond to trading yet or some of the other flags I wanted but I'll update if I pursue those issue.
Hope this will be of help to others. All the above works in DF v0.31.12
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: mLegion on August 09, 2010, 05:57:38 pm
Wouldn't making a water source just be a matter of finding the relevant bits that determine whether or not a tile is part of an aquifer? I thought that was what the 'water_table' bits where for? Or is whether or not a tile is part of an aquifer determined by the biome/geolayer?

edit: yes,  does seem to determine whether or not a tile is an aquifer, also appears to have something to do with whether or not a tile is 'damp'.
edit 2: The water_table bit marks a tile as damp. The tiletype for 'river source' is 90 and 'waterfall' is 89, waterfall tiles also act as mistgenerators.

Also does anyone have the slightest clue what needs to be edited to make a tile farmable? Nothing i change seems to make a tile able to be used for surface crops. The one time i managed it was by changing the biome/geolayer/tiletype of a natural rock area to soil and setting it to inside light above ground and then mining it out, the resulting floor was farmable, but making it from scratch just hasn't been working even if I get every blockflag identical to a working patch of soil. Is there some 'can_farm' bit that i overlooked?
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: Kaelem Gaen on August 11, 2010, 12:48:48 am
Probably a stupid question, but how exactly does DFvdig  work?  does it set all tiles for the vein reveled and hidden? or just revealed?
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: Askot Bokbondeler on August 11, 2010, 01:59:49 am
it designates a vein for digging without revealing the tiles
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: mLegion on August 11, 2010, 05:33:48 pm
Ok i figured out the farming problem, it was the geolayer_index that was wrong, the layer i was working on didn't have any soil in it.

So does anyone have any idea how to dump a list of tile types? eg.
89 = waterfall
90 = river source
...
331  obsidian

This might be problematic since certain numbers don't point to a material but rather a type in that biome/geolayer, like tile type 265 is sand in a sandy biome and clay in a nearby biome.
Does DFHack use an internal table for that or does it get the strings from the game?
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: peterix on August 12, 2010, 02:29:49 am
This might be problematic since certain numbers don't point to a material but rather a type in that biome/geolayer, like tile type 265 is sand in a sandy biome and clay in a nearby biome.
Does DFHack use an internal table for that or does it get the strings from the game?
The known tile types are in the DFTileTypes header (http://github.com/peterix/dfhack/blob/master/library/include/dfhack/DFTileTypes.h).
The real materials are a bit more complicated to determine, and it depends on the tile type too of course. You can look at the prospector tool (http://github.com/peterix/dfhack/blob/master/tools/supported/prospector.cpp) and the Maps module (http://github.com/peterix/dfhack/blob/master/library/include/dfhack/modules/Maps.h) for how that's done.
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: FleshForge on August 12, 2010, 11:37:43 pm
I just realized I should have posted here instead of making a new thread (sorry, haven't had coffee yet).  There is a bug in the current version of DF that causes any items that were claimed by a task to become "stuck" on reclaim when a fort is defeated or abandoned, and Quietust came up with a fix for it.  I don't know how to compile it and I looked at trying to do it for long enough to realize I'm not going to figure it out too quickly, so if someone already familiar with compiling dfhack utilities could take a look, I'm sure a great many people would appreciate it at ton:

http://www.bay12forums.com/smf/index.php?topic=63297.0

Thanks!
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: Quietust on August 13, 2010, 08:10:10 am
Technically, that "bug" has been present in every version of Dwarf Fortress ever released (well, every version that included Reclaim mode, anyways). Frankly, I'm surprised nobody else wrote a comparable utility until now.
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: mLegion on August 13, 2010, 12:48:33 pm
Could anyone who truly understands the way DF handles map tiles/blocks write and api reference for DFHack?
I still haven't quite figured out what all the functions are/do, and there doesn't appear to be a dedicated dfhack forum anywhere.
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: peterix on August 13, 2010, 03:22:37 pm
K. I'll add the utility. I've been hit by this bug more than once and this is just too useful :) There will be a Windows binary release very soon, last in the 0.4 series.

About a week and a bit from now, I should have 0.5 ready, which will break compatibility with the current Memory.xml format. I'll be adding a GUI tool for editing the file and extending what it can do considerably. This will in turn make it possible to easily see which offsets are missing and detect missing features in the tools.
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: TroZ_shack on August 13, 2010, 06:48:05 pm
Hi,

I'd like to thank everyone for their help last week. I have DFHack working in VSE 2010, and have the basics of my DF to Minecraft program working. It isn't nearly working yet, but it is a start.

I've converted this map: http://mkv25.net/dfma/map-9322-roadraced ( A completely above ground wooden castle )
to this Minecraft level: http://troz.shackspace.com/minecraft/df2mc/cutdown.mclevel
playable here after loading from file (assuming you have a purchased account): http://minecraft.net/indev/

images:
Spoiler (click to show/hide)

issues:
Spoiler (click to show/hide)

Some questions:
I have some walls showing up as having a TileMaterial of 'constructed'. Does the 'tempvein' look up as done by Probe for those tiles show the material of the 'floor' that was there before the wall was constructed?  If so, then I'm assuming that I can get the constructed wall material for the wall by looking in the Constructions object, is that correct? (I haven't looked at the Constructions object yet, but that is the thing I plan to do next.
Are tree tops not an actual DF tile type, and are just 'created' by the interface if a tree is below a air space?
I know I can get the date from the World object, but is it possible to get the location or group name? Civilization name?
Is it possible to get the water depth on a tile? ( just noticed designations[x%16][y%16].bits.flow_size - so yes)
Is it possible to tell if a location is part of a natural cave, and compared to a dwarf dug hallway?  I would like to put Minecraft Torches in dwarf dug areas, but natural cave should be unlit. If there isn't an easy way to tell, I guess I can check for mud (all caves have mud floors, correct?) using code from cleanmap.  What doe sthe magic number 0xC in cleanmap do, and what would be the value for mud?
Is it possible to find out what items are where?  I see that item are available from Items.h, but that doesn't seem to have location, and I don't see where the definitions for item class are.  I'm mostly interested in finding barrels and bins and replacing them with Minecraft chests and possibly pile designations (that would probably be someplace else).

I'm going to try to get torches, construction material, and buildings in before I release the code, hopefully by the end next weekend.  I'll probably have to do some optimization as well, as it currently take about 15 minutes to convert a 5x5 embarked area, and I'm going to be doing more lookups for buildings, water and such.

Thanks again for all your help!
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: peterix on August 13, 2010, 07:37:25 pm
I'd like to thank everyone for their help last week. I have DFHack working in VSE 2010, and have the basics of my DF to Minecraft program working. It isn't nearly working yet, but it is a start.
I fixed the build system for that recently. Is it what you're using or did you fix it yourself?

I have some walls showing up as having a TileMaterial of 'constructed'. Does the 'tempvein' look up as done by Probe for those tiles show the material of the 'floor' that was there before the wall was constructed?  If so, then I'm assuming that I can get the constructed wall material for the wall by looking in the Constructions object, is that correct? (I haven't looked at the Constructions object yet, but that is the thing I plan to do next.
Yes, you get the material from the construction itself. Also, you must mean the prospector tool, not probe.

Are tree tops not an actual DF tile type, and are just 'created' by the interface if a tree is below a air space?
Not there, it's all fakery, much like seeing the floors of one Z below.

I know I can get the date from the World object, but is it possible to get the location or group name? Civilization name?
I created the World module for that time-related stuff because putting it in Maps seemed wrong... yet Maps also holds parts of the world map. It's a bit messy but nothing unexpected with all the random adding of new features.
There was a Settlements module before, but was never ported from DF 40d. Rest of the stuff: simply not there.

Is it possible to tell if a location is part of a natural cave, and compared to a dwarf dug hallway?  I would like to put Minecraft Torches in dwarf dug areas, but natural cave should be unlit. If there isn't an easy way to tell, I guess I can check for mud (all caves have mud floors, correct?) using code from cleanmap.  What does the magic number 0xC in cleanmap do, and what would be the value for mud?
Yes, you can cross-reference tiles and blocks with local/global features. This is how things like hell and adamantine are detected also. Each map block can have one local and one global feature. Tiles then have a flag that determines if they belong to those map features. You can get caves, rivers, pits, hell, all that stuff. I filter most of this out when determining the materials though. Look at Maps::ReadLocalFeatures and Maps::ReadGlobalFeatures. It should be fairly easy to extend them. 0xC = mud, it's making an exception for mud to keep it around and not break your farms. It could probably find farms and only apply the exception there, but this works. I had some table for those values, but don't know where it went... Must be in one of my paper heaps ~_~

Is it possible to find out what items are where?  I see that item are available from Items.h, but that doesn't seem to have location, and I don't see where the definitions for item class are.  I'm mostly interested in finding barrels and bins and replacing them with Minecraft chests and possibly pile designations (that would probably be someplace else).
Hmm. It should be t_item in Items.h, but that's missing the bits you're looking for. The Items module needs some fixing.
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: TroZ_shack on August 13, 2010, 08:04:14 pm
Yes, I was able to use the build system (once I installed CMake) for Visual Studio Express 2010, and I was able to use the project it created without much fuss.  I then created a sub-project in there for my map converter and copied the settings from the prospector project to get my new project to build and link correctly.

Thanks for the prompt response!  I guess I have a bunch of work this weekend :)
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: Rose on August 13, 2010, 08:58:32 pm
oh man, this is way cool

need any help?
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: FleshForge on August 13, 2010, 11:06:04 pm
K. I'll add the utility. I've been hit by this bug more than once and this is just too useful :) There will be a Windows binary release very soon, last in the 0.4 series.

Hooray, that's a very useful bugfix!  Thanks!
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: chessepuff on August 14, 2010, 07:11:42 am
Im having some compilation problems im trying to compile for Linux all Dependencies are met and I've tried about everything i can think of to get this to compile so here goes oh and im working with the latest from the public git repo
here's the output from the terminal

Code: [Select]
joshua@joshua-laptop:~/Desktop/dfhgit/dfhack/build$ cmake -DCMAKE_BUILD_TYPE:string=Release \ -DCMAKE_INSTALL_PREFIX=/usr \ -DMEMXML_DATA_PATH:path=/usr/share/dfhack \ -BUILD_DFHACK_DOCUMENTATION=ON \ BUILD_DFHACK_EXAMPLES=ON \ BUILD_DFHACK_PLAYGROUND=ON ..
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found.
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found.
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - not found.
-- Looking for _POSIX_TIMERS
-- Looking for _POSIX_TIMERS - found
-- Configuring done
-- Generating done
-- Build files have been written to: /home/joshua/Desktop/dfhgit/dfhack/build
joshua@joshua-laptop:~/Desktop/dfhgit/dfhack/build$ make
-- Configuring done
-- Generating done
-- Build files have been written to: /home/joshua/Desktop/dfhgit/dfhack/build
Scanning dependencies of target dfhack
[  1%] Building CXX object library/CMakeFiles/dfhack.dir/DFMemInfo.cpp.o
[  3%] Building CXX object library/CMakeFiles/dfhack.dir/DFMemInfoManager.cpp.o
[  4%] Building CXX object library/CMakeFiles/dfhack.dir/DFContextManager.cpp.o
[  6%] Building CXX object library/CMakeFiles/dfhack.dir/DFContext.cpp.o
[  7%] Building CXX object library/CMakeFiles/dfhack.dir/DFProcessEnumerator.cpp.o
[  9%] Building CXX object library/CMakeFiles/dfhack.dir/ContextShared.cpp.o
[ 10%] Building CXX object library/CMakeFiles/dfhack.dir/depends/md5/md5.cpp.o
[ 12%] Building CXX object library/CMakeFiles/dfhack.dir/depends/md5/md5wrapper.cpp.o
[ 13%] Building CXX object library/CMakeFiles/dfhack.dir/depends/tinyxml/tinystr.cpp.o
[ 15%] Building CXX object library/CMakeFiles/dfhack.dir/depends/tinyxml/tinyxml.cpp.o
[ 16%] Building CXX object library/CMakeFiles/dfhack.dir/depends/tinyxml/tinyxmlerror.cpp.o
[ 18%] Building CXX object library/CMakeFiles/dfhack.dir/depends/tinyxml/tinyxmlparser.cpp.o
[ 19%] Building CXX object library/CMakeFiles/dfhack.dir/modules/Buildings.cpp.o
[ 21%] Building CXX object library/CMakeFiles/dfhack.dir/modules/Constructions.cpp.o
[ 22%] Building CXX object library/CMakeFiles/dfhack.dir/modules/Creatures.cpp.o
[ 24%] Building CXX object library/CMakeFiles/dfhack.dir/modules/Gui.cpp.o
[ 25%] Building CXX object library/CMakeFiles/dfhack.dir/modules/Items.cpp.o
[ 27%] Building CXX object library/CMakeFiles/dfhack.dir/modules/Maps.cpp.o
[ 28%] Building CXX object library/CMakeFiles/dfhack.dir/modules/Materials.cpp.o
[ 30%] Building CXX object library/CMakeFiles/dfhack.dir/modules/Position.cpp.o
[ 31%] Building CXX object library/CMakeFiles/dfhack.dir/modules/Translation.cpp.o
[ 33%] Building CXX object library/CMakeFiles/dfhack.dir/modules/Vegetation.cpp.o
[ 34%] Building CXX object library/CMakeFiles/dfhack.dir/modules/World.cpp.o
[ 36%] Building CXX object library/CMakeFiles/dfhack.dir/DFProcess-linux.cpp.o
/home/joshua/Desktop/dfhgit/dfhack/library/DFProcess-linux.cpp: In member function ‘virtual void DFHack::NormalProcess::getMemRanges(std::vector<DFHack::t_memrange, std::allocator<DFHack::t_memrange> >&)’:
/home/joshua/Desktop/dfhgit/dfhack/library/DFProcess-linux.cpp:186: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 3 has type ‘uint32_t’
[ 37%] Building CXX object library/CMakeFiles/dfhack.dir/DFProcess-linux-SHM.cpp.o
/home/joshua/Desktop/dfhgit/dfhack/library/DFProcess-linux-SHM.cpp: In member function ‘void DFHack::SHMProcess::Private::FreeLocks()’:
/home/joshua/Desktop/dfhgit/dfhack/library/DFProcess-linux-SHM.cpp:178: warning: ignoring return value of ‘int lockf(int, int, __off_t)’, declared with attribute warn_unused_result
/home/joshua/Desktop/dfhgit/dfhack/library/DFProcess-linux-SHM.cpp: In member function ‘virtual void DFHack::SHMProcess::getMemRanges(std::vector<DFHack::t_memrange, std::allocator<DFHack::t_memrange> >&)’:
/home/joshua/Desktop/dfhgit/dfhack/library/DFProcess-linux-SHM.cpp:389: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 3 has type ‘pid_t’
[ 39%] Building CXX object library/CMakeFiles/dfhack.dir/DFProcess-linux-wine.cpp.o
/home/joshua/Desktop/dfhgit/dfhack/library/DFProcess-linux-wine.cpp: In member function ‘virtual void DFHack::WineProcess::getMemRanges(std::vector<DFHack::t_memrange, std::allocator<DFHack::t_memrange> >&)’:
/home/joshua/Desktop/dfhgit/dfhack/library/DFProcess-linux-wine.cpp:198: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 3 has type ‘uint32_t’
[ 40%] Building CXX object library/CMakeFiles/dfhack.dir/modules/WindowIO-linux.cpp.o
[ 42%] Building CXX object library/CMakeFiles/dfhack.dir/DFContext_C.cpp.o
[ 43%] Building CXX object library/CMakeFiles/dfhack.dir/DFTypes_C.cpp.o
[ 45%] Building CXX object library/CMakeFiles/dfhack.dir/modules/Buildings_C.cpp.o
[ 46%] Building CXX object library/CMakeFiles/dfhack.dir/modules/Constructions_C.cpp.o
[ 48%] Building CXX object library/CMakeFiles/dfhack.dir/modules/Creatures_C.cpp.o
[ 50%] Building CXX object library/CMakeFiles/dfhack.dir/modules/Gui_C.cpp.o
[ 51%] Building CXX object library/CMakeFiles/dfhack.dir/modules/Items_C.cpp.o
[ 53%] Building CXX object library/CMakeFiles/dfhack.dir/modules/Maps_C.cpp.o
[ 54%] Building CXX object library/CMakeFiles/dfhack.dir/modules/Position_C.cpp.o
[ 56%] Building CXX object library/CMakeFiles/dfhack.dir/modules/Materials_C.cpp.o
[ 57%] Building CXX object library/CMakeFiles/dfhack.dir/modules/Translation_C.cpp.o
[ 59%] Building CXX object library/CMakeFiles/dfhack.dir/modules/Vegetation_C.cpp.o
[ 60%] Building CXX object library/CMakeFiles/dfhack.dir/modules/WindowIO_C.cpp.o
[ 62%] Building CXX object library/CMakeFiles/dfhack.dir/modules/World_C.cpp.o
Linking CXX shared library ../../output/libdfhack.so
[ 62%] Built target dfhack
[ 63%] Generating qrc_resources.cxx
[ 65%] Generating dfedit.moc
[ 66%] Generating memxmlModel.moc
Scanning dependencies of target dfoffsetedit
[ 68%] Building CXX object offsetedit/src/CMakeFiles/dfoffsetedit.dir/dfedit.cpp.o
In file included from /home/joshua/Desktop/dfhgit/dfhack/offsetedit/src/dfedit.cpp:1:
/home/joshua/Desktop/dfhgit/dfhack/offsetedit/src/dfedit.h:5:21: error: ui_main.h: No such file or directory
In file included from /home/joshua/Desktop/dfhgit/dfhack/offsetedit/src/dfedit.cpp:1:
/home/joshua/Desktop/dfhgit/dfhack/offsetedit/src/dfedit.h:16: error: ‘Ui’ has not been declared
/home/joshua/Desktop/dfhgit/dfhack/offsetedit/src/dfedit.h:16: error: ISO C++ forbids declaration of ‘MainWindow’ with no type
/home/joshua/Desktop/dfhgit/dfhack/offsetedit/src/dfedit.h:16: error: expected ‘;’ before ‘ui’
/home/joshua/Desktop/dfhgit/dfhack/offsetedit/src/dfedit.cpp: In constructor ‘dfedit::dfedit(QWidget*)’:
/home/joshua/Desktop/dfhgit/dfhack/offsetedit/src/dfedit.cpp:8: error: ‘ui’ was not declared in this scope
/home/joshua/Desktop/dfhgit/dfhack/offsetedit/src/dfedit.cpp: In member function ‘void dfedit::slotOpen(bool)’:
/home/joshua/Desktop/dfhgit/dfhack/offsetedit/src/dfedit.cpp:53: error: ‘ui’ was not declared in this scope
make[2]: *** [offsetedit/src/CMakeFiles/dfoffsetedit.dir/dfedit.cpp.o] Error 1
make[1]: *** [offsetedit/src/CMakeFiles/dfoffsetedit.dir/all] Error 2
make: *** [all] Error 2

ok so everythings going good with the exception of a few warnings untill i hit this line

[ 68%] Building CXX object offsetedit/src/CMakeFiles/dfoffsetedit.dir/dfedit.cpp.o

the error chain that follows is what ends up causing the fatal error all because of the missing file ui_main.h that's included by dfedit.h that''s included by dfedit.cpp in the whole dfoffsetedit thing now the rest of the project does compile properly i went into the build/library and build/tools and build/docs folders and did make in each and it got though the compilation of those parts and put the resulting files in the output/ folder as expected though i havent tested them now i checked the entire source tree and i couldn't find an ui_main.h or ui_main.cpp or anything like that and it's not in the dwarf fortress game folder either so yeah it feels like im missing something stupid simple so any help would be much appreciated
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: MaximumZero on August 14, 2010, 09:11:19 am
Came over from the Runesmith thread to say:

Thank you for fixing the memory leak! THANKYOUTHANKYOUTHANKYOU!!!
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: Artanis00 on August 14, 2010, 01:52:44 pm
What needs to happen to get the Python bindings working?
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: peterix on August 14, 2010, 02:06:18 pm
Im having some compilation problems im trying to compile for Linux all Dependencies are met and I've tried about everything i can think of to get this to compile so here goes oh and im working with the latest from the public git repo
here's the output from the terminal...

... stuff ...

it feels like im missing something stupid simple so any help would be much appreciated
You aren't missing anything, it was a bug. dfedit is just a part of the thing that will eventually become the memory.xml editor. I fixed it, added a switch for building it and set it to disabled by default for now. It's not really useful right now.
What needs to happen to get the Python bindings working?
Hmm... I'd say ask doomchild.
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: chessepuff on August 14, 2010, 03:33:07 pm
Ahh ok that makes sense now yeah the new one compiles just fine thanks for the update and for the great tool
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: peterix on August 14, 2010, 04:29:11 pm
A new binary version appears! :D
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: FleshForge on August 14, 2010, 06:16:09 pm
Excellent, I'm sure that will fix A LOT of problems - I notice that when people carrying a corpse for burial or butchering are interrupted, the corpse becomes stuck, so your map is littered with deaders even in a good scenario!
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: FleshForge on August 14, 2010, 08:11:27 pm
Hmm, the corpses thing seems to be another matter I guess, this utility doesn't get them moving again.  Still should fix MANY problems though!
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: keda on August 15, 2010, 07:30:46 pm
Today pread caused me a lot of headache, until I figured out that it was pread's fault. Whoever made it take a signed integer and throw errors at negative numbers must have had a screw lose. I had to switch to pread64 just to read the full 4G address space :(
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: strich on August 16, 2010, 05:48:38 am
I've started my own little project using DFhack but I'm struggling to gain an understanding of how it all works. Is there any decent documentation I've missed or do I have to rely on the examples?
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Serird on August 16, 2010, 08:08:44 am
Is it possible to add cut/copy/paste to DFhack?
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Rose on August 16, 2010, 08:14:44 am
that would be something that goes into a client utility, rather than DFhack itself
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: mLegion on August 16, 2010, 10:54:33 am
What is the current standard for any sort of GUI given that DFHack is supposed to be crossplatform?
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: doomchild on August 19, 2010, 04:48:55 pm
What needs to happen to get the Python bindings working?

Sorry I've been slacking off lately.  Going into beta has involved more stress and less sleep than any of our other projects thus far.

I don't think my latest additions have been pulled into the trunk yet, but the Python bindings largely work in my tests.  I've been able to interact with map data, read creature states, and the like.  Some of the bigger pieces haven't been tested much (or at all), mostly writing map features or creature jobs.  I'm not too worried about it, though, since just about all of the calls equate to something like "allocate via buffer callback -> call C++ stuff -> vector copy -> return -> whores".

I'm going back through everything trying to make sure I haven't missed anything, but I know there are a couple of unwrapped pieces at the moment.

In short, I'd consider the Python bindings to be highly experimental, but ready for some amount of field testing.
Title: Re: DFHack 0.4.0.5 - tools and memory access library
Post by: Artanis00 on August 19, 2010, 06:00:13 pm
What needs to happen to get the Python bindings working?

Sorry I've been slacking off lately.  Going into beta has involved more stress and less sleep than any of our other projects thus far.

I don't think my latest additions have been pulled into the trunk yet, but the Python bindings largely work in my tests.  I've been able to interact with map data, read creature states, and the like.  Some of the bigger pieces haven't been tested much (or at all), mostly writing map features or creature jobs.  I'm not too worried about it, though, since just about all of the calls equate to something like "allocate via buffer callback -> call C++ stuff -> vector copy -> return -> whores".

I'm going back through everything trying to make sure I haven't missed anything, but I know there are a couple of unwrapped pieces at the moment.

In short, I'd consider the Python bindings to be highly experimental, but ready for some amount of field testing.

Sounds like fun. When I get a chance then, I'll pull your code into my repo and look at it.

I want to see if I can do some dwarf therapist stuff, but I prefer to work in Python.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Shukaro on August 21, 2010, 12:40:58 pm
Quick question, I'm trying to figure out how to use DFHack with AHK to retrieve the memory offsets for the mouse, cursor, and window coordinates, but I know practically nothing about coding in C++. So, I'd like some advice on how to solve this issue. I can retrieve the values from the offsets just fine, I'm just looking for a way to get the offsets in the first place. Looking through the the functions in the position module, it seems that they return several separate values for X, Y, and Z with each call. I'm looking for a way to only return one value per call so that dllcall (http://www.autohotkey.com/docs/commands/DllCall.htm) can handle it. Any help would be appreciated, but I hope you don't feel obligated to do much.  :D
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Kashyyk on August 21, 2010, 12:44:27 pm
On the topic of utilities (Basically what this is) Does anyone know of one that modifies the number of starting dwarves/points at embark?
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Shukaro on August 21, 2010, 12:49:39 pm
Your probably looking for friendship enhancer to change the number of starting dwarves. As for the points, that's an easy memory hack with cheat engine or something similar. Just go to the embark buying screen, search for the number of points you have, change your point number, search next for the new one, and repeat until you've found the value you need. Then just change it to what you want and optionally freeze it.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Kashyyk on August 21, 2010, 12:51:25 pm
Thanks!
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Shukaro on August 21, 2010, 12:53:15 pm
No problem, always happy to help when I can.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: TroZ_shack on August 21, 2010, 04:37:58 pm
Hi, I'm about ready to release the initial version of the Dwarf Fortress to Minecraft level converter tool based upon DFHack 0.4.0.5, but I though I'd post it here and get some feedback before creating a thread for it.

http://github.com/TroZ/DF2MC

I've never used git before and I'm really not sure how to setup a project so that you could be able to compile on both Windows and Linux, so I've just posted the .cpp source and settings xml file that the program uses as well as a simple readme. Hopefully people and compile what I've posted (or download the build I made).

I setup a separate project as there is still a bunch of work to do to get a 'finished' converter, and I didn't think the DFHack project would want the trouble of bug reports from this code, but feel free to include it in the unsupported tools come with DFHack if you want.

There is still a bunch of work to do to have a 'proper' conversion. Most of the import TODOs are mentioned in the readme. So, if you feel like helping out, that's a good place to start.

I'll probably create a separate thread tomorrow, after I've gotten some feedback and fixed any fatal bugs if any are found.

Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Rose on August 21, 2010, 09:47:49 pm
tried it with my DF map, spawned in the lava

nevermind, after some readme reading, it would seem that the top, center of the level is lava. I am now floring that bit over.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Repulsion on August 22, 2010, 02:20:17 pm
  Is there like a 40d version of this, or at least a 40d version of prospector and reveal/unreveal?
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Rose on August 22, 2010, 02:24:30 pm
yeah, you have too go back a bunch of versions
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Repulsion on August 22, 2010, 04:09:18 pm
  And where can I get the 40d version? I can't seem to find it. Can someone provide me with a download link?
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: peterix on August 22, 2010, 04:28:20 pm
  And where can I get the 40d version? I can't seem to find it. Can someone provide me with a download link?
http://github.com/downloads/peterix/dfhack/dfhack-bin-0.2.1.zip (http://github.com/downloads/peterix/dfhack/dfhack-bin-0.2.1.zip)

It doesn't have some of the newer utils, but also has some other ones. Everything between 40d and 40d19-2 should be supported, along with versions before that.

btw: I'm back and coding again :)
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Repulsion on August 22, 2010, 05:04:37 pm
  Thanks.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: mLegion on August 23, 2010, 02:04:18 am
I'm looking for a way to only return one value per call so that dllcall (http://www.autohotkey.com/docs/commands/DllCall.htm) can handle it. Any help would be appreciated, but I hope you don't feel obligated to do much.  :D

You want to write a simple DLL that just calls DFHack and then returns only 1 of the co-ordinates.

edit: @peterix: is there any kind of standard for making GUI apps with DFHack so that they remain cross-platform?
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: peterix on August 23, 2010, 05:04:01 am
I'm looking for a way to only return one value per call so that dllcall (http://www.autohotkey.com/docs/commands/DllCall.htm) can handle it. Any help would be appreciated, but I hope you don't feel obligated to do much.  :D

You want to write a simple DLL that just calls DFHack and then returns only 1 of the co-ordinates.

edit: @peterix: is there any kind of standard for making GUI apps with DFHack so that they remain cross-platform?
Not really a standard, but it should be possible to use the Qt libraries for example. I'll be using those for GUI DFHack tools. Any cross-platform GUI framework (or 3D engine) should work though.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: sizeak on August 23, 2010, 05:16:37 am
Runesmith uses Qt too and I believe Dwarf Foreman might as well.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Shukaro on August 23, 2010, 12:13:55 pm
mLegion: Thanks, that's what I'm doing now, just have to read up on C++ syntax first.  :D
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Quietust on August 23, 2010, 03:08:58 pm
I've got another simple tool to submit: getting rid of water sitting in buckets (and thus preventing said buckets from being used for anything).

Code: [Select]
// boils away all pools of liquid water (generally sitting in buckets)
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <climits>
#include <vector>
using namespace std;

#include <DFHack.h>
#include <dfhack/DFVector.h>
#include <dfhack/DFTypes.h>
#include <dfhack/modules/Items.h>

DFHack::Items * Items;

int main ()
{
    DFHack::Process * p;
    unsigned int i;
    DFHack::ContextManager DFMgr("Memory.xml");
    DFHack::Context * DF;
    try
    {
        DF = DFMgr.getSingleContext();
        DF->Attach();
    }
    catch (exception& e)
    {
        cerr << e.what() << endl;
#ifndef LINUX_BUILD
        cin.ignore();
#endif
        return 1;
    }

    DFHack::memory_info * mem = DF->getMemoryInfo();
    p = DF->getProcess();
    DFHack::DfVector <uint32_t> p_items (p, p->getDescriptor()->getAddress ("items_vector"));
    uint32_t size = p_items.size();
    Items = DF->getItems();

    int numboiled = 0;
    for (i=0;i<size;i++)
    {
        DFHack::t_item item;
        if (!Items->getItemData(p_items[i], item))
            continue;
        if (item.matdesc.itemType != 72) // LIQUID_MISC
            continue;
        // haven't checked, but one of the other members of item.matdesc might contain this value as well
        if (p->readWord(p_items[i] + 0x0090) != 6) // WATER
            continue;
        // technically, the temperature just needs to be raised far enough so that it's still above 10180 after one step
        p->writeDWord(p_items[i] + 0x0078, 10200);
        numboiled++;
    }
    cout << "Found and boiled away " << numboiled << " puddles of water." << endl;

#ifndef LINUX_BUILD
    cout << "Done. Press any key to continue" << endl;
    cin.ignore();
#endif
    return 0;
}

Disclaimer: the water is removed by making it boil away, and the resulting steam may or may not do damage to your dwarves.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Teocali on August 25, 2010, 03:51:03 am
Hello,

I'm not sure that the good place to ask a dev. question, but as I don't find any forum or FAQ page on the DFHack Github page...

So, I'm really new at Linux Dev, but I'm trying to compile DFhack on my Ubuntu (as the only package version is available for ArchLinux)

Aftert having some probleme with the X11 lib and the Doxygen tool, I'm currently stuck with some ncurse file entry missing. I have tried to install every ncurse package on Synaptic (and restarting Cmake and/or deleting the CMakeCache.txt file), but I'm still having some CMake entries marked as "NOTFOUND".

Here the list, extracted from the CMakeCache.txt file.
Code: [Select]
CURSES_EXTRA_LIBRARY:FILEPATH=CURSES_EXTRA_LIBRARY-NOTFOUND
CURSES_HAVE_NCURSESW_H:FILEPATH=CURSES_HAVE_NCURSESW_H-NOTFOUND
CURSES_HAVE_NCURSES_CURSES_H:FILEPATH=CURSES_HAVE_NCURSES_CURSES_H-NOTFOUND
CURSES_HAVE_NCURSES_H:FILEPATH=CURSES_HAVE_NCURSES_H-NOTFOUND
CURSES_HAVE_NCURSES_NCURSES_H:FILEPATH=CURSES_HAVE_NCURSES_NCURSES_H-NOTFOUND
CURSES_INCLUDE_PATH:FILEPATH=CURSES_CURSES_H_PATH-NOTFOUND CURSES_CURSESW_H_PATH-NOTFOUND
CURSES_NCURSES_INCLUDE_PATH:PATH=CURSES_NCURSES_INCLUDE_PATH-NOTFOUND
FORM_LIBRARY:FILEPATH=CURSES_FORM_LIBRARY-NOTFOUND
Any hints will be welcome. Thanks in advance.

EDIT : Ok, forget this.  The make file are now correctly generated. I think i had deleted the wrong file, somewhere. Sorry about that.

Regards,
Teocali
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Teocali on August 25, 2010, 06:28:51 am
Yey, another question from the newb'

As said juste before, i'm trying to use DFHack on the latest version of DF on an Ubuntu Linux.

After some aventures with CMake, I have compiled the tools for Linux, but when I try to launch the dfcreaturedump tool, I just get an std::bad_alloc exception.

I've tried to look in the code, and this exception is raised when the program is trying to read all the materials of DF (line 443, Search the string "Just Here" if you're interested)
Code: [Select]

// Creature dump

#include <iostream>
#include <climits>
#include <string.h>
#include <vector>
#include <stdio.h>
using namespace std;

#define DFHACK_WANT_MISCUTILS
#include <DFHack.h>

enum likeType
{
    FAIL = 0,
    MATERIAL = 1,
    ITEM = 2,
    FOOD = 3
};

DFHack::Materials * Materials;
DFHack::memory_info *mem;
vector< vector<string> > englishWords;
vector< vector<string> > foreignWords;
DFHack::Creatures * Creatures = NULL;
uint32_t current_year;
uint32_t current_tick;
/*
likeType printLike40d(DFHack::t_like like, const matGlosses & mat,const vector< vector <DFHack::t_itemType> > & 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,
    //so I am not going to try and put all the possibilites here, only the low hanging fruit, with stones and metals, as well as items,
    //you can easily find good canidates for military duty for instance
    //The ideal thing to do would be to call the df function directly with the desired likes, the df function modifies a string, so it should be possible to do...
    if(like.active){
        if(like.type ==0){
            switch (like.material.type)
            {
            case 0:
                cout << mat.woodMat[like.material.index].name;
                return(MATERIAL);
            case 1:
                cout << mat.stoneMat[like.material.index].name;
                return(MATERIAL);
            case 2:
                cout << mat.metalMat[like.material.index].name;
                return(MATERIAL);
            case 12: // don't ask me why this has such a large jump, maybe this is not actually the matType for plants, but they all have this set to 12
                cout << mat.plantMat[like.material.index].name;
                return(MATERIAL);
            case 32:
                cout << mat.plantMat[like.material.index].name;
                return(MATERIAL);
            case 121:
                cout << mat.creatureMat[like.material.index].name;
                return(MATERIAL);
            default:
                return(FAIL);
            }
        }
        else if(like.type == 4 && like.itemIndex != -1){
            switch(like.itemClass)
            {
            case 24:
                cout << itemTypes[0][like.itemIndex].name;
                return(ITEM);
            case 25:
                cout << itemTypes[4][like.itemIndex].name;
                return(ITEM);
            case 26:
                cout << itemTypes[8][like.itemIndex].name;
                return(ITEM);
            case 27:
                cout << itemTypes[9][like.itemIndex].name;
                return(ITEM);
            case 28:
                cout << itemTypes[10][like.itemIndex].name;
                return(ITEM);
            case 29:
                cout << itemTypes[7][like.itemIndex].name;
                return(ITEM);
            case 38:
                cout << itemTypes[5][like.itemIndex].name;
                return(ITEM);
            case 63:
                cout << itemTypes[11][like.itemIndex].name;
                return(ITEM);
            case 68:
            case 69:
                cout << itemTypes[6][like.itemIndex].name;
                return(ITEM);
            case 70:
                cout << itemTypes[1][like.itemIndex].name;
                return(ITEM);
            default:
          //      cout << like.itemClass << ":" << like.itemIndex;
                return(FAIL);
            }
        }
        else if(like.material.type != -1){// && like.material.index == -1){
            if(like.type == 2){
                switch(like.itemClass)
                {
                case 52:
                case 53:
                case 58:
                    cout << mat.plantMat[like.material.type].name;
                    return(FOOD);
                case 72:
                    if(like.material.type =! 10){ // 10 is for milk stuff, which I don't know how to do
                        cout << mat.plantMat[like.material.index].extract_name;
                        return(FOOD);
                    }
                    return(FAIL);
                case 74:
                    cout << mat.plantMat[like.material.index].drink_name;
                    return(FOOD);
                case 75:
                    cout << mat.plantMat[like.material.index].food_name;
                    return(FOOD);
                case 47:
                case 48:
                    cout << mat.creatureMat[like.material.type].name;
                    return(FOOD);
                default:
                    return(FAIL);
                }
            }
        }
    }
    return(FAIL);
}
*/

void printCreature(DFHack::Context * DF, const DFHack::t_creature & creature)
{
    uint32_t dayoflife;
cout << "address: " << hex <<  creature.origin << dec << " creature type: " << Materials->raceEx[creature.race].rawname
                << "[" << Materials->raceEx[creature.race].tile_character
                << "," << Materials->raceEx[creature.race].tilecolor.fore
                << "," << Materials->raceEx[creature.race].tilecolor.back
                << "," << Materials->raceEx[creature.race].tilecolor.bright
                << "]"
                << ", position: " << creature.x << "x " << creature.y << "y "<< creature.z << "z" << endl;
        bool addendl = false;
        if(creature.name.first_name[0])
        {
            cout << "first name: " << creature.name.first_name;
            addendl = true;
        }
        if(creature.name.nickname[0])
        {
            cout << ", nick name: " << creature.name.nickname;
            addendl = true;
        }

        DFHack::Translation *Tran = DF->getTranslation();
        DFHack::memory_info *mem = DF->getMemoryInfo();

        string transName = Tran->TranslateName(creature.name,false);
        if(!transName.empty())
        {
            cout << ", trans name: " << transName;
            addendl=true;
        }

        transName = Tran->TranslateName(creature.name,true);
        if(!transName.empty())
        {
            cout << ", last name: " << transName;
            addendl=true;
        }

        if(creature.civ)
        {
            cout << "civilization: " << creature.civ;
            addendl = true;
        }

        /*
        cout << ", likes: ";
        for(uint32_t i = 0;i<creature.numLikes; i++)
        {
            if(printLike(creature.likes[i],mat,itemTypes))
            {
                cout << ", ";
            }
        }
        */
        if(addendl)
        {
            cout << endl;
            addendl = false;
        }
        cout << "profession: " << mem->getProfession(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;
        dayoflife = creature.birth_year*12*28 + creature.birth_time/1200;
        cout << "Born on the year " << creature.birth_year << ", month " << (creature.birth_time/1200/28) << ", day " << ((creature.birth_time/1200) % 28 + 1) << ", " << dayoflife << " days lived." << endl;
        cout << "Appearance : ";
        for(unsigned int i = 0; i<creature.nbcolors ; i++)
        {
            cout << Materials->raceEx[creature.race].castes[creature.caste].ColorModifier[i].part << " ";
            uint32_t color = Materials->raceEx[creature.race].castes[creature.caste].ColorModifier[i].colorlist[creature.color[i]];
            if(color<Materials->color.size())
                cout << Materials->color[color].name << "["
                    << (unsigned int) (Materials->color[color].r*255) << ":"
                    << (unsigned int) (Materials->color[color].v*255) << ":"
                    << (unsigned int) (Materials->color[color].b*255) << "]";
            else
                cout << Materials->alldesc[color].id;
            if( Materials->raceEx[creature.race].castes[creature.caste].ColorModifier[i].startdate > 0 )
            {
                if( (Materials->raceEx[creature.race].castes[creature.caste].ColorModifier[i].startdate <= dayoflife) &&
                    (Materials->raceEx[creature.race].castes[creature.caste].ColorModifier[i].enddate > dayoflife) )
                    cout << "[active]";
                else
                    cout << "[inactive]";
            }
            cout << " - ";

        }
        cout << endl;
        cout << "happiness: "   << creature.happiness
             << ", strength: "  << creature.strength.level
             << ", agility: "   << creature.agility.level
             << ", toughness: " << creature.toughness.level
             << ", endurance: " << creature.endurance.level
             << ", recuperation: " << creature.recuperation.level
             << ", disease resistance: " << creature.disease_resistance.level
             //<< ", money: " << creature.money
             << ", id: " << creature.id;
        /*
        if(creature.squad_leader_id != -1)
        {
            cout << ", squad_leader_id: " << creature.squad_leader_id;
        }
        if(creature.mood != -1){
            cout << ", mood: " << creature.mood << " ";
        }*/
        cout << ", sex: ";
        if(creature.sex == 0)
        {
            cout << "Female";
        }
        else
        {
            cout <<"Male";
        }
        cout << endl;

        if((creature.mood != -1) && (creature.mood<5))
        {
            cout << "mood: " << creature.mood << ", skill: " << mem->getSkill(creature.mood_skill) << endl;
            vector<DFHack::t_material> mymat;
            if(Creatures->ReadJob(&creature, mymat))
            {
                for(unsigned int i = 0; i < mymat.size(); i++)
                {
                    printf("\t%s(%d)\t%d %d %d - %.8x\n", Materials->getDescription(mymat[i]).c_str(), mymat[i].itemType, mymat[i].subType, mymat[i].subIndex, mymat[i].index, mymat[i].flags);
                }
            }
        }

        /*
        if(creature.pregnancy_timer > 0)
            cout << "gives birth in " << creature.pregnancy_timer/1200 << " days. ";
        cout << "Blood: " << creature.blood_current << "/" << creature.blood_max << " bleeding: " << creature.bleed_rate;
        */
        cout << endl;

        if(creature.has_default_soul)
        {
            //skills
            cout << "Skills" << endl;
            for(unsigned int i = 0; i < creature.defaultSoul.numSkills;i++)
            {
                if(i > 0)
                {
                    cout << ", ";
                }
                cout << mem->getSkill(creature.defaultSoul.skills[i].id) << ": " << creature.defaultSoul.skills[i].rating;
            }
            cout << endl;
            cout << "Traits" << endl;
            for(uint32_t i = 0; i < 30;i++)
            {
                string trait = mem->getTrait (i, creature.defaultSoul.traits[i]);
                if(!trait.empty()) cout << trait << ", ";
            }
            cout << endl;

            // labors
            cout << "Labors" << endl;
            for(unsigned int i = 0; i < NUM_CREATURE_LABORS;i++)
            {
                if(!creature.labors[i])
                    continue;
                string laborname;
                try
                {
                    laborname = mem->getLabor(i);
                }
                catch(exception &)
                {
                    break;
                }
                cout << laborname << ", ";
            }
            cout << endl;
        }
        /*
         * 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;

        if(creature.flags1.bits.had_mood && (creature.mood == -1 || creature.mood == 8 ) )
        {
            string artifact_name = Tran->TranslateName(creature.artifact_name,false);
            cout << "artifact: " << artifact_name << endl;
        }


    cout << endl;
}


int main (int numargs, char ** args)
{
    DFHack::World * World;
    DFHack::ContextManager DFMgr("Memory.xml");
    DFHack::Context* DF;
    try
    {
        DF = DFMgr.getSingleContext();
        DF->Attach();
    }
    catch (exception& e)
    {
        cerr << e.what() << endl;
        #ifndef LINUX_BUILD
            cin.ignore();
        #endif
        return 1;
    }
    string check = "";
    if(numargs == 2)
        check = args[1];

    Creatures = DF->getCreatures();
    Materials = DF->getMaterials();
    World = DF->getWorld();
    current_year = World->ReadCurrentYear();
    current_tick = World->ReadCurrentTick();
    DFHack::Translation * Tran = DF->getTranslation();

    uint32_t numCreatures;
    if(!Creatures->Start(numCreatures))
    {
        cerr << "Can't get creatures" << endl;
        #ifndef LINUX_BUILD
            cin.ignore();
        #endif
        return 1;
    }
    if(!numCreatures)
    {
        cerr << "No creatures to print" << endl;
        #ifndef LINUX_BUILD
            cin.ignore();
        #endif
        return 1;
    }

    mem = DF->getMemoryInfo();
    Materials->ReadAllMaterials(); <== Just here !

    if(!Tran->Start())
    {
        cerr << "Can't get name tables" << endl;
        return 1;
    }
    vector<uint32_t> addrs;
    //DF.InitViewAndCursor();
    for(uint32_t i = 0; i < numCreatures; i++)
    {
        DFHack::t_creature temp;
        Creatures->ReadCreature(i,temp);
        if(check.empty() || string(Materials->raceEx[temp.race].rawname) == check)
        {
            cout << "index " << i << " ";

            printCreature(DF,temp);
            addrs.push_back(temp.origin);
        }
    }
    if(addrs.size() <= 10)
    {
        interleave_hex(DF,addrs,200);
    }
    /*
    uint32_t currentIdx;
    DFHack::t_creature currentCreature;
    DF.getCurrentCursorCreature(currentIdx);
    cout << "current creature at index " << currentIdx << endl;

    DF.ReadCreature(currentIdx, currentCreature);
    printCreature(DF,currentCreature);
    */
    Creatures->Finish();
    DF->Detach();
    #ifndef LINUX_BUILD
    cout << "Done. Press any key to continue" << endl;
    cin.ignore();
    #endif
    return 0;
}
I was wondering if the problem was coming from DF, so I just get a look in the df-hacked script, in the ./precompiled/linux directory of the DFHack distrib, and it seems that the library libdfconnect.so in the same dir must be moved in the libs directory of the DF distribution

So, i made the three following things :

But again, no luck, same error.

So, at the end, I have two questions :

Regards,
Teocali
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: sizeak on August 25, 2010, 07:41:37 am
Think there is a bad/missing offset
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: peterix on August 25, 2010, 09:12:16 am
Think there is a bad/missing offset
Exactly.
The tools from the 'tools/supported' directory work. Those are also normally in the binary releases. Things from 'tools/playground' probably won't. Unfortunately, that's also true for most of the stuff in 'tools/examples'.

I'm working on solving the problem on a bigger scale -- redoing the memory.xml format and writing a GUI tool to edit the file. That should make maintaining the offsets easier.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Teocali on August 25, 2010, 09:54:36 am
Ok, Thanks for your work.

Regards,
Teocali
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: devek on August 27, 2010, 12:31:32 am
How hard would it be to get something better from item dump than "COPPER weapon" ?
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: mLegion on August 27, 2010, 01:01:26 pm
I don't suppose someone as written a utility to remove ownership flags from items so i can finally dump all those 'xXpig tail socksXx'?
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: devek on August 28, 2010, 07:33:06 am
How hard would it be to get something better from item dump than "COPPER weapon" ?

sigh,

OK, if you're using IDA the function that turns an item into a textual description is sub_CD7420.

it switches on the type multiple times...

so a weapon which is type 24 calls sub_B37750, which looks up the weapon name from unk_1d5a27c.
.....
edit: it looks kind of like..
Code: [Select]
    string item = "[";

    switch(dfitem.matdesc.itemType)
    {
        case 24: // weapon
        {
            string material = Materials->getDescription(dfitem.matdesc);
            transform(material.begin(), material.end(), material.begin(), ::tolower);
            item.append(material);
            item.append(" ");
        }
            break;
        default:
            item.append("unknown item]");
            return item;
    }

    switch(dfitem.matdesc.itemType)
    {
    case 24: //weapon
        {
            uint32_t a = p->readDWord(dfbase+0x12DA27C + 0x24);
            uint32_t b = p->readDWord(a + (dfitem.matdesc.subType * 4));
            item.append(p->readCString(b+0x28));
        }
        break;
    default:
        item.append("unknown item]");
        return item;

    }

    item.append("]");

which looks kind of ugly, but that is how toady has to do it :(
....
edit2: !#$#@, why do material names have to be at different offsets?!?!?!
....
Now, the only tool that will really benefit from getting exact textual representation of items is Dwarf Foreman. So I guess it is up to me to write it :/ It will be super annoying to do, so I hope you have a better idea peter :P It would require dfhack tracking lots of new offsets, but they will all be super easy to automate the finding of.

Thoughts?
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: peterix on August 28, 2010, 07:19:36 pm

How hard would it be to get something better from item dump than "COPPER weapon" ?
In my books, the item dump doesn't work at all. The whole Items module is something that either needs a lot of work poured into it (documenting what's going on at least) or replacing with the old one, which could do almost the same with a lot less complexity. The old module determined item types by looking at the item's vtable pointer alone.

What's required is copying the item class hierarchy of DF. Depending on the vtable pointer from DF, the right classes would be used for the DFHack item objects. This way reading items won't involve things like creating text descriptions... that can be left for another layer or be implemented as Item::getDescription().

A problem to solve here is the amount of items that can be present -- those have to be read, processed and later disposed of. Maybe using a design pattern like flyweight could provide a lot of benefits. Have a set of vectors of items. A vector for each type. Keep away from constructors and destructors and use one real object whose data is supplied by the vector.

Those are two layers - one that loads individual items based on type and second that provides the cache/storage.
edit2: !#$#@, why do material names have to be at different offsets?!?!?!
/me doesn't understand.

Now, the only tool that will really benefit from getting exact textual representation of items is Dwarf Foreman. So I guess it is up to me to write it :/ It will be super annoying to do, so I hope you have a better idea peter :P It would require dfhack tracking lots of new offsets, but they will all be super easy to automate the finding of.

Thoughts?
No more thoughts really. Items are just plain broken in their current state. The module only works on Windows too.
If the problem of reading DF types with a virtual base class like Items is solved, the solution can be applied elsewhere. For example for reading building details.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: peterix on August 28, 2010, 07:35:00 pm
Also: double posting!

The memory.xml rewrite is pretty much done and the modules needed by the supported DFHack tools (not third-party utils) have been updated. The offset dumper can now print out offsets that are missing. I'll have to document this stuff.

Next up:
* Update rest of the modules to use the new offsets
* Work on memory.xml editor. I want to take it a bit further than previously planned and add a way to actually explore DF's memory space, probably forking this (http://www.codef00.com/projects.php) along the way. Unlike rest of DFHack, the utility will be GPL.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: devek on August 28, 2010, 09:53:29 pm
How hard would it be to get something better from item dump than "COPPER weapon" ?
In my books, the item dump doesn't work at all. The whole Items module is something that either needs a lot of work poured into it (documenting what's going on at least) or replacing with the old one, which could do almost the same with a lot less complexity. The old module determined item types by looking at the item's vtable pointer alone.

I'm not really certain it is dfhack that is broken, dwarf fortress is.. Toady's use of polymorphism is a sham. It is basically a bunch of objects put into an array that get dealt with by hand. When it looks at an item like a steel mace, it has to go through elaborate nested switch statements to figure out what the item is. The same applies to materials...

edit2: !#$#@, why do material names have to be at different offsets?!?!?!
/me doesn't understand.

Whoever wrote the materials module ran into the same problem...

If you look at the t_matgloss structure.. the char name[128] member isn't used! He started to read the data, but commented the code out. That is because the offset required based off the material also requires nested switch statements AND THEN you then a series of if/then statements. It isn't just the items module that needs to be fixed.

I'm divided between actually untangling the mess or rewriting my program to run inside of dwarf fortress and calling its own functions to get this information.

Look at this shit
(http://lh3.ggpht.com/_daUHwma1YLg/THnIsprHmKI/AAAAAAAAAHA/qifAEgCqUdg/s800/readitem.png)

That is the graph of code DF uses to figure out what an item is. That is more branches than all of dfhack put together, and it doesn't include the myriad of functions called from within that function..  it is just one function.

DF is chock full of this crap and I run into it wherever I go. I have no choice but to push ahead. Despite the fact this isn't my first rodeo, this is turning into the single most complicated piece of code I have untangled in my entire life.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Artanis00 on August 29, 2010, 01:19:56 am
Look at this shit
(http://lh3.ggpht.com/_daUHwma1YLg/THnIsprHmKI/AAAAAAAAAHA/qifAEgCqUdg/s800/readitem.png)

That is the graph of code DF uses to figure out what an item is. That is more branches than all of dfhack put together, and it doesn't include the myriad of functions called from within that function..  it is just one function.

DF is chock full of this crap and I run into it wherever I go. I have no choice but to push ahead. Despite the fact this isn't my first rodeo, this is turning into the single most complicated piece of code I have untangled in my entire life.

Erm, wow. That looks like an amazingly complicated function... Two things, though: How did you generate that graph? What does a slightly less complicated function look like?
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: devek on August 29, 2010, 02:02:07 am
IDA Pro, it will cost ya.

With a less complicated function, you should be able to make out some of the actual code and not just lots of lines :P
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Artanis00 on August 29, 2010, 05:51:58 am
IDA Pro, it will cost ya.

With a less complicated function, you should be able to make out some of the actual code and not just lots of lines :P

I see. It's a feature of the disassembler. Don't do enough of that to warrant any outlay. Nifty graph, though if I guess if I ever need a tool to visualize my code paths plan A is "rewrite."

Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: devek on August 29, 2010, 10:04:50 am
Well if outlay is a problem you could check out clang. Clang is poised to replace all c/c++ compilers in the near feature and has static analysis built in.

X Code for the mac is the only IDE that supports it from within the IDE, but you can still do static analysis from the command line on other platforms.

(http://developer.apple.com/mac/library/featuredarticles/StaticAnalysis/Art/uninitialized.jpg)
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: peterix on August 29, 2010, 04:20:20 pm
So. I just looked at the Items module because I'm updating everything to use the new offset storage classes... and it really needs a rewrite. Consider the module's API deprecated.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: devek on August 29, 2010, 05:10:34 pm
Well, I don't think anyone actually uses the API directly due to its memory leak.

1 question though.

Why doesn't it work on Linux?

Reading the code to get the get the type and material ids is correct and identical to how DF itself does it. The only other way to do it would be to find the exact offset of the id for each item class and switching for it. I'm assuming it has different code due to linux having a different c++ runtime, but I don't know due to the fact I have never reverse engineering any code on linux (never had a job where it came up).

EDIT: wow, I should have done this sooner. IDA's output on linux binaries is a lot more informative :D Switch statements are organized so much better... MSVC does some sneaky shit to optimize switches. I should have some code for you by next weekend you can build a proper item and material module with.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Luewen82 on August 30, 2010, 04:29:43 pm
Been trying to use DF clear task on items that are accumulating all over the fortress and dwarfs wont claim,dump or retrieve items no matter what i do. Cleartask worked fine until recently that it has started to crash DF after 15 seconds of use. I wonder whats going on.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Quietust on August 31, 2010, 07:47:58 am
Cleartask is only meant to be used immediately after reclaiming (i.e. before you unpause) - using it in an active fortress is asking for trouble, since it can easily disrupt all of your active tasks. I did some testing on a fortress with legitimately active tasks and it didn't seem to cause immediate problems (aside from some jobs cancelling due to "job item lost or destroyed"), though it's possible something else may be going on in your case. By any chance are you running the tool while your game is unpaused?

It's far more likely that the items your dwarves won't collect are owned by other dwarves who don't have bedrooms with sufficient storage space (either a cabinet or lots of floor space).
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Luewen82 on August 31, 2010, 09:46:11 am
Cleartask is only meant to be used immediately after reclaiming (i.e. before you unpause) - using it in an active fortress is asking for trouble, since it can easily disrupt all of your active tasks. I did some testing on a fortress with legitimately active tasks and it didn't seem to cause immediate problems (aside from some jobs cancelling due to "job item lost or destroyed"), though it's possible something else may be going on in your case. By any chance are you running the tool while your game is unpaused?

It's far more likely that the items your dwarves won't collect are owned by other dwarves who don't have bedrooms with sufficient storage space (either a cabinet or lots of floor space).

Hmmm. the items loitering around are mostly from migrants that arrive and i change their jobs. And suddenly they drop half of their stuff and leave it there. Have to try assigning them room and see if that works.  But some times there seem to be whole set of wardrobe dropped from dwarf for no visible reason in middle of their running around.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: calrogman on August 31, 2010, 09:59:21 am
I'm just curious here, but could DFHack be used to modify the contents of the embark rectangle offsets (horribly worded, I know) and replicate the functionality of Nano Fortress (http://www.bay12forums.com/smf/index.php?topic=21601.0)?
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: peterix on August 31, 2010, 10:25:11 am
I'm just curious here, but could DFHack be used to modify the contents of the embark rectangle offsets (horribly worded, I know) and replicate the functionality of Nano Fortress (http://www.bay12forums.com/smf/index.php?topic=21601.0)?
Interesting idea. I'll have to try that :)
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Truean on September 01, 2010, 06:47:41 am
Hi,

The link on your README page is broken, and I just thought that you should know.

Read the README :)

Takes me here:

http://github.com/peterix/dfhack/blob/master/README

Thanks again for making this.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: mLegion on September 01, 2010, 02:24:14 pm
I'm just curious here, but could DFHack be used to modify the contents of the embark rectangle offsets (horribly worded, I know) and replicate the functionality of Nano Fortress (http://www.bay12forums.com/smf/index.php?topic=21601.0)?

Should include 'embark anywhere' functionality as well in that case.

EDIT: How difficult would it be to implement a hotkey/keypress hook so that we can make DFHack based utilities that run in the background and do something when a person presses a key in DF?
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: lolghurt on September 02, 2010, 10:50:09 am
Is there some issue with spawning liquids above a certain level or is it impossible to place liquids above the max natural elevation to stop people binding obsidian to the top pf the sky?
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: peterix on September 02, 2010, 11:13:23 am
Is there some issue with spawning liquids above a certain level or is it impossible to place liquids above the max natural elevation to stop people binding obsidian to the top pf the sky?
The map simply doesn't exist there to keep the memory use low. No simple way around that I'm afraid.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Quietust on September 02, 2010, 12:24:31 pm
I'm just curious here, but could DFHack be used to modify the contents of the embark rectangle offsets (horribly worded, I know) and replicate the functionality of Nano Fortress (http://www.bay12forums.com/smf/index.php?topic=21601.0)?

Should include 'embark anywhere' functionality as well in that case.

EDIT: How difficult would it be to implement a hotkey/keypress hook so that we can make DFHack based utilities that run in the background and do something when a person presses a key in DF?

It's certainly possible on Windows, even without dfhack - I wrote a utility for the old 2D version of Dwarf Fortress so I could forbid/chasm/melt items without having to go into the stocks screen, and it just monitored the "f"/"c"/"m" keys while it was running in the background and making sure that the Dwarf Fortress window had focus (see here (http://dffd.wimbli.com/file.php?id=2380), sources included).
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: mLegion on September 02, 2010, 12:30:20 pm
Is there some issue with spawning liquids above a certain level or is it impossible to place liquids above the max natural elevation to stop people binding obsidian to the top pf the sky?
Use 'k' to view and then go up in Z-levels, you should see the right pane showing 'open space' until you get to above a certain point then it will be blank, that 'block' of the map isn't loaded until you build something near there like a tower.


(see here (http://dffd.wimbli.com/file.php?id=2380), sources included).
Thanks that does help, but it would still be nice for DFHack to be able to hook DF's keyboard input and allow us to register a callback function on a certain keypress.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: peterix on September 02, 2010, 05:21:53 pm
(see here (http://dffd.wimbli.com/file.php?id=2380), sources included).
Thanks that does help, but it would still be nice for DFHack to be able to hook DF's keyboard input and allow us to register a callback function on a certain keypress.
Well, I can add that by catching SDL events. I'd need to restructure things to do that though. I already have a way to get code into DF by adding an extra library that looks like SDL to DF. It needs to have a few bugs fixed to be good for general use though.

So, let's do a short status/planning update:

If you are missing some features, don't be afraid to jump in and add them :)
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Dan Backslide on September 03, 2010, 03:02:37 pm
I recently started using DFHack, and tried out reveal. It gave me the notices for finding the pit and I thought nothing of it until I went to create magma forges. From what I've read when you use reveal, it skips the flags for finding magma and then doesn't allow construction of magma forges. I tried to find a mod to help and the only one I saw was Gibbed's Tweak which has long since been out of production. Is there any way I can reset the flags or is my current save screwed for that and I should start over? How can I avoid this in the future if I want to use reveal? Thank you for any help.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: devek on September 03, 2010, 03:03:42 pm
Only use reveal while paused.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Andux on September 03, 2010, 06:50:44 pm
I tried to find a mod to help and the only one I saw was Gibbed's Tweak which has long since been out of production. Is there any way I can reset the flags or is my current save screwed for that and I should start over?

I've been working on updated Tweak XML files for 0.31.xx (http://meepo.dnsalias.org/files/tweak_core-xml-31xx.zip); they don't have the offsets to enable magma buildings directly, but you could try using For Each Tile (http://df.magmawiki.com/index.php/Utility:For_Each_Tile) to hide all the tiles with magma, then have your miners dig down to "discover" them again, which should set the flags for you.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: peterix on September 03, 2010, 06:57:44 pm
I tried to find a mod to help and the only one I saw was Gibbed's Tweak which has long since been out of production. Is there any way I can reset the flags or is my current save screwed for that and I should start over?

I've been working on updated Tweak XML files for 0.31.xx (http://meepo.dnsalias.org/files/tweak_core-xml-31xx.zip); they don't have the offsets to enable magma buildings directly, but you could try using For Each Tile (http://df.magmawiki.com/index.php/Utility:For_Each_Tile) to hide all the tiles with magma, then have your miners dig down to "discover" them again, which should set the flags for you.
Yeah. that could help. maybe I should add a backup feature to the reveal tool - just save the 'hidden' bitmask into a file. It already backs it up for a short while, only in memory.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: devek on September 03, 2010, 07:34:51 pm
Or you could maybe make sure the game is paused and/or force it to be so :)

Dwarf Fortress.exe+10BCE11 is the byte that determines if the game is paused or not.

Dwarf Fortress.exe+14F589 is the instruction that writes to that address...

EDIT: There ya go, replace Dwarf Fortress.exe+14F583 with 90 90 90 90 90 90 and set Dwarf Fortress.exe+10BCE11 to 01 when dfreveal loads. The game will be paused and there will be no way to unpause it.

When you unreveal, replace Dwarf Fortress.exe+14F583 with 2a 15 11 ce 2e 01 and the user will be able to unpause again.

This works for windows only, obviously.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Dan Backslide on September 03, 2010, 10:58:14 pm
Only use reveal while paused.

Well, now I know to only use while paused. The command prompt's dialogue wasn't really clear on what game state I should mess around reveal with. I've decided it is best for me to start a new fort so the flagging will be a non-issue. Thanks for the information.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: finesse on September 04, 2010, 02:08:38 am
Or you could maybe make sure the game is paused and/or force it to be so :)

Dwarf Fortress.exe+10BCE11 is the byte that determines if the game is paused or not.

Dwarf Fortress.exe+14F589 is the instruction that writes to that address...

EDIT: There ya go, replace Dwarf Fortress.exe+14F583 with 90 90 90 90 90 90 and set Dwarf Fortress.exe+10BCE11 to 01 when dfreveal loads. The game will be paused and there will be no way to unpause it.

When you unreveal, replace Dwarf Fortress.exe+14F583 with 2a 15 11 ce 2e 01 and the user will be able to unpause again.

This works for windows only, obviously.

Will that also disable the 'take a turn key' cause my fat fingers have accidentally tapped that when changing levels before.. very annoying - i should really change the z level keys.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: peterix on September 04, 2010, 08:09:47 am
The reveal tool will pause automatically in the next release and warn you about unleashing hell.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: mLegion on September 04, 2010, 09:02:33 am
might be worth it to make it so reveal can reveal only everything above the magma sea.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: rmunn on September 04, 2010, 10:16:01 am
FYI: the next version of Ubuntu Linux, due to be released in October 2010, turns OFF (by default, you can change this) the ability of programs to access each others' memory. You can turn it back on; see this thread (http://www.bay12forums.com/smf/index.php?topic=65326.0) for details. This won't be a huge problem yet, as only beta-testers and other brave souls will be running Ubuntu 10.10 ("Maverick Meerkat") just now... but once the end of October rolls around and the Ubuntu users start upgrading, you're going to see a lot of "How Come DFHack/Dwarf Therapist/Stonesense/etc aren't working?" posts. At that time, it might be worth updating the OP to point to the "Fixing problems with Maverick" thread (http://www.bay12forums.com/smf/index.php?topic=65326.0).
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: devek on September 04, 2010, 02:27:19 pm
Will that also disable the 'take a turn key' cause my fat fingers have accidentally tapped that when changing levels before.. very annoying - i should really change the z level keys.

Negative.. but you could hit escape -> key bindings -> dwarf more -> and delete the binding for one step.

Also peter.. if you're in a coding mood. It would be nice if dfliquids could remove and add the aquifer feature from a region. Furthermore, if you could change a tile type to 90, that is a river source and a person could actually make a river with df hack (or a waterfall suspended in air). The river source requires the same global feature though. 
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: mLegion on September 04, 2010, 04:31:20 pm
i just added a mode to a local copy of dfliquids named dfenvironment for every flag that Maps->ReadDesignations returns which is fun to play with, don't know what happened to the .cpp file though, I got distracted by trying to figure out how to read in DF's map using DFHack and display it in a Qt widget so i can make a GUI editor and backed up dfenvironment somewhere and lost it. :(
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Rumrusher on September 04, 2010, 06:14:44 pm
I wonder is building spawning from utility checking for an item out of the question? if so then building walls in adventure mode is out of the question.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: devek on September 04, 2010, 07:04:58 pm
I wonder is building spawning from utility checking for an item out of the question? if so then building walls in adventure mode is out of the question.

I'm not sure I understand your question.

You can build obsidian walls in adventure mode with dfliquids.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: mLegion on September 04, 2010, 08:18:10 pm
i think he means spawning a construction if you use/have an item ingame.

personally i just look forward to the day we can do all fortress mode stuff in adv. mode.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Rumrusher on September 05, 2010, 03:22:34 pm
i think he means spawning a construction if you use/have an item ingame.

personally i just look forward to the day we can do all fortress mode stuff in adv. mode.
yes this would make building stairs for towers easier especially with the wanderer mod.
now the only two major huddles for me is learning DFhack so I can start this project and see If the game just cut off access to the fort mode options and one can build in adventure mode. know where to start screwing around in the game code.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: dierre on September 07, 2010, 04:44:28 pm
Hi! I'm having trouble compiling dfhack on linux.

I have this error:

Quote
dierre@cox:~/Programmi/dfhack/build$ cmake .. -DCMAKE_BUILD_TYPE:string=Release
-- Wide-character ncurses library not found - veinlook can't be built
CMake Error at tools/supported/CMakeLists.txt:120 (install):
  install TARGETS given target "dfveinlook" which does not exist in this
  directory.


-- Configuring incomplete, errors occurred!

I have libncurses5 and libncurses5-dev
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: peterix on September 07, 2010, 04:49:51 pm
Hi! I'm having trouble compiling dfhack on linux.

I have this error:

Quote
dierre@cox:~/Programmi/dfhack/build$ cmake .. -DCMAKE_BUILD_TYPE:string=Release
-- Wide-character ncurses library not found - veinlook can't be built
CMake Error at tools/supported/CMakeLists.txt:120 (install):
  install TARGETS given target "dfveinlook" which does not exist in this
  directory.


-- Configuring incomplete, errors occurred!

I have libncurses5 and libncurses5-dev
Well, you should have the wide-character version of them. Otherwise it won't build veinlook. Probably not much of a loss tho. The real bug here is in the build system, because it should be able to ignore such errors and just print the first line (-- Wide-character ncurses library not found - veinlook can't be built). I'll fix that ASAP :)
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Artanis00 on September 07, 2010, 05:23:13 pm
Hi! I'm having trouble compiling dfhack on linux.

I have this error:

Quote
dierre@cox:~/Programmi/dfhack/build$ cmake .. -DCMAKE_BUILD_TYPE:string=Release
-- Wide-character ncurses library not found - veinlook can't be built
CMake Error at tools/supported/CMakeLists.txt:120 (install):
  install TARGETS given target "dfveinlook" which does not exist in this
  directory.


-- Configuring incomplete, errors occurred!

I have libncurses5 and libncurses5-dev

On Ubuntu 10.04 at least, you need libncursesw5 and libncursesw5-dev.

Code: [Select]
sudo apt-get install libncursesw5 libncursesw5-dev
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: dierre on September 07, 2010, 05:57:26 pm
I've updated the repository and now is working. :D
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: dierre on September 07, 2010, 06:08:50 pm
A question. I've compiled dfhack to run stonesense. Now it's running but not able to connect because, I think, the Memory.xml file is for windows. Should I use the one from dfhack or is it the same?
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: peterix on September 07, 2010, 07:33:42 pm
A question. I've compiled dfhack to run stonesense. Now it's running but not able to connect because, I think, the Memory.xml file is for windows. Should I use the one from dfhack or is it the same?
Should be about the same. It's safer to overwrite the stonesense Memory.xml with the one from dfhack tho. Ideally, it would use the system-installed memory file along with the library, but that requires some more changes to stonesense.

Note: the Memory.xml in data/ is NOT the real deal. I changed the format of the file and it's there simply for reference. You can use either Memory-ng.xml from data/, the Memory.xml file that is placed in output/ after building DFHack or the one placed into /usr/share/dfhack/ after installing DFHack globally (they should be identical).

Also note that you can't run more than one DF tool at the same time on Linux.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: dierre on September 07, 2010, 08:08:45 pm
A question. I've compiled dfhack to run stonesense. Now it's running but not able to connect because, I think, the Memory.xml file is for windows. Should I use the one from dfhack or is it the same?
Should be about the same. It's safer to overwrite the stonesense Memory.xml with the one from dfhack tho. Ideally, it would use the system-installed memory file along with the library, but that requires some more changes to stonesense.

Note: the Memory.xml in data/ is NOT the real deal. I changed the format of the file and it's there simply for reference. You can use either Memory-ng.xml from data/, the Memory.xml file that is placed in output/ after building DFHack or the one placed into /usr/share/dfhack/ after installing DFHack globally (they should be identical).

Also note that you can't run more than one DF tool at the same time on Linux.

pread failed: can't read 0x30 bytes at address 0xb2e80710
errno: 16
terminate called after throwing an instance of 'DFHack::Error::MemoryAccessDenied'
  what():  SHM ACCESS DENIED
Aborted

Using Memory-ng.xml with stonesense and df running.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: peterix on September 07, 2010, 08:46:46 pm
A question. I've compiled dfhack to run stonesense. Now it's running but not able to connect because, I think, the Memory.xml file is for windows. Should I use the one from dfhack or is it the same?
Should be about the same. It's safer to overwrite the stonesense Memory.xml with the one from dfhack tho. Ideally, it would use the system-installed memory file along with the library, but that requires some more changes to stonesense.

Note: the Memory.xml in data/ is NOT the real deal. I changed the format of the file and it's there simply for reference. You can use either Memory-ng.xml from data/, the Memory.xml file that is placed in output/ after building DFHack or the one placed into /usr/share/dfhack/ after installing DFHack globally (they should be identical).

Also note that you can't run more than one DF tool at the same time on Linux.

pread failed: can't read 0x30 bytes at address 0xb2e80710
errno: 16
terminate called after throwing an instance of 'DFHack::Error::MemoryAccessDenied'
  what():  SHM ACCESS DENIED
Aborted

Using Memory-ng.xml with stonesense and df running.
Strange.
OK. Let's check one thing.

1. Run DF
2. Run this command and post the results:
cat /proc/`pidof Dwarf_Fortress`/maps | grep Dwarf

Should look a bit like this for DF 31.12:

08048000-08b39000 r-xp 00000000 08:01 303572                             /home/peterix/DF2010/libs/Dwarf_Fortress
08b39000-08b3a000 r--p 00af0000 08:01 303572                             /home/peterix/DF2010/libs/Dwarf_Fortress
08b3a000-08b3b000 rw-p 00af1000 08:01 303572                             /home/peterix/DF2010/libs/Dwarf_Fortress

If the first numbers don't match, try using a -pae kernel. See if anything changes :)

You can also use this:
less /proc/`pidof Dwarf_Fortress`/maps
and look for a bigger chunk:

08048000-08b39000 r-xp 00000000 08:01 303572                             /home/peterix/DF2010/libs/Dwarf_Fortress
08b39000-08b3a000 r--p 00af0000 08:01 303572                             /home/peterix/DF2010/libs/Dwarf_Fortress
08b3a000-08b3b000 rw-p 00af1000 08:01 303572                             /home/peterix/DF2010/libs/Dwarf_Fortress
08b3b000-09578000 rw-p 00000000 00:00 0

Second thing to check is this:
http://www.bay12forums.com/smf/index.php?topic=65326.0 (http://www.bay12forums.com/smf/index.php?topic=65326.0)
The new ubuntu release will have some extra security stuff that needs disabling ...
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: MaximumZero on September 07, 2010, 10:20:52 pm
Wow, I'm really glad I'm not on Linux. That stuff seems to be way over my head, until next semester.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: snooptodd on September 08, 2010, 12:00:44 am
peterix,

Just so you know the pae kernel didn't really help with dfhack not able to connect reliably to df.

I should have said something earlier but I still haven't really figured out how to consistently/reliably cause dfhack not to connect.

this is what i know
I did a git pull last week,
dfhack will connect after a reboot when i first start df before being unpaused.
after the fort runs for a while dfhack may or may not connect.
Ubuntu has had ASLR turned on since 6.06 and fully turned on since 9.04. source (https://wiki.ubuntu.com/Security/Features)
I tried disabling ASLR, dfhack would not connect at all. (i don't have the command i used handy.)

This isn't a big deal to me, it forces me to only use dfvdig when i start playing and not rain obsidian  when a colossus shows up.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: dierre on September 08, 2010, 03:18:06 am
New update:

Code: [Select]
dierre@cox:~$ cat /proc/`pidof Dwarf_Fortress`/maps | grep Dwarf
08048000-08b39000 r-xp 00000000 08:01 657242     /home/dierre/Programmi/df_linux/libs/Dwarf_Fortress
08b39000-08b3a000 r--p 00af0000 08:01 657242     /home/dierre/Programmi/df_linux/libs/Dwarf_Fortress
08b3a000-08b3b000 rw-p 00af1000 08:01 657242     /home/dierre/Programmi/df_linux/libs/Dwarf_Fortress

I do not have 4GB of ram so do you think is necessary a kernel-pae?

I'm not using ubuntu 10.10 so there is no /proc/sys/kernel/yama/ptrace_scope

And then I tried dfhack tools:

Code: [Select]
dierre@cox:~/Programmi/dfhack/output$ ./dfreveal
Pausing...
pause set
pread failed: can't read 0x30 bytes at address 0xb5e06188
errno: 16
terminate called after throwing an instance of 'DFHack::Error::MemoryAccessDenied'
  what():  SHM ACCESS DENIED
Aborted

but

Code: [Select]
dierre@cox:~/Programmi/dfhack/output$ ./dfweather
The sky is clear.
Options:
'r' to make it rain.
's' to make it snow.
'q' to quit.
anything else to refresh
>s
It is snowing.
Options:
'c' to clear the sky.
'r' to make it rain.
'q' to quit.
anything else to refresh
>
But it actually does nothing.
Maybe this can help you.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: dierre on September 08, 2010, 04:40:56 am
It was the kernel-pae :D

(http://img62.imageshack.us/img62/3387/schermatam.png)
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: peterix on September 08, 2010, 05:06:54 am
All this is a bit too weird to be honest. I dug into it a bit more and found out that I've had ASLR enabled pretty much since I started working on dfhack, with a 64bit kernel.
This is with ASLR enabled (/proc/sys/kernel/randomize_va_space set to 2):
Code: [Select]
08048000-08b39000 r-xp 00000000 08:01 303572                             /home/peterix/DF2010/libs/Dwarf_Fortress
08b39000-08b3a000 r--p 00af0000 08:01 303572                             /home/peterix/DF2010/libs/Dwarf_Fortress
08b3a000-08b3b000 rw-p 00af1000 08:01 303572                             /home/peterix/DF2010/libs/Dwarf_Fortress
08b3b000-09578000 rw-p 00000000 00:00 0
0a1e8000-1c97f000 rw-p 00000000 00:00 0                                  [heap]
There's a clear distinction between the heap (0a1e8000-1c97f000) and the 'static data' (08b3b000-09578000). All the addresses in Memory.xml actually point into this 'static data' area. The binary contains pointers into this area (for example a static 'WORLD' pointer is used all over the place).

Now this is how the memory layout looks like without ASLR:
Code: [Select]
08048000-08b39000 r-xp 00000000 08:01 303572                             /home/peterix/DF2010/libs/Dwarf_Fortress
08b39000-08b3a000 r--p 00af0000 08:01 303572                             /home/peterix/DF2010/libs/Dwarf_Fortress
08b3a000-08b3b000 rw-p 00af1000 08:01 303572                             /home/peterix/DF2010/libs/Dwarf_Fortress
08b3b000-09ac4000 rw-p 00000000 00:00 0                                  [heap]
f3ea7000-f3f83000 rw-p 00000000 00:00 0
No 'static data' area, only heap. I'll do some testing with my automated offset search tool and report back :)

Edit:
OK. the tool crashes and burns without ASLR. It actually makes the binary easier to hack... lol.
WTF.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: dierre on September 08, 2010, 05:39:31 am
I'm using a 32bit kernel so if you want to try something just let me know.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: peterix on September 08, 2010, 06:08:31 am
I'm using a 32bit kernel so if you want to try something just let me know.
It would be awesome if you could get the memory layout (/proc/pid/maps) of the same version of DF running under the generic and -pae kernels.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: dierre on September 08, 2010, 06:17:33 am
I'm using a 32bit kernel so if you want to try something just let me know.
It would be awesome if you could get the memory layout (/proc/pid/maps) of the same version of DF running under the generic and -pae kernels.

Just to be clear:

Code: [Select]
cat /proc/`pidof Dwarf_Fortress`/maps | grep Dwarf
This, right?
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: peterix on September 08, 2010, 06:21:54 am
Code: [Select]
cat /proc/`pidof Dwarf_Fortress`/maps | grep Dwarf
This, right?
This:
Code: [Select]
cat /proc/`pidof Dwarf_Fortress`/mapsPreferably posted to pastebin :)
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: dierre on September 08, 2010, 06:24:54 am
generic-PAE

http://pastebin.com/5CPeF8CE

I have to reboot.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: dierre on September 08, 2010, 06:29:47 am
generic

http://pastebin.com/FmxXmGTv
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: zxcvmnb on September 08, 2010, 07:18:56 am
Wow, I'm really glad I'm not on Linux. That stuff seems to be way over my head, until next semester.

Similar things happen on Windows, but Linux is less tight-lipped about it. The problem is complicated, not the system.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: peterix on September 08, 2010, 07:36:44 am
Hmm... doesn't tell me much unfortunately. The layout is quite different, but the binary itself seems to be mapped into the same place... I'll have to do a bit of research it seems.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: dierre on September 08, 2010, 08:24:03 am
Hmm... doesn't tell me much unfortunately. The layout is quite different, but the binary itself seems to be mapped into the same place... I'll have to do a bit of research it seems.

well, if you need something else, just let me know.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: finesse on September 08, 2010, 10:55:07 am
I don't know if this is a false alarm, but im getting a malware warning when trying to view the last page of this thread (100 posts per page).

EDIT: After some checking, it seems to be the site that dierre is hosting his avatar on. It's been flagged for one reason or another.

--> http://safebrowsing.clients.google.com/safebrowsing/diagnostic?site=http://gaming.ngi.it/customavatars/avatar30146_24.gif&client=googlechrome&hl=en-US <-- a friendly google generated page about it, I don't think it's a problem though.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Woof on September 08, 2010, 11:11:11 am
I don't know if this is a false alarm, but im getting a malware warning when trying to view the last page of this thread (100 posts per page).

EDIT: After some checking, it seems to be the site that dierre is hosting his avatar on. It's been flagged for one reason or another.


Yup, chrome keeps flagging it up for me and it's mildly annoying...
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Granite on September 08, 2010, 11:56:36 am
I'm trying to compile DFHack 0.4.0.7b under Mandriva, following the instructions in the COMPILE file, but cmake always complains about X11_LIBRARY not being installed. What does that mean? X11 seems to be working normally.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Rose on September 08, 2010, 12:09:41 pm
you need the x11-dev files
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Granite on September 08, 2010, 12:26:36 pm
Mm... thanks Japa! One step ahead...
Now I'm getting this:
Quote
Wide-character ncurses library not found - veinlook can't be built
CMake Error at tools/supported/CMakeLists.txt:120 (install):
  install TARGETS given target "dfveinlook" which does not exist in this
  directory.
ncurses? Well, if I can trust my memory(and sometimes I can not, due to abuse of marijuana), DF required me to install this ncurses library in order to run. Is it the same thing?
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Rose on September 08, 2010, 12:30:51 pm
again, ncursesw-dev
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Granite on September 08, 2010, 12:38:22 pm
Yes... I already have both libncursesw5 and libncurseswdev installed, but I keep getting the error.
Note: mine is a 64bit OS.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Rose on September 08, 2010, 12:44:58 pm
one workaround: remove the offending portion of the build.

I don't know the exact steps of doing that, however
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: dierre on September 08, 2010, 01:16:24 pm
I've removed link. Sorry folks. It's a trusted forum, one of their ads service had an advertise with a malware.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Granite on September 08, 2010, 01:23:04 pm
the offending portion of the build
I don't really know what you mean, but here's what I've done:
I noticed I had installed 32bit version of that ncurses-dev lib. Uninstalled it, and intalled the 64bit version. Deleted the whole dfhack folder, unpacked the tarball again and tried to compile. It worked! =D

Thanks again Japa!
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: devek on September 08, 2010, 01:47:00 pm
pastebin is legit, but I think they expect everyone that goes there to use adblock heh.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: devek on September 08, 2010, 02:11:35 pm
Ok. I know the items module is being dumped and blah blah... but what about materials?

Code: [Select]
#14 0xcd621e8 item_barst [0,-1,8,-1] 8 40 0 0 1 CAT bar
#1648 0xdea4740 item_barst [0,-1,9,-1] 8 0 0 0 1 MULE bar

Why does it think ash and potash are now cats and mules? lol
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: dierre on September 09, 2010, 04:08:42 pm
Ok, I did some other empirical tries. The problem is not the kernel-pae. It works with the non-pae too. It's just that sometimes it can't catch the right address, sometime it can.

The current error is here:

Code: [Select]
pread failed: can't read 0x30 bytes at address 0xb3fd2258
errno: 16
terminate called after throwing an instance of 'DFHack::Error::MemoryAccessDenied'
  what():  SHM ACCESS DENIED
Aborted
dierre@cox:~/Programmi/stonesense$
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: devek on September 09, 2010, 06:59:43 pm
Hey Peter,

I was looking at your git commit history regarding reveal. I run into the same problem, making sure the game isn't actually doing anything regardless of the fact it is suspended.

The obvious was to check if it says "*PAUSED*" in the corner, but that doesn't work because as the frame is being redrawn there are moments it doesn't say that :P (and not every game menu says paused on it...)

The way that would work is to take advantage of the fact that every frame has an "id" that increments once per main game loop. It increments regardless of what menu you are in or the game state, so you could spin waiting on it to increment. It isn't a big deal for reveal I suppose, but for utilities that may be more aggressive it will be necessary to put the game in a known state quickly.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: peterix on September 10, 2010, 07:24:44 am
Hey Peter,

I was looking at your git commit history regarding reveal. I run into the same problem, making sure the game isn't actually doing anything regardless of the fact it is suspended.

The obvious was to check if it says "*PAUSED*" in the corner, but that doesn't work because as the frame is being redrawn there are moments it doesn't say that :P (and not every game menu says paused on it...)

The way that would work is to take advantage of the fact that every frame has an "id" that increments once per main game loop. It increments regardless of what menu you are in or the game state, so you could spin waiting on it to increment. It isn't a big deal for reveal I suppose, but for utilities that may be more aggressive it will be necessary to put the game in a known state quickly.
Well. Or I could provide proper synchronization between DF and the client apps, even with the normal memory access :)

Ok, I did some other empirical tries. The problem is not the kernel-pae. It works with the non-pae too. It's just that sometimes it can't catch the right address, sometime it can.
Thanks for the info. I have a bit similar problem with the offset search tool, where it sometimes can't find anything and all the search methods return garbage. Seems awfully random.

Status update:
I got Mafia 2 and had to finish it first :)
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: dierre on September 10, 2010, 06:44:04 pm
Take your time. BTW DwarfTherapist uses this file for memory access: http://greatred-dwarftherapist.googlecode.com/hg/etc/memory_layouts/linux/v0.31.12.ini

maybe it's helpful.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: quillbreaker on September 12, 2010, 10:23:19 am
I haven't worked with C / C++ in a while - would anyone like to suggest a compiler package for writing DFHack enabled applications?
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: devek on September 12, 2010, 01:53:17 pm
Qt creator.

It will just work, you won't have to do anything fancy.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Gearheart on September 15, 2010, 01:36:12 pm
With the advent of 31.13, the tools no longer work.

I am traumatised. They are so useful.

Any idea on when (And indeed, if) they're going to be updated to be compatible? I know it's a little early to be asking, but I REALLY like those tools, so sorry if I'm adding unneeded pressure.

Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Turambar on September 15, 2010, 01:42:53 pm
They'll get around to it.  Retain control of your domesticated equines.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: MaximumZero on September 15, 2010, 03:05:49 pm
From what I've seen, it usually only takes a few days, tops.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: darius on September 15, 2010, 04:29:46 pm
and don't forget: new compiler - could mean more then usual delays
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: devek on September 15, 2010, 04:48:01 pm
Working..
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: mLegion on September 15, 2010, 05:40:02 pm
Anyone else have problems with newer mingw versions, i just cant seem to get a static dfhack.dll built without it linking to libgcc and mingw10.dll even with -static and -static-libgcc
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: peterix on September 15, 2010, 09:29:05 pm
Working..
Come to the #dfhack irc on freenode channel sometimes :)

Bit of news:
I have almost everything on the Linux side. Windows is next.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: FleshForge on September 15, 2010, 09:46:42 pm
Good work Peter, looking forward to this when you're done :)
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: daoist on September 16, 2010, 06:28:25 am
keep up the good work. I can't live without dfvdig!
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Gearheart on September 16, 2010, 09:29:26 am
Good job man.

Loving the fast response time.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: mLegion on September 17, 2010, 08:30:28 am
What would be nice is a graphics lib which can read a DF install and translate map data from DFHack into a reference to a tile in a tileset if installed or a default 16x16 graphic with the relevant ascii on it. Essentially reading a DF tile and telling you that you need tile [xx][yy] in file xxx.png in order to draw it the same way DF does.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Passive Fist on September 17, 2010, 03:32:33 pm
keep up the good work. I can't live without dfvdig!
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: magistrate101 on September 18, 2010, 04:47:50 pm
keep up the good work. I can't live without dfvdig!
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: mLegion on September 18, 2010, 05:46:58 pm
Does anyone know any good documentation on tilesets and how they tie into mapdata?
Eg. how could one use the info DFProbe provides to determine how that tile should be drawn; what graphic, which ascii, what colors ect..

The wiki didn't appear to have much info on this unfortunately.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: peterix on September 18, 2010, 06:41:33 pm
Does anyone know any good documentation on tilesets and how they tie into mapdata?
Eg. how could one use the info DFProbe provides to determine how that tile should be drawn; what graphic, which ascii, what colors ect..

The wiki didn't appear to have much info on this unfortunately.
The ascii is probably as static data somewhere in the DF executable. Colors need all the materials stuff to work... and DFHack doesn't read colors for materials yet. You'd also need building layouts/properties, items and so on.

Stonesense has its own list of colors for materials, and the look of tiles in general is not read from DF, but filled in from rules stored in XML files.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Gearheart on September 18, 2010, 07:56:14 pm
So how is the .13 compatible version of this coming?

I realised how much harder life is without dfprospector, dfdig and dfclean. Dfliquid too, if I don't want to spend 3 seasons bucketing a farm up.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: magistrate101 on September 18, 2010, 07:57:50 pm
So how is the .13 compatible version of this coming?
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Seriyu on September 18, 2010, 08:28:44 pm
Does anyone know if this is capable of assigning specific pets to dwarves? And how to do such a thing? I realize it probably won't be simple, but I'd like to know if it's possible without breaking anything.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: magistrate101 on September 18, 2010, 08:39:27 pm
Does anyone know if this is capable of assigning specific pets to dwarves? And how to do such a thing? I realize it probably won't be simple, but I'd like to know if it's possible without breaking anything.

it cannot be done right now as, as far as i know, we do not know the offsets for who the pet adopts :\
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Seriyu on September 18, 2010, 08:52:24 pm
Dang, oh well. Thanks anyway.  :D
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Olith McHuman on September 19, 2010, 01:33:54 am
On linux, I'm getting this
Code: [Select]
pread failed: can't read 0x3c bytes at address 0xa9536288
errno: 16
terminate called after throwing an instance of 'DFHack::Error::MemoryAccessDenied'
  what():  SHM ACCESS DENIED
Aborted

error too. I'm on a custom compile of kernel 2.6.32 and I still have the sources for it. If you want me to play with some kernel settings, just let me know :).
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: dierre on September 19, 2010, 06:02:06 am
On linux, I'm getting this
Code: [Select]
pread failed: can't read 0x3c bytes at address 0xa9536288
errno: 16
terminate called after throwing an instance of 'DFHack::Error::MemoryAccessDenied'
  what():  SHM ACCESS DENIED
Aborted

error too. I'm on a custom compile of kernel 2.6.32 and I still have the sources for it. If you want me to play with some kernel settings, just let me know :).

I used the last memory-ng from the git repository and I'm ok now. Even with stonesense.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: magistrate101 on September 19, 2010, 10:35:57 pm
I used the last memory-ng from the git repository and I'm ok now. Even with stonesense.

WHAT??!?!?!?! i have been working for 2 days to find the god danged memory.xml thingy for 0.31.13 -.- TELL ME HOW TO GET IT TO WORK!
 :'( :'( :'( :'( :'(
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Rose on September 20, 2010, 06:17:28 am
I assume he's talking about linux, because windows needs a recompile to work, and not all the offsets are found yet.
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Eugenitor on September 20, 2010, 10:38:42 am
The rest of them I consider cheating, but I neeeeeed my dfcleanmap. The outside of my fort is absolutely coated in blood, pus, and vomit...
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: bartavelle on September 20, 2010, 11:13:50 am
Ok. I know the items module is being dumped and blah blah... but what about materials?

Code: [Select]
#14 0xcd621e8 item_barst [0,-1,8,-1] 8 40 0 0 1 CAT bar
#1648 0xdea4740 item_barst [0,-1,9,-1] 8 0 0 0 1 MULE bar

Why does it think ash and potash are now cats and mules? lol

Probably because I decided to do it empirically instead of systematically reversing the material subsystem. I'll take a look when I have a bit of free time. Also I didn't realize the item module is to be dumped, why is that ? Because of the hackish nature of the accessors decoding "system" ?
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: Olith McHuman on September 20, 2010, 03:38:05 pm
On linux, I'm getting this
Code: [Select]
pread failed: can't read 0x3c bytes at address 0xa9536288
errno: 16
terminate called after throwing an instance of 'DFHack::Error::MemoryAccessDenied'
  what():  SHM ACCESS DENIED
Aborted

error too. I'm on a custom compile of kernel 2.6.32 and I still have the sources for it. If you want me to play with some kernel settings, just let me know :).

I used the last memory-ng from the git repository and I'm ok now. Even with stonesense.

Ok, it works now (mostly, sometimes it stops working and I get those errors again, restarting df fixes it). Thanks!
Title: Re: DFHack 0.5.0.0 - tools and memory access library
Post by: peterix on September 20, 2010, 07:32:03 pm
Right guys. Just pushed out a tools-only release.

If you're on Windows, you can use the tools, but the Memory.xml that comes with them won't work for Stonesense yet. Wait for further updates.

If you're on Linux, all should be fine. Both tools and Stonesense should work nicely or with minimal glitches.
Title: Re: DFHack 0.5.0.0 - tools and memory access library
Post by: magistrate101 on September 20, 2010, 10:38:39 pm
Right guys. Just pushed out a tools-only release.

If you're on Windows, you can use the tools, but the Memory.xml that comes with them won't work for Stonesense yet. Wait for further updates.

If you're on Linux, all should be fine. Both tools and Stonesense should work nicely or with minimal glitches.

THANK YOU THANK YOU THANK YOU!!!!!  :o  :D :)
Title: Re: DFHack 0.4.0.7b - tools and memory access library
Post by: devek on September 21, 2010, 05:49:15 am
Probably because I decided to do it empirically instead of systematically reversing the material subsystem. I'll take a look when I have a bit of free time. Also I didn't realize the item module is to be dumped, why is that ? Because of the hackish nature of the accessors decoding "system" ?

The accessor decoding worked great..  the problem with the module is that it only works(worked) on windows.

I'm torn, because Dwarf Fortress itself has to switch on each item's type to really understand it. The thing is, because Dwarf Fortress uses that switch it already has the types. So for us to properly understand items we too have to switch on each type anyway, so what to do?

EDIT:

This seems to work and has show then right material types for all the items I have ran across in .13.

Code: [Select]
const uint32_t vtable = p->readDWord(items[i]);
const std::string className = p->readClassName(vtable);
const uint32_t type = p->readWord(p->readDWord(vtable)) >> 8;
const uint32_t matoff = p->readDWord(p->readDWord(vtable+8)) >> 24 ;
const int16_t typeC = p->readWord(items[i]+matoff);
const int32_t typeD = p->readDWord(items[i]+matoff+(matoff % 4 ? 2:4)); // faster to grab the next aligned byte than read the vtable more

If someone can show me one it doesn't work on, that would be great.


Title: Re: DFHack 0.5.0.0 - tools and memory access library
Post by: Gearheart on September 21, 2010, 09:12:21 am
Yay, dfhack.

No more bloodsoaked maps killing my fps!
Title: Re: DFHack 0.5.0.0 - tools and memory access library
Post by: sizeak on September 21, 2010, 08:10:35 pm
Any news on .13 creature offsets?
Title: Re: DFHack 0.5.0.0 - tools and memory access library
Post by: Glimmlampe on September 23, 2010, 05:57:42 am
i'm running df .13 on windows, most tools from dfhack work allright. only the most important tool (dfcleartask) got "missing offset for item vectors".
anything i could do, besides wait for a new release?
Title: Re: DFHack 0.5.0.0 - tools and memory access library
Post by: doomchild on September 23, 2010, 09:14:33 am
I know that items are pretty much completely broken right now, so that one may take some time.  I have no idea what the fix is, though, since I'm largely ignorant about the inner workings of dfhack.

DC
Title: Re: DFHack 0.5.0.0 - tools and memory access library
Post by: pkmnfrk on September 23, 2010, 12:01:10 pm
I know that items are pretty much completely broken right now, so that one may take some time.  I have no idea what the fix is, though, since I'm largely ignorant about the inner workings of dfhack.

DC

I get this too, in .12, when compiling from source. The version in the Lazy Newb pack works fine, though. :\

On the bright side, I'd like to submit a patch for dfreveal. You know how it reveals the entire map, and has a 20% chance of unleashing Fun even if you're paused? Well, I got annoyed at that, and modified it so that by default, it only reveals the current Z-level. You can still reveal everything, if you pass the -a command line option.

Code: [Select]
diff --git "a/C:\\Users\\Mike\\AppData\\Local\\Temp\\reveal_HEAD.cpp" "b/D:\\dfhack\\tools\\supported\\reveal.cpp"
index e2a1579..b1238fd 100644
--- "a/C:\\Users\\Mike\\AppData\\Local\\Temp\\reveal_HEAD.cpp"
+++ "b/D:\\dfhack\\tools\\supported\\reveal.cpp"
@@ -30,8 +30,25 @@ struct hideblock
     uint8_t hiddens [16][16];
 };
 
-int main (void)
+bool viewAll = false;
+
+void parseArguments(int argc, char* argv[]) {
+    for(int i = 1; i < argc; i++) {
+        if(argv[i][0] == '-') {
+            switch(argv[i][1]) {
+                case 'a':
+                case 'A':
+                    viewAll = true;
+                    break;
+            }
+        }
+    }
+}
+
+int main (int argc, char* argv[])
 {
+    parseArguments(argc, argv);
+
     uint32_t x_max,y_max,z_max;
     DFHack::designations40d designations;
     
@@ -80,11 +97,20 @@ int main (void)
     Maps->getSize(x_max,y_max,z_max);
     vector <hideblock> hidesaved;
 
+    uint32_t minz = 0, maxz = z_max;
+
+    if(!viewAll) {
+        int32_t viewx, viewy, viewz;
+        DF->getPosition()->getViewCoords(viewx, viewy, viewz);
+        minz = viewz;
+        maxz = viewz + 1;
+    }
+
     for(uint32_t x = 0; x< x_max;x++)
     {
         for(uint32_t y = 0; y< y_max;y++)
         {
-            for(uint32_t z = 0; z< z_max;z++)
+            for(uint32_t z = minz; z< maxz;z++)
             {
                 if(Maps->isValidBlock(x,y,z))
                 {
Title: Re: DFHack 0.5.0.0 - tools and memory access library
Post by: MaximumZero on September 23, 2010, 12:20:08 pm
I don't understand the code at all, nor what to do with it, but from the description it sounds as if it would be something I would use on a regular basis.
Title: Re: DFHack 0.5.0.0 - tools and memory access library
Post by: pkmnfrk on September 23, 2010, 12:27:52 pm
It's a patch, you just have to apply it directly to the forehead source code :)
Title: Re: DFHack 0.5.0.0 - tools and memory access library
Post by: devek on September 23, 2010, 01:16:47 pm
static/global initialized vectors for .14

Spoiler (click to show/hide)
Title: Re: DFHack 0.5.0.0 - tools and memory access library
Post by: Zwaryczuk on September 24, 2010, 01:06:32 am
static/global initialized vectors for .14

 I'm assuming this is not some type of patch to apply to the old version but merely vector info that will lead to a speedy launch. Either way I hope its fully operational for the weekend as I plan to change up my whole fort design and go for an aquifer map.

Hope all goes well with the update!
Title: Re: DFHack 0.5.0.0 - tools and memory access library
Post by: Gearheart on September 24, 2010, 02:55:39 pm
Indeed. Looking forward to the new version.
Title: Re: DFHack 0.5.0.0 - tools and memory access library
Post by: Quietust on September 24, 2010, 08:58:00 pm
This seems to be enough to get dfreveal and dfcleanmap working in 0.31.14 on Windows:

Code: [Select]
    <Version name="v0.31.14 SDL" os="windows" base="v0.31.13 SDL" rebase="0x1000">
        <PETimeStamp value="0x4C9B6EFB" />
    </Version>
Title: Re: DFHack 0.5.0.0 - tools and memory access library
Post by: Zwaryczuk on September 25, 2010, 06:31:19 am
This seems to be enough to get dfreveal and dfcleanmap working in 0.31.14 on Windows:


Any thoughts if this could work with dfliquids also? Or is that going to need some updated vector data?
Title: Re: DFHack 0.5.0.0 - tools and memory access library
Post by: Leeko on September 26, 2010, 02:21:19 am
This seems to be enough to get dfreveal and dfcleanmap working in 0.31.14 on Windows:

Code: [Select]
    <Version name="v0.31.14 SDL" os="windows" base="v0.31.13 SDL" rebase="0x1000">
        <PETimeStamp value="0x4C9B6EFB" />
    </Version>

How would I go about applying this?
Title: Re: DFHack 0.5.0.0 - tools and memory access library
Post by: Antilope on September 26, 2010, 11:09:00 am
This seems to be enough to get dfreveal and dfcleanmap working in 0.31.14 on Windows:

Code: [Select]
    <Version name="v0.31.14 SDL" os="windows" base="v0.31.13 SDL" rebase="0x1000">
        <PETimeStamp value="0x4C9B6EFB" />
    </Version>

How would I go about applying this?

Don't know if this is the perfectly right method to do it, but it worked for me:

open memory.xml with any editor and look for the windows/wine section and copy/pastee the <version></version> tag directly beneath.
Title: Re: DFHack 0.5.0.0 - tools and memory access library
Post by: Zwaryczuk on September 26, 2010, 12:52:01 pm
Don't know if this is the perfectly right method to do it, but it worked for me:

open memory.xml with any editor and look for the windows/wine section and copy/pastee the <version></version> tag directly beneath.

Works like a charm for DFliquids too
Title: Re: DFHack 0.5.0.0 - tools and memory access library
Post by: Heliman on September 26, 2010, 05:42:29 pm
is there any place where I can get detailed  descriptions of all the features? I'd say this wasn't attempting to go over my head but I'd be lying.
Title: Re: DFHack 0.5.0.0 - tools and memory access library
Post by: sizeak on September 26, 2010, 06:39:31 pm
Any news on fully working .13 & .14 creature offsets? When I tried them just now, all my dwarves were listed as fey XD
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: Serird on September 29, 2010, 09:03:25 am
I've got a problem for DFHack : my Dwarfs cannot walk on muddy soil (when you delete water with DFliquid)
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: jaxad0127 on September 29, 2010, 09:59:27 am
I've got a problem for DFHack : my Dwarfs cannot walk on muddy soil (when you delete water with DFliquid)
Because the game still thinks the tile is unwalkable. The easiest way to unlock is to have water flow on it. In a nearby walkable tile, put some water at a lower depth (like 4/7) and unpause. Any tile it flows on will definately be walkable. Just keep adding water onto tile already walkable until ever tile is released.
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: ghosteh on September 29, 2010, 06:00:34 pm
so glad you did a temp release for .14, Im hopelessly dependant on the auto vein digger
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: FrozenViolet on September 29, 2010, 10:09:20 pm
Not sure if it's been mentioned, but it should be noted in the files for us Windows newbie types that these files need to be Run as Administrator in order to work. I kept getting errors galore when trying to get dfcleanmap to work, but running it as administrator worked like a charm :)
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: peterix on September 29, 2010, 11:11:03 pm
Not sure if it's been mentioned, but it should be noted in the files for us Windows newbie types that these files need to be Run as Administrator in order to work. I kept getting errors galore when trying to get dfcleanmap to work, but running it as administrator worked like a charm :)
I never had to do that... your setup might be different.
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: sizeak on September 30, 2010, 03:55:15 am
Not sure if it's been mentioned, but it should be noted in the files for us Windows newbie types that these files need to be Run as Administrator in order to work. I kept getting errors galore when trying to get dfcleanmap to work, but running it as administrator worked like a charm :)

Yeah I don't have that problem on Win7, are you using Vista maybe? (Just asking because of its more paranoid security)
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: FrozenViolet on September 30, 2010, 08:48:25 am
Not sure if it's been mentioned, but it should be noted in the files for us Windows newbie types that these files need to be Run as Administrator in order to work. I kept getting errors galore when trying to get dfcleanmap to work, but running it as administrator worked like a charm :)
I never had to do that... your setup might be different.

Yeah I'm on Win 7 and was trying it on 2 different computers. I guess if you don't have administrative rights on the main account it goes silly or something!
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: xczxc on October 02, 2010, 08:33:24 pm
Do you need to compile dfhack in order to use it on linux?
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: peterix on October 03, 2010, 12:52:55 am
Do you need to compile dfhack in order to use it on linux?
Yes. Also, only DF versions up to 31.13 are supported right now.
Title: Re: DFHack 0.5.0.0 - tools and memory access library
Post by: magistrate101 on October 03, 2010, 03:30:08 am
Any news on fully working .13 & .14 creature offsets? When I tried them just now, all my dwarves were listed as fey XD

I wish i could help, but i have no idea on how to do it! Good luck, and remember to have fun!
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: bcd1024 on October 03, 2010, 04:21:58 am
I think I'm doing something really wrong.

I run dwarf fortress and load my game. I try to run dfcleanmap but I get "This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information."

I read the Readme but I can't find what I'm missing.

Running Windows 7 fully updated. I tried dfhack .5 and .5.0.1 with .12 .13 and .14 legacy.
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: sizeak on October 03, 2010, 07:40:38 am
As far as I know, it only works with SDL versions
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: magistrate101 on October 03, 2010, 12:11:48 pm
As far as I know, it only works with SDL versions

that sucks, but i only have 0.31.12 legacy and i never use it :D
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: NKDietrich on October 03, 2010, 05:13:12 pm
Anyone had any luck working out the offsets for .15?
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: JAFANZ on October 03, 2010, 06:22:02 pm
Anyone had any luck working out the offsets for .15?
Someone said in another thread (Stonesense? or maybe TheRapist?) that the offsets are the same, but the checksum changed.

Does that make sense? (& help? 'cos I have no idea how to get DFHack or Stonesense going with .15)
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: NKDietrich on October 03, 2010, 06:25:41 pm
Anyone had any luck working out the offsets for .15?
Someone said in another thread (Stonesense? or maybe TheRapist?) that the offsets are the same, but the checksum changed.

Does that make sense? (& help? 'cos I have no idea how to get DFHack or Stonesense going with .15)

I saw that and tried figuring it out myself, and plugged in the MD5 of the new executable into the Memory.xml, and updating the version string to .15, but that apparently wasn't enough.
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: magistrate101 on October 04, 2010, 12:24:48 am
use the program bundled with DFhack to see if the offsets work :D (dfdoffsets.exe)
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: JAFANZ on October 04, 2010, 08:38:39 am
use the program bundled with DFhack to see if the offsets work :D (dfdoffsets.exe)

It crashed (all 3 attempts), so I'm guessing the answer is a resounding "NO!!!". :\
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: NKDietrich on October 04, 2010, 09:05:47 am
use the program bundled with DFhack to see if the offsets work :D (dfdoffsets.exe)

It crashed (all 3 attempts), so I'm guessing the answer is a resounding "NO!!!". :\

And now .16 is out anyway! Arrghh! :P
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: NKDietrich on October 04, 2010, 05:24:13 pm
I tried popping in the new checksum and MD5, it finds the executable but the offsets have apparently changed as you might imagine. Drats!
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: magistrate101 on October 04, 2010, 07:41:43 pm
I just find this amusing, obviously toady is attempting to thwart hacking with his numerous updates XD i can;t see why he cant bundle a bunch of bug-fixes togethor and release them right as the hacking community recovers from the previous update ^.^
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: NKDietrich on October 04, 2010, 07:46:43 pm
I just find this amusing, obviously toady is attempting to thwart hacking with his numerous updates XD i can;t see why he cant bundle a bunch of bug-fixes togethor and release them right as the hacking community recovers from the previous update ^.^

Yeah I'm sitting here reading the forums because I'm waiting for DFHack so I can continue a project I'm working on :P
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: finesse on October 04, 2010, 08:26:50 pm
I just find this amusing, obviously toady is attempting to thwart hacking with his numerous updates XD i can;t see why he cant bundle a bunch of bug-fixes togethor and release them right as the hacking community recovers from the previous update ^.^

Hehe, it does seem like that.. but the fixes in .16 are very welcomed by me. Im sure theres a way Toady could make it easier for programs like DFHack to access DF memory, but to do that might also give away too much. It might be something worth pursuing though.
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: MaximumZero on October 04, 2010, 08:30:42 pm
[REDACTED] Reason: Stupidity of suggestion. I should be barred from the internet after 10pm.
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: peterix on October 04, 2010, 11:29:46 pm
Please, don't bother Toady with this stuff :<

He said numerous times that he doesn't want to get involved with writing APIs or hacking.
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: NKDietrich on October 05, 2010, 03:00:13 am
Please, don't bother Toady with this stuff :<

He said numerous times that he doesn't want to get involved with writing APIs or hacking.

Yeah. Leave the haxx0ring to Pete here ;) What would be the challenge if Toady put in a fancy-pants API?
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: Mozleron on October 05, 2010, 11:56:23 am
I'm not sure if it helps anyone here, but Dwarf Therapist works with 31.16.  My theoretical line of thinking is that some of the offsets used there could be helpful for this tool.  If not, then i'll go back to my little corner and maybe get back to work... :)

~Mozleron
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: NKDietrich on October 05, 2010, 11:58:44 am
I'm not sure if it helps anyone here, but Dwarf Therapist works with 31.16.  My theoretical line of thinking is that some of the offsets used there could be helpful for this tool.  If not, then i'll go back to my little corner and maybe get back to work... :)

~Mozleron

There are a lot of things that DFHack messes with that The Rapist doesn't, so it doesn't have all the offsets needed. I think I'll mess with that a bit though and see if I can get any of the tools to work.
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: JanusTwoface on October 05, 2010, 12:00:47 pm
I'm not sure if it helps anyone here, but Dwarf Therapist works with 31.16.  My theoretical line of thinking is that some of the offsets used there could be helpful for this tool.  If not, then i'll go back to my little corner and maybe get back to work... :)

~Mozleron

There are a lot of things that DFHack messes with that The Rapist doesn't, so it doesn't have all the offsets needed. I think I'll mess with that a bit though and see if I can get any of the tools to work.

I vaguely remember something about the offsets being *slighly* different in format as well, although I could be completely off base.  If it's not working directly, that might be something to look into.
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: NKDietrich on October 05, 2010, 12:07:23 pm
I'm not sure if it helps anyone here, but Dwarf Therapist works with 31.16.  My theoretical line of thinking is that some of the offsets used there could be helpful for this tool.  If not, then i'll go back to my little corner and maybe get back to work... :)

~Mozleron

There are a lot of things that DFHack messes with that The Rapist doesn't, so it doesn't have all the offsets needed. I think I'll mess with that a bit though and see if I can get any of the tools to work.

I vaguely remember something about the offsets being *slighly* different in format as well, although I could be completely off base.  If it's not working directly, that might be something to look into.

Not many offsets in here are the same anyway, The Rapist doesn't have any of the geology stuff for example. Meh. Guess I'll just wait :P
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: Drakeero on October 05, 2010, 03:01:17 pm
Its amaaaazing just how addicted you can get to these tools and then feel paralyzed when they don't work.  Now I'm going to have to wait for the spring thaw before I can empty a pond and get my farm started.
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: kmob on October 05, 2010, 03:12:44 pm
Its amaaaazing just how addicted you can get to these tools and then feel paralyzed when they don't work.  Now I'm going to have to wait for the spring thaw before I can empty a pond and get my farm started.

That's so true. For me it's dfclean.. I've lost over 10 dwarfs so far to forgotten beast ichor .. time to shelve my game until I can dfclean! :)
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: dragonshardz on October 05, 2010, 03:14:27 pm
Is it possible to make it so that dfliquids can create an x*y block of water to the right and down of the cursor? I find that the current block function is imprecise and the point function makes filling a 10*10*5 cistern tedious.
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: NKDietrich on October 05, 2010, 03:17:31 pm
Its amaaaazing just how addicted you can get to these tools and then feel paralyzed when they don't work.  Now I'm going to have to wait for the spring thaw before I can empty a pond and get my farm started.

That's so true. For me it's dfclean.. I've lost over 10 dwarfs so far to forgotten beast ichor .. time to shelve my game until I can dfclean! :)

I'm waiting on dfreveal for a mega project I am working on. I guess I'll play Deus Ex or something.
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: jaxad0127 on October 05, 2010, 03:22:31 pm
dfreveal and dfclean work fine for Windows .14 (and through WINE for Linux, etc). dfliquids is a bit weird through WINE atm: game locks up, have to exit dfliquids and send CONT to the game. Though this seems to make every female on the map pregnant.
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: Malibu Stacey on October 05, 2010, 03:43:10 pm
dfreveal and dfclean work fine for Windows .14 (and through WINE for Linux, etc). dfliquids is a bit weird through WINE atm: game locks up, have to exit dfliquids and send CONT to the game. Though this seems to make every female on the map pregnant.

That's nice. We're on 0.31.16 now btw. You may want to update.
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: NKDietrich on October 05, 2010, 03:47:51 pm
dfreveal and dfclean work fine for Windows .14 (and through WINE for Linux, etc). dfliquids is a bit weird through WINE atm: game locks up, have to exit dfliquids and send CONT to the game. Though this seems to make every female on the map pregnant.

That's nice. We're on 0.31.16 now btw. You may want to update.

Or sit around and futz with worldgen and do other random crap while waiting for DFHack :P
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: jaxad0127 on October 05, 2010, 04:37:20 pm
dfreveal and dfclean work fine for Windows .14 (and through WINE for Linux, etc). dfliquids is a bit weird through WINE atm: game locks up, have to exit dfliquids and send CONT to the game. Though this seems to make every female on the map pregnant.

That's nice. We're on 0.31.16 now btw. You may want to update.
I'll wait, tyvm.
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: Drakeero on October 05, 2010, 06:21:58 pm
I'd like reveal right now, but I'd LOVE liquids since there's no water on the map this season to make my underground farm until the spring thaw.
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: Riversand on October 06, 2010, 01:05:08 am
putting a note here, for the huge success of an update.
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: Zaerosz on October 06, 2010, 06:17:47 am
putting a note here, for the huge success of an update.
This was a triumph
I'm leaving a note here: HUGE SUCCESS
It's hard to overstate my satisfaction...
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: sizeak on October 06, 2010, 06:40:09 am
Ahh GLaDOS
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: Gearheart on October 06, 2010, 10:27:22 am
Oh, is a compatible version for .16 out?

I'm kind of wasting away without prospector, dig and liquids.
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: NKDietrich on October 06, 2010, 11:30:28 am
Oh, is a compatible version for .16 out?

I'm kind of wasting away without prospector, dig and liquids.

Not that I've seen. I'm waiting for DFhack too :P
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: Quietust on October 06, 2010, 12:56:08 pm
Extremely partial offsets for 0.31.16 Windows SDL:

Code: [Select]
    <Version name="v0.31.16 SDL" os="windows" base="v0.31.14 SDL" rebase="0x1050">
        <PETimeStamp value="0x4CA9D544" />
        <Offsets>
            <Group name="Position">
                <Address name="cursor_xyz" value="0xac97f0" />
            </Group>
        </Offsets>
    </Version>

Position stuff (at least the cursor position) seems to be offset by 0x1000 relative to 0.31.14 but a bunch of other stuff (including map data) is offset by 0x1050.

Works well enough for cleanmap, liquids, probe, prospector, reveal, and vdig. Anything else will probably crash.
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: NKDietrich on October 06, 2010, 02:47:43 pm
Extremely partial offsets for 0.31.16 Windows SDL:

Code: [Select]
    <Version name="v0.31.16 SDL" os="windows" base="v0.31.14 SDL" rebase="0x1050">
        <PETimeStamp value="0x4CA9D544" />
        <Offsets>
            <Group name="Position">
                <Address name="cursor_xyz" value="0xac97f0" />
            </Group>
        </Offsets>
    </Version>

Position stuff (at least the cursor position) seems to be offset by 0x1000 relative to 0.31.14 but a bunch of other stuff (including map data) is offset by 0x1050.

Works well enough for cleanmap, liquids, probe, prospector, reveal, and vdig. Anything else will probably crash.

You sir are a gentleman and a scholar.
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: NecroRebel on October 06, 2010, 03:39:14 pm
For those of you who don't know, if you open the Memory.xml document in the dfhack folder with something that can edit it (notepad will suffice if nothing else), search for W I N D O W S and W I N E (including the "and" between, as well as spaces between each letter of WINDOWS and WINE), and just paste in Quietust's elegantly-crafted and masterful code directly beneath, it'll work.

Just giving exact instructions on how to use such a thing  ;)

Edit: Just for clarity, it doesn't actually work if you search for the whole thing as I put it there. Just search for W I N D O W S and you'll find it I suspect.
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: kmob on October 06, 2010, 03:41:34 pm
Extremely partial offsets for 0.31.16 Windows SDL:
<snip>

Superb! This works well with dfclean and .16. Thank you!
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: Brandedahall on October 06, 2010, 03:43:30 pm
i cant find W I N D O W S and W I N E in the memory.xml, it simply cant find it
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: NecroRebel on October 06, 2010, 03:50:46 pm
i cant find W I N D O W S and W I N E in the memory.xml, it simply cant find it
It's roughly halfway through the file, though due to how dense the code can be, it can be very, very hard to find by hand...

Actually... It appears that notepad puts many more than just 1 space between the S and the word "and" and the word "and" and the W in W I N E. Try searching for just W I N D O W S instead (with spaces, of course).
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: JAFANZ on October 06, 2010, 03:54:18 pm
Extremely partial offsets for 0.31.16 Windows SDL:

Spoiler (click to show/hide)
Position stuff (at least the cursor position) seems to be offset by 0x1000 relative to 0.31.14 but a bunch of other stuff (including map data) is offset by 0x1050.

Works well enough for cleanmap, liquids, probe, prospector, reveal, and vdig. Anything else will probably crash.

You sir are a gentleman and a scholar.
Seconded!
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: Brandedahall on October 06, 2010, 04:23:56 pm
ahh thankz necro, it works :) woot i can now dig properly, if only df had this build in :/
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: kasker on October 06, 2010, 05:26:32 pm
Thanks for this library it is awesome =) I added a 'range' brush mode to liquids. Instead of a point or block, brush will prompt for a width and height and fill the entire rectangle with the cursor as top left corner.

Spoiler (click to show/hide)

Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: NecroRebel on October 06, 2010, 05:50:26 pm
Thanks for this library it is awesome =) I added a 'range' brush mode to liquids. Instead of a point or block, brush will prompt for a width and height and fill the entire rectangle with the cursor as top left corner.
You must tell the rest of us how to add this 'range' brush and/or upload the modified tool yourself! Science demands it! Also, it's something many of us have been desirous of for a long while and we will all praise you greatly for it, as it would make the tool infinitely more convenient.
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: peterix on October 06, 2010, 08:21:04 pm
Right. I managed to get away from playing minecraft and attending lectures for a while and pushed things a bit in the right direction :)


Try this file: http://github.com/peterix/dfhack/blob/master/data/Memory-ng.xml (http://github.com/peterix/dfhack/blob/master/data/Memory-ng.xml)


There are some problems with new creature skills, but that shouldn't affect the normal DFHack tools in any way.
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: magistrate101 on October 06, 2010, 08:40:04 pm
Right. I managed to get away from playing minecraft and attending lectures for a while and pushed things a bit in the right direction :)


Try this file: http://github.com/peterix/dfhack/blob/master/data/Memory-ng.xml (http://github.com/peterix/dfhack/blob/master/data/Memory-ng.xml)


There are some problems with new creature skills, but that shouldn't affect the normal DFHack tools in any way.

I MUST beg you to update the code and add what quietust posted! If you do not, i will release my desert gnomes.... (you don't wanna know what they do when they catch you!)
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: NKDietrich on October 06, 2010, 09:55:02 pm
Right. I managed to get away from playing minecraft and attending lectures for a while and pushed things a bit in the right direction :)


Try this file: http://github.com/peterix/dfhack/blob/master/data/Memory-ng.xml (http://github.com/peterix/dfhack/blob/master/data/Memory-ng.xml)


There are some problems with new creature skills, but that shouldn't affect the normal DFHack tools in any way.

Thanks for the update :D
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: dragonshardz on October 06, 2010, 09:58:53 pm
Thanks for this library it is awesome =) I added a 'range' brush mode to liquids. Instead of a point or block, brush will prompt for a width and height and fill the entire rectangle with the cursor as top left corner.
You must tell the rest of us how to add this 'range' brush and/or upload the modified tool yourself! Science demands it! Also, it's something many of us have been desirous of for a long while and we will all praise you greatly for it, as it would make the tool infinitely more convenient.

Seconded! Pleeeeeeeease give us this, you will be a God among Men (and Toady).
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: magistrate101 on October 06, 2010, 10:27:32 pm
Thanks for this library it is awesome =) I added a 'range' brush mode to liquids. Instead of a point or block, brush will prompt for a width and height and fill the entire rectangle with the cursor as top left corner.
You must tell the rest of us how to add this 'range' brush and/or upload the modified tool yourself! Science demands it! Also, it's something many of us have been desirous of for a long while and we will all praise you greatly for it, as it would make the tool infinitely more convenient.

Seconded! Pleeeeeeeease give us this, you will be a God among Men (and Toady).

Toady is a god among gods... let's hope he allows us to have 0.31.17 so i get an E-cookie :D
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: kasker on October 07, 2010, 06:19:08 am
This dfliquids.exe was compiled for 31.14 on Windows. Adds the range option as a brush.

http://www.mediafire.com/?pzdz4pq314e89kh
http://www.mediafire.com/file/csutthorq4e6278/dfliquids.exe
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: Gearheart on October 07, 2010, 09:36:20 am
I can't seem to get it working. I replaced memory.xml with memory-ng.xml. This is correct, right?

I can be pretty inept when it comes to this sort of thing.
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: NKDietrich on October 07, 2010, 09:39:28 am
I can't seem to get it working. I replaced memory.xml with memory-ng.xml. This is correct, right?

I can be pretty inept when it comes to this sort of thing.

Did you rename the memory-ng.xml to memory.xml? It needs to be called memory.xml I believe, for the program to find it.

I personally just copy pasta'd the .15 and .16 stuff into my old memory.xml.
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: dragonshardz on October 07, 2010, 09:58:44 am
Okay, I get an error when trying to run the dfliquids provided by kasker. Says the "program can't start because libdfhack-debug.dll is missing" from my computer and to "try reinstalling the program to fix this problem."
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: Gearheart on October 07, 2010, 10:05:53 am
Yeah, like I said, ineptitude.

I'll try renaming it now.

Edit: Didn't work.

Could you perhaps upload your memory.xml file somewhere so I can grab it? I just can't seem to get it work right for some reason.
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: Quietust on October 07, 2010, 10:22:27 am
Try this file: http://github.com/peterix/dfhack/blob/master/data/Memory-ng.xml (http://github.com/peterix/dfhack/blob/master/data/Memory-ng.xml)

I MUST beg you to update the code and add what quietust posted! If you do not, i will release my desert gnomes.... (you don't wanna know what they do when they catch you!)

Er, the XML file peterix posted contains even more than what I posted - it's got enough to make more of tools work (most notably position and weather).
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: kasker on October 07, 2010, 12:54:10 pm
Okay, I get an error when trying to run the dfliquids provided by kasker. Says the "program can't start because libdfhack-debug.dll is missing" from my computer and to "try reinstalling the program to fix this problem."

Oops, that one is from the debug build. This should work.
http://www.mediafire.com/file/csutthorq4e6278/dfliquids.exe
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: randomnation on October 07, 2010, 05:14:37 pm
Okay, I get an error when trying to run the dfliquids provided by kasker. Says the "program can't start because libdfhack-debug.dll is missing" from my computer and to "try reinstalling the program to fix this problem."

Oops, that one is from the debug build. This should work.
http://www.mediafire.com/file/csutthorq4e6278/dfliquids.exe

Says I need libdfhack.dll. Can you upload that as well?
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: dragonshardz on October 07, 2010, 09:40:12 pm
IIRC, that should be in the linux build.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: peterix on October 07, 2010, 10:24:13 pm
Right. Released 0.5.0.2. Should be good for Windows 31.16. I tested that and it works fine. The Memory.xml will work with stonesense too. Linux support is very bad right now and I'm getting more problems there... unfortunately I'm horribly busy with other things.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: magistrate101 on October 07, 2010, 11:35:25 pm
Right. Released 0.5.0.2. Should be good for Windows 31.16. I tested that and it works fine. The Memory.xml will work with stonesense too. Linux support is very bad right now and I'm getting more problems there... unfortunately I'm horribly busy with other things.

eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee :3

Thank you so much! now i need runesmith to work! Please hurry and get the creature offsets, i need runesmith for my legendary+5 smiths >:3


edit: we need a tool that lets us place creatures, if you can provide it i will shit myself!
Title: Re: DFHack 0.5.0.1 - tools and memory access library
Post by: dragonshardz on October 08, 2010, 02:48:47 am
IIRC, that should be in the linux build.

Okay, I'm wrong. So we need libdfhack.dll...

EDIT: Go here (http://code.google.com/p/stonesense/source/browse/trunk/libdfhack.dll?r=838), click on view raw file, and put the .dll in your DFHack folder.

However dfliquids then returns an error stating that libgcc_s_dw2-1.dll is missing.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: mLegion on October 08, 2010, 04:22:50 am
Newer mingw adds dependancies to to builds namely mingw10.dll and libgcc_s_dw2-1.dll, you need to add -static-libgcc to your build to get rid of that.
Also modify the build file to output dfhack.dll instead of libdfhack.dll, or better yet just build against the newest dfhack.dll from peterix's page.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: kasker on October 08, 2010, 08:34:05 am
Oh man I'm terrible at this. What mLegion said, it's in the main build now.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Gearheart on October 08, 2010, 09:31:45 am
Woo, dfdig, reveal, and liquid!
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: peterix on October 08, 2010, 01:31:40 pm
@ people building stuffs:
PROTIP: Never mix C++ libraries and binaries built with different compilers/stl implementations. You're only asking for trouble of the explosive kind.
PROTIP: Get MSVC, it makes smaller binaries and the tools you build have a slightly higher chance to work with the libs I release (I'm currently using MSVC 2008 SP1 for Windows builds).

Thank you so much! now i need runesmith to work! Please hurry and get the creature offsets, i need runesmith for my legendary+5 smiths >:3
Shouldn't take such a long time I guess. I can't give any promises tho... I get distracted easily with silly things ;)
edit: we need a tool that lets us place creatures, if you can provide it i will shit myself!
Remotely possible. Wait some time and *maybe* you'll get it. People are working on things that are pre-requisites for this kind of manipulation, but that's still a bit too experimental.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: dragonshardz on October 08, 2010, 05:59:52 pm
See, I don't know /how/ to build the .dll or anything like that. Can someone just give me a link to the dfliquids with range mode that doesn't need another 50* .dlls?

*exaggerating


First I herped, then I derped.

dfhack 5.0.2 has the new dfliquids and it works just fine.

Herp-derp-derp.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: magistrate101 on October 08, 2010, 10:26:21 pm
Thank you so much! now i need runesmith to work! Please hurry and get the creature offsets, i need runesmith for my legendary+5 smiths >:3
Shouldn't take such a long time I guess. I can't give any promises tho... I get distracted easily with silly things ;)

Well, that sucks :P well, heres hope for a fast finding!
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: FleshForge on October 09, 2010, 11:30:55 am
Quote
•Support for DF 31.15 and 31.16 on Windows.

Yay, good job :)
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Grimlocke on October 09, 2010, 11:16:53 pm
Something I would realy love to see: a tool that can kick plant growth back to life after reclaiming.

Currentelly reclaiming not only removes all mud, but also breaks the trees/wild plants growth system. Would love a way to at least get that last one fixed.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: LealNightrunner on October 11, 2010, 03:24:56 am
Is there a command or program that can issue a pause to the game?  I have a bugged world and I'm trying to grind it into usable shape by letting all the magma flow out, but it was so CPU intensive, it stopped processing keyboard events (or flat out crashed), and eventually even redrawing the screen.  It's still crunching numbers, but not doing anything else that I can see. 

As long as it was paused though it would run fine, so I'd like to see if there's a way I can hook into it and just pause it so it stops processing the magma flow and rebuilds the screen.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: FleshForge on October 11, 2010, 05:08:52 am
Something I would realy love to see: a tool that can kick plant growth back to life after reclaiming.

Currentelly reclaiming not only removes all mud, but also breaks the trees/wild plants growth system. Would love a way to at least get that last one fixed.

I've reclaimed a few times in 31.16 and while the mud is still gone, underground plants do start growing on your soil tiles that are "subterranean/dark".  Not every soil layer will work that way though, that's not a new thing.  I'm not sure which soil types work and which don't.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: sizeak on October 11, 2010, 02:45:09 pm
Hey, the name offsets don't appear to be working. (Unless you changed how names are handled in which case I'm surprised Runesmith compiled)
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: dragonshardz on October 11, 2010, 03:01:21 pm
Is there a command or program that can issue a pause to the game?  I have a bugged world and I'm trying to grind it into usable shape by letting all the magma flow out, but it was so CPU intensive, it stopped processing keyboard events (or flat out crashed), and eventually even redrawing the screen.  It's still crunching numbers, but not doing anything else that I can see. 

As long as it was paused though it would run fine, so I'd like to see if there's a way I can hook into it and just pause it so it stops processing the magma flow and rebuilds the screen.

Try using dfsuspend, and use DFinit to set your game to pause after loading a savegame.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: peterix on October 11, 2010, 05:46:07 pm
Is there a command or program that can issue a pause to the game?  I have a bugged world and I'm trying to grind it into usable shape by letting all the magma flow out, but it was so CPU intensive, it stopped processing keyboard events (or flat out crashed), and eventually even redrawing the screen.  It's still crunching numbers, but not doing anything else that I can see. 

As long as it was paused though it would run fine, so I'd like to see if there's a way I can hook into it and just pause it so it stops processing the magma flow and rebuilds the screen.

Try using dfsuspend, and use DFinit to set your game to pause after loading a savegame.
Hmm... nope. That's not how it works. Actually, reveal should work for making the game actually pause. The pause offset is known and this is the only place it's used...
Note that this can lead to even more !!FUN!! with one 'tick' taking so long.
dfsuspend just stops the process from executing at the OS level, which is useless in this case, because you can't interact with it normally when it's suspended.

Hey, the name offsets don't appear to be working. (Unless you changed how names are handled in which case I'm surprised Runesmith compiled)
The string layout changed, you need to recompile everything. Reading is OK AFAIK. I haven't tested any kind of writing tho.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: LealNightrunner on October 11, 2010, 06:23:31 pm
Is there a command or program that can issue a pause to the game?  I have a bugged world and I'm trying to grind it into usable shape by letting all the magma flow out, but it was so CPU intensive, it stopped processing keyboard events (or flat out crashed), and eventually even redrawing the screen.  It's still crunching numbers, but not doing anything else that I can see. 

As long as it was paused though it would run fine, so I'd like to see if there's a way I can hook into it and just pause it so it stops processing the magma flow and rebuilds the screen.

Try using dfsuspend, and use DFinit to set your game to pause after loading a savegame.

I completely missed that utility.  Thanks for pointing it out!

I've tried running Reveal on it, but it ends up crashing because of corrupt data I'm assuming (It is a bugged world gen after all).  Can I use it just to pause and kill it before it reveals?
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: sizeak on October 11, 2010, 07:14:40 pm
Hey, the name offsets don't appear to be working. (Unless you changed how names are handled in which case I'm surprised Runesmith compiled)
The string layout changed, you need to recompile everything. Reading is OK AFAIK. I haven't tested any kind of writing tho.

Ok well it appears reading was working, but creature.name.has_name always seems to be false so it wasn't trying to process them. Any ideas?
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: LealNightrunner on October 11, 2010, 07:36:17 pm
Hmm... nope. That's not how it works. Actually, reveal should work for making the game actually pause. The pause offset is known and this is the only place it's used...
Note that this can lead to even more !!FUN!! with one 'tick' taking so long.
dfsuspend just stops the process from executing at the OS level, which is useless in this case, because you can't interact with it normally when it's suspended.

Awesome, dfreveal both didn't crash it and issued the pause!  Thanks for your help.

Now I just need to make something to just pause it and not try the reveal... I got incredibly lucky that reveal didn't actually do anything beyond the pause.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Makbeth on October 12, 2010, 02:29:31 pm
I'm trying to add some code to dfliquids to make water-source tiles, and followed the instructions in compiling.htm for compiling dfhack with cmake and mingw, but every time I try to run cmake it throws a bunch of errors saying it can't find libgimp-10.dll.  The dll is in mingw\bin, and I tried it with the path variable set to mingw\ and mingw\bin, and get the same result.  Everything it says it can't find is there but it isn't finding it for some reason.

I'm not very experienced with compiling source code in C.  Closest I've come to it before is compiling UnrealScript, so I'm wondering if there's anything I should have already known that wasn't in the compiling instructions.

Working on Windows Vista 32 bit.  UAC is turned on.

Cmake.exe is installed to C:\Program Files\CMake 2.8\bin and the Mingw exes and dlls live in C:\MinGW\bin.  The build folder is <user>\Desktop\DFhack modding\peterix-dfhack-d4b8b8d\build.

Any advice would be much appreciated.  Thanks.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: dragonshardz on October 12, 2010, 03:37:51 pm
...Working on Windows Vista 32 bit.  UAC is turned on...

This ismore along the lines of general advice than compiling advice: TURN UAC OFF.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Makbeth on October 12, 2010, 04:06:49 pm
True, up until recently it's been a job requirement to keep it on.  However, no longer working with them so...
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Quietust on October 12, 2010, 06:38:06 pm
...Working on Windows Vista 32 bit.  UAC is turned on...

This ismore along the lines of general advice than compiling advice: TURN UAC OFF.

Would you also recommend that Linux users login as root to perform everyday tasks?
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: LealNightrunner on October 12, 2010, 07:49:08 pm
Nah, that's what they made sudo for.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Halnoth on October 13, 2010, 03:21:51 am
dfcleanmap keeps giving me the error message "Can't init map." can anyone help me out here? I'm sure its a simple fix that I am overlooking.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Uristisdying on October 13, 2010, 03:08:38 pm
Ahoy!

I used dfreveal to design my fortress before unpausing the game for the first time. After spending three hours designating my future fortress, I saved the game in order not to lose everything in case of random computer disasters. OF COURSE in my tremendous stupidity I forgot to unreveal beforehand, and now am stuck with a completely revealed map. I tried to run dfreveal again, but the map won't change anymore, every tile remains visible.

Is there anything I can do in order to hide all revealed map features again? Puhleeeze help!  :'(
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Andux on October 13, 2010, 09:29:03 pm
Is there anything I can do in order to hide all revealed map features again?

Tweak (http://dffd.wimbli.com/file.php?id=666) + updated XML files for 0.31.xx (http://meepo.dnsalias.org/files/tweak_core-xml-31xx.zip) + For Each Tile (http://dffd.wimbli.com/file.php?id=404)

Code: (Condition) [Select]
is_subterranean
Code: (Operations) [Select]
hide;
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: LealNightrunner on October 13, 2010, 09:43:09 pm
Would it be relatively trivial to comment out the actual revealing portions of DFreveal and just use the pausing function through MSVC10?  I'd like a straight DF pause toggle switch for various reasons, and in some of them keyboard input won't cut it compared to writing to the memory space directly.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Makbeth on October 13, 2010, 09:43:25 pm
Tweak will only work for 40d.  Might be possible to mod dfliquids to do it, or perhaps even mod an unreveal feature into dfreveal.  Have there been screams?
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: kasker on October 13, 2010, 09:45:52 pm
Running cleartask 0.5.0.2 on DF 31.16
"missing offset for the item vector, exiting :("
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Quietust on October 13, 2010, 10:38:15 pm
Give me 5 minutes and I'll find it.

[edit] Best I can tell, the items vector is at 0x16580d8, but dfcleartask.exe doesn't seem to like it. It might need a recompile.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Quietust on October 13, 2010, 11:04:32 pm
Okay, here's how to fix it:

In memory.xml:
Code: [Select]
            <Group name="Items">
                <Address name="items_vector" value="0x16580d8" />
            </Group>

In cleartask.cpp
Code: [Select]
replace

p->getDescriptor()->getAddress ("items_vector");

with

p->getDescriptor()->getGroup("Items")->getAddress ("items_vector");
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: kasker on October 14, 2010, 10:52:19 am
Works great thanks =)
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: kasker on October 14, 2010, 01:45:33 pm
Does anybody know why some stones still won't get dumped and still prevent/suspend buildings AFTER running cleartasks?
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: negorath on October 14, 2010, 02:01:52 pm
Does anybody know why some stones still won't get dumped and still prevent/suspend buildings AFTER running cleartasks?

My guess is they were designated to be used in a building, and cleartask doesn't clear those properties, at least I've had issues like that before where I have to deconstruct the buildings in progress and redesignate them to be built.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Quietust on October 14, 2010, 02:54:25 pm
The only thing cleartask does is clear the "tasked" flag on the item, which is what prevents it from being used by anything else. Note that you should only run cleartask immediately after a reclaim - running it on an active fortress is sure to mess things up.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Andux on October 14, 2010, 03:15:07 pm
Tweak will only work for 40d.

Hence the "updated XML files" part. You may also need to rename the DF executable to dwarfort.exe for Tweak to recognize it.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: kasker on October 15, 2010, 01:35:22 am
My guess is they were designated to be used in a building, and cleartask doesn't clear those properties, at least I've had issues like that before where I have to deconstruct the buildings in progress and redesignate them to be built.

Hmm, well I had canceled all 'suspended' buildings and tried placing each one at a time but with no difference. Some stones seem invisible to the dwarves. The fort was reclaimed over a year ago, didn't realize the proper use of cleartask lol. Oh well.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: twalberg on October 15, 2010, 10:54:37 am
Initial stab at 0.31.16 linux offsets - probably incomplete, but this gets reveal, cleanmap and vdig working for me with 0.5.0.2:
Code: [Select]
    <Version name="v0.31.16 linux" os="linux" base="v0.31.14 linux" rebase="0x1b40">
        <MD5 value="9cca2fa5da509e2f9a1042ddd1f9669c" />
        <Offsets>
            <Group name="Position">
                <Address name="cursor_xyz" value="0x8b33550 0x8b311f8" />
                <Address name="screen_tiles_pointer" invalid = "true" />
            </Group>
        </Offsets>
    </Version>
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Makbeth on October 15, 2010, 04:21:08 pm
Tweak will only work for 40d.

Hence the "updated XML files" part. You may also need to rename the DF executable to dwarfort.exe for Tweak to recognize it.

...wow, had no idea that was possible.  What would I need to do to get the Adjust Start module to work?  I'm happy to search for the offset or address myself, but I don't know how to.  Can you point me in the right direction?
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: mrkamikaze on October 16, 2010, 02:27:56 pm
Okay, here's how to fix it:

In memory.xml:
Code: [Select]
            <Group name="Items">
                <Address name="items_vector" value="0x16580d8" />
            </Group>

In cleartask.cpp
Code: [Select]
replace

p->getDescriptor()->getAddress ("items_vector");

with

p->getDescriptor()->getGroup("Items")->getAddress ("items_vector");

I am having the same issue

 "Running cleartask 0.5.0.2 on DF 31.16
"missing offset for the item vector, exiting :(""

I don't know the first thing about using a compiler.  Can some upload the fixed files for cleartask?

Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Andux on October 16, 2010, 03:47:52 pm
What would I need to do to get the Adjust Start module to work?  I'm happy to search for the offset or address myself, but I don't know how to.  Can you point me in the right direction?

I use Cheat Engine (http://www.cheatengine.org/) to search for offsets; there are some basic tutorials in the help files, though they're probably not especially helpful in finding constants like starting_dwarf_count. :-\
Embark points can be set during world gen now, so starting_point_count should be easier to find; maybe the dwarf count is still in the same/similar position relative to that (was +0xE7F bytes in 40d)?
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Uristisdying on October 16, 2010, 05:43:14 pm
Sorry for the delay, had to replace my keyboard (!beer! + *keyboard* =  :-[). Thank you for your replies; the "Tweak" solution worked.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: MaximumZero on October 19, 2010, 12:19:27 am
You poured flaming beer on your keyboard!?

Awesome.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Sudius on October 20, 2010, 10:30:01 pm
In cleartask.cpp
Code: [Select]
replace

p->getDescriptor()->getAddress ("items_vector");

with

p->getDescriptor()->getGroup("Items")->getAddress ("items_vector");

Hi Quietust,

Complete compiler noob here, but I am running into SERIOUS issues with items stuck on the ground that no one will touch.  I had to reclaim my wood city after a nasty ambush and zillions of things are strewn about.

After cleaning up the mess, I am having trouble with many objects that have had their job "stuck".

Could you either A) Recommended a free, fast editor so that I can edit this line myself, or B) Just simply upload yours somewhere for the community to use? (assuming yours is fixed for .16).

Thanks! :)
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: rmunn on October 21, 2010, 05:47:34 am
FYI: the latest version of Ubuntu Linux, Ubuntu 10.10 ("Maverick Meerkat") has just been released. By default, it turns OFF the ability of programs to access each others' memory. This will, of course, cause problems for DFHack and other related utilities (like Stonesense, Dwarf Therapist, ...) This is fixable by changing an obscure system configuration value; the "Fixing problems with Maverick" thread (http://www.bay12forums.com/smf/index.php?topic=65326.0) has the details. I suggest updating the OP with a link to that thread for the next few weeks, because people running Ubuntu Linux will be upgrading soon and when they do, they'll need to be able to find the thread.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Quietust on October 21, 2010, 08:44:07 am
Could you either A) Recommended a free, fast editor so that I can edit this line myself, or B) Just simply upload yours somewhere for the community to use? (assuming yours is fixed for .16).

What you need is a compiler, not an editor. MingW would probably be the best option - I'd upload my own fixed build, but I use Visual C++ Express 2010 which is completely incompatible with the existing dfhack.dll.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Makbeth on October 21, 2010, 01:31:09 pm
I'm trying to add some code to dfliquids to make water-source tiles, and followed the instructions in compiling.htm for compiling dfhack with cmake and mingw, but every time I try to run cmake it throws a bunch of errors saying it can't find libgimp-10.dll.  The dll is in mingw\bin, and I tried it with the path variable set to mingw\ and mingw\bin, and get the same result.  Everything it says it can't find is there but it isn't finding it for some reason.

I'm not very experienced with compiling source code in C.  Closest I've come to it before is compiling UnrealScript, so I'm wondering if there's anything I should have already known that wasn't in the compiling instructions.

Working on Windows Vista 32 bit.  UAC is turned on.

Cmake.exe is installed to C:\Program Files\CMake 2.8\bin and the Mingw exes and dlls live in C:\MinGW\bin.  The build folder is <user>\Desktop\DFhack modding\peterix-dfhack-d4b8b8d\build.

Any advice would be much appreciated.  Thanks.

Could someone please tell me what I need to do once I have cmake and minggw installed to get this thing to compile?  I've followed the compile.html as closely as I can and in all permutations I could think of.  I continue to get this error.  What am I missing?

Quote
Using mingw
You also need a compiler. I build dfhack using mingw. You can get it from the mingw site: http://www.mingw.org/

Get the automated installer, it will download newest version of mingw and set things up nicely.

You'll have to add C:\MinGW\ to your PATH variable.

Building
open up cmd and navigate to the dfhack\build folder, run cmake and the mingw version of make:

cd build
cmake .. -G"MinGW Makefiles" -DCMAKE_BUILD_TYPE:string=Release
mingw32-make

What is the minGW version of make?  Do these have to be run through cmd.exe or can they be run through the gui?  Is there anything in the build folder that I need to change before compiling?  Are the above commands meant to be entered verbatim+program/file paths, or are there placeholders in there that I would know not to type if I had done this before?

And if these questions are too N00b for you, where do I go to de-N00b?  I'm perfectly willing to do my own homework (taught myself how to mod and make levels for UT 2004)but I don't know where to start.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Makbeth on October 21, 2010, 01:57:44 pm
Did I even install minGW and Cmake to the right place?   Are they supposed to be installed in the DFhack folder?

So ".." means parent directory.  If I understand it right, that just tells cmake to look in the parent directory of the dfhack\build folder, which is \dfhack (Captain Obvious, I know, but just so I'm not leaving anything out).  But is that right?  Shouldn't it go to the source folder or the build folder instead? 

But all of this looks like it's unrelated to Cmake not finding that .dll.  Still can't get it to look in the minGW\bin folder for it.  How do I do that?  It seems that setting the path variable to C:\minGW or C:\minGW\bin isn't enough.  Is that not the path variable's job or is there something I need to "connect" the path variable to in order for it to work?  Am I even creating the path variable in the wrong way?  All the compile document said was "You'll have to add C:\MinGW\ to your PATH variable.".  It didn't say how.  The way I went about it was to open the Cmake gui and create an entry of the type "PATH" and put either C:\MinGW or C:\MinGW\bin in the "value" field.  I'm not sure that's what the document meant but it's impossible to know for sure from the information I have.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Sudius on October 21, 2010, 02:33:16 pm
Yea I got MinGW, had no idea where to go from there, and decided to forego trying to fix DFClearTask and opted to continue channeling out items into my basement.  I won't pester anyone else, and instead be patient and wait for it to be updated and released to the public. :)

Thanks for the help regardless. :)
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: peterix on October 21, 2010, 02:37:52 pm
Did I even install minGW and Cmake to the right place?   Are they supposed to be installed in the DFhack folder?
No. Definitely not. But hopefully it won't break anything...
So ".." means parent directory.  If I understand it right, that just tells cmake to look in the parent directory of the dfhack\build folder, which is \dfhack (Captain Obvious, I know, but just so I'm not leaving anything out).  But is that right?  Shouldn't it go to the source folder or the build folder instead? 
It won't work. The directry you run cmake from is the build directory. The ".." is therefore used to separate the build files and source files. I enforce this, it will yell at you and refuse to continue if you run cmake from the source directory.
But all of this looks like it's unrelated to Cmake not finding that .dll.  Still can't get it to look in the minGW\bin folder for it.  How do I do that?  It seems that setting the path variable to C:\minGW or C:\minGW\bin isn't enough.  Is that not the path variable's job or is there something I need to "connect" the path variable to in order for it to work?  Am I even creating the path variable in the wrong way?  All the compile document said was "You'll have to add C:\MinGW\ to your PATH variable.".  It didn't say how.  The way I went about it was to open the Cmake gui and create an entry of the type "PATH" and put either C:\MinGW or C:\MinGW\bin in the "value" field.  I'm not sure that's what the document meant but it's impossible to know for sure from the information I have.
The PATH variable is an environment variable, and is specified for the whole system in one of the Windows control panels (Probably named System too). This tells the system where to look for binaries (like compilers and stuff).

So, what you need:
Working cmake
Working Mingw32
(Both have installers that should be able to set the PATH automatically for you)
Then go to dfhack\build and double-click one of the .bat files (Release Mingw32 build should be right)
Results are placed into dfhack\output
If you have MSVC and decide to use it, a project file will be generated in dfhack\build\build-real\
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Makbeth on October 21, 2010, 04:17:25 pm
Thanks Peterix, I'll use that and see if I can get it working later today.  :)
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Makbeth on October 22, 2010, 02:52:47 pm
Reinstalled mingw and cmake, had to add c:\mingw\bin\ to the path variable to get rid of the dll bug.  Thanks for cluing me in on that, had no idea what that was.

Looks like I'm not done though because g++.exe apparently isn't installed with mingw and it's needed for the build. I get the following output:

Spoiler (click to show/hide)

Gonna see if I can find out how I go about getting the g++.exe for MinGW...
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Makbeth on October 22, 2010, 03:28:19 pm
*sigh*  So apparently MinGW doesn't work very well with Vista, with Cmake or any other similar program, in any version.  Tried some of the patches and workarounds that people have come up with but still no luck.

Dare I hope it works ok on Windows 7 or do I just need to install linux?  I'm having a new PC built for me (i7 980 hex core, yay!) and it should be done either today or early next week. 

REALLY looking forward to getting away from Vista anyway.  This PC and I started hating each other several months ago.  Fooled around with the beta for Windows 7 and it was a huge improvement.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: peterix on October 22, 2010, 06:31:24 pm
Makbeth: I see no reason why should it fail that way, even with Vista. You just need to set the PATH for mingw32 right. Cmake can't find it.



Everyone:
I have some patches and code people contributed. This should be reviewed/merged over the weekend. Why not right now you may ask? Because I just did math for three days straight and now I'm going to play Fallout for a bit to clear my head :P
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Organum on October 24, 2010, 06:24:50 am
Is there any way to fix pathing errors caused by excessive use of DFliquids?
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: peterix on October 24, 2010, 09:01:28 am
Is there any way to fix pathing errors caused by excessive use of DFliquids?
Cover the bad parts with 1/7 of magma, wait for evaporation.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Makbeth on October 24, 2010, 12:27:42 pm
^ That's how you know peterix really is a dwarf.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Shurikane on October 24, 2010, 01:46:49 pm
I asked the question in chat before, but I figured it might be worth it to ask at large.

I am running a save of the many-z-levels game located at http://www.bay12forums.com/smf/index.php?topic=43793.msg830218#msg830218  It's got several mods plugged in.  The save is on a 40d version.

Now, I wish to use df_magmacreate to create some magma, using DFhack 0.2.1.  Unfortunately, when I start the program, I get "Failure 2" and the program exits.

Has anybody else ever run into this?  Is there a way to make it work somehow?
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Makbeth on October 24, 2010, 02:17:15 pm
Sorry to keep asking for help here but I really don't know what to do.  I just restarted with a fresh dfhack directory (plus modified dfliquids), fresh cmake, and fresh MinGW.  Some errors are gone now, others remain.

Spoiler (click to show/hide)

So now it seems to say that it's missing these files:

C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-g++.cmake
C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-gcc.cmake
C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/CMakeCXXInformation.cmake

The only one of those that's actually missing though is Windows-gcc.cmake.

Where can I find where to set CMAKE_CXX_COMPILER?  Is it in Cmakelists or do I need to do it through the CMake gui?

I'd add the windows-gcc.cmake file to the cmake directory, but everything you've said here and in the documentation suggests that I shouldn't have to.  I really wish I knew why this is not working out of the box when everything I read seems to say it should.  I added the recommended path variables and got errors.  I add more path variables and those errors go away.  I've now got path variables to every directory that's been referenced so far, and that well seems to have run dry.

Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Makbeth on October 24, 2010, 02:37:33 pm
It keeps looking for Windows-gcc.cmake.  There is none, but there is a Windows-GNU-C.cmake.  Would that work?  If so how do I get Cmake to use that instead?
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Organum on October 24, 2010, 03:00:32 pm
Is there any way to fix pathing errors caused by excessive use of DFliquids?
Cover the bad parts with 1/7 of magma, wait for evaporation.

Thanks for the help, I'll do that next time instead of save scumming ;_;
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: peterix on October 25, 2010, 02:39:12 am
^ That's how you know peterix really is a dwarf.
Actually, I play as a dwarf in every RPG where it's possible and I have beard ... and this forum lacks dwarf smiley faces with beer and axes and stuff :P

Makbeth:
Seriously, IDK. The output seems to indicate that you have only the C portion of the compiler and the C++ portion is missing.
Can you check some things?
run cmd.exe and put this in:
Code: [Select]
echo [%PATH%]Post the result.

Then look into MinGW's bin folder and check if g++.exe is there. If it's not, go and install it.

Shurikane:
Right. Ancient code. I'll go check what it means... DFHack changed quite a bit since then and nobody backported bugfixes. Now I know. It means there's no cursor. Hit 'k' and point at an empty tile before running the tool. I know it's not very friendly, but it's really, really old code.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Makbeth on October 25, 2010, 02:32:31 pm
[C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32
;C:\Windows;C:\Windows\System32\Wbem;C:\hp\bin\Python;C:\Program Files\QuickTime
\QTSystem\;c:\Program Files\System Center Operations Manager 2007\;C:\Program Fi
les\Common Files\Autodesk Shared\;C:\MinGW\;C:\MinGW\bin\;C:\MinGW\bin;C:\MinGW\
libexec\gcc\mingw32\3.4.5;C:\MinGW\libexec\gcc\mingw32\4.5.0;C:\Program Files\CM
ake 2.8\bin;C:\Program Files\CMake 2.8\share\cmake-2.8\Modules\;C:\Program Files
\CMake 2.8\share\cmake-2.8\Modules\Platform\;C:\Program Files\Common Files\Micro
soft Shared\Windows Live;c:\Program Files\System Center Operations Manager 2007\
]

As for g++.exe, it's not installed by the automated MinGW installer.  I found one in a user-made patch for MinGW 3.4.5, not sure if it works with the current version.  Not sure where else to get it.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: peterix on October 25, 2010, 02:42:14 pm
[C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32
;C:\Windows;C:\Windows\System32\Wbem;C:\hp\bin\Python;C:\Program Files\QuickTime
\QTSystem\;c:\Program Files\System Center Operations Manager 2007\;C:\Program Fi
les\Common Files\Autodesk Shared\;C:\MinGW\;C:\MinGW\bin\;C:\MinGW\bin;C:\MinGW\
libexec\gcc\mingw32\3.4.5;C:\MinGW\libexec\gcc\mingw32\4.5.0;C:\Program Files\CM
ake 2.8\bin;C:\Program Files\CMake 2.8\share\cmake-2.8\Modules\;C:\Program Files
\CMake 2.8\share\cmake-2.8\Modules\Platform\;C:\Program Files\Common Files\Micro
soft Shared\Windows Live;c:\Program Files\System Center Operations Manager 2007\
]

As for g++.exe, it's not installed by the automated MinGW installer.  I found one in a user-made patch for MinGW 3.4.5, not sure if it works with the current version.  Not sure where else to get it.
Run the installer, it should be in the start menu. At least it did that back when I used MinGW.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Makbeth on October 25, 2010, 02:52:24 pm
No such luck, just the uninstaller for the MinGW-get tool, which also doesn't seem to be the installer, or at least doesn't do anything.

Anybody who uses MinGW know where to get a current g++.exe?
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Shurikane on October 25, 2010, 09:39:02 pm
Now I know. It means there's no cursor. Hit 'k' and point at an empty tile before running the tool. I know it's not very friendly, but it's really, really old code.

Bingo!  Now that'll make the magma spreadin' a whole lot faster.  :D
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: zxcvmnb on October 26, 2010, 07:06:30 am
No such luck, just the uninstaller for the MinGW-get tool, which also doesn't seem to be the installer, or at least doesn't do anything.

Anybody who uses MinGW know where to get a current g++.exe?
So just to check, you have tried "mingw-get install package g++" from the command line? (described here (http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/mingw-get/mingw-get-0.1-alpha-4/mingw-get-0.1-mingw32-alpha-4-RELEASE-NOTES.txt/view); I found it via http://www.mingw.org/wiki/InstallationHOWTOforMinGW (http://www.mingw.org/wiki/InstallationHOWTOforMinGW))
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Makbeth on October 26, 2010, 12:59:55 pm
Thank you for having the patience to walk a total newb through his own mistakes.  I'm ashamed to say this, but it looks like the main problem was my tendency to click through install dialogues as fast as possible.  There's a part in the install where it asks which components you'd like to install, and I selected all the languages.  g++.exe was then installed correctly, I ran the .bat file, and the compile seems to have worked.  I had done so before, but at the time I was doing a bunch of other things wrong. 

Sorry for taking up your time with this, and thanks for your patience. 

Now, to get to splicing code.

Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Makbeth on October 26, 2010, 01:35:04 pm
Hey, it worked.  I modified a 3-tile pond, breached it, and now it's proceeding to flood the whole world. 

It's a very minor thing (takes like 1 minute, most of which is spent looking up the river source tile ID), but should I send my source file to you anyway so it can be included in the official version?
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Makbeth on October 26, 2010, 02:32:09 pm
So I've got two new commands for dfliquids.  typing "r" will switch to river source mode, which lays down tiles that regenerate water very quickly.  Typing "a" will switch to featstone mode, which can be used to fill in hollow adamantine veins for cyan-starved maps.  It can affect slade as well, but I haven't tested it yet and it probably only works in demonic fortresses or hell, and even then it may require that a piece be missing, which is unlikely with this rock.  Using it anywhere but inside an adamantine vein, on a natural adamantine floor, or in slade features will generate a wall of unknown material. 

Entries have been added to the "help" command list.  I'd add more, but there's not much else in tiletypes that looks interesting.  Maybe wet soil floors, but I tend not to have a shortage of those.  I'll add them if anyone wants them though.

I should probably get to work now, but later I'll see about making the brush 2x2 for featstone.  I think one tile at a time for river sources is probably enough.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Quietust on October 26, 2010, 04:04:29 pm
One other possibly useful option would be the ability to toggle the "aquifer" flag on selected tiles.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: peterix on October 26, 2010, 05:26:36 pm
One other possibly useful option would be the ability to toggle the "aquifer" flag on selected tiles.
I'm afraid that depends on the layer itself having an aquifer... and changing that would require knowing what to change.

Makbeth:
Cool stuff. Send me a patch and I'll merge it :)

I still plan to rewrite some of the tools, just don't know when I get to it. Many would benefit from the block cache used in the vein digger.

A block cache in this case is something like a layer in gimp/photoshop - it tracks the changes on top of some other layer. In case of the vein digger, that base layer is the game itself, but the classes could be extended to using an another block cache as the base...

The block cache itself provides uniform access to tiles, so the 16x16 blocks are basically hidden from the cache's user. Doing brushes on top of the cache is much easier, commit/revert mechanics are basically free and the code would be much nicer... Now what would be required is a way to display all this stuff to the user... I'm undecided about that - it requires more dependencies and I can either DIY the whole thing or use some library. Suggestions are welcome.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Makbeth on October 26, 2010, 08:12:02 pm
For sending a patch, is it enough to simply send you the .cpp file (the only thing I edited), or do you need more than that?  I've never used github before this, I'll see if there's some way for me to post it there, unless I can just email the thing.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Quietust on October 26, 2010, 09:57:39 pm
One other possibly useful option would be the ability to toggle the "aquifer" flag on selected tiles.
I'm afraid that depends on the layer itself having an aquifer... and changing that would require knowing what to change.

Damn, didn't realize that. Curious, though, that setting the "water_table" flag still causes nearby tiles to be marked as damp, even though mining them out doesn't result in any leaks.

Also, on a somewhat unrelated note, I just did some tinkering in Adventurer mode and confirmed that the "e_liquidcharacter" value in naked_designation is actually just two flags - the lower bit means "stagnant" and the upper bit means "salty" (when I changed the bits while the Eat menu was open, the "Drink water (Here)" option instantly changed to "Drink salt water"/"Drink stagnant water"/"Drink stagnant salt water").
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Burning_Iceman on October 27, 2010, 06:14:48 am
Are there any 31.16 linux memory bindings that work with dfcleanmap yet?
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: twalberg on October 27, 2010, 07:01:53 am
Are there any 31.16 linux memory bindings that work with dfcleanmap yet?

I posted my offsets in this thread a few days back - it's not complete, but I can reliably use reveal, cleanmap and vdig with (so far) no ill effects.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: peterix on October 27, 2010, 09:36:49 am
Curious, though, that setting the "water_table" flag still causes nearby tiles to be marked as damp, even though mining them out doesn't result in any leaks.
I'd say not every tile of the layer has to be part of the aquifer, but having the aquifer in the layer is required.
Also, on a somewhat unrelated note, I just did some tinkering in Adventurer mode and confirmed that the "e_liquidcharacter" value in naked_designation is actually just two flags - the lower bit means "stagnant" and the upper bit means "salty" (when I changed the bits while the Eat menu was open, the "Drink water (Here)" option instantly changed to "Drink salt water"/"Drink stagnant water"/"Drink stagnant salt water").
Cool, I'll add that. Every bit of information helps :)
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: plynxis on October 28, 2010, 01:41:10 pm
i normally play 31.16 through wine (had some strange crashes with native and since i switched to wine they didnt show up again) and i tried running the win32 dfhack through wine and got an immediate crash so i compiled the native linux version 0.5.0.2 which, if i understand correctly, can work with 31.16 through wine.

it compiled just fine but its giving me a "couldn't find a suitable process" error in the terminal. i did run a search and found a post in this thread where someone asked for a solution but the advice was to compile the 0.4.0.2 version and not use wine. that was on page 4 or something and probably back when the latest linux version was usable with dfhack so i dont think it will work for me and obviously i need 0.5.0.2 for 31.16 support.

is there any way to help dfhack find DF through wine? i'm guessing it has to do with memory.xml but i have no idea what to do with it

sorry for my noobness - all i'm really interested is fixing my fps problems really, trying to find what's causing them - maybe gonna have to plug up an underground lake or something.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: snooptodd on October 28, 2010, 08:01:23 pm
If you are running Ubuntu maverick (10/10) try this http://www.bay12forums.com/smf/index.php?topic=65326.0

Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: elmariachi on October 29, 2010, 10:48:07 am
I installed the archlinux package but i can't use any of the apps and I can't compile stonesense  :-\ do i have to copy the files to somewhere?

I'm not using DF from arch-games repos, I'm using the one from Community (31.16)
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: plynxis on November 02, 2010, 12:08:58 pm
If you are running Ubuntu maverick (10/10) try this http://www.bay12forums.com/smf/index.php?topic=65326.0

sorry for the late reply - i am actually running maverick and i tried that but it didnt change anything. i guess i'll have to figure out memory.xml. thanks though

in any case, i did manage to get dfhack to run perfectly when i'm on winxp (running both windows df and dfhack ofcourse). at that time all i wanted to do was figure out if i had leaks and what was causing my fps to drop to the 5-15 range. i filled my fortress and outside with 7/7 magma burning nearly everything except iron stuff and some parts of my fort that strangely the 7/7 magma wouldn't burn. got up to 50 fps with gfps capped at 25 or 15 (cant remember). about 10 or so dwarves were left and i think close to the same amount of animals, luckily tucked at the lower z-levels. i was atom smashing for a long while, slowly getting my 10k stone to about 7k or something but it didnt help much. eventually, after spending whole days just waiting for a season to pass and trying to atom smash a septillion items (like infinite stuff from dead invaders and caravans) i gave up and restarted :P
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Raziel_Blaze on November 02, 2010, 09:28:57 pm
Any news on dfcleartask.exe working yet, btw where to you get the .cpp file from?
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: peterix on November 03, 2010, 10:22:37 am
Any news on dfcleartask.exe working yet, btw where to you get the .cpp file from?
I've recently merged some item-related fixes. Guess it could work now, I'll have to test this :)

Anyway, my current plan is to start working on a map editor/visualizer, which will eventually obsolete all of the dfhack map tools. The GUI parts and input will use Qt. The visualization will be done with OpenGL 2, avoiding the fixed pipeline. View will be top-down with perspective, z-levels above current hidden and z-levels below possibly dimmed. The main goal is me learning Qt (better) and all the fancy shader stuff, but I guess you guys will like the results ;)

I'd like to have the visualization part and some basic controls first, along with an equivalent of reveal and vein digger.

Further work on the memory.xml overhaul has been stalled for some time now, and I'll leave all that stuff for some other time or a different project.

I installed the archlinux package but i can't use any of the apps and I can't compile stonesense  :-\ do i have to copy the files to somewhere?
I'm not using DF from arch-games repos, I'm using the one from Community (31.16)
The package is probably horribly outdated. I could publish a working PKGBUILD on AUR tho. DF 31.16 is not yet supported on linux because I've been lazy and not really playing DF :P

So, I'll try to get things in order and then start working on the editor.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Quietust on November 03, 2010, 12:07:32 pm
dfcleartask might not even be necessary soon - the bug tracker seems to indicate that the reclaim bug will finally be fixed in version 0.31.17.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: nordak on November 06, 2010, 12:30:49 pm
Anyone have custom tools for DF hack, such as the one for designating all trees or all sunberry bushes?
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Raziel_Blaze on November 10, 2010, 12:38:37 am
Well if anyone can get clear tasks working or know a way please tell me, for it sounds like you will need to gen a new world so I would loose my fort.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Kearn on November 10, 2010, 06:01:41 pm
a little help?

whenever i try using something it keeps saying that it couldn't configure the application or something like that

someone tell me what steps i take to use any of this?
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Kearn on November 11, 2010, 07:00:32 pm
still won't work

agggggggaaaaah  :(
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Raufgar on November 12, 2010, 01:56:15 am
Aaaaaaaaaaaaand 0.31.17 is out. Toady working overtime again...
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Kearn on November 12, 2010, 11:39:48 am
aaaaaaaand it still won't work

what the heck is wrong with this thing
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: proxn_punkd on November 12, 2010, 04:24:30 pm
Kearn, do you have DF running while you use the hax?
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: peterix on November 12, 2010, 06:32:39 pm
a little help?
whenever i try using something it keeps saying that it couldn't configure the application or something like that
someone tell me what steps i take to use any of this?
1. Please don't spam the thread.
2. What does it say exactly?

My guess is that you don't have the right C/C++ libs. Get this (http://www.microsoft.com/downloads/en/details.aspx?familyid=a5c84275-3b97-4ab7-a40d-3802b2af5fc2&displaylang=en).

@everyone
Also, don't expect any kind of updates until at least tuesday. I have too much other stuff to do.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Abraxis on November 12, 2010, 09:26:11 pm
I am having the same problem another guy had in here, when I run dfcleanmap I get "Can't init map." in the consol and nothing else.  This is in windows, hack v. 0.5.0.2, DF v.31.16.

I get this message whether the game is running or not.  DFhack is running from a directory outside Dwarf Fortress'.  As there are no installation instructions anywhere I assume this is meant to run anywhere.

Anywho, that's all I can think of, help would be appreciated, my fortress had been massacred down to 3 dwarfs a year and a half ago, now that more migrants have begun to show up the FPS from all the blood is killing me.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: plynxis on November 12, 2010, 09:55:18 pm
i cant say anything about your dfhack prob but AFAIK blood/stains dont impact fps, at least they dont seriously affect it. i ran dfcleanmap on a fort of mine that was running at 10-15 fps and it had no noticable effect (and believe me, i had a LOT of blood). flooding everything with magma to destroy the excess of dwarves and objects hanging around however got my fps to 50.

what i'm trying to say is, blood is probably not cutting any fps - if your fps is low, there's something else there killing it.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Rumrusher on November 13, 2010, 04:24:25 pm
Man I wonder if there a T'ravel Anywhere utility. I can't get use to having to walk out of a 10 zlevel castle to start a quest. It's Insane.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: peterix on November 13, 2010, 06:52:45 pm
i cant say anything about your dfhack prob but AFAIK blood/stains dont impact fps, at least they dont seriously affect it. i ran dfcleanmap on a fort of mine that was running at 10-15 fps and it had no noticable effect (and believe me, i had a LOT of blood). flooding everything with magma to destroy the excess of dwarves and objects hanging around however got my fps to 50.

what i'm trying to say is, blood is probably not cutting any fps - if your fps is low, there's something else there killing it.
Well. Basically, a spatter object is a pair of a monochrome bitmap and material. By clearing the bitmap (which dfclearmap does), no creature can pick up materials from the objects, but they are kept around. The game still has to check them for the values of the tiles, and there's no change to the CPU time the checking takes.

Hmm... maybe:
Code: [Select]
For each spatter object, find tile where value_of(bitmap) != 0 and there's no creature or building on the tile
    For each tile where tile != found tile
        Set value_of(bitmap) to 0
        Place 1/7 on found tile
Anyone feel like implementing this? Maybe with a slight modification, where it would try to avoid placing magma on tiles that intersect the whitelisted spatter objects (mud, snow) and single-tile passages? If my guess is right, it could make the game destroy the objects and reclaim a bit of resources that way. Still, the effect could be minimal.

I am having the same problem another guy had in here, when I run dfcleanmap I get "Can't init map." in the consol and nothing else.  This is in windows, hack v. 0.5.0.2, DF v.31.16.
Are you running the SDL DF version? DFHack doesn't have offsets for the legacy versions.
The FPS from all the blood is killing me.
Well, can't help there right now... try magma ;)
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Quietust on November 13, 2010, 10:27:36 pm
Code: [Select]
    <Version name="v0.31.17 SDL" os="windows" base="v0.31.16 SDL" rebase="0x472D0">
        <PETimeStamp value="0x4CDC27A0" />
        <MD5 value="2265cdcb215a0f12c5530cfd95d4d6fa" />
        <Offsets>
            <Group name="Position">
                <Address name="cursor_xyz" value="0xb107f0" />
            </Group>
            <Group name="Materials">
                <Address name="inorganics" value="0x16e327c" />
                <Address name="organics_all" value="0x16e329c" />
                <Address name="organics_trees" value="0x16e32cc" />
                <Address name="organics_plants" value="0x16e32ac" />
                <Address name="creature_type_vector" value="0x16E3370" />
            </Group>
            <Group name="GUI">
                <Address name="pause_state" value="0x14C7BE1" />
            </Group>
        </Offsets>
    </Version>

It's enough for dfcleanmap, dfvdig, dfprobe, and dfliquids; dfposition is missing a few offsets, and dfprospector crashes. Dfreveal mostly works, but the "pause" offset is wrong so it's probably causing very subtle memory corruption.

[edit]

Found the pause offset, so dfreveal should work properly now.

[edit]

Rechecked all of the materials vectors - turns out a bunch of them were wrong. Unfortunately, dfprospector still crashes, so I can only assume I'm missing something else.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: NecroRebel on November 13, 2010, 10:41:33 pm
It's enough for dfcleanmap, dfvdig, dfprobe, and dfliquids; dfposition is missing a few offsets, and dfprospector crashes. Dfreveal mostly works, but the "pause" offset is wrong so it's probably causing very subtle memory corruption.
As always, sir, you are a gentleman and scholar.

Given the problem with the pause offset, it's likely best to simply not save after revealing. Presumably that would avoid the issue entirely.

Also, once more, for those who don't know, to apply Quietust's finely-crafted and elegant code:
1. Open a previous version of dfhack's Memory.xml in some editor (notepad works in windows).
2. Search for W I N E, including that specific capitalization and the spaces between the letters.
3. Copy-paste Quietust's code just after the last E in W I N E.
4. Now dfhack will work, at least with some tools.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: cryopyre on November 14, 2010, 05:04:26 am
I get the "Can't find suitable process" error. I am running 0.31.17. It was running previously on 0.31.12. I have dfhack version 0.5.0.2. I am trying to run dfreveal.

Is this a problem with the software not being configured with 0.31.17? Or do you think it's problem with my computer/something I don't have/etc.?
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Rose on November 14, 2010, 05:49:00 am
it's a problem with requiring weeks of work by everybody involved to get it working on the new version.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: cryopyre on November 14, 2010, 05:59:58 am
it's a problem with requiring weeks of work by everybody involved to get it working on the new version.

Haha, well shit. Well thanks for letting me know.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Kearn on November 14, 2010, 08:36:51 am
What does it say exactly?

"The application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem."
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Dragonchampion on November 14, 2010, 10:05:42 am
Anyone know how to fix dfdig? That's really the only thing I used. MUCH easier than having to keep on selecting blocks in a vein as you see then.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Quietust on November 14, 2010, 12:31:40 pm
I get the "Can't find suitable process" error. I am running 0.31.17. It was running previously on 0.31.12. I have dfhack version 0.5.0.2. I am trying to run dfreveal.

Is this a problem with the software not being configured with 0.31.17? Or do you think it's problem with my computer/something I don't have/etc.?

Did you edit your memory.xml to add the section I posted above? If so, make sure you're running the SDL version and not the Legacy version.

[edit] Also, I found the pause offset, so dfreveal should be safe to use. Well, as safe as it was in 0.31.16 - it looks like the "pause" logic is actually writing 4 bytes when the game itself only uses a single byte to store the pause state, so it's actually clearing 3 other unknown flags in the process.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Kearn on November 14, 2010, 02:45:45 pm
I get the "Can't find suitable process" error. I am running 0.31.17. It was running previously on 0.31.12. I have dfhack version 0.5.0.2. I am trying to run dfreveal.

Is this a problem with the software not being configured with 0.31.17? Or do you think it's problem with my computer/something I don't have/etc.?

Did you edit your memory.xml to add the section I posted above? If so, make sure you're running the SDL version and not the Legacy version.

[edit] Also, I found the pause offset, so dfreveal should be safe to use. Well, as safe as it was in 0.31.16 - it looks like the "pause" logic is actually writing 4 bytes when the game itself only uses a single byte to store the pause state, so it's actually clearing 3 other unknown flags in the process.

I've heard I need to edit memory.xml, but what am I supposed to do exactly? I'm a bit confused with that...
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: NecroRebel on November 14, 2010, 03:39:21 pm
I've heard I need to edit memory.xml, but what am I supposed to do exactly? I'm a bit confused with that...

Also, once more, for those who don't know, to apply Quietust's finely-crafted and elegant code:
1. Open a previous version of dfhack's Memory.xml in some editor (notepad works in windows).
2. Search for W I N E, including that specific capitalization and the spaces between the letters.
3. Copy-paste Quietust's code just after the last E in W I N E.
4. Now dfhack will work, at least with some tools.
Code: [Select]
    <Version name="v0.31.17 SDL" os="windows" base="v0.31.16 SDL" rebase="0x472D0">
        <PETimeStamp value="0x4CDC27A0" />
        <MD5 value="2265cdcb215a0f12c5530cfd95d4d6fa" />
        <Offsets>
            <Group name="Position">
                <Address name="cursor_xyz" value="0xb107f0" />
            </Group>
            <Group name="Materials">
                <Address name="inorganics" value="0x16e327c" />
                <Address name="organics_all" value="0x16e328c" /> not sure about this one
                <Address name="organics_trees" value="0x16e32bc" /> or this one either
                <Address name="organics_plants" value="0x16e329c" /> these were pretty much guessed
                <Address name="creature_type_vector" value="0x16E3360" /> based on their order in previous versions
            </Group>
            <Group name="GUI">
                <Address name="pause_state" value="0x14C7BE1" />
            </Group>
        </Offsets>
    </Version>
Reading!
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Kearn on November 14, 2010, 07:47:53 pm
still does absolutely nothing to get it to work
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Nameless Archon on November 14, 2010, 08:11:42 pm
still does absolutely nothing to get it to work
Worked for me, once I followed the directions exactly, and copied linefeed characters to prevent Notepad from working its corrupting magic.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Quietust on November 14, 2010, 11:14:22 pm
Minor bump, I've also narrowed down the materials vectors, but DFProspector still wants something else and is crashing.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: LoSboccacc on November 15, 2010, 06:21:03 am
note, on the previous page, use the first one not the second memory layout.

the second one being quoted is not as updated as the first one
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Kearn on November 15, 2010, 11:14:08 am
i downloaded df hack and unzipped it

it is now sitting as a folder seperate from dwarf fortress files, am i supposed to do something with them?
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: LoSboccacc on November 15, 2010, 11:24:14 am
i downloaded df hack and unzipped it

it is now sitting as a folder seperate from dwarf fortress files, am i supposed to do something with them?


here is a list of what each of the small .exe file does
http://df.magmawiki.com/index.php/DF2010:Utilities#DFHack

you'll need to mess with the configuration files if you have the dwarf fortress version 0.31.17, you'll find instructions for that on the previous page
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Kearn on November 15, 2010, 11:35:22 am
i am still using .16, i was able to use some of it before but now it keeps saying
"The application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem."
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: nordak on November 15, 2010, 11:51:22 am
DFHACK and .17 doesn't work ATM, please try again after it is updated.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Quietust on November 15, 2010, 12:29:33 pm
DFHACK and .17 doesn't work ATM, please try again after it is updated.

If you're using 0.31.17 SDL on Windows, look on the previous page and you'll find that I've located most of the offsets necessary for the common utilities - I'm already using dfcleanmap in 0.31.17 without any problems.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: caperon on November 15, 2010, 01:34:13 pm
Would you mind in upload the updated memory.xml file? Im having problems to make it run editing it myself.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: peterix on November 15, 2010, 02:02:43 pm
Guys, I appreciate the work, but 31.18 is supposed to come out tomorrow and I'll support that instead.
.17 will be skipped as a buggy release.


There's also some improvement to the memory.xml format ready for release - the ability to set inherited offset groups/entries as invalid. This will let me release partial offsets without them causing bad errors all over the place by marking the stuff that's not tested yet as invalid.


EDIT: better formulated ~_~
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: BigD145 on November 15, 2010, 05:54:02 pm
I came looking for .18 support and I see you're planning it. Thanks for the hard work.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: BurnedToast on November 15, 2010, 06:10:31 pm
Hey just wanted to say thank you to Quietust for the bandaid fix to get the dfvdig tool working again! It's the only one I use, and I can't imagine playing without it.

Also thanks to Peterix for continued work on the tools!
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: magistrate101 on November 16, 2010, 05:56:26 pm
Guys, I appreciate the work, but 31.18 is supposed to come out tomorrow and I'll support that instead.
.17 will be skipped as a buggy release.


There's also some improvement to the memory.xml format ready for release - the ability to set inherited offset groups/entries as invalid. This will let me release partial offsets without them causing bad errors all over the place by marking the stuff that's not tested yet as invalid.


EDIT: better formulated ~_~

eeeeeeeeeeeeeeeeeeeeeeeeeee :3 I can't wait for the new DFHack!!! :D
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: duckInferno on November 18, 2010, 03:54:41 am
Got a memory.xml update for the meantime :D?
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: daftfad on November 18, 2010, 01:06:08 pm
Here's a backport for peterix's latest 0.31.18 work to dfhack 0.5.0.2 .

**NOTE: This has only been tested for dfvdig, which is the only dfhack tool I use :] Enjoy.**

Code: [Select]
<Version name="v0.31.18 SDL" os="windows" base="v0.31.16 SDL" rebase="0x492D0">
        <PETimeStamp value="0x4CE2841D" />
        <MD5 value="b7be6b9db369d6adb72319dcf780f9f5" />
        <Offsets>
            <Group name="Position">
                <Address name="cursor_xyz" value="0xb127f0"/>
            </Group>
            <Group name="GUI">
                <Address name="pause_state" value="0x14c9be1"/>
            </Group>
            <Group name="Materials" >
                <Address name="creature_type_vector" value="0x16E533C"  />
                <Address name="inorganics" value="0x16e527C"  />
                <Address name="organics_all" value="0x16e529C"  />
                <Address name="organics_plants" value="0x16e52AC"  />
                <Address name="organics_trees" value="0x16e52CC" />
            </Group>
         </Offsets>
    </Version>
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Jorshamo on November 18, 2010, 02:02:30 pm
Did a little testing. dfreveal, and dfcleanmap both work, in addition to dfvdig, like daftfad said. dfprospector crashes, and will sometimes crash DF. I'm not familiar enough with to others to test them, though.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: Uzu Bash on November 18, 2010, 02:23:16 pm
dfclean was the one I really needed, thank you.
Title: Re: DFHack 0.5.0.2 - tools and memory access library
Post by: duckInferno on November 18, 2010, 08:15:33 pm
Thanks ^^
Title: Re: DFHack 0.5.1
Post by: magistrate101 on November 18, 2010, 10:28:23 pm
I really needed this, now it's a matter of time before RuneSmith starts workin' :D
Title: Re: DFHack 0.5.1
Post by: peterix on November 18, 2010, 10:31:08 pm
Just released 0.5.1. All the basic tools work on Windows.
Next step is to make the other tools work too (stonesense,etc.) and get the Linux support where it should be instead of trailing a few versions behind...
I really needed this, now it's a matter of time before RuneSmith starts workin' :D
You're fast. Also, 4:30 AM :P
Title: Re: DFHack 0.5.1
Post by: krisslanza on November 18, 2010, 10:33:04 pm
Now I can go back to revealing my sites and seeing awesome stuff, hooray!

I know I shouldn't rely on this so much, but it helps. A lot.
I wonder if the Hellhole hack or whatever will work with the new DFHack, even if that thing hasn't been updated...
Title: Re: DFHack 0.5.1
Post by: NecroRebel on November 18, 2010, 10:35:50 pm
I wonder if the Hellhole hack or whatever will work with the new DFHack, even if that thing hasn't been updated...
I was considering looking into that, as having revealed my new map, I found that I have no adamantine tubes on my current map  >:(

I thought there was supposed to be one tube in every 2x2 area on the local embark screen! My 3x3 map should be guarunteed at least one!  :'(
Title: Re: DFHack 0.5.1
Post by: magistrate101 on November 18, 2010, 10:54:16 pm
Just released 0.5.1. All the basic tools work on Windows.
Next step is to make the other tools work too (stonesense,etc.) and get the Linux support where it should be instead of trailing a few versions behind...
I really needed this, now it's a matter of time before RuneSmith starts workin' :D
You're fast. Also, 4:30 AM :P


no way, it's 9:52 PM here (CST)
And, we need a program that disables bogeymen or modifies the skill points you get in adventure mode, so your demigod lvl character can be a REAL demigod! Praise be to the Son of Armok!

edit:
I wonder if the Hellhole hack or whatever will work with the new DFHack, even if that thing hasn't been updated...
I was considering looking into that, as having revealed my new map, I found that I have no adamantine tubes on my current map  >:(

I thought there was supposed to be one tube in every 2x2 area on the local embark screen! My 3x3 map should be guarunteed at least one!  :'(

A tube is guranteed in every grid of the local map (Every square has the chance of one, but the entire grid HAS to produce at least one)

Almost forgot, does 0.5.1 cover 0.31.17 as well (haven't updated yet ;) )
Title: Re: DFHack 0.5.1
Post by: Selklubber on November 19, 2010, 05:12:06 am
I just downloaded this and I can't find dfXvdig! Do I need to get it from somewhere else?
Title: Re: DFHack 0.5.1
Post by: Rumrusher on November 19, 2010, 06:10:51 am
Just released 0.5.1. All the basic tools work on Windows.
Next step is to make the other tools work too (stonesense,etc.) and get the Linux support where it should be instead of trailing a few versions behind...
I really needed this, now it's a matter of time before RuneSmith starts workin' :D
You're fast. Also, 4:30 AM :P


no way, it's 9:52 PM here (CST)
And, we need a program that disables bogeymen or modifies the skill points you get in adventure mode, so your demigod lvl character can be a REAL demigod! Praise be to the Son of Armok!

edit:
I wonder if the Hellhole hack or whatever will work with the new DFHack, even if that thing hasn't been updated...
I was considering looking into that, as having revealed my new map, I found that I have no adamantine tubes on my current map  >:(

I thought there was supposed to be one tube in every 2x2 area on the local embark screen! My 3x3 map should be guarunteed at least one!  :'(

A tube is guranteed in every grid of the local map (Every square has the chance of one, but the entire grid HAS to produce at least one)

Almost forgot, does 0.5.1 cover 0.31.17 as well (haven't updated yet ;) )
if you check DffD the updated tweak grants you the power to dig holes which causes the bogeymen to vanish due to you are somehow not outside, and DFusion adventurer swap will allow you to swap to a underground dweller long enough for the bogeymen to vanish and give you enough time to leave the site. tweak you might need to rename dwarf fortress to dwarfort for it to work but I haven't had trouble with bogeymen since.
Title: Re: DFHack 0.5.1
Post by: peterix on November 19, 2010, 09:31:22 am
I just downloaded this and I can't find dfXvdig! Do I need to get it from somewhere else?
Right. forgot that.
Make a file called dfxvdig.bat and put this in:
Code: [Select]
dfvdig.exe -x
That should do the trick.
Title: Re: DFHack 0.5.1
Post by: Selklubber on November 19, 2010, 01:32:25 pm
Thanks, it worked!  :)
Title: Re: DFHack 0.5.1
Post by: Falc on November 20, 2010, 08:41:38 am
Minor bug report: dfreveal shows me I have a few z-levels of nice fluxy marble, but dfprospector claims I have no marble at all...
Title: Re: DFHack 0.5.1
Post by: krisslanza on November 20, 2010, 08:59:03 am
Minor bug report: dfreveal shows me I have a few z-levels of nice fluxy marble, but dfprospector claims I have no marble at all...

More then likely the marble is a stone layer, or some such. Prospector doesn't tell you the stone counts of layers.
Title: Re: DFHack 0.5.1
Post by: Falc on November 20, 2010, 11:15:47 am
Ah, didn't know that. Thanks.
Title: Re: DFHack 0.5.1
Post by: peterix on November 20, 2010, 04:19:24 pm
Ah, didn't know that. Thanks.
Actually prospector has some parameters.
Code: [Select]
'-a' -- show hidden
'-b' -- show base layers
On windows, I enable the 'show hidden' parameter so that it prints something reasonable when you just double-click the icon. Giving it the '-b' will make it print the layer stone too. For example create "layerprospector.bat" and put this in:
Code: [Select]
dfprospector.exe -bNow that I think about it, I'll put all kinds of .bat files for running stuff in different modes into the next release... possibly integrate this with the build system too, so it doesn't get 'forgotten' again ~_~
Title: Re: DFHack 0.5.1
Post by: Quietust on November 20, 2010, 05:41:17 pm
An option for dfcleanmap to remove "water" contaminants would be nice, specifically because they're otherwise never cleaned up (they happen most often when milking creatures using buckets that were left around with water in them).
Title: Re: DFHack 0.5.1
Post by: Falc on November 20, 2010, 11:51:34 pm
Actually prospector has some parameters.
Code: [Select]
'-a' -- show hidden
'-b' -- show base layers
On windows, I enable the 'show hidden' parameter so that it prints something reasonable when you just double-click the icon. Giving it the '-b' will make it print the layer stone too. For example create "layerprospector.bat" and put this in:
Code: [Select]
dfprospector.exe -bNow that I think about it, I'll put all kinds of .bat files for running stuff in different modes into the next release... possibly integrate this with the build system too, so it doesn't get 'forgotten' again ~_~

Might I perhaps suggest also allowing '-h' which would then print all possible parameters?
Title: Re: DFHack 0.5.1
Post by: bowdown2q on November 21, 2010, 02:55:39 pm
hm.

Is it possible to create a tool which removes forbid/dump designations globally? I know I can do it on the stocks screen, but that can be a LOT of manual button-presses.

I'm not a coder, but if somebody can give me some tips, I could probably throw something together..
Title: Re: DFHack 0.5.1
Post by: Quietust on November 21, 2010, 05:43:12 pm
Is it possible to create a tool which removes forbid/dump designations globally?

Certainly - just take my "cleartask" tool and change the flags it clears.
Title: Re: DFHack 0.5.1
Post by: magistrate101 on November 21, 2010, 06:02:23 pm
Is it possible to create a tool which removes forbid/dump designations globally?

Certainly - just take my "cleartask" tool and change the flags it clears.

Could somebody throw together a tool that lets you place animals? and flag them as pets if you so desire... (I want a maze filled with BogeyMen as a defensive line for my fortress ^.^)
Title: Re: DFHack 0.5.1
Post by: SquidgyB on November 21, 2010, 06:07:35 pm
Sorry to add another question but - would it be possible to create a tool which removes mud?
Title: Re: DFHack 0.5.1
Post by: bowdown2q on November 21, 2010, 06:07:59 pm
I was under the impression that critters create crazy issues.

Also, I have no idea how to work this code - and cleartask isn't part of the tools in the dl?
Title: Re: DFHack 0.5.1
Post by: Rumrusher on November 21, 2010, 06:23:06 pm
Is it possible to create a tool which removes forbid/dump designations globally?

Certainly - just take my "cleartask" tool and change the flags it clears.

Could somebody throw together a tool that lets you place animals? and flag them as pets if you so desire... (I want a maze filled with BogeyMen as a defensive line for my fortress ^.^)
Daruis had a steal function in his 40d version of friendship enhancer which would if selected will convert the creature into a miner in your fort. though during fusion it seems he never brought that back.
maybe due to having runesmith's tame flag was just good enough for that.
Title: Re: DFHack 0.5.1
Post by: LealNightrunner on November 22, 2010, 08:54:29 pm
Thanks for putting in the forcepause util!
Title: Re: DFHack 0.5.1
Post by: magistrate101 on November 22, 2010, 11:03:33 pm
I was under the impression that critters create crazy issues.

Also, I have no idea how to work this code - and cleartask isn't part of the tools in the dl?

You're thinkin of the wrong thing :D
I mean a tool that spawns the ENTIRE creature through memory hacking, it sounds dwarven, since, by criteria I recently saw, it will be extremely difficult to make, and probably won't work in the first place >:)
Title: Re: DFHack 0.5.1
Post by: Rumrusher on November 23, 2010, 12:20:05 am
I was under the impression that critters create crazy issues.

Also, I have no idea how to work this code - and cleartask isn't part of the tools in the dl?

You're thinkin of the wrong thing :D
I mean a tool that spawns the ENTIRE creature through memory hacking, it sounds dwarven, since, by criteria I recently saw, it will be extremely difficult to make, and probably won't work in the first place >:)
so you want arena mode spawning ability in both fort and adventurer mode?
Title: Re: DFHack 0.5.1
Post by: jaked122 on November 24, 2010, 02:33:09 pm
are you looking for any help peterix? I might be able to program a high level interface to your library if you'd like.
Title: Re: DFHack 0.5.1
Post by: peterix on November 24, 2010, 03:24:17 pm
are you looking for any help peterix? I might be able to program a high level interface to your library if you'd like.
Always. This is something that's really missing.  I've done a bit of work on a map cache for the vdig tool (for flood fills) and that could be refactored into something reasonably high level I guess... rest is a ton of low level stuff with just enough abstraction to shield the user from doing the memory access themselves.

Anyway, there's an IRC channel on freenode: #dfhack

@everyone else: Sorry for the wait on the other offsets. I was terribly busy lately.
Title: Re: DFHack 0.5.1
Post by: Axecleaver on December 03, 2010, 05:38:42 am
I read somewhere a message that suggested there was talk of adding more official support for mods in a later version of DF - as in code changes to make it easier to write or update mods. Can someone confirm this? And, if true, wouldn't this lessen the (currently vital) importance of dfhack to other mods?
Title: Re: DFHack 0.5.1
Post by: Gara-nis on December 03, 2010, 01:19:22 pm
As far as I've read, toady is not planning on implementing an API like that anytime soon, if at all, though footkerchief or someone like that would have a more definitive answer.
Title: Re: DFHack 0.5.1
Post by: DFPongo on December 03, 2010, 02:02:32 pm
Last I saw on it, Toady had considered it fully and was not going to do the API thing. He had good reasons that I doubt have changed, or that the tone of some of these threads would change.
Title: Re: DFHack 0.5.1
Post by: Igfig on December 06, 2010, 10:18:56 pm
Something I've been wondering about recently.  If DFHack can find all the blood and contaminants and stuff on the map, can it do the same for stones?  As in, the colossal profusion of worthless stones that end up all over your fortress and slow your FPS to a crawl?

Can this be done easily with a slight modification of dfcleanmap.exe, or would it take something entirely new?
Title: Re: DFHack 0.5.1
Post by: Gara-nis on December 06, 2010, 11:50:35 pm
 Looking through the code, I think splatters work differently from normal items you might find on the ground.

You'd probably have to code a fresh util.

Edit: There would probably need to be some recoding done in the dfhack items module as well. Also, it isn't possible to just remove items without causing glitches. It would be possible to change stone to some useless stone that could could then mod to evaporate at room temperature in the raws, but there would need to be some way to distinguish between unused stone and stone that is in constructions, and as far as I can tell, there is no easy way to do that.

TL;DR -- No.
Title: Re: DFHack 0.5.1
Post by: peterix on December 07, 2010, 07:48:05 am
Looking through the code, I think splatters work differently from normal items you might find on the ground.
Very differently. Splatters are bitmaps layered over map blocks. Items are individually tracked objects.
You'd probably have to code a fresh util.

Edit: There would probably need to be some recoding done in the dfhack items module as well. Also, it isn't possible to just remove items without causing glitches. It would be possible to change stone to some useless stone that could could then mod to evaporate at room temperature in the raws, but there would need to be some way to distinguish between unused stone and stone that is in constructions, and as far as I can tell, there is no easy way to do that.

TL;DR -- No.
Yes, the items module would have to get the support for flags back. Then it should be possible to check if the item is used for something... and set the 'on fire' flag on it if it isn't. The utility that does this would have to limit the number of items so affected, because having so many burning items around can lag DF too much (think freeze).
Title: Re: DFHack 0.5.1
Post by: bowdown2q on December 07, 2010, 01:02:40 pm

What if the utility designated all stone under the cursor? That ought to take care of excess stone without killing the system.
Honestly, I find the best way to deal with useless rocks is to quantum stockpile them in a dump, and occasionally unforbid the pile.
Title: Re: DFHack 0.5.1
Post by: Askot Bokbondeler on December 07, 2010, 03:26:32 pm
couldn't it melt all the items mark'd for (D)umping?
Title: Re: DFHack 0.5.1
Post by: Homr_Zodyssey on December 07, 2010, 03:45:55 pm
Hello. 
I recently downloaded and became addicted to Dwarf Fortress 31.18 SDL running on Windows 7.  I'm trying to figure out if there is any flux stone in my map.  (I coulda swore I put it as a requirement in the embark finder thingy.)  So, I downloaded dfhack-bin-0.5.0.2.  I tried to run dfprospector.exe.  At first, I kept getting "couldn't find a suitable process".  Then I came across this thread, and I added in the offsets posted by daftfad a couple weeks ago.  Now, I get this:
Quote
Match found! Using version v0.31.18 SDL.

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

After that, DwarfFortress.exe is locked up and I have to kill it.  Have I done something wrong?  Can anyone give me a hint?

I apologize if this has already been answered somewhere.  I tried researching it, but I'm at a loss.

--Homr

--Addendum--
After playing around a bit more, I realized that dfreveal works fine.  Unfortunately the first layer of Marble is 43 levels down.  :'(






Title: Re: DFHack 0.5.1
Post by: twilightdusk on December 07, 2010, 09:07:21 pm
Is there any way to use DFhack to locate aquifers? I'm currently on a multi-biome embark (volcano and sand desert), and I was relying on the existence of an aquifer layer the embark screen said was in the desert, but I can't seem to find it. I downloaded this with the idea of using DFreveal to locate it, but it doesn't distinguish between aquifer sand and regular sand. Any advice? other than just digging holes until I manage to find it?
Title: Re: DFHack 0.5.1
Post by: bowdown2q on December 07, 2010, 10:28:24 pm
Start DFreveal, and the go to DF and hit it up like you were doing to dig. wet stone/sand should flash blue.
Title: Re: DFHack 0.5.1
Post by: twilightdusk on December 07, 2010, 10:34:29 pm
Aquifers don't show up as wet stone though, do they? I thought the wet stone warning only happened if the water was actually there, and aquifers don't produce water until a side is open.

Yea, just tested it. Either the game lied about there being an aquifer or the aquifer tiles don't automatically show up as wet.
Title: Re: DFHack 0.5.1
Post by: Quietust on December 07, 2010, 10:51:07 pm
Looking through the code, I think splatters work differently from normal items you might find on the ground.
Very differently. Splatters are bitmaps layered over map blocks. Items are individually tracked objects.

On that topic, is it known where the game keeps track of "debris" (i.e. the "≥" and "≤" from expended ammunition)? A way to clear those away would be really nice, and it'd be an ideal addition to dfcleanmap.
Title: Re: DFHack 0.5.1
Post by: peterix on December 08, 2010, 04:03:43 am
Looking through the code, I think splatters work differently from normal items you might find on the ground.
Very differently. Splatters are bitmaps layered over map blocks. Items are individually tracked objects.

On that topic, is it known where the game keeps track of "debris" (i.e. the "≥" and "≤" from expended ammunition)? A way to clear those away would be really nice, and it'd be an ideal addition to dfcleanmap.
I'd assume it's still in one of the tile flag fields. Hmm.. can you add it to the problem tracker on github?
Aquifers don't show up as wet stone though, do they? I thought the wet stone warning only happened if the water was actually there, and aquifers don't produce water until a side is open.
Yea, just tested it. Either the game lied about there being an aquifer or the aquifer tiles don't automatically show up as wet.
Aquifers are geology related and the wet tiles probably come from water being nearby/the tiles being open to air. Currently, dfhack only reads the layer materials from the geology data, so a bit of research would be required. But then we could flip those bits and get rid of those pesky things .. or just see them ;)
Title: Re: DFHack 0.5.1
Post by: Rose on December 08, 2010, 04:15:43 am
the behavior must have changed since .28 then, because there, you'd see the whole aquifier layer as flashing blue when you tried to dig it.
Title: Re: DFHack 0.5.1
Post by: twilightdusk on December 08, 2010, 06:59:32 am
Aquifers don't show up as wet stone though, do they? I thought the wet stone warning only happened if the water was actually there, and aquifers don't produce water until a side is open.
Yea, just tested it. Either the game lied about there being an aquifer or the aquifer tiles don't automatically show up as wet.
Aquifers are geology related and the wet tiles probably come from water being nearby/the tiles being open to air. Currently, dfhack only reads the layer materials from the geology data, so a bit of research would be required. But then we could flip those bits and get rid of those pesky things .. or just see them ;)

Visibility is all I'm looking for in this case (no other source of water until I'm ready to brave the caverns). If you could make some tool to locate aquifiers I would be very appreciative  :)
Title: Re: DFHack 0.5.1
Post by: twalberg on December 08, 2010, 07:43:50 am
dfreveal will show aquifers - just be careful to not unpause, but hit 'd' 'm' to designate a mining area - aquifers (and any other wet stone features, e.g. river borders, etc...) will blink blue.
Title: Re: DFHack 0.5.1
Post by: Quietust on December 08, 2010, 11:16:41 am
On that topic, is it known where the game keeps track of "debris" (i.e. the "≥" and "≤" from expended ammunition)? A way to clear those away would be really nice, and it'd be an ideal addition to dfcleanmap.
I'd assume it's still in one of the tile flag fields. Hmm.. can you add it to the problem tracker on github?
I would, but I don't have an account on github (and I don't have a good enough reason to sign up). Anybody else who has an account is welcome to add it.
Title: Re: DFHack 0.5.1
Post by: twilightdusk on December 08, 2010, 03:27:44 pm
dfreveal will show aquifers - just be careful to not unpause, but hit 'd' 'm' to designate a mining area - aquifers (and any other wet stone features, e.g. river borders, etc...) will blink blue.
Aquifiers don't show up as wet stone though, do they? I thought the wet stone warning only happened if the water was actually there, and aquifiers don't produce water until a side is open.

Yea, just tested it. Either the game lied about there being an aquifier or the aquifier tiles don't automatically show up as wet.
Title: Re: DFHack 0.5.1
Post by: Askot Bokbondeler on December 09, 2010, 05:45:06 am
the game lied about there being an aquifier
have you checked every levels? throughly?

also, aquifer
Title: Re: DFHack 0.5.1
Post by: twilightdusk on December 09, 2010, 05:30:50 pm
the game lied about there being an aquifier
have you checked every levels? throughly?

also, aquifer

Tested every layer of sand on the map, no blue.
Title: Re: DFHack 0.5.1
Post by: TolyK on December 12, 2010, 04:48:21 am
btw it also occurs on soil ;)

other than that no ideas on what the problem could be. bug?
Title: Re: DFHack 0.5.1
Post by: foil on December 14, 2010, 04:24:05 pm
Hello, How exactly do i get dfliquids.exe to work?..  Ive tried putting the (k)look cursor onto a tile and typing many different commands from the wiki and the help file but it still will not make magma...

Does the thing have to be run in open space or a revealed area? 

All im trying to do is get some magma upto almost the top without making a 150 level piston or pump stack.

Does it even work with v.18 yet?
Title: Re: DFHack 0.5.1
Post by: NecroRebel on December 14, 2010, 04:39:01 pm
It does work with v31.18.

Step by step instructions for making magma with dfliquids:

1. Start Dwarf Fortress
2. Load your fortress.
3. Minimize Dwarf Fortress or otherwise alt-tab out of it.
4. Open dfliquids
5. Go back into Dwarf Fortress
6. Go into the loo(k) or (d)esignations cursor
7. Scroll over the tile you want magma in
8. Alt-tab to dfliquids
9. Hit enter (the line in dfliquids should be blank; this is the "execute in Dwarf Fortress" line, since it doesn't have anything else to do)

Now there's 7/7 magma in that tile. If you're using the loo(k) cursor, it won't actually tell you that the magma has appeared until you move the cursor off the tile then back on, but the magma will be there. It doesn't have to be done on a revealed tile, either. The most likely difficulties you were having were probably either that you weren't executing a blank line, or you weren't moving the cursor in DF to check if it actually worked.
Title: Re: DFHack 0.5.1
Post by: foil on December 14, 2010, 05:07:09 pm
ah sweet, I just 1/2 figured it out myself.  All the tuts say u need to type the commands in every time but all you do it hit enter lol.

I ended up just building a huge tank and filling it with several presses of enter, Great success.

Is there ever magma near the surface as ive never found it above -80 or so levels.

Are you expected to usually build a 100 pump tall stack etc etc to get magma to the surface?
Title: Re: DFHack 0.5.1
Post by: Caudyr on December 14, 2010, 05:12:46 pm
Occasionally you'll find lava tubes that protrude up into the upper layers - but usually it seems like they're pretty far down there. The closest I've seen them in areas that weren't volcanoes was around 15ish levels down, so they're always a little ways down there I believe. I'm sure they can be closer to the surface with the right location and/or map generator settings, etc.
Title: Re: DFHack 0.5.1
Post by: Musashi on December 16, 2010, 04:43:30 pm
No more insta-crash if I happen to look at the wrong tile. And FPS IS increasing.  I love dfcleanmap so much. ;_;
Title: Re: DFHack 0.5.1
Post by: ext0l on December 16, 2010, 10:47:12 pm
I suck at linux.
How can I get this to work on Ubuntu 10.04?

I've tried using wine, but it keeps giving me an error
Spoiler (click to show/hide)
Title: Re: DFHack 0.5.1
Post by: zxcvmnb on December 17, 2010, 06:14:06 am
I suck at linux.
How can I get this to work on Ubuntu 10.04?

I've tried using wine, but it keeps giving me an error
Spoiler (click to show/hide)
Hmm, it worked for me with Ubuntu 10.04 using Wine with both DFHack and the Windows version of DF. Got a missing dll error from DF, used winetricks, but then it worked fine. Are you compiling DFHack yourself or using the binary tools?
Title: Re: DFHack 0.5.1
Post by: Korgana on December 17, 2010, 12:07:05 pm
Hi.
I've got a little problem with dfliquids

I was trying to make a waterfall, and unfortunately, the flow was "a bit" too high, my fortress quickly get flooded, on almost every floors (waterfall from +1 to -80), and dwarves start to drown.

So, i've used dfliquids, removing all the waters, and shut the waterfall with the floodgate.

But, all tiles that have been marked as unaccessible, due to high level water, are still unaccessible.

A large part of my fortress is unaccessible, and almost all dwarves are, more or less, stuck, sleeping on floor ; although they have royal bedroom, and so on.

Is there a way to make all this tiles back accessible ?

P.S : sorry for my english  :-[
Title: Re: DFHack 0.5.1
Post by: Rose on December 17, 2010, 12:08:57 pm
on each inaccessible tile, put 1 lava. when the lava is stolen by evil elves, it will become accessible.
Title: Re: DFHack 0.5.1
Post by: ext0l on December 17, 2010, 03:26:04 pm
I suck at linux.
How can I get this to work on Ubuntu 10.04?

I've tried using wine, but it keeps giving me an error
Spoiler (click to show/hide)
Hmm, it worked for me with Ubuntu 10.04 using Wine with both DFHack and the Windows version of DF. Got a missing dll error from DF, used winetricks, but then it worked fine. Are you compiling DFHack yourself or using the binary tools?

Ok if I use wine for both the DF hack binaries and DF_win then it works fine.
But this kills my fps. How do i compile DF hack?
Title: Re: DFHack 0.5.1
Post by: Korgana on December 17, 2010, 05:59:24 pm
on each inaccessible tile, put 1 lava. when the lava is stolen by evil elves, it will become accessible.
Hum, is it a joke ?  :o

It dont seems to be a good idea to put lava in a few thousands of tiles, even only with 1 level.
Title: Re: DFHack 0.5.1
Post by: Vattic on December 17, 2010, 06:04:29 pm
No joke. If you hack fluids out of a map it doesn't reset some flag* which indicates if a tile is passable; If you place 1/7 depth magma and let it evaporate the flag will get reset.

*Not sure if it is a flag or some other variable.
Title: Re: DFHack 0.5.1
Post by: Korgana on December 17, 2010, 06:56:33 pm
Will that work with 1/7 of water ?

As i said, there is thousands of inacessible tiles, and i can't put magma on them individualy (it will take me months).
So, i have to put magma/water in something like 8000-10000 tiles, on 80+ z-levels. Does'nt sound well if it's magma.

Edit : ok, it's working. And i didn't had to flood so much (thanks to the seasonal save)
Title: Re: DFHack 0.5.1
Post by: ext0l on December 17, 2010, 10:24:31 pm
I compiled DFHack on linux but it's unable to find the process
This error keeps appearing
Code: [Select]
terminate called after throwing an instance of 'DFHack::Error::NoProcess'
  what():  couldn't find a suitable process
Aborted
Title: Re: DFHack 0.5.1
Post by: peterix on December 18, 2010, 02:43:22 am
I compiled DFHack on linux but it's unable to find the process
This error keeps appearing
Code: [Select]
terminate called after throwing an instance of 'DFHack::Error::NoProcess'
  what():  couldn't find a suitable process
Aborted
Latest supported DF version on Linux is currently 31.16. It won't recognize anything newer.
Title: Re: DFHack 0.5.1
Post by: Antonater on December 25, 2010, 08:21:16 am
ive been looking everywhere but i cant find anything explaining how to use this, trying to use df clean, where are instructions???
Title: Re: DFHack 0.5.1
Post by: rephikul on December 25, 2010, 09:08:57 am
Readme.html?
Title: Re: DFHack 0.5.1
Post by: peterix on December 25, 2010, 09:44:02 am
ive been looking everywhere but i cant find anything explaining how to use this, trying to use df clean, where are instructions???
Run df, load a fort, run the tool. That's all. Tools that need more input from you will ask nicely in a terminal window.
Title: Re: DFHack 0.5.1
Post by: Uristocrat on December 27, 2010, 09:41:23 pm
Wanted to report an issue on the tracker like the first message said to, but I have no GitHub account.

Anyhow, the issue itself is pretty simple:  dfprospector doesn't list MARBLE anywhere in its output and that's kind of hard to miss (it's a layer stone that should have covered about half the map).  Actually... wait... I can't find any layer stones on here?  Not gabbro or anything else.  Marble and obsidian are the only one I care much about, though.

While I'm at it, I might as well toss in a feature request.  It would be lovely if you could separate the output of dfprospector a little, so that there are categories.  In other words, make the output look something like:

*** GEMS ***
RUBY: 20
DIAMOND: 25

*** NON-ORE ECONOMIC STONES ***
CALCITE: 1234
MARBLE:  2456
OBSIDIAN:  2345
GYPSUM:  23456
BITUMINOUS_COAL:  1345

*** METAL ORES ***
NATIVE_SILVER:  1234
MALACHITE:  2345
RAW_ADAMANTINE: 7

*** ROCKS ***
ORPIMENT:  1234
SLADE:  12345
MICROLINE:  9999999999
Title: Re: DFHack 0.5.1
Post by: peterix on December 28, 2010, 05:12:46 pm
Wanted to report an issue on the tracker like the first message said to, but I have no GitHub account.
Added it there (https://github.com/peterix/dfhack/issues/issue/57) so I don't forget.
Title: Re: DFHack 0.5.1
Post by: snooptodd on December 29, 2010, 12:06:20 am
Code: [Select]
// produces a list of vein materials available on the map. can be run with '-a' modifier to show even unrevealed minerals deep underground
// with -b modifier, it will show base layer materials too

so to show marble or any other base layer you use dfprospector.exe -b
Title: Re: DFHack 0.5.1
Post by: Quietust on December 29, 2010, 11:41:18 am
On the topic of dfprospector, there seems to be an oddity with how it's counting minerals - I just embarked on a test site which dfprospector claims contains 96 clusters of clear diamonds, yet a visual inspection (aided by changing clear diamond's tile and color to stand out from everything else) only managed to locate 55 tiles. The magma sea cut into a large section of gabbro - perhaps it's being confused by veins/clusters that happen to have been overwritten with semi-molten rock?
Title: Re: DFHack 0.5.1
Post by: zilpin on December 29, 2010, 12:30:30 pm
The magma sea cut into a large section of gabbro - perhaps it's being confused by veins/clusters that happen to have been overwritten with semi-molten rock?

Not quite, the semi-molten is considered a "feature" vein in the data structure, so it can't be considered part of gem vein at the same time.

But it may be counting tiles which were veins, but got overwritten with empty space in the caves.
The empty space will still maintain its identity as once being part of a vein.
Also consider floors.
Title: Re: DFHack 0.5.1
Post by: Quietust on December 29, 2010, 12:49:03 pm
But it may be counting tiles which were veins, but got overwritten with empty space in the caves.
The empty space will still maintain its identity as once being part of a vein.
Also consider floors.

I considered that possibility, but dfprospector does seem to properly recognize (and not count) mined tiles.
Title: Re: DFHack 0.5.1
Post by: peterix on December 29, 2010, 01:11:21 pm
Well, it was never intended to give exact numbers, just a value that gives you the idea of what to expect. The original purpose was to scan only the visible tiles when you embark, because that's what I always did manually (and it was really bugging me on mountain embarks with lots of z-levels to look at).
Title: Re: DFHack 0.5.1
Post by: Jar of Jam on December 31, 2010, 06:57:08 pm
I'm assuming it's expected behavior if FPS drops noticeably even after unrevealing what I've revealed ?
Title: Re: DFHack 0.5.1
Post by: jaxad0127 on December 31, 2010, 10:23:35 pm
Did you unpause before unrevealing?
Title: Re: DFHack 0.5.1
Post by: Jar of Jam on January 01, 2011, 09:16:19 am
Did you unpause before unrevealing?
Yeah, I guess I did it once, receiving the "Screams and stuff" message, indicating hell. If I don't do that in the next embarks, everything should be fine ?
Title: Re: DFHack 0.5.1
Post by: TolyK on January 01, 2011, 12:08:37 pm
yeah. unpausing will cause some tiles to be incorrectly unrevealed and will cause lots of creatures spawning
Title: Re: DFHack 0.5.1
Post by: peterix on January 01, 2011, 10:31:58 pm
yeah. unpausing will cause some tiles to be incorrectly unrevealed and will cause lots of creatures spawning
Just a small correction here:
If you reveal and let the demons spawn, unrevealing the map won't help anymore, because it won't remove the demons. To avoid problems like this, don't unpause with a revealed map.
Title: Re: DFHack 0.5.1
Post by: Tjalling on January 01, 2011, 10:58:08 pm
I can't seem to find dfXvdig in the .zip that I downloaded. Is this correct?
Title: Re: DFHack 0.5.1
Post by: Rose on January 02, 2011, 12:22:06 am
yeah. unpausing will cause some tiles to be incorrectly unrevealed and will cause lots of creatures spawning
Just a small correction here:
If you reveal and let the demons spawn, unrevealing the map won't help anymore, because it won't remove the demons. To avoid problems like this, don't unpause with a revealed map.

what's worse, you will be the demons.
Title: Re: DFHack 0.5.1
Post by: dragonshardz on January 02, 2011, 01:27:54 am
And then Japa was demons.
Title: Re: DFHack 0.5.1
Post by: Johnfalcon99977 on January 04, 2011, 07:32:56 pm
I need help with DFliquid. How do I place magma?
Title: Re: DFHack 0.5.1
Post by: telamon on January 04, 2011, 08:52:45 pm
Basically, when you open dfliquids, you see that string of .... stuff. That stuff indicates several flags about what dfliquids will do, when ordered to "place liquid". The commands are almost all one character long; you just press enter after typing them.
The first part is your current liquid; either magma or water. m changes to magma, w to water.
The next part is how much liquid to place; 0 to 7. Just input the desired level as a number between 0 to 7.
The f+ and f- things indicate whether or not to set the flow flag. When DF checks for flowing liquids, if the liquid was placed with flow ON, the liquid will flow just like anything else, if it was placed with flow OFF, it will sit there like a brick and not move until you remove it yourself, or interrupt it somehow. I don't know the specifics of what makes stuff flow. To turn this flag on/off, just input f+ or f-.
The s+, s. and s- flags indicate whether to set, add or remove. If s. is the current state, then all squares affected by the next dfliquids place command will be SET to the desired level of the desired liquid. If s+ is the current state, tiles will only be changed if they'd be gaining liquid. If s- is the current state, tiles will only be changed if they'd be losing liquid. For example, if you have a 3-tile long test space with 0, 4 and 7 levels of non-flowing water, and you set your current water level to 7, then place on the 0 tile with s-... basically, since the tile is currently 0 water and you'd be setting it to 7, this action would be ignored since you have the s- flag on - remove only.
Pressing p will set dfliquids to point by point application. Pressing r will set it to rectangular. You specify the width and height of the rectangle.
To actually put stuff down, go into [d]esignations or loo[k] in DF itself and move the cursor to the desired location. If you have it set on point to point mode, only the space your cursor is currently on will be filled; if in rectangular, the current location of the cursor will be treated as the top left of the rectangle. Pressing ENTER with no characters then fires a place command, which will drop liquids onto the screen.
As long as you don't unpause, you can always clean up your mistakes with no ill effect using dfliquids again, so you can  mess around until you get the hang of it.
Title: Re: DFHack 0.5.1
Post by: dragonshardz on January 05, 2011, 06:23:01 am
Or you could simply type "help" into the command prompt...
Title: Re: DFHack 0.5.1
Post by: Ferrum on January 09, 2011, 07:51:50 pm
I can't seem to find dfXvdig in the .zip that I downloaded. Is this correct?

look here...

I just downloaded this and I can't find dfXvdig! Do I need to get it from somewhere else?
Right. forgot that.
Make a file called dfxvdig.bat and put this in:
Code: [Select]
dfvdig.exe -x
That should do the trick.
Title: Re: DFHack 0.5.1
Post by: Nami on January 15, 2011, 10:27:52 pm
Okay, I was just wondering, how do I use this to make Runesmith to work?  IT says it uses the DFhack Library but then it spouts all this nonsense about not being able to connect, and I can't find out what to do -.-;;; 
Title: Re: DFHack 0.5.1
Post by: telamon on January 16, 2011, 09:35:59 pm
I've tried it too and, yeah, it doesn't work. I don't think support for .18 is complete yet so we'll all just have to sit tight.
Quote
Preliminary support for DF 31.18 on Windows.
Title: Re: DFHack 0.5.1
Post by: BigD145 on January 17, 2011, 02:04:34 pm
If it worked it would have been done already. It does not work. Runesmith has different hoops to jump through.
Title: Re: DFHack 0.5.1
Post by: TolyK on January 17, 2011, 02:10:12 pm
dfliquids is awesome for adventure mode.
I pretend I build obsidian walls to protect me  :P
Title: Re: DFHack 0.5.1
Post by: yeath on January 17, 2011, 04:14:26 pm
I'm re-posting my question from a thread I created in the "modding" forum, because I'm hoping to get some more help here.

I'm running a vanilla DF version 31.18, and DF Hack version 0.5.1.  I've tried creating multiple worlds and embarking at different 4x4 sites in those worlds, but every time I run dfreveal, it reports that it is revealing and to please wait.  And I wait for 15 minutes, and nothing has changed.  Others have said that it typically takes 10-15 seconds, so something seems to be wrong.  Any ideas?

Here is the exact output of dfreveal.exe
Spoiler (click to show/hide)

And not sure it helps, but here's my System Information
Spoiler (click to show/hide)
Title: Re: DFHack 0.5.1
Post by: Moander on January 19, 2011, 01:47:36 pm
Is there any possibility that a Linux v0.31.18 memory.xml definition will be found someday?

Is there anything someone that is not a DF memory expert can do to help?
Title: Re: DFHack 0.5.1
Post by: zxcvmnb on January 19, 2011, 06:12:27 pm
Is there any possibility that a Linux v0.31.18 memory.xml definition will be found someday?

Is there anything someone that is not a DF memory expert can do to help?
This. Also, out of curiousity, what tools are used to get the offsets in Linux?
Title: Re: DFHack 0.5.1
Post by: Rose on January 19, 2011, 09:09:39 pm
peterix is making his own linux memory searching tool that will make things a lot easier, but he can't continue that till February.
Title: Re: DFHack 0.5.1
Post by: peterix on January 19, 2011, 09:42:37 pm
Is there any possibility that a Linux v0.31.18 memory.xml definition will be found someday?

Is there anything someone that is not a DF memory expert can do to help?
This. Also, out of curiousity, what tools are used to get the offsets in Linux?
What Japa said.

The same tools that are used for Windows really. Edb for most of the poking around in memory, my own tools for automatic search(unfinished and not intended for general use) and IDA Pro when I need to look at how DF does things.

Title: Re: DFHack 0.5.1
Post by: twalberg on January 21, 2011, 10:50:56 am
I've had pretty good luck getting a lot of the offsets (on Linux) by using 'objdump -d --no-show-raw-insn' on the old version and the new version, then running diff against the two dumps. Assuming I know for certain a particular offset in the old version, the new one is pretty easy to find from the diff output, as many of them appear as constants in the code. Doesn't get all of them, though, and you have to have known good values for the old version first...
Title: Re: DFHack 0.5.1
Post by: folgsam on January 27, 2011, 03:30:03 pm
Vista 64bit OS

Having some trouble using the tools, they seem to recognize the game :
Match found! Using version v.0.31.18 SDL.
Match found! Using version v.0.31.18 SDL.
(note that that this line is printed twice)

according to the tools, everything works just fine, the only problem is though, that the currently running fort seems pretty unaffected by dfcleanmap, dfweather, dfreveal and pretty much everything else.
Anyone else had this problem?
Title: Re: DFHack 0.5.1
Post by: profit on January 28, 2011, 05:41:21 pm
Try running the tool as administrator.

There are weird times when it is required.  I dont know those times just that sometimes they occur and sometimes they do not.

(One of the NOT times is if you run DF from a folder on your desktop and run hack from a folder on your desktop in windows 7 64 bit... For some reason then you can run in normal mode and everything works... Move one of those folders to something like program files and it doesn't... sometimes!)

The same thing goes for Dwarf Therapist...
Title: Re: DFHack 0.5.1
Post by: BigD145 on January 28, 2011, 06:40:41 pm
Or find an administrators unlocker tool. I don't know of any software on this site that would do your computer great harm, except the CPU melting tendencies of DF itself.
Title: Re: DFHack 0.5.1
Post by: Jacob/Lee on January 29, 2011, 03:03:26 pm
Thanks man, now my Dwarf Wash is effective with Cleanmap, and I no longer need to babysit my coal mining operations.
Title: Re: DFHack 0.5.1
Post by: folgsam on January 29, 2011, 09:27:37 pm
Try running the tool as administrator.

There are weird times when it is required.  I dont know those times just that sometimes they occur and sometimes they do not.

(One of the NOT times is if you run DF from a folder on your desktop and run hack from a folder on your desktop in windows 7 64 bit... For some reason then you can run in normal mode and everything works... Move one of those folders to something like program files and it doesn't... sometimes!)

The same thing goes for Dwarf Therapist...

Thank you very much, that was indeed the whole of the problem.

Though I am running everything from desktop (at least everything dwarf related), I had to execute the hacks as an administrator. Somehow that sounds awesome.


Title: Re: DFHack 0.5.1
Post by: ben8763 on February 07, 2011, 10:57:54 pm
I'm having issues running any of the tools, they're not getting the cursor coords so I am unable to use the liquid tool or position tool, I have tried running the hacks as admin and have moved both the df file and hacks file to the desktop to run them from there and still nothing
Title: Re: DFHack 0.5.1
Post by: strich on February 09, 2011, 01:55:20 am
Can anyone give me a quick overview of where DFHack is at now-a-days? I haven't been around for awhile and I'm just wondering if progress has been made on features such as item lists and locations, etc.
Title: Re: DFHack 0.5.1
Post by: Rose on February 09, 2011, 02:03:27 am
peterix just started working on it again.
Title: Re: DFHack 0.5.1
Post by: strich on February 09, 2011, 02:16:43 am
peterix just started working on it again.
Where did he leave off? What is he working on now?
Title: Re: DFHack 0.5.1
Post by: peterix on February 09, 2011, 04:41:41 am
peterix just started working on it again.
Where did he leave off? What is he working on now?
Offset search automation.
Title: Re: DFHack 0.5.1
Post by: strich on February 09, 2011, 05:50:38 am
Ah, so improving the current situation? I presume finding those fabled item lists and properties is still beyond us at this point? Any new ideas on how to fix that up?
Title: Re: DFHack 0.5.1
Post by: strich on February 10, 2011, 07:20:55 am
DFHack doesn't currently compile via VS2010 on Windows:
Code: [Select]
1>..\..\..\library\DFProcess-windows.cpp(298): error C2011: '_MEMORY_BASIC_INFORMATION' : 'struct' type redefinition
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winnt.h(8775) : see declaration of '_MEMORY_BASIC_INFORMATION'

Seems it is trying to redefine the same struct from WINNT.H. Any ideas?
Title: Re: DFHack 0.5.1
Post by: magistrate101 on February 10, 2011, 05:46:37 pm
peterix just started working on it again.
Where did he leave off? What is he working on now?
Offset search automation.
I actually have an idea of how this would work... though, it would be VERY ineffective, inefficient, and would take a while...
Have the program take the entire .exe file, scan it for offsets, and compare what the offsets do to it's own database, and if it finds a match, it updates. I would have 0 clue on how to do this, but I get the feeling cheat engine might be a nice example...
Title: Re: DFHack 0.5.1
Post by: Thundercraft on February 10, 2011, 11:11:09 pm
I want to code a simple tool to retrieve the map coordinates, the latitude and longitude of the embark site, the region, as well as the world size. However, I'm trying to code this in AutoHotkey (http://www.autohotkey.com/) as my C#/++ is incredibly rusty (i.e., basically nonexistent).

Question: What variable type are the following values stored in? (That is: UInt, Int, Int64, Short, UShort, Double, or Float?)

Code: [Select]
region_x :=
region_y :=
region_z :=
world_size_x :=
world_size_y :=
x_count :=
x_count_block :=
y_count :=
y_count_block :=
z_count :=
z_count_block :=
Title: Re: DFHack 0.5.1
Post by: Rose on February 10, 2011, 11:44:30 pm
region blocks aren't currently accessible from DFhack, but it's being worked on.
Title: Re: DFHack 0.5.1
Post by: Andux on February 11, 2011, 08:32:48 am
Question: What variable type are the following values stored in?

Int32. Unsigned, I assume.

The offsets for map x/y/z_count are easiest to find while in arena mode, since the size of the arena is fixed at 9x9x9 blocks (09 00 00 00 09 00 00 00 09 00 00 00) 144x144x9 tiles (90 00 00 00 90 00 00 00 09 00 00 00).

http://df.magmawiki.com/index.php/DF2010:Memory_hacking#Map_data
Title: Re: DFHack 0.5.1
Post by: Kipi on February 12, 2011, 07:01:25 am
Can anyone make the dfcleartask to work? I tried to follow the instructions how to build it, but it just won't work.
Title: Re: DFHack 0.5.1
Post by: peterix on February 14, 2011, 12:31:08 am
Can anyone make the dfcleartask to work? I tried to follow the instructions how to build it, but it just won't work.
Well, if someone else picks it up, then maybe. It's pretty low priority compared with the other work that needs doing I'm afraid.
Title: Re: DFHack 0.5.1
Post by: Kipi on February 14, 2011, 01:07:49 am
Yeah, I believe that. After all, it's only needed if you reclaim fortress.

So, the building works fine, but when I try to run the exe then I get error that dfhack-debug.dll is missing from the computer. So, anyone knows if this problem can be solved by copying some files to certain place?
Title: Re: DFHack 0.5.1
Post by: strich on February 14, 2011, 01:22:48 am
You just need to put that dll in the same folder at the executable. If you did a default build you should be able to find it all under:
.\DFHack\output\Release
or for debug versions:
.\DFHack\output\Debug
Title: Re: DFHack 0.5.1
Post by: Kipi on February 14, 2011, 01:33:57 am
Okay, I moved the dfcleartask to place where my other tools for DF were, now that I tried to run the exe from the \output\debug\ folder, where the .dll file is, I get an error that

"R6010

-abort() has been called"

Any clues? Did I mess something during the usage of CMake or building?

I used MVSC2010 by the way.

Also, I have no \output\release -folder.
Title: Re: DFHack 0.5.1
Post by: peterix on February 16, 2011, 09:33:18 pm
Hello!


Just a bit of news:
Title: Re: DFHack 0.5.1
Post by: Thundercraft on February 17, 2011, 01:04:39 am
I do appreciate the effort that goes into DFHack. And it sounds like that the recent concentration on automating the offset hunting process might pay off soon.

But I have to ask: Can we still expect to see more than "preliminary support" for DF 31.18 on Windows eventually? Or, instead, will that effort be skipped in favor of support for 31.19, 31.20, etc...?
Title: Re: DFHack 0.5.1
Post by: Thoranius on February 17, 2011, 01:34:30 pm
You have my sympathy peterix, I felt the same when I awoke in the middle of the night last night (I blame the weather change) Couldn't even swallow pills to alleviate the pain/swelling, had to dissolve the little buggers in water and wash em down. Unfortunately, it's such a common occurrence for me anymore that I don't even notice the taste of dissolved excederine or ibuprofens anymore. I hope the offsets grab goes well, I can't seem to maintain a workable fort, even with lots of ponds and rainfal, without the DFliquids tool.
Title: Re: DFHack 0.5.1
Post by: janglur on February 17, 2011, 08:02:11 pm
I hope DFHack, or at the very least DFVDIG and DFCLEANMAP are updated for 31.19 soon!
Title: Re: DFHack 0.5.1
Post by: RiderofDark on February 18, 2011, 02:21:47 am
  • It looks like I caught some bug and my throat hates me. If it gets bad, I could be MIA for a few days.
Don't work too hard. We issue orders to dwarves, after all. :P Just finished getting over a nasty bug myself, hope you feel better soon.
Title: Re: DFHack 0.5.1
Post by: Taricus on February 18, 2011, 02:22:54 am
Posting to watch.
Title: Re: DFHack 0.5.1
Post by: Rose on February 18, 2011, 02:27:09 am
I hope DFHack, or at the very least DFVDIG and DFCLEANMAP are updated for 31.19 soon!

I think cleanmap already is.
Title: Re: DFHack 0.5.1
Post by: janglur on February 18, 2011, 02:50:10 pm
I hope DFHack, or at the very least DFVDIG and DFCLEANMAP are updated for 31.19 soon!

I think cleanmap already is.


Really?!  Where!?
Title: Re: DFHack 0.5.1
Post by: LordShotGun on February 18, 2011, 03:29:51 pm
Well this is so many bundles of awesome all wrapped up in one package it should be illegal. I particularly like the dfvdig feature that saves me soooooo much time and effort.
Title: Re: DFHack 0.5.1
Post by: Grax on February 19, 2011, 03:49:40 am
I'm eager only for dfreveal. ;-)
Title: Re: DFHack 0.5.1
Post by: Rose on February 19, 2011, 03:51:43 am
dfreveal works great if you go and compile it yourself, actually.
Title: Re: DFHack 0.5.1
Post by: Grax on February 19, 2011, 04:09:10 am
dfreveal works great if you go and compile it yourself, actually.
I, sadly, have wrong-way-growing hands to make such actions.  :D
Title: Re: DFHack 0.5.1
Post by: Durian Hohlades on February 19, 2011, 12:09:18 pm
dfreveal works great if you go and compile it yourself, actually.

can yo upload yors?
Title: Re: DFHack 0.5.1
Post by: Captain Goatse on February 19, 2011, 01:11:58 pm
dfreveal works great if you go and compile it yourself, actually.

Too bad that I am an electrician and cannot tell a C++ command from a wheelbarrow...
Title: Re: DFHack 0.5.1
Post by: janglur on February 19, 2011, 03:49:21 pm
dfreveal works great if you go and compile it yourself, actually.

can yo upload yors?

He's being facetious.
Title: Re: DFHack 0.5.1
Post by: Rumrusher on February 19, 2011, 04:15:23 pm
someone already updated Tweak and that has Reveal all in the for each tile addon... which still works.
Title: Re: DFHack 0.5.1
Post by: Rose on February 19, 2011, 09:48:46 pm
dfreveal works great if you go and compile it yourself, actually.

can yo upload yors?

He's being facetious.

PSYCHE!!!! (http://dffd.wimbli.com/file.php?id=3819)
Title: Re: DFHack 0.5.1
Post by: Askot Bokbondeler on February 19, 2011, 09:51:53 pm
hallelujah!
Title: Re: DFHack 0.5.1
Post by: Rose on February 19, 2011, 09:53:45 pm
mind you, these are unstable and untested.
Title: Re: DFHack 0.5.1
Post by: Askot Bokbondeler on February 19, 2011, 09:54:47 pm
properly dwarven then
Title: Re: DFHack 0.5.1
Post by: Captain Goatse on February 20, 2011, 04:45:32 pm

PSYCHE!!!! (http://dffd.wimbli.com/file.php?id=3819)

THANKS! It works!
Title: Re: DFHack 0.5.2
Post by: peterix on February 21, 2011, 04:47:11 am
Alright guys, 0.5.2 is available now. Creature and material offsets required for the advanced stonesense features aren't there yet, but all the tools in the dfhack package should work.

Some notable changes: inclusion of the memory search tool, bugfixes and dfcleanmap clearing broken arrows (suggested by Cubittus (https://github.com/Cubittus)).

Enjoy! :D
Title: Re: DFHack 0.5.2
Post by: Thundercraft on February 21, 2011, 04:59:38 am
I realize that there is a lot of interest in and attention on 31.19 right now. And I don't mean to sound ungrateful. But in all the excitement, perhaps my earlier post was missed?

I do appreciate the effort that goes into DFHack. And it sounds like that the recent concentration on automating the offset hunting process might pay off soon.

But I have to ask: Can we still expect to see more than "preliminary support" for DF 31.18 on Windows eventually?
Title: Re: DFHack 0.5.2
Post by: dragonshardz on February 21, 2011, 05:03:39 am
0.5.1 works fine with 31.18, afaik.
Title: Re: DFHack 0.5.2
Post by: Korva on February 21, 2011, 09:24:20 am
0.5.1 works very well for me on 31.18 yes.

Thank you very much for the update! One problem, though: trying to use any of the exes gives me an error that says MSVCP100.dll was not found.
Title: Re: DFHack 0.5.2
Post by: Rumrusher on February 21, 2011, 09:50:54 am
0.5.1 works very well for me on 31.18 yes.

Thank you very much for the update! One problem, though: trying to use any of the exes gives me an error that says MSVCP100.dll was not found.
ditto same problem as well.
Title: Re: DFHack 0.5.2
Post by: dragonly on February 21, 2011, 10:00:47 am
Alright guys, 0.5.2 is available now. Creature and material offsets required for the advanced stonesense features aren't there yet, but all the tools in the dfhack package should work.

Great job, thank you.
Title: Re: DFHack 0.5.2
Post by: peterix on February 21, 2011, 10:56:45 am
0.5.1 works very well for me on 31.18 yes.

Thank you very much for the update! One problem, though: trying to use any of the exes gives me an error that says MSVCP100.dll was not found.
Yep, I moved to a newer compiler. Get the MSVC 10 redistributable (http://www.microsoft.com/downloads/en/details.aspx?FamilyID=a7b7a05e-6de6-4d3a-a423-37bf0912db84) from Microsoft.
Title: Re: DFHack 0.5.2
Post by: Rumrusher on February 21, 2011, 11:43:41 am
sweet thanks now I can find the offsets for creatures and maybe find a way to trigger Webbing.
edit: uhh do any one know a good tutorial on reading and using Hex memory searches?
Title: Re: DFHack 0.5.2
Post by: ST753M on February 21, 2011, 12:32:59 pm
I guess this means I won't be able to use DFHack from now on.  Back to digging exploratory tunnels to find things.  :(

The MSVC 10 thing requires me to get an administrator to download it.  Also, I REALLY don't like the requirement of downloading something just to be able to run something else.  Is there any way for me to get around needing to have it?
Title: Re: DFHack 0.5.2
Post by: Camden1990 on February 21, 2011, 12:52:15 pm
I guess this means I won't be able to use DFHack from now on.  Back to digging exploratory tunnels to find things.  :(

The MSVC 10 thing requires me to get an administrator to download it.  Also, I REALLY don't like the requirement of downloading something just to be able to run something else.  Is there any way for me to get around needing to have it?

I wouldn't worry about it, its from the MS website and its only around 5mb, so security and size shouldn't really be too much of an issue, and it is from a reliable poster. If it requires that .dll file to run, well, there isn't really much you can do about it as far as I am aware?

In other news thanks for the update! Now I can find an embark with, you know, actual metal!
Title: Re: DFHack 0.5.2
Post by: HammerDave on February 21, 2011, 02:33:19 pm
0.5.1 works very well for me on 31.18 yes.

Thank you very much for the update! One problem, though: trying to use any of the exes gives me an error that says MSVCP100.dll was not found.

I think this DLL is included in DF, in which case you can just make a copy of the one in the DF directory into the dfhack one.

Given it's a redistributable file, it should also be OK to include it right in the dfhack distribution too.  Though I have not looked at the licensing so don't just take my word on it.

Ultimately, Toady should perhaps put the file in the shared DLL directory -- when version 1 has a true installer.  For now it's not costing much to have separate files in each program that uses it.
Title: Re: DFHack 0.5.2
Post by: ST753M on February 21, 2011, 03:15:55 pm
I think this DLL is included in DF, in which case you can just make a copy of the one in the DF directory into the dfhack one.

Thank you!  This seems to work well.
Title: Re: DFHack 0.5.2
Post by: Thundercraft on February 21, 2011, 11:28:58 pm
0.5.1 works fine with 31.18, afaik.

You are referring to the tools in DFHack 0.5.1 working fine with 31.18. What I am talking about are the missing 31.18 offsets in 0.5.1 that, as far as I can tell, are still missing in 0.5.2.

I've tried using the new 0.5.2 Memory.xml file with Stonesense and DF 31.18. But while Stonesense does run, it's still as glitchy as before. Creatures do not show up, nor do my dwarves or their names. And all objects and furniture are still missing. (And, yes, this is a memory offset issue.)

Version 0.5.1 was released two days after 31.18 came out:
Just released 0.5.1. All the basic tools work on Windows.
Next step is to make the other tools work too (stonesense,etc.) and get the Linux support where it should be instead of trailing a few versions behind...

I remember rather clearly because I was first introduced to DF about the same time 31.18 was released and I was hoping these tools (Runesmith & Stonesense) would get updated with 31.18 support before 31.19 got released. These and other mods cite the lack of full 31.18 support in DFHack as the reason development was halted 3 months ago.

Anyway, my question was about this:
Creature and material offsets required for the advanced stonesense features aren't there yet...

From this, one might imply that these are either being worked on or are planned for in the near future. But will this only be the creature and material offsets for 31.19? Or will this also / instead be the ones still missing from 31.18?
Title: Re: DFHack 0.5.2
Post by: peterix on February 22, 2011, 12:57:09 am
From this, one might imply that these are either being worked on or are planned for in the near future. But will this only be the creature and material offsets for 31.19? Or will this also / instead be the ones still missing from 31.18?
Well, it takes a significant amount of effort to find all those. So what I'm doing instead is making my tools better. Hopefully to the point where I take a generic pattern matching algorithm, a save file from 31.16 where we have all the offsets known and let it find all the offsets for the newer versions and linux DF. Ambitious, I know... but I really hate to repeat myself and finding this stuff manually *again* is not my idea of fun :) I'd rather explore some new things.
Title: Re: DFHack 0.5.2
Post by: Brandon816 on February 22, 2011, 03:48:47 am
Cleanmap tool now also removes any and all broken ammunition from the map.
About time. You should see the entrance to my fortress right now. Oh, and I'm using civilization forge, so the broken ammo is all sorts of different colors. Anyway, thanks for adding this in.
Title: Re: DFHack 0.5.2
Post by: peterix on February 22, 2011, 04:59:51 am
Cleanmap tool now also removes any and all broken ammunition from the map.
About time. You should see the entrance to my fortress right now. Oh, and I'm using civilization forge, so the broken ammo is all sorts of different colors. Anyway, thanks for adding this in.
I did test it with a hunter killing waterfowl with a crossbow. Seemed to work alright here. I'd be interested in how it works with more stuff around :]
Title: Re: DFHack 0.5.2
Post by: Phrog on February 22, 2011, 11:12:25 am
I downloaded DFHack just now and tried to run dfreveal. First it gave me an error that I was missing msvcp100.dll so I downloaded that. Then it told me I was missing msvcr100.dll so I downloaded that too. Now it is telling me "The procedure entry point _invalid_parameter_noinfo_noreturn could not be located in the dynamic link library MSVCR100.dll." I downloaded and installed the MSVC 2010 redistributable but that didn't fix the problem.

Any advice?
Title: Re: DFHack 0.5.2
Post by: Neowulf on February 22, 2011, 11:50:10 am
I downloaded DFHack just now and tried to run dfreveal. First it gave me an error that I was missing msvcp100.dll so I downloaded that. Then it told me I was missing msvcr100.dll so I downloaded that too. Now it is telling me "The procedure entry point _invalid_parameter_noinfo_noreturn could not be located in the dynamic link library MSVCR100.dll." I downloaded and installed the MSVC 2010 redistributable but that didn't fix the problem.

Any advice?
Same.
Title: Re: DFHack 0.5.2
Post by: Greiger on February 22, 2011, 12:33:18 pm
Everything is working but it's looking like prospector is maybe a little wonky.
Quote
Match found! Using version v0.31.19 SDL.
Maximal regionoffset seen: 0.
SCHORL : 652
RAW_ADAMANTINE : 1687
CRYSTAL_ROCK : 2304
PYRITE : 2609
AMETHYST : 3357
SLADE : 69533
Done. Press any key to continue

It doesn't seem to be reading the gabbro, slate, marble or diorite that makes up most of the map.  I suppose that could be intentional, since it does still display the kinda things folks would actually be interested in.  (Oh look, it confirms that even though I embarked on a tile that claimed to have deep metal there's no metal in sight!).  But figured I would report it just in case.
Title: Re: DFHack 0.5.2
Post by: Lamphare on February 22, 2011, 12:44:13 pm
I downloaded DFHack just now and tried to run dfreveal. First it gave me an error that I was missing msvcp100.dll so I downloaded that. Then it told me I was missing msvcr100.dll so I downloaded that too. Now it is telling me "The procedure entry point _invalid_parameter_noinfo_noreturn could not be located in the dynamic link library MSVCR100.dll." I downloaded and installed the MSVC 2010 redistributable but that didn't fix the problem.

Any advice?
Same.
SAME,
then i used this fellow's (http://www.bay12forums.com/smf/index.php?topic=58809.msg1999439#msg1999439) dfreveal, and it worked.
Title: Re: DFHack 0.5.2
Post by: Quietust on February 22, 2011, 01:29:26 pm
Everything is working but it's looking like prospector is maybe a little wonky.

It doesn't seem to be reading the gabbro, slate, marble or diorite that makes up most of the map.  I suppose that could be intentional, since it does still display the kinda things folks would actually be interested in.  (Oh look, it confirms that even though I embarked on a tile that claimed to have deep metal there's no metal in sight!).  But figured I would report it just in case.

That's a feature - in order to report layer stones, you need to run dfprospector with the -b option.
Title: Re: DFHack 0.5.2
Post by: Neowulf on February 22, 2011, 02:06:25 pm
I downloaded DFHack just now and tried to run dfreveal. First it gave me an error that I was missing msvcp100.dll so I downloaded that. Then it told me I was missing msvcr100.dll so I downloaded that too. Now it is telling me "The procedure entry point _invalid_parameter_noinfo_noreturn could not be located in the dynamic link library MSVCR100.dll." I downloaded and installed the MSVC 2010 redistributable but that didn't fix the problem.

Any advice?
Same.
SAME,
then i used this fellow's (http://www.bay12forums.com/smf/index.php?topic=58809.msg1999439#msg1999439) dfreveal, and it worked.
Fixed it, which is odd because I've never had this problem before with hack and any other .31.x. That link's version worked fine over the weekend, and stopped working this morning (two different computers, exact same behavior).

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=a7b7a05e-6de6-4d3a-a423-37bf0912db84&displaylang=en
VC++ redist installer.
Title: Re: DFHack 0.5.2
Post by: Greiger on February 22, 2011, 02:07:34 pm
Ah ok, I thought that might be the case.  Keep up the good work!
Title: Re: DFHack 0.5.2
Post by: Rumrusher on February 22, 2011, 03:06:55 pm
so how do you look into a creatures memory hex or know what hex does what?
Title: Re: DFHack 0.5.2
Post by: murdersmith on February 23, 2011, 12:32:49 pm
Greetings, fellow Dwarfs!

I am trying to build DFHack on my linux machine to get Stonesense working, but i have run into problems with compiling the source, and can't understand what I did incorrectly.

Details:
Spoiler (click to show/hide)

I would greatly appreciate if someone could point me to the right direction, thanks!
Title: Re: DFHack 0.5.2
Post by: peterix on February 23, 2011, 02:20:01 pm
I would greatly appreciate if someone could point me to the right direction, thanks!
You found a bug! Should be fixed now, but I'm merging in some other things right now...  it might break again.
Title: Re: DFHack 0.5.2
Post by: murdersmith on February 23, 2011, 03:19:02 pm
I would greatly appreciate if someone could point me to the right direction, thanks!
You found a bug! Should be fixed now, but I'm merging in some other things right now...  it might break again.

Thanks!

I got farther now with the compiling, but now was stopped with:
Spoiler (click to show/hide)

But thanks to your bugfix and the example it set, I was able to easily get past this by adding the appropriate namespace specifier to the lines 458 and 473 in the file DFProcess-linux-wine.cpp:
Code: [Select]
         uint32_t orig = Process::readDWord(offset);



It builds all the way now, thanks! :)
Title: Re: DFHack 0.5.2
Post by: Whiplash on February 23, 2011, 07:53:46 pm
Is cleartask no longer supported or something? Why is it not included for 31.x? I have so many stuck items that can't be dumped/moved and I really need a way to remove em.
Title: Re: DFHack 0.5.2
Post by: peterix on February 24, 2011, 01:29:12 am
Is cleartask no longer supported or something? Why is it not included for 31.x? I have so many stuck items that can't be dumped/moved and I really need a way to remove em.
No item offsets yet, sorry. That part should get some attention when I'm done with the current internal changes and easier offset search for the insides of objects (creatures and items mainly).
Title: Re: DFHack 0.5.2
Post by: Whiplash on February 24, 2011, 01:37:44 am
Is cleartask no longer supported or something? Why is it not included for 31.x? I have so many stuck items that can't be dumped/moved and I really need a way to remove em.
No item offsets yet, sorry. That part should get some attention when I'm done with the current internal changes and easier offset search for the insides of objects (creatures and items mainly).
Ah, how unfortunate. Thanks for the information.
Title: Re: DFHack 0.5.2
Post by: JacenHanLovesLegos on February 25, 2011, 04:04:46 pm
Is it right that using this with dead bodies creates zombies?
Title: Re: DFHack 0.5.2
Post by: Rumrusher on February 25, 2011, 04:34:46 pm
Is it right that using this with dead bodies creates zombies?
yeah if you make a utility for that. if you do hopefully you fix the issue I have with my zombie utility(addon to Dfusion) on the not safe to kill with out pissing off the entire town/companions.
Title: Re: DFHack 0.5.2
Post by: Fafzor on February 26, 2011, 09:08:49 am
Hey folks, I'm trying to use the dfhack library in my project. However I'm getting the following errors at runtime using visual studio 2010:
Code: [Select]
Unhandled exception at 0x775db727 in DwarfNET.exe: Microsoft C++ exception: DFHack::Error::MemoryXmlParse at memory location 0x0048f744..
Unhandled exception at 0x775db727 in DwarfNET.exe: Microsoft C++ exception: DFHack::Error::MemoryXmlNoRoot at memory location 0x0048f730..
Unhandled exception at 0x5b5b3943 in DwarfNET.exe: 0xC0000005: Access violation reading location 0x00000020.

It probably can't find the xml file or something, but I've made sure it is in the same folder as the dll and executable. I've also tried some path variable settings in the project.

Anyone know how to fix this?
Title: Re: DFHack 0.5.2
Post by: profit on February 26, 2011, 09:16:56 am
I think you might be bumping up against the missing memory locations in the memory layout file.

Try just a pause and unpause call and see if it works then.
Title: Re: DFHack 0.5.2
Post by: Fafzor on February 26, 2011, 09:55:53 am
All I'm trying to do at this moment is attaching to DF.

Code: [Select]
DFHack::ContextManager DFMgr("Memory.xml");
etc

In the same way as in the example tools. Running the attachtest tool code in my project produces the same error so it's probably in my project settings.
Title: Re: DFHack 0.5.2
Post by: Rose on February 26, 2011, 10:39:26 am
when you run dfhack from within MSVC, it runs it from a different directory than the one it should. have you tried running the files manually?
Title: Re: DFHack 0.5.2
Post by: Fafzor on February 26, 2011, 11:16:11 am
You sir, are a gentleman and a scholar.

Building a release and testing it manually seems to work, thank you for pointing this out to me.
Title: Re: DFHack 0.5.2
Post by: strich on February 26, 2011, 05:21:32 pm
Hey folks, I'm trying to use the dfhack library in my project. However I'm getting the following errors at runtime using visual studio 2010:

It probably can't find the xml file or something, but I've made sure it is in the same folder as the dll and executable. I've also tried some path variable settings in the project.

Anyone know how to fix this?

Yep VS2010 does some funky stuff to the way it runs the exe. If you've started a new VS project, then by default it won't work. Go into the configuration properties -> Debugging and make sure the Working Directory is $TargetDir. Do this for both Release and Debug configs. You should now be able to run them within VS2010.
Title: Re: DFHack 0.5.2
Post by: Khift on February 26, 2011, 08:59:51 pm
Question: Is it normal for DFHack to not work on modded DFs? I'm tweaking some of the numbers in inorganic_stone_mineral.txt in the hopes of making ores more common, but in doing so I seem to have broken prospector and reveal, the two tools I would normally use to find the minerals. Did I screw the pooch (very possible) or is this normal behavior for DFHack?
Title: Re: DFHack 0.5.2
Post by: Rose on February 26, 2011, 09:43:05 pm
modding DF isn't supposed to break dfhack, and usually doesn't
Title: Re: DFHack 0.5.2
Post by: Khift on February 26, 2011, 10:18:14 pm
I wonder what it is that I did, then... Everything else looks pretty much normal. Maps gen and load just fine and dicking around after embarking doesn't bring up any issues. When I try to use DFReveal or DFProspector, though, they both say "Can't init map."

Here is what I changed:
Spoiler (click to show/hide)
Doing essentially the same thing for all metal ores across the board, albeit with different values. I also changed most of the fluff minerals (pitchblende, etc) to have a frequency of 25. But that's all I did. Why would this break DFHack?
Title: Re: DFHack 0.5.2
Post by: kyle902 on February 26, 2011, 11:00:55 pm
I'm having trouble using DFliquid. When I try to place something I get the Can't get cursor coords error.
Title: Re: DFHack 0.5.2
Post by: peterix on February 27, 2011, 04:30:40 am
I'm having trouble using DFliquid. When I try to place something I get the Can't get cursor coords error.
The tool needs the 'look' cursor to be active ingame. Point it at something before use.

I wonder what it is that I did, then... Everything else looks pretty much normal. Maps gen and load just fine and dicking around after embarking doesn't bring up any issues. When I try to use DFReveal or DFProspector, though, they both say "Can't init map."

Here is what I changed:
Spoiler (click to show/hide)
Doing essentially the same thing for all metal ores across the board, albeit with different values. I also changed most of the fluff minerals (pitchblende, etc) to have a frequency of 25. But that's all I did. Why would this break DFHack?
This is pretty much a mystery to me. I tried changing hematite just like you did and gen a new world. Everything seems to work just right. Can you give me the save?

Anyway, here's a piece of news: I have the creature offsets. Creatures should work in stonesense and other tools when they get updated :)
Title: Re: DFHack 0.5.2
Post by: Rose on February 27, 2011, 04:51:56 am
Anyway, here's a piece of news: I have the creature offsets. Creatures should work in stonesense and other tools when they get updated :)

Title: Re: DFHack 0.5.2
Post by: Truean on February 27, 2011, 08:35:24 am
Did I just hear Japa has offsets? Awesome.

Also legacy question. I've used DF Hack's liquids to cast obsidian en mass. I've also used it to individually alter tile by tile obsidian. When casting en mass, I end up with heat traps and realize the readme even warns of this.

Is there any way to mod in large amounts of water over magma without generating heat traps? It's quite a shock to see your dwarf on fire and a puddle of melted copper (formerly his pick). :)
Title: Re: DFHack 0.5.2
Post by: Haruspex_Pariah on February 27, 2011, 10:20:56 am
Hey guys. I downloaded the bin files, and it told me I needed msvc. I downloaded the msvc, but when I double click dfcleanmap it says there's an error and closes. When I double click dfliquids I get "couldn't find a suitable process". I'm a bit confused here.

EDIT: Wait, does it have to be the SDL version of DF to work?
Title: Re: DFHack 0.5.2
Post by: peterix on February 27, 2011, 11:05:28 am
Hey guys. I downloaded the bin files, and it told me I needed msvc. I downloaded the msvc, but when I double click dfcleanmap it says there's an error and closes. When I double click dfliquids I get "couldn't find a suitable process". I'm a bit confused here.

EDIT: Wait, does it have to be the SDL version of DF to work?
Yes.
Title: Re: DFHack 0.5.2
Post by: Khift on February 27, 2011, 02:06:34 pm
This is pretty much a mystery to me. I tried changing hematite just like you did and gen a new world. Everything seems to work just right. Can you give me the save?

Anyway, here's a piece of news: I have the creature offsets. Creatures should work in stonesense and other tools when they get updated :)
Here's a save, from the fourth world I've genned using this modified .txt (no embark on any of the four worlds has worked with DFHack): http://dffd.wimbli.com/file.php?id=3862

I'm going to mess around with some more numbers, see if that changes anything. I'm getting the feeling that a lower frequency value actually makes that type of stone more frequent as opposed to less....
Title: Re: DFHack 0.5.2
Post by: Khift on February 27, 2011, 03:10:03 pm
Alrighty, so now I feel rather silly but in hindsight I suppose I shouldn't because let's be honest I couldn't have seen this coming.

Turns out, the issue I've been having is that I had a phantom copy of dwarf fortress floating around my active processes. Evidently at some point I acquired this phantom copy and beyond that point every time I tried to fire up DFHack it would try and probe the phantom copy and inevitably fail. I didn't realize it was there until I swapped back to an unmodded mineral file and still couldn't use DFHack, so I decided to reinstall DF and windows wouldn't let me because the core DLLs were still technically in use. A trip through the task manager revealed another copy of DF, and cancelling that fixed all my problems.

Not certain how I could have seen that coming... >_> Anyways, thanks for the help. Probably no point in examining that file, eh?
Title: Re: DFHack 0.5.2
Post by: peterix on February 27, 2011, 04:22:35 pm
Alrighty, so now I feel rather silly but in hindsight I suppose I shouldn't because let's be honest I couldn't have seen this coming.

Turns out, the issue I've been having is that I had a phantom copy of dwarf fortress floating around my active processes. Evidently at some point I acquired this phantom copy and beyond that point every time I tried to fire up DFHack it would try and probe the phantom copy and inevitably fail. I didn't realize it was there until I swapped back to an unmodded mineral file and still couldn't use DFHack, so I decided to reinstall DF and windows wouldn't let me because the core DLLs were still technically in use. A trip through the task manager revealed another copy of DF, and cancelling that fixed all my problems.

Not certain how I could have seen that coming... >_> Anyways, thanks for the help. Probably no point in examining that file, eh?
I looked at it already, and found nothing strange. Anyway, no harm done. The embark has a LOT of native aluminium :)
Title: Re: DFHack 0.5.2
Post by: Khift on February 27, 2011, 05:25:30 pm
Yeah I'm working on finding a balance between too many minerals and enough minerals to be playable. I should have something worthwhile to post soon, though. I've already got a setup that's good for the goal, but I want... better!

Edit: Is there any way to get prospector to print it's results to a text file? That would save me quite a bit of time. Trying to document results with various settings here.
Title: Re: DFHack 0.5.2
Post by: Quietust on February 27, 2011, 05:38:59 pm
Also legacy question. I've used DF Hack's liquids to cast obsidian en mass. I've also used it to individually alter tile by tile obsidian. When casting en mass, I end up with heat traps and realize the readme even warns of this.

Is there any way to mod in large amounts of water over magma without generating heat traps? It's quite a shock to see your dwarf on fire and a puddle of melted copper (formerly his pick). :)
If you add the water 1 Z-level above the magma and allow the water to fall down onto the magma, then the game should properly reset the fixed temperature of each tile. Heat traps only happen when you use dfliquids to delete magma (or presumably place obsidian on top of magma) - if you want to safely remove magma, what you should do is reduce the area to 2/7 depth and then set a few individual tiles to 1/7 to start it sloshing around and drying up (in my previous tests, setting it directly to 1/7 seemed to make the game forget that it should start drying up, but I could very well be mistaken).
Title: Re: DFHack 0.5.2
Post by: Truean on February 28, 2011, 02:53:44 pm
Also legacy question. I've used DF Hack's liquids to cast obsidian en mass. I've also used it to individually alter tile by tile obsidian. When casting en mass, I end up with heat traps and realize the readme even warns of this.

Is there any way to mod in large amounts of water over magma without generating heat traps? It's quite a shock to see your dwarf on fire and a puddle of melted copper (formerly his pick). :)
If you add the water 1 Z-level above the magma and allow the water to fall down onto the magma, then the game should properly reset the fixed temperature of each tile. Heat traps only happen when you use dfliquids to delete magma (or presumably place obsidian on top of magma) - if you want to safely remove magma, what you should do is reduce the area to 2/7 depth and then set a few individual tiles to 1/7 to start it sloshing around and drying up (in my previous tests, setting it directly to 1/7 seemed to make the game forget that it should start drying up, but I could very well be mistaken).

Hum, I'll have to try that. I've usually set the magma to straight 2/7 tiles right under the water and it hasn't worked. Perhaps if I unpause the game, let it slosh around a bit and then ad the 7/7 water a z level above, that might work...? Hum, interesting, will have to test....
Title: Re: DFHack 0.5.2
Post by: BigD145 on February 28, 2011, 03:32:39 pm
It's best if the liquid has some movement to it so the game knows what to do with this magically appearing magma/water.
Title: Re: DFHack 0.5.2
Post by: myrkul on March 01, 2011, 08:10:21 pm
Maybe I'm just an idiot... where is the source, so I can compile for linux?
Don't see a link on the first post.

Edit: found it. you should probably include that github link in the op, rather than burying it in the readme.

edit2: Now I get this error when I try to configure it...
Code: [Select]
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
X11_LIBRARY
    linked by target "dfhack" in directory /home/marty/Downloads/dfhack/library

-- Configuring incomplete, errors occurred!

Also, it's still complaining about not having wide ncurses libraries, even after I installed libncursesw5 and -dev.
All I want is reveal and liquids, so it's not a huge loss, but it is annoying.
Title: Re: DFHack 0.5.2
Post by: peterix on March 02, 2011, 02:38:29 am
edit2: Now I get this error when I try to configure it...
Code: [Select]
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
X11_LIBRARY
    linked by target "dfhack" in directory /home/marty/Downloads/dfhack/library

-- Configuring incomplete, errors occurred!

Also, it's still complaining about not having wide ncurses libraries, even after I installed libncursesw5 and -dev.
All I want is reveal and liquids, so it's not a huge loss, but it is annoying.
You probably need something like libx11-dev. I'm not sure about the exact name right now. It is listed in the Compile file.
Here's the dependencies `objdump -x projects/dfhack/output/libdfhack-debug.so | grep NEEDED`reports on my system:
Spoiler (click to show/hide)

The ncurses lib is required for the dfveinlook tool I use for testing map reading... and one of the build scripts can't find it. You could give cmake the exact place where the library is, or try to fix this file (https://github.com/peterix/dfhack/blob/master/CMake/Modules/FindCurses.cmake) so it works with your distribution. The tool is more for looking at the 'guts' of the map than anything else though.
Title: Re: DFHack 0.5.2
Post by: myrkul on March 02, 2011, 04:13:21 am
That worked. All built and installed. test forthcoming.

Important tools work. They crash when exiting, but well, they're exiting. I don't mind.
Title: Re: DFHack 0.5.2
Post by: Thundercraft on March 03, 2011, 10:38:51 am
Anyway, here's a piece of news: I have the creature offsets. Creatures should work in stonesense and other tools when they get updated :)

From the little testing I've done, it seems those new creature offsets only work for the new .19.
There is certainly excitement among the Stonesense crowd now that creatures work. But nearly everyone seems to forget to mention which version of DF they're using.
Title: Re: DFHack 0.5.2
Post by: Thundercraft on March 04, 2011, 12:02:20 am
I have the creature offsets. Creatures should work in stonesense and other tools when they get updated :)

I'm glad to hear that creature offsets have been worked on recently. But confusion could have been avoided by stating that you had creature offsets for .19, but not for .18.

I asked about this very issue more than once, but I guess my questions were missed:
...will this only be the creature and material offsets for 31.19? Or will this also / instead be the ones still missing from 31.18?

The situation seems to be just as I feared: All the excitement over .19 means it takes priority. Am I correct in assuming that legacy support for .18 took the back burner the day .19 came out?

Yeah, creatures work with .19, but not .18. Finding the creature offsets is a lot of work, and the guy who does them didn't want to waste his time with an older version.

you can easily load your old fort in .19, and it'll work fine.

Forgive my bluntness, but that is backwards thinking.

There are a lot of players right now, myself included, who've decided to stick with .18 for a while longer for three reasons: 1) because .19 is very, very buggy, 2) because metals are incredibly rare in .19 (and trading does not yet compensate for this), and 3) to give their favorite mods more of a chance to catch up with the changes.

I say "backwards" because it was to be expected that the first release in a new "arc" of major features would be unusually buggy and unbalanced. And Toady already stated that the next release will be very soon and that it will mostly be a bug fix release. He even said that there may be a world-gen option to bypass the metal scarcity (for those who want it).

Another words, the life expectancy of .19 can be measure in weeks, if not days. I fully expect over 90% of those using .19 to switch over to .20 the same day it is released (for the 3 reasons I mentioned above). And then .19 will go the way of .17...

So, what was the point in wasting that effort to find the creature offsets for .19, when we've been patiently waiting for the creature offsets for .18 for three and a half months? Just two days after 31.18 was released:
Just released 0.5.1. All the basic tools work on Windows.
Next step is to make the other tools work too (stonesense,etc.) and get the Linux support where it should be instead of trailing a few versions behind...
(emphasis added)
Title: Re: DFHack 0.5.2
Post by: LoSboccacc on March 04, 2011, 04:17:33 am
Forgive my bluntness, but that is backwards thinking.

you're pretty spot on!

now thundercraft go and search me the .18 creature offset, as I'd like too to explore my .18 fort.

for the sarcasm impaired: thundercraft, see how bad it is when someone come at you and demand you to spend your time in doing something and points out how bad a person are you for not doing it his way?
Title: Re: DFHack 0.5.2
Post by: peterix on March 04, 2011, 05:27:08 am
STUFF
Whatever. 31.20 will be here (hopefully) in a few days and I'll update the offsets then. 31.18 wouldn't be hard to finish at this point anyway, so I could just as well do that too.
So, what was the point in wasting that effort to find the creature offsets for .19, when we've been patiently waiting for the creature offsets for .18 for three and a half months?
It is not wasted ~_~
Title: Re: DFHack 0.5.2
Post by: Rose on March 04, 2011, 05:57:59 am
I say just give the guy a refund and be done with it.
Title: Re: DFHack 0.5.2
Post by: myrkul on March 04, 2011, 06:01:01 am
I say just give the guy a refund and be done with it.

Exactly.
Title: Re: DFHack 0.5.2
Post by: thvaz on March 04, 2011, 07:10:38 am
Nice fellow this Thundercraft, huh?
Title: Re: DFHack 0.5.2
Post by: Thundercraft on March 04, 2011, 12:50:10 pm
for the sarcasm impaired: thundercraft, see how bad it is when someone come at you and demand you to spend your time in doing something and points out how bad a person are you for not doing it his way?
Actually, I did not imply that peterix or anyone else was a "bad person" - for this, or any other reason. (Speaking of "points out how bad a person are you": Perhaps, in retrospect, you can now see the irony of that comment?) I never demanded anything, either. There's nothing in my message that even implies a demand. I will admit, however, that I may have come off sounding rude or even rather ungrateful. For that I apologize.

Nice fellow this Thundercraft, huh?
Myself, I try to avoid judging the personality and moral character of others. Especially if all I have to go on are a few written comments. Assumptions are like dirty glasses, through which our view becomes obscured and it can be difficult to see anything but dirt.

So, what was the point in wasting that effort to find the creature offsets for .19, when we've been patiently waiting for the creature offsets for .18 for three and a half months?
It is not wasted ~_~

In hindsight, it was rather harsh and unwarrented for me to say it that way and I apologize. What I was trying to say was that, personally, I would have given .18 priority over .19 simply because .19 is a buggy version that is not expected be used for much longer. In comparison, some players might stick with .18 even after .20 comes out because they do not like the way the Caravan Arc is going. (At least until things balance out better.)

I do not doubt that offset searching is boring and tedious work. (I can only imagine that this is even worse than searching for memory values for a console game to create new cheat codes.) I understand why peterix did things the way he did. I certainly do not find fault with making the improvement of the DFHack tools a priority over searching for offsets. And I can appreciate the strategy of concentrating on writing a memory search tool and improving the pattern matching algorithms to make offset searches faster and easier. If I was in that position, I would have made the same decision.

Honestly, I would not have said anything had we been better informed. Saying that the "Next step" is to make tools like stonesense work for .18 raised our expectations. But for a long while we were left in the dark that the decision was made to go a different direction. Then suddenly finding out - from all appearances - that this much anticipated support of .18 was skipped... it felt like a rather big disappointment.

And to say "I have the creature offsets" without specifying these were for .19 only, is to again raise expectations, only to again be dissappointed by finding out the hard way.

What I'm saying is that there was a failure to communicate. (And it seems that I am guilty myself of failing to communicate clearly.)

All I'm asking is that, next time, can we be informed of these things? Preferably by editing the first post in this topic?

31.18 wouldn't be hard to finish at this point anyway, so I could just as well do that too.
All your work on the DFHack is appreciated by fans. And that includes me.
Thank you.
Title: Re: DFHack 0.5.2
Post by: telamon on March 04, 2011, 05:58:09 pm
Meh. Is it kinda annoying that we *still* have no .18 offsets?
Yeah.
I don't play .19 and I'll probably be sticking to .18 for a while. Since so many things are reliant on hack, it can impair a bunch of utilities.

Do I really care?
Nah.
Not like I can't play DF (although it's possible that some people can't because of this, who knows). And I don't have to play DF.

Can I wait?
Yeah.
And so I will.
No sense getting mad/ticked/annoyed over things you can't change.
Title: Re: DFHack 0.5.2
Post by: AdeleneDawner on March 04, 2011, 09:04:50 pm
I recently switched from .12 to .18, and I like the updates to the DFHack tools since I first downloaded them. But is there a way to have the cleanmap tool clear snow in this version? I like that it doesn't do so automatically but I'd prefer to still have the option.
Title: Re: DFHack 0.5.2
Post by: Carcanken on March 06, 2011, 11:09:47 am
I get the following error when I try to use DFhack, I have been able to use it before on .18, but no luck for .19.
The error says:
The program cant start because MSVCP100.dll is missing from your computer. Try reinstalling the program to fix this problem.

Okay, so I tried reinstalling, no luck.
Title: Re: DFHack 0.5.2
Post by: schussel on March 06, 2011, 01:44:53 pm
for this problem refer to

On Windows, you might have to install the MSVC 2010 redistributable.

link found in first post ..

next time check the whole first post first :D
Title: Re: DFHack 0.5.2
Post by: Krinogen on March 06, 2011, 02:00:38 pm
anyone working on 31.20 hackbin ?
Title: Re: DFHack 0.5.2
Post by: parlor_tricks on March 06, 2011, 02:59:58 pm
Posting in thread to say thanks for all the help!
Title: Re: DFHack 0.5.2
Post by: gtmattz on March 06, 2011, 04:24:30 pm
anyone working on 31.20 hackbin ?

One would assume so, hopefully.
Title: Re: DFHack 0.5.2
Post by: peterix on March 06, 2011, 05:55:16 pm
anyone working on 31.20 hackbin ?

One would assume so, hopefully.
Actually, the windows version is almost ready. It just needs a bit of testing. And I'm waiting for some more code to merge. There will be a horrible dangerous hack tool in the next release.
Title: Re: DFHack 0.5.2
Post by: gtmattz on March 06, 2011, 06:04:50 pm
There will be a horrible dangerous hack tool in the next release.

This sounds... interesting.

 :o
Title: Re: DFHack 0.5.2
Post by: Chattox on March 06, 2011, 06:52:33 pm
How long can we expect to wait for a new version? I admit I would like to know what this horrible dangerous hack tool is :P
Title: Re: DFHack 0.5.2
Post by: BigD145 on March 06, 2011, 07:10:18 pm
How long can we expect to wait for a new version? I admit I would like to know what this horrible dangerous hack tool is

The moment you know, your computer will explode into tiny bits of confetti.  kazoo.wav

Are you willing to take this inevitable end?
Title: Re: DFHack 0.5.2
Post by: myrkul on March 06, 2011, 07:36:11 pm
How long can we expect to wait for a new version? I admit I would like to know what this horrible dangerous hack tool is
The moment you know, your computer will explode into tiny bits of confetti.  kazoo.wav
Are you willing to take this inevitable end?

What is it? dfsendintheclowns?
'cause that fits both horribly dangerous, and the kazoo-explosion.
Title: Re: DFHack 0.5.2
Post by: arkhometha on March 06, 2011, 07:37:22 pm
How long can we expect to wait for a new version? I admit I would like to know what this horrible dangerous hack tool is
The moment you know, your computer will explode into tiny bits of confetti.  kazoo.wav
Are you willing to take this inevitable end?

What is it? dfsendintheclowns?
'cause that fits both horribly dangerous, and the kazoo-explosion.

Actually, you already can do that with dfreveal.
Title: Re: DFHack 0.5.2
Post by: myrkul on March 06, 2011, 07:41:41 pm
I donno.. might be fun to spawn a squad of 'em at map edge, like a siege, to test out the military before you go knocking on their doors.

Or, it might be !!fun!! Either way, Enjoyment to be had.
Title: Re: DFHack 0.5.2
Post by: Alkhemia on March 06, 2011, 07:56:04 pm
I donno.. might be fun to spawn a squad of 'em at map edge, like a siege, to test out the military before you go knocking on their doors.

Or, it might be !!fun!! Either way, Enjoyment to be had.
http://www.bay12forums.com/smf/index.php?topic=78247.msg2017119#msg2017119 There ya go. Good luck there really strong
Title: Re: DFHack 0.5.2
Post by: janglur on March 06, 2011, 07:58:31 pm
Is DFHack updated for 31.20 yet?
Title: Re: DFHack 0.5.2
Post by: peterix on March 06, 2011, 08:06:30 pm
I'll just leave this here:
http://www.youtube.com/watch?v=p3h8ZnXLsRg (http://www.youtube.com/watch?v=p3h8ZnXLsRg)
Don't expect total awesome. It's more like a really fragile process where you can F up and make everyone fight each other to the death or crash DF. Still don't have the code for the tool (only dfhack API calls), but it should be ready for 31.21.

Anyway, seems like 31.20 is a dead release plagued with crashes (to the point of being pulled from the site). I'll release what I have anyway, so people who have it can use the tools :)
Title: Re: DFHack 0.5.2
Post by: agatharchides on March 06, 2011, 08:09:51 pm
I'm a little confused on what the link has to do with DFHack? Or is there some in-joke I haven't heard yet at play?  :P
Title: Re: DFHack 0.5.2
Post by: Askot Bokbondeler on March 06, 2011, 08:13:30 pm
assuming control of a dwarf in fortress mode as in arena? damn... if that was true, i'd piss my pants
Title: Re: DFHack 0.5.2
Post by: janglur on March 06, 2011, 08:14:03 pm
I'll just leave this here:
http://www.youtube.com/watch?v=p3h8ZnXLsRg (http://www.youtube.com/watch?v=p3h8ZnXLsRg)
Don't expect total awesome. It's more like a really fragile process where you can F up and make everyone fight each other to the death or crash DF. Still don't have the code for the tool (only dfhack API calls), but it should be ready for 31.21.

Anyway, seems like 31.20 is a dead release plagued with crashes (to the point of being pulled from the site). I'll release what I have anyway, so people who have it can use the tools :)


Buh?  It runs perfectly fine for me..
Title: Re: DFHack 0.5.2
Post by: arkhometha on March 06, 2011, 08:17:02 pm
I'll just leave this here:
http://www.youtube.com/watch?v=p3h8ZnXLsRg (http://www.youtube.com/watch?v=p3h8ZnXLsRg)
Don't expect total awesome. It's more like a really fragile process where you can F up and make everyone fight each other to the death or crash DF. Still don't have the code for the tool (only dfhack API calls), but it should be ready for 31.21.

Anyway, seems like 31.20 is a dead release plagued with crashes (to the point of being pulled from the site). I'll release what I have anyway, so people who have it can use the tools :)


Buh?  It runs perfectly fine for me..

Me too. For quite a time, and not a single crash.
Title: Re: DFHack 0.5.2
Post by: therahedwig on March 06, 2011, 08:19:17 pm
I'll just leave this here:
http://www.youtube.com/watch?v=p3h8ZnXLsRg (http://www.youtube.com/watch?v=p3h8ZnXLsRg)
Don't expect total awesome. It's more like a really fragile process where you can F up and make everyone fight each other to the death or crash DF. Still don't have the code for the tool (only dfhack API calls), but it should be ready for 31.21.

Anyway, seems like 31.20 is a dead release plagued with crashes (to the point of being pulled from the site). I'll release what I have anyway, so people who have it can use the tools :)


Buh?  It runs perfectly fine for me..
My first fort ran sorta perfectly fine for me as well, but then hit year two, my dwarves refused to drink booze and somehow I was getting lags within a tantrum spiral.(While my general fps was still in the 50)

My second fort crashed on migrant wave.

Some people had crash on mining.
Df is kinda lacking in content if you can't mine :s.
Title: Re: DFHack 0.5.2
Post by: arkhometha on March 06, 2011, 08:21:17 pm
hmmm I'm in year 2 so I better watch out.

Ah, they really don't have any booze to drink, so it's all right.
Title: Re: DFHack 0.5.2
Post by: agatharchides on March 06, 2011, 08:25:09 pm
Mine has quite consistently crashed on  embark. Once it erased all the underground seeds in the world in the process. Still trying to figure that one out.
Title: Re: DFHack 0.5.2
Post by: arkhometha on March 06, 2011, 08:30:12 pm
Maybe because I'm using Windows?

edit: fixing up a linux/osx issue, release should be up later today
Title: Re: DFHack 0.5.2
Post by: therahedwig on March 06, 2011, 08:33:16 pm
Nope, windows 7 girl :s
Title: Re: DFHack 0.5.3
Post by: agatharchides on March 06, 2011, 08:34:16 pm
I'm using XP
Title: Re: DFHack 0.5.3
Post by: _DivideByZero_ on March 06, 2011, 08:35:05 pm
I'm using Ubuntu... no crashes. :)

But I run it through wine, so I think that might be the reason.
Title: Re: DFHack 0.5.3
Post by: peterix on March 06, 2011, 08:37:24 pm
Anyway, I just pushed the release on github. Grab it and have fun. If things crash, make them crash creatively ;)
Title: Re: DFHack 0.5.3
Post by: xtank5 on March 06, 2011, 08:43:15 pm
(You may want to update your signature.  :P)

You sure got those offsets fast.  Isn't there a tutorial somewhere for finding offsets yourself?  I couldn't find one and was hoping to help out. :-\
Title: Re: DFHack 0.5.2
Post by: gtmattz on March 06, 2011, 08:46:31 pm
I'll just leave this here:
http://www.youtube.com/watch?v=p3h8ZnXLsRg (http://www.youtube.com/watch?v=p3h8ZnXLsRg)
Don't expect total awesome. It's more like a really fragile process where you can F up and make everyone fight each other to the death or crash DF. Still don't have the code for the tool (only dfhack API calls), but it should be ready for 31.21.

Anyway, seems like 31.20 is a dead release plagued with crashes (to the point of being pulled from the site). I'll release what I have anyway, so people who have it can use the tools :)


Buh?  It runs perfectly fine for me..

Me too. For quite a time, and not a single crash.

Same here.  The only problem I have run into so far is that pump stacks seem to be abnormally laggy for me for some reason, even if I apply power to a dry stack with no source, as soon as it starts 'pumping' my FPS drops into the 2-4 range lol.
Title: Re: DFHack 0.5.2
Post by: Askot Bokbondeler on March 06, 2011, 08:49:17 pm
so, what's the
horrible dangerous hack tool in the next release.
Title: Re: DFHack 0.5.3
Post by: peterix on March 06, 2011, 09:32:22 pm
You sure got those offsets fast.  Isn't there a tutorial somewhere for finding offsets yourself?  I couldn't find one and was hoping to help out. :-\
Yeah. I just want this stuff out of the way.

Anyway, if you can read C++ code, you're halfway there already - you can read what the dfhack modules do to read things. Then you need tools. Some visual debugger that lets you disable everything but bookmarks and the memory view is always helpful. I use edb for that (it's a linuxy thing, but I'm sure it has windows equivalents). Look at what's at the addresses known in older versions, look at the code and see what it does with the data it reads and how it reads it. Load the same save in a newer version of DF and see if you can find the same data. For more involved things, you'll need a decent disassembler or a good knowledge of x86 assembly. IDA Pro is great here - even the free version without hexrays.

Well, and that about covers the essentials. Look at things, try to make sense of what you see.

DFHack will eventually have better tools for offset searching. Right now there's just dfincremental, which can, when used properly, speed up your work. I'll cover the basic modes here (and skip the ones that don't work on windows yet)

First thing it will ask you about is the ranges in which it should search. Picking all of them is OK.
Code: [Select]
[peterix@peterix output]$ ./dfincremental
Which range to search? (default is 1-4)
(0) 10000 - 110000|rw-|
(1) 110000 - 220000|rwx|
(2) 220000 - 221000|rwx|
...

(400) ff8b0000 - ffcb0000|rwx|
(401) ffcb3000 - ffcd4000|rw-|[stack]
(402) ffce0000 - ffff0000|---|
>>0-400
Here I pick ranges 0-400. This will be different depending on your system and the version of DF you use. The less ranges you pick, the faster the search, but you can miss things. When you know that the stuff you search for is normally in some range, you can limit the search this way.

Then it will ask you about what kind of search you want to do:

Quote
0= exit
1=number(default) = this lets you incrementally search for an exact number. Incrementally = you search, change it in DF, search again, etc, until you get a small set of addresses. This is a common property of many of the search types.
2=vector by length = very useful. many things in DF are stored in STL vectors. This lets you search for those vectors by how many items they hold. Embark, build a constructed floor, search for 1, build another, search for 2, etc. You'll find the constructions.
3=vector>object>string = only works on linux right now ~_~ Very useful for materials/raws.
4=string = STL string, linux only. For any place you can type things in.
5=automated offset search = very limited automated search. linux only. to be expanded.
6=vector by address in its array = not very useful. lets you search for a vector by a single address that lies inside its range. Produces too many useless results.
7=pointer vector by address of an object = you have an object address and want to find a vector that holds it. the more objects you have, the more you can limit the list
8=vector>first object>string = another linux only.
9=string buffers = plain non-STL string search. Just put in letters and it finds them.
10=known data = similar to string buffers, but accepts a series of bytes in hexadecimal code. useful for binary strings or when you need to string more numbers together.
11=backpointers = say you have an address that you know is inside an object (you searched for a dwarf's nickname for example). this lets you find where the creature object starts and what is referencing it. The search it does is greedy, so it will follow the first backpointer and won't explore the others, if there are any. Combine with plain number search if you think that's happening.
12=data+backpointers = data search and backpointers combined
13=coord lookup = this lets you for example put the DF cursor over something of interest and do a search for the coords of the cursor. Usually, it finds and address that's inside the interesting object, or more addresses if more things share the same coords. Follow a dwarf for a bit with this and you'll certainly find him.

Making the linux-only things here working for windows DF is my next goal.

I'm sure you could find many other tools too.
Title: Re: DFHack 0.5.3
Post by: Truean on March 06, 2011, 10:33:36 pm
I'd be happy if Toady slowed down a bit and bug tested more with a smaller test group before release.

31.21 is out :)
Title: Re: DFHack 0.5.3
Post by: blue emu on March 06, 2011, 10:43:48 pm
Any ETA on a Memory.XML for the new 31.21 version?
Title: Re: DFHack 0.5.3
Post by: Truean on March 06, 2011, 11:03:00 pm
Any ETA on a Memory.XML for the new 31.21 version?

Is that a record?
Title: Re: DFHack 0.5.3
Post by: BigD145 on March 06, 2011, 11:07:06 pm
Any ETA on a Memory.XML for the new 31.21 version?

Does it not work on 31.21?
Title: Re: DFHack 0.5.3
Post by: blue emu on March 06, 2011, 11:15:37 pm
Any ETA on a Memory.XML for the new 31.21 version?

Is that a record?

My instantaneous request for a support file? Or Toady's instantaneous release of a new version? I think we're running neck-and-neck...

Any ETA on a Memory.XML for the new 31.21 version?

Does it not work on 31.21?

The old XML file? Haven't tried it. The off-sets usually change with each version, though. v31.21 isn't listed in the current XML as a supported version, so dfprospector refuses to start.
Title: Re: DFHack 0.5.3
Post by: Andux on March 06, 2011, 11:55:08 pm
The off-sets usually change with each version, though. v31.21 isn't listed in the current XML as a supported version, so dfprospector refuses to start.

Offsets seem to be the same this time around. Try adding this:
Code: [Select]
    <Version name="v0.31.21 SDL" os="windows" base="v0.31.20 SDL" >
        <PETimeStamp value="0x4D743DA7" />
        <MD5 value="3aadcbd781f7d70d5ee552b92c03bc6b" />
    </Version>
Title: Re: DFHack 0.5.3
Post by: janglur on March 07, 2011, 02:20:55 am
Since I dunno what the above post means, i'll ask that if anyone can give me a DFHack compatible with 31.20 (I haven't upgraded to 31.21, no need) then i'll share my +pepsi+ with you.  =3
Title: Re: DFHack 0.5.3
Post by: agatharchides on March 07, 2011, 02:26:47 am
The one linked in the OP works for me.
Title: Re: DFHack 0.5.3
Post by: Ovg on March 07, 2011, 02:29:39 am
All right, can't guarantee anything, but here's my xml after making it work with 31.21, it's untested though it looks like it will work.
http://www.speedyshare.com/files/27255063/Memory.xml

5.3 works with 31.20
Title: Re: DFHack 0.5.3
Post by: Truean on March 07, 2011, 03:32:38 am
Any ETA on a Memory.XML for the new 31.21 version?

Is that a record?

My instantaneous request for a support file? Or Toady's instantaneous release of a new version? I think we're running neck-and-neck...

Technically both?
Title: Re: DFHack 0.5.4
Post by: peterix on March 07, 2011, 04:27:14 am
There, 31.21 windows SDL support along with the new dfmode tool (by TheWonderIdiot!).
Title: Re: DFHack 0.5.4
Post by: shibdib on March 07, 2011, 04:35:42 am
any possible way to release just a dfvdig application... so i dont have to be tempted to scum my game with the other options :D
Title: Re: DFHack 0.5.4
Post by: Lysabild on March 07, 2011, 04:48:01 am
any possible way to release just a dfvdig application... so i dont have to be tempted to scum my game with the other options :D
Scum? A bit of magma and obsidian can hardly harm anything, riiiight?
Title: Re: DFHack 0.5.4
Post by: peterix on March 07, 2011, 04:51:41 am
any possible way to release just a dfvdig application... so i dont have to be tempted to scum my game with the other options :D
If you feel tempted by the tools, then delete the ones you don't want to use :D
Title: Re: DFHack 0.5.4
Post by: myrkul on March 07, 2011, 11:28:37 am
So, what's the chances of getting a linux update for 31.21?

(Note that I waited until the widows one had at least a preliminary working one to start whining...;))
Title: Re: DFHack 0.5.4
Post by: Thundercraft on March 07, 2011, 01:18:04 pm
I've learned my lesson and I'd be a bit cautious about whining if I were you. It seems these forums have a certain degree of whine intolerance. :P
Title: Re: DFHack 0.5.4
Post by: Lysabild on March 07, 2011, 01:18:50 pm
I've learned my lesson and I'd be a bit cautious about whining if I were you. It seems these forums have a certain degree of whine intolerance. :P

Whine is bad mkay? :b
Title: Re: DFHack 0.5.4
Post by: peterix on March 07, 2011, 01:21:36 pm

So, what's the chances of getting a linux update for 31.21?

(Note that I waited until the widows one had at least a preliminary working one to start whining... ;) )
Chance? Pretty high. Don't expect it to come in one day though. I'm back to making improvements on the search side.
Title: Re: DFHack 0.5.4
Post by: myrkul on March 07, 2011, 01:27:08 pm

So, what's the chances of getting a linux update for 31.21?

(Note that I waited until the widows one had at least a preliminary working one to start whining... ;) )
Chance? Pretty high. Don't expect it to come in one day though. I'm back to making improvements on the search side.

Accuracy > speed. Take your time, get it right. I'm in no rush.
Title: Re: DFHack 0.5.4
Post by: LoSboccacc on March 07, 2011, 03:21:04 pm
   Added dfmode tool for changing game mode. *assuming direct control*

whaaaaaaaaaaaaaaaaaaaaaaaat?
Title: Re: DFHack 0.5.2
Post by: Askot Bokbondeler on March 07, 2011, 03:44:50 pm
assuming control of a dwarf in fortress mode as in arena? damn... if that was true, i'd piss my pants

FUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
Title: Re: DFHack 0.5.4
Post by: Jeoshua on March 07, 2011, 03:52:53 pm
So wait... about DFMode.

What happens in legends to the fort when you switch to your militia captain and turn on Adventure mode when the siege happens?

And can you switch back after it's all said and done?

I...

I think I just peed a little...

Edit: And... and... you can go... offsite?
Title: Re: DFHack 0.5.4
Post by: peterix on March 07, 2011, 04:13:39 pm
So wait... about DFMode.

What happens in legends to the fort when you switch to your militia captain and turn on Adventure mode when the siege happens?

And can you switch back after it's all said and done?

I...

I think I just peed a little...

Edit: And... and... you can go... offsite?
Well, sort of. Keep in mind that the game was never made to deal with this properly.


So, be careful. And make backups in case things go bad.
Title: Re: DFHack 0.5.4
Post by: Greiger on March 07, 2011, 04:18:15 pm
Well, sort of. Keep in mind that the game was never made to deal with this properly. So, I think items might scatter and people you leave behind might die, just like animals on abandon. Also, don't unpause fort switched to arena mode. Controlling a dwarf in arena mode fort and moving around leads to everyone killing each other. Switching to some of the other modes will probably lead to instant abandon. So, be careful. And make backups in case things go bad.

Am I the only one who just "Muahaha"-d A little inside?

Dwarf Fortress,  Deathmatch mode.
Title: Re: DFHack 0.5.4
Post by: Jeoshua on March 07, 2011, 04:20:10 pm
I didn't "muaha" inside, no.

It was audible.
Title: Re: DFHack 0.5.4
Post by: Jiri Petru on March 07, 2011, 04:21:44 pm
Can I get a bit more instructions how to switch to adventurer mode, please?
I switch to arena mode-managing, assume control of a dwarf. So far so good.
I switch to adventurer mode-direct control. The interface changes to adventurer mode allright but I can't move and no other keys (not even escape) work.
Title: Re: DFHack 0.5.4
Post by: peterix on March 07, 2011, 04:37:14 pm
Can I get a bit more instructions how to switch to adventurer mode, please?
I switch to arena mode-managing, assume control of a dwarf. So far so good.
I switch to adventurer mode-direct control. The interface changes to adventurer mode allright but I can't move and no other keys (not even escape) work.
I never said it was without bugs. This worked when I tested it with 31.19 though. Now I tried with 31.21 and it seems like I can move around, but at a glacial pace. Like my guy uses the world-scale time and the map around him uses th fort mode scale. Escape worked.

It's weird. Anyway, I'll keep the tool around, even if it's only for hilariously random results :)

Edit:
OK. It's a bit unpredictable. Sometimes it seems to work, sometimes the switching can break things. Just savescum the hell out of it :)
/me licks dwarven blood from the floor as an alligator right now.
Title: Re: DFHack 0.5.4
Post by: thewonderidiot on March 07, 2011, 04:38:41 pm
Can I get a bit more instructions how to switch to adventurer mode, please?
I switch to arena mode-managing, assume control of a dwarf. So far so good.
I switch to adventurer mode-direct control. The interface changes to adventurer mode allright but I can't move and no other keys (not even escape) work.

Using exact numbers...

I'll refer to things as (game mode, control mode) herein. So in fortress mode, you start out in mode (0,0). You change the mode to (4,0) via dfmode to enter arena. Find whoever you wanna control, and when you assume them, you enter (5,1). If you then change the mode to (1,1), you should have full control over your assumed creature in adventure mode.

Same process applies to switching adventurers when already in adventure mode. You're starting out in (1,1). You change the mode to (5,1), then press C in game to release control, which takes you to standard arena mode (4,0). Then you assume control of your new adventurer, which takes you into (5,1), and then you dfmode to take you back to (1,1) for normal adventurer mode.
Title: Re: DFHack 0.5.4
Post by: Jiri Petru on March 07, 2011, 04:45:49 pm
Hmm... I wasn't using the (5,1) but even with it it makes no difference. I'm doing exactly what you said but I can't move and the buttons don't respond. Guess it just doesn't work in 31.21 or on my computer. Thanks anyway.
Title: Re: DFHack 0.5.4
Post by: thewonderidiot on March 07, 2011, 04:53:04 pm
Hmm... I wasn't using the (5,1) but even with it it makes no difference. I'm doing exactly what you said but I can't move and the buttons don't respond. Guess it just doesn't work in 31.21 or on my computer. Thanks anyway.

Well, the (5,1) should be happening automatically when you assume control. Taking it into (1,1) from there should give your adventurer full range of movement when unpaused. There's a pretty good chance that if you're trying to do this in a very large and successful fort, your FPS is just incredibly low.
Title: Re: DFHack 0.5.4
Post by: Jiri Petru on March 07, 2011, 05:27:03 pm
You'll probably right, it might be the FPS. Tried it on a different fort and it worked perfectly. Thanks for your help.
Title: Re: DFHack 0.5.4
Post by: LoSboccacc on March 07, 2011, 05:29:44 pm
Can I get a bit more instructions how to switch to adventurer mode, please?
I switch to arena mode-managing, assume control of a dwarf. So far so good.
I switch to adventurer mode-direct control. The interface changes to adventurer mode allright but I can't move and no other keys (not even escape) work.

Using exact numbers...

I'll refer to things as (game mode, control mode) herein. So in fortress mode, you start out in mode (0,0). You change the mode to (4,0) via dfmode to enter arena. Find whoever you wanna control, and when you assume them, you enter (5,1). If you then change the mode to (1,1), you should have full control over your assumed creature in adventure mode.

Same process applies to switching adventurers when already in adventure mode. You're starting out in (1,1). You change the mode to (5,1), then press C in game to release control, which takes you to standard arena mode (4,0). Then you assume control of your new adventurer, which takes you into (5,1), and then you dfmode to take you back to (1,1) for normal adventurer mode.

I can be a boogeyman! crash, here I come!
Title: Re: DFHack 0.5.4
Post by: thewonderidiot on March 07, 2011, 06:38:07 pm
By the by, if anybody figures out what game mode and control mode "kittens" are for, let me know  ;)
Title: Re: DFHack 0.5.4
Post by: _DivideByZero_ on March 07, 2011, 07:44:35 pm
This doesn't seem to work on wine anymore. That's odd, because the previous versions worked fine.
It gives me the following error when I run any of the utilities:
memory object not set: type offset key /string/MSVC/buffer                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
Title: Re: DFHack 0.5.4
Post by: IT 000 on March 07, 2011, 11:30:46 pm
Sorry if I've glanced over it.

Can I get a link for version 0.5.4 for DF 31.20? I have a windows and saw no reason to download .21 after I've updated my mod.
Title: Re: DFHack 0.5.4
Post by: Rose on March 07, 2011, 11:32:52 pm
Sorry if I've glanced over it.

Can I get a link for version 0.5.4 for DF 31.20? I have a windows and saw no reason to download .21 after I've updated my mod.

have you actually tried the download and found that it was not backwards compatible?

if you did, then it's a bug and should be reported.
Title: Re: DFHack 0.5.4
Post by: noob on March 07, 2011, 11:45:31 pm
no creature creation in arena mode  :(

but on the bright side everyone starts killing each other in fortress mode. they all go independent for instant FUN (including clowns).
Title: Re: DFHack 0.5.4
Post by: IT 000 on March 07, 2011, 11:47:53 pm
Well, it does work. I did not know that.
Title: Re: DFHack 0.5.4
Post by: Makbeth on March 08, 2011, 12:20:49 am
Wohoo!  Can start out as my best legendary axeman already decked out in *adamantine armor*.  Maybe I'll actually be able to take two punches from that accursed Specter of Brine before being reduced to paste.
Title: Re: DFHack 0.5.4
Post by: Truean on March 08, 2011, 11:36:36 am
Is there any way we can make the area designation for DF Liquids to create Obsidian work? I know about magma being created over water and vice versa, but that leaves heat traps. Can we make large areas of obsidian without doing so by going through each and every individual tile directly?
Title: Re: DFHack 0.5.4
Post by: peterix on March 08, 2011, 02:40:10 pm
Is there any way we can make the area designation for DF Liquids to create Obsidian work? I know about magma being created over water and vice versa, but that leaves heat traps. Can we make large areas of obsidian without doing so by going through each and every individual tile directly?
Yes. It's not ideal. I'll look at it.
Title: Re: DFHack 0.5.4
Post by: Lysabild on March 08, 2011, 04:17:52 pm
Is there any way we can make the area designation for DF Liquids to create Obsidian work? I know about magma being created over water and vice versa, but that leaves heat traps. Can we make large areas of obsidian without doing so by going through each and every individual tile directly?
Yes. It's not ideal. I'll look at it.

That'd be so great! I've been wanting to make a town cut in obsidian with your tool but it's hard to make it work probably with water and magma and 1 tile at a time is just.. Torture..
Title: Re: DFHack 0.5.4
Post by: TolyK on March 08, 2011, 04:45:39 pm
Is there any way we can make the area designation for DF Liquids to create Obsidian work? I know about magma being created over water and vice versa, but that leaves heat traps. Can we make large areas of obsidian without doing so by going through each and every individual tile directly?
Yes. It's not ideal. I'll look at it.

That'd be so great! I've been wanting to make a town cut in obsidian with your tool but it's hard to make it work probably with water and magma and 1 tile at a time is just.. Torture..
seconded. i use this rarely but it helps.

edit: also: this is great in adventure mode ;)
Title: Re: DFHack 0.5.4
Post by: darius on March 08, 2011, 04:59:20 pm
found arena creature lists and item lists:
Code: [Select]
0x1463B2C+0x400000( seems that dfhack offsets use this offset scheme) creatures vector, each entry a short (2bytes)
0x1463B3C+0x400000 castes vector, also 2 bytes each (usually just 0 or 1 - male, female)
item vectors are a bit further (+0xd4 from creatures vector). They are pointer to structures with item type, material and something... Maybe someone will find this usefull
Title: Re: DFHack 0.5.4
Post by: Askot Bokbondeler on March 08, 2011, 06:15:42 pm
if i take control of a squad leader, does the squad follow me in adventure mode?

i really want to take this for a test drive, but sadly i can't right now... i'm dead curious, though
also, about this:
Then if you go offsite, items might scatter and people you leave behind might die, just like animals on abandon.

rumrusher discovered how to turn a site into a night creature lair type site (http://www.bay12forums.com/smf/index.php?topic=69682.msg2044831#msg2044831) and darius implemented it into DFusion (http://www.bay12forums.com/smf/index.php?topic=69682.msg2051691#msg2051691)

man... this is a great day for df's community...
Title: Re: DFHack 0.5.4
Post by: Truean on March 08, 2011, 06:33:30 pm
Is there any way we can make the area designation for DF Liquids to create Obsidian work? I know about magma being created over water and vice versa, but that leaves heat traps. Can we make large areas of obsidian without doing so by going through each and every individual tile directly?
Yes. It's not ideal. I'll look at it.

Awesome, thanks. :)
Title: Re: DFHack 0.5.4
Post by: Twobeard on March 08, 2011, 08:46:45 pm
Sorry peterix but i was just using dfvdig and it doesnt seem to want to recognise the vein.

Have had no problem in previous versions, in fact it is a life saver. Was wondering if either this is a new bug or i am just doing something wrong.

Thanks for all the hard work man. Your awesome.
Title: Re: DFHack 0.5.4
Post by: peterix on March 08, 2011, 09:59:08 pm
Sorry peterix but i was just using dfvdig and it doesnt seem to want to recognise the vein.

Have had no problem in previous versions, in fact it is a life saver. Was wondering if either this is a new bug or i am just doing something wrong.

Thanks for all the hard work man. Your awesome.
Thanks for reporting the problem. It will be fixed soon (already is, but I'll do some more fixing before I release that).
Title: Re: DFHack 0.5.4
Post by: darius on March 09, 2011, 06:14:54 am
if i take control of a squad leader, does the squad follow me in adventure mode?

i really want to take this for a test drive, but sadly i can't right now... i'm dead curious, though
No unfortunately they don't. However if you leave your fort with a creature in adv. mode, and then return all your dwarfs are turned to "Friendly" but you can change it back to fort mode and continue (with your adventurer dwarf as last dwarf your fort has).

Edit: for some reason i can't save now :/
Title: Re: DFHack 0.5.4
Post by: KylonOrina on March 09, 2011, 06:29:13 am
So when trying to use reveal and prospector in the newest version it says

"uses world ptr
can't init map"

and stops there.
What's wrong? And how do I fix this?
Title: Re: DFHack 0.5.4
Post by: peterix on March 09, 2011, 07:02:00 am
So when trying to use reveal and prospector in the newest version it says

"uses world ptr
can't init map"

and stops there.
What's wrong? And how do I fix this?
Unfortunately, that's nowhere near enough info to know what happened... Those tools work over here. It's a 31.20 or 31.21, judging from the 'uses world ptr' part. Never ran into the 'can't init map' bit with those versions. Normally that means there's no local map loaded.

I'd have to have more details, but there's no easy way to retrieve those on your side... I'll have to think about this a bit.
Title: Re: DFHack 0.5.4
Post by: Andux on March 09, 2011, 08:23:32 am
Edit: for some reason i can't save now :/

Switching to arena mode does that sometimes; I think it's when you switch back from (5,1) to arena mode using ctrl+a - I went from (0,0) to (4,0), assumed control, then to (1,1) and could still save (though I ran into the bodyswapping bug when I tried to travel - had to use DFusion's "?Change Adv permenent?" tool to fix it).

The flag that controls whether you can save is at offset 0x15087c5 in 0.31.20/21 SDL (working offsets for .18 and .19 are on the wiki (http://df.magmawiki.com/index.php/DF2010:Memory_hacking#SDL_versions) - seems to be always 0x25 bytes after current_weather); changing it back to 1 should work.
Title: Re: DFHack 0.5.4
Post by: KylonOrina on March 09, 2011, 09:00:49 am
Unfortunately, that's nowhere near enough info to know what happened... Those tools work over here. It's a 31.20 or 31.21, judging from the 'uses world ptr' part. Never ran into the 'can't init map' bit with those versions. Normally that means there's no local map loaded.

I'd have to have more details, but there's no easy way to retrieve those on your side... I'll have to think about this a bit.

Well I got it to work. It seems it only works for me when I use the Lazy Newb Pack GUI to launch the programs as opposed to just double clicking on the icon in the folder.
Very odd.
Title: Re: DFHack 0.5.4
Post by: darius on March 09, 2011, 03:43:02 pm
I started to wonder: how obse works (oblivions script extender if somebody does not know, also similar things exist for fallout3 and new vegas). It basically patches into Classes. And new version come out very fast if oblivion is updated (but usually that happens a lot less frequently). So how do they do it?
Title: Re: DFHack 0.5.4
Post by: Jeoshua on March 09, 2011, 03:47:21 pm
.dll wrapping and other more advanced techniques.

Also, Timeslipped is a freak of nature, able to code anything in any language, even ASM.

Don't hold your breath on a DFSE...
Title: Re: DFHack 0.5.4
Post by: darius on March 09, 2011, 03:49:17 pm
Well there is no script system to extend :D but i already have a dll that patches lua scripts into DF. Unfortunately that alone does nothing...

Edit: and somehow he uses RTTI to his advantage. I'm sure that linux version would be a lot more complicated. Well i guess time for some research.
Edit2: It's fun... but somehow i'm feeling like i'm doing something i'm not supposed to...
Title: Re: DFHack 0.5.4
Post by: Jeoshua on March 09, 2011, 04:42:01 pm
Well you are doing something that Toady expressly does not support: Reverse Engineering... then again this is a game about Dwarves, and anything with Engineering in it's title is bound to be very Dwarfy
Title: Re: DFHack 0.5.4
Post by: GJM on March 09, 2011, 05:57:33 pm
Hi,

I'm trying to get this running (just Reveal and prospector mostly) on Linux, but I seem to be having some trouble. I've got the file downloaded and extracted, but I'm a bit lost as to where I go from here. I tried just compiling the files in toos/supported, but got the error
fatal error: DFHack.h: no such file or directory.

I'm quite new to linux so some of this higher stuff confuses the hell out of me -any help appreciated.
Title: Re: DFHack 0.5.4
Post by: Lesseps on March 09, 2011, 06:11:24 pm
Hey, my 0.5.2 dfcleanmap tool doesnt work. it says ' can't find MSVCP100.dll '. What should I do ? :/
Title: Re: DFHack 0.5.4
Post by: thewonderidiot on March 09, 2011, 06:12:44 pm
Hey, my 0.5.2 dfcleanmap tool doesnt work. it says ' can't find MSVCP100.dll '. What should I do ? :/

On Windows, you might have to install the MSVC 2010 redistributable (http://www.microsoft.com/downloads/en/details.aspx?FamilyID=a7b7a05e-6de6-4d3a-a423-37bf0912db84).
Title: Re: DFHack 0.5.4
Post by: Lesseps on March 09, 2011, 06:32:08 pm
thanks a lot!
Title: Re: DFHack 0.5.4
Post by: peterix on March 09, 2011, 06:56:11 pm
Hi, I'm trying to get this running (just Reveal and prospector mostly) on Linux, but I seem to be having some trouble. I've got the file downloaded and extracted, but I'm a bit lost as to where I go from here. I tried just compiling the files in toos/supported, but got the error
fatal error: DFHack.h: no such file or directory.

I'm quite new to linux so some of this higher stuff confuses the hell out of me -any help appreciated.
First, read the COMPILE (https://github.com/peterix/dfhack/blob/master/COMPILE.rst) file and try to follow the instructions there. Ask questions if that fails :)
Anyway, the latest supported (=map tools run) DF version on linux is 31.19.
Title: Re: DFHack 0.5.4
Post by: Seriyu on March 09, 2011, 08:47:30 pm
If I were to use DFmode to take control of a soldier during a seige, would this result in fortress mode breaking when I try to return to, well, fortress mode?

I read the readme but I didn't know if "lost a fortress" was meant literally.
Title: Re: DFHack 0.5.4
Post by: Askot Bokbondeler on March 09, 2011, 08:52:59 pm
unfortunatelly, yes, you'd loose the fortress. you could use dfusion to save the site as a lair and the items wouldn't scatter and the creatures wouldn't die, but upon *reclaiming* it everything would be revealed, including the HFS(killing your fps forever) and your dwarves would be counted as *friendly*, you'd just have control of the dude you previously possessed



but we could use this little trick to build a shack in the woods with our little adventurer, if we had an axe, or dig a burrow, if we had a pick, provided we generated a world without hfs
Title: Re: DFHack 0.5.4
Post by: thewonderidiot on March 09, 2011, 08:57:26 pm
I've been thinking about using pieces of dfreveal to keep things hidden during mode switches. I'll experiment with it later, but I'd like to turn dfmode into a slightly more intelligent tool that does its best to keep DF from messing up.
Title: Re: DFHack 0.5.4
Post by: Seriyu on March 09, 2011, 09:19:21 pm
Ahhh, dang. Oh well, thanks!
Title: Re: DFHack 0.5.4
Post by: Askot Bokbondeler on March 09, 2011, 09:46:04 pm
I've been thinking about using pieces of dfreveal to keep things hidden during mode switches. I'll experiment with it later, but I'd like to turn dfmode into a slightly more intelligent tool that does its best to keep DF from messing up.

yeah, that might work...  and you can recover your dwarves using runesmith, i just did it, just removed the flag "is resident"
Title: Re: DFHack 0.5.4
Post by: Rumrusher on March 09, 2011, 10:39:13 pm
DFMODE? so this means Succession forts will never be the same? also does this work with .19? edit wait so this means Hermit adventure forts will work.
Title: Re: DFHack 0.5.4
Post by: thewonderidiot on March 09, 2011, 11:25:30 pm
yeah, that might work...  and you can recover your dwarves using runesmith, i just did it, just removed the flag "is resident"

Excellent, thanks for that info.

wait so this means Hermit adventure forts will work.

If you mean taking an adventurer to fortress mode, then unfortunately, this doesn't work. You can only take arena mode, and therefore adventure mode, into fortress mode if you're currently within the bounds of your (still alive) fortress embark. If you're not, the game just crashes.
Title: Re: DFHack 0.5.4
Post by: Rumrusher on March 10, 2011, 12:30:30 am
yeah, that might work...  and you can recover your dwarves using runesmith, i just did it, just removed the flag "is resident"

Excellent, thanks for that info.

wait so this means Hermit adventure forts will work.

If you mean taking an adventurer to fortress mode, then unfortunately, this doesn't work. You can only take arena mode, and therefore adventure mode, into fortress mode if you're currently within the bounds of your (still alive) fortress embark. If you're not, the game just crashes.
so if we can only go back to fort mode if it's not dead. darn looks like rembarking still has to be done... also whats the Kitten mode do?
Title: Re: DFHack 0.5.4
Post by: GJM on March 10, 2011, 07:18:06 am
Hi, I'm trying to get this running (just Reveal and prospector mostly) on Linux, but I seem to be having some trouble. I've got the file downloaded and extracted, but I'm a bit lost as to where I go from here. I tried just compiling the files in toos/supported, but got the error
fatal error: DFHack.h: no such file or directory.

I'm quite new to linux so some of this higher stuff confuses the hell out of me -any help appreciated.
First, read the COMPILE (https://github.com/peterix/dfhack/blob/master/COMPILE.rst) file and try to follow the instructions there. Ask questions if that fails :)
Anyway, the latest supported (=map tools run) DF version on linux is 31.19.

Thanks for the help. I followed the instructions there, but when I typed cmake -DCMAKE_BUILD_TYPE:string=Release I got these errors:

CMake Error at CMakeLists.txt:18 (message):
  In-source builds are not allowed.


CMake Error at CMakeLists.txt:41 (add_subdirectory):
  add_subdirectory given source "library" which is not an existing directory.


CMake Error at CMakeLists.txt:44 (add_subdirectory):
  add_subdirectory given source "tools/supported" which is not an existing
  directory.

I feel like I'm missing something obvious here  :-[
Especially as tools/supported is definitely in there.
Title: Re: DFHack 0.5.4
Post by: peterix on March 10, 2011, 08:08:19 am
Thanks for the help. I followed the instructions there, but when I typed cmake -DCMAKE_BUILD_TYPE:string=Release I got these errors:

CMake Error at CMakeLists.txt:18 (message):
  In-source builds are not allowed.
You're not doing this from the build folder. The file says it very clearly:
Code: [Select]
cd build
cmake .. -DCMAKE_BUILD_TYPE:string=Release
make
This is enforced because running cmake from the dfhack root folder would mix the build system with the source code... which is rather ugly. So. The '..' part is important.
Title: Re: DFHack 0.5.4
Post by: thewonderidiot on March 10, 2011, 09:05:15 am
also whats the Kitten mode do?

You tell me ;) I have no idea, we haven't figured out what the kittens modes are yet.
Title: Re: DFHack 0.5.4
Post by: Jeoshua on March 10, 2011, 09:14:32 am
I think that's a hidden mode where Toady logs into your machine when he's bored and makes the cat's breed to insane numbers, makes them sit DIRECTLY where you need to build a wall, then buffs them and makes them kill invaders they have no right to kill.
Title: Re: DFHack 0.5.4
Post by: GJM on March 10, 2011, 09:33:32 am
Thanks for the help. I followed the instructions there, but when I typed cmake -DCMAKE_BUILD_TYPE:string=Release I got these errors:

CMake Error at CMakeLists.txt:18 (message):
  In-source builds are not allowed.
You're not doing this from the build folder. The file says it very clearly:
Code: [Select]
cd build
cmake .. -DCMAKE_BUILD_TYPE:string=Release
make
This is enforced because running cmake from the dfhack root folder would mix the build system with the source code... which is rather ugly. So. The '..' part is important.

woops, don't know how I missed that. Up an running now though, thanks for the help.
Title: Re: DFHack 0.5.4
Post by: baaleze on March 10, 2011, 10:11:18 am
Helloooo
Ah ah ah. I was writing my first post here about an error I got when trying to compile probe.cpp on linux. I was getting a link error. And I found the solution just before clicking the "Post" button. But I'm posting it anyway, so if anyone has the same error, at least he won't be looking for the solution for 1 hour, like I did (maybe I'm just stupid).
It was caused by the fact that I was compiling without the option : -ldfhack
I thought the library was used automatically, and even when I tried the -l option, it was with libdfhack or libdfhack.so... I hope it'll be useful for someone (maybe you could put a note about "dontforgetthedamnoption" in COMPILE, a friend of mine tried and he forgot the option too).

Anyway, I'm stupid but I'm also grateful to you who made this library. Thanks!  :)
Title: Re: DFHack 0.5.4
Post by: Greiger on March 10, 2011, 10:37:59 am
Kitten mode is clearly a mode where it takes your current mode and simulates scamps sleeping on your keyboard.
Title: Re: DFHack 0.5.4
Post by: Jiri Petru on March 10, 2011, 01:52:24 pm
I am extremely interested in the dfmode tool and it's interaction with other tools. Can anyone who experiments with it post their results here? Also here's hoping for more future development, this sounds very exciting.

And thanks to those who've already posted about it.
Title: Re: DFHack 0.5.4
Post by: darius on March 10, 2011, 02:09:54 pm
I am extremely interested in the dfmode tool and it's interaction with other tools. Can anyone who experiments with it post their results here? Also here's hoping for more future development, this sounds very exciting.

And thanks to those who've already posted about it.
crossposting from DFusion thread:
Tried traveling from one fort site to other ( embark, abandon, embark again, arena mode, assume control, adventurer mode, travel, arena mode-assumed, leave creature, fort mode) at first it worked ok but after some time suddenly it exited to the main menu without any warning...
Title: Re: DFHack 0.5.4
Post by: Askot Bokbondeler on March 10, 2011, 02:26:13 pm
i never tried to save my game while swaped into adventurer, anybody did? did it cause anything funny?
Title: Re: DFHack 0.5.4
Post by: myrkul on March 10, 2011, 02:56:04 pm
Can you pause, switch mode back to the HFS-revealing mode, and use dfreveal to hide it all again before unpausing? (at least as a workaround until the unreveal code gets incorporated)
Title: Re: DFHack 0.5.4
Post by: Askot Bokbondeler on March 10, 2011, 03:06:12 pm
yes, that's what im using
i posted the proper steps on dfusion's thread:
this is how it's done:

1 first, save your fortress as a lair using the dfusion "protect the site from item scattering" functionality
2 then run dfhack's reveal, leave it open
3 do the tricks required to swap to adventurer mode
4 fool around the world
5 return to your fortress
6 do the tricks required to swap to fortress mode
7 use runesmith to turn off the flag "is resident" on your friendly dwarves
8 before unpausing, unreveal your fortress tiles again using the reveal process you had already open


NOTE: it worked for me, but some dwarves were teleported into the unexplored depths, i haven't tried, but i suspect that if i use the fast mode of "protect the site from item scattering", only a few selected z levels are stored as a lair preventing the scattering of dwarves
also, always back up your save, it is extremely easy to screw up everything

if you do as explained it should preserve your fortress, it has worked so far, for me
Title: Re: DFHack 0.5.4
Post by: darius on March 10, 2011, 03:13:08 pm
Btw i suspect that "protect the site from item scattering" functionality if implemented correctly in DFHack would work a lot faster. All it needs to do is flip 14-th flag in  each tile's occupancy (although it's still a lot of tiles).
Title: Re: DFHack 0.5.4
Post by: Jeoshua on March 10, 2011, 03:22:49 pm
The idea of being able to make a grand fort, then train up a great hero and send him forth, only to have him eventually settle down and form his own community intrigues me.  It is FAR preferable to abandoning a fort after getting bored, I think.  I vote the next release should have nothing to do with anything (apart from bugfixes) except this newfound wizardry.
Title: Re: DFHack 0.5.4
Post by: Askot Bokbondeler on March 10, 2011, 03:29:43 pm
Btw i suspect that "protect the site from item scattering" functionality if implemented correctly in DFHack would work a lot faster. All it needs to do is flip 14-th flag in  each tile's occupancy (although it's still a lot of tiles).

could you make a functionality to mark only revealed tiles as lair?

and could the dfhack guys make it so dfreveal outputs a file it could load later so it could remember which tiles it was supposed to unreveal? it would be usefull if we were fooling arround the world as an adventurer but planed to return to our fortress later, or if we manage to juggle tow or tree fortresses
Title: Re: DFHack 0.5.4
Post by: peterix on March 10, 2011, 04:14:35 pm
Helloooo
Ah ah ah. I was writing my first post here about an error I got when trying to compile probe.cpp on linux. I was getting a link error. And I found the solution just before clicking the "Post" button. But I'm posting it anyway, so if anyone has the same error, at least he won't be looking for the solution for 1 hour, like I did (maybe I'm just stupid).
It was caused by the fact that I was compiling without the option : -ldfhack
There is no -ldfhack needed. All you have to do is build dfhack with cmake and make from the build folder, as described in the COMPILE document. I suspect you tried (and after an hour of applied masochism succeeded) to compile the indicidual tools. You don't have to do that - ever. Just copypaste a few commands from COMPILE and it does all the hard work for you.
Btw i suspect that "protect the site from item scattering" functionality if implemented correctly in DFHack would work a lot faster. All it needs to do is flip 14-th flag in  each tile's occupancy (although it's still a lot of tiles).
Yep. I'll have to do a bit of research into the occupancy stuff. In 40d, it contained mostly blood splatter flags, which no longer work in 31.xx. So, the occupancy struct is outdated.
could you make a functionality to mark only revealed tiles as lair?
Good idea.
and could the dfhack guys make it so dfreveal outputs a file it could load later so it could remember which tiles it was supposed to unreveal? it would be usefull if we were fooling around the world as an adventurer but planed to return to our fortress later, or if we manage to juggle tow or tree fortresses
And another good idea. I won't do that by default tho.
Title: Re: DFHack 0.5.4
Post by: Rumrusher on March 10, 2011, 05:12:43 pm
so did any one attempt to do this in other sites? like a lair or human fort?
Title: Re: DFHack 0.5.4
Post by: Askot Bokbondeler on March 10, 2011, 05:23:40 pm
it stops responding when i try to change to fortress mode in the wilderness, but changing mode again lets you resume adventuring... i suppose it's because it's missing the site's information, like the name of the fortress, it's relation to other civs, etc, so it isn't able to start fortress mode... human towns and lairs could work, i haven't tried

what i tried was saving and quiting and nothing funky happens:
i used reveal, possessed a dwarf, saved the game in adventurer mode, quit the game, restarted it, returned to fortress mode, and used reveal to hide the tiles again (i had left the process open), and it all worked flawlessly

next i'll try to save in the wilderness and return to the fortress to see if leaving the site changes anything
Title: Re: DFHack 0.5.4
Post by: Jeoshua on March 10, 2011, 05:30:49 pm
Askot, your dwarvenly endeavors inspire me.  FOR !!SCIENCE!!
Title: Re: DFHack 0.5.4
Post by: Jiri Petru on March 10, 2011, 06:00:38 pm
what i tried was saving and quiting and nothing funky happens:
i used reveal, possessed a dwarf, saved the game in adventurer mode, quit the game, restarted it, returned to fortress mode, and used reveal to hide the tiles again (i had left the process open), and it all worked flawlessly

Perhaps this process could be automated for a possible two way "Fortress>Adventurer; Adventurer>Fortress" tool? It shouldn't be that difficult, right?

---

In other news, I did some experimenting on my own. I have a massive fortress where it's impossible to change into adventurer mode - as I've written, the keyboard doesn't register any keypresses, as if the game looped in the first step of adventurer mode forever. DF is responding, I can change the mode back, though it becomes very messed up and generally doesn't work.

What's strange is:
1) I let it run through the night to to avail so it definitely isn't an FPS issue.
2) On an earlier save of this fortress, changing to adventurer mode worked perfectly.

I can only assume something happened later in the game that prevented changing to adventurer mode. Possible causes (I'm just listing any differences between the saves I can think of): ongoing ambush, ghosts on the map... can't really think of anything else. Hell is revealed but an earlier save with revealed hell worked no problem. It would be really interesting to know what the real cause is.

If anyone wants to try to find the cause of the problem, here is the save (http://rpgforum.cz/temp/DF%20Gemclod.zip). Since it is a massive succession fortress (the current SA let's play) I'd be forever indebted to anyone who makes it work so I can do crazy stuff in the succession. Please don't take this as a request, though. I'm just providing material in case anyone is interested in finding little bugs and issues.  ;)
Title: Re: DFHack 0.5.4
Post by: Askot Bokbondeler on March 10, 2011, 06:16:28 pm
trying to return to my fortress i was attacked by boogeyman, it zooms in and gives me the text "you've discovered a great magma sea", followed by "the cackling fades away"... i notice that i'm a magma crab swimming beneath the earth...
i swap to arena mode, discover my adventurer a few z levels above, possess him, return to adventuring and reach my destination... i swap to fortress mode, run reveal to hide everything again... and it crashes... then i unpause fortress mode and it runs for a minute, before it too crashed... eh, seems this might still be a bit unstable

Askot, your dwarvenly endeavors inspire me.  FOR !!SCIENCE!!

thank you, but the guys deserving praise here are darius, peterix and rumrusher
Title: Re: DFHack 0.5.4
Post by: thewonderidiot on March 10, 2011, 06:31:54 pm
thank you, but the guys deserving praise here are darius, peterix and rumrusher
Aww, no love for the one who wrote the tool and fleshed out the modes?  ;)

then i unpause fortress mode and it runs for a minute, before it too crashed...

Try saving before the crash happens and see if it still crashes after the save is reloaded. It could potentially be just a temporary memory issue.
Title: Re: DFHack 0.5.4
Post by: Andux on March 10, 2011, 06:58:00 pm
i never tried to save my game while swaped into adventurer, anybody did? did it cause anything funny?
Yes (http://www.bay12forums.com/smf/index.php?topic=58809.msg2058778#msg2058778). I assumed control of one of my militiadorfs and was able to save and reload successfully. Side effects:
Title: Re: DFHack 0.5.4
Post by: Askot Bokbondeler on March 10, 2011, 06:59:34 pm
thank you, but the guys deserving praise here are darius, peterix and rumrusher
Aww, no love for the one who wrote the tool and fleshed out the modes?  ;)

damn! from now on i shall carry your name in my sig to redeem my honor

EDIT:
Spoiler (click to show/hide)

yeah, i've had my go with save and load and it's side effects (http://www.bay12forums.com/smf/index.php?topic=58809.msg2063572#msg2063572),
Title: Re: DFHack 0.5.4
Post by: Rumrusher on March 10, 2011, 08:55:25 pm
i never tried to save my game while swaped into adventurer, anybody did? did it cause anything funny?
Yes (http://www.bay12forums.com/smf/index.php?topic=58809.msg2058778#msg2058778). I assumed control of one of my militiadorfs and was able to save and reload successfully. Side effects:
  • On travelling to a nearby lair, I found myself in control of the resident night creature; my dorf was waiting on the edge of the site, so I was able to switch back (permanently) using DFusion. Immediately, the night creature attacked me, whereupon I proceeded to take my mittenfull of the deadly -bronze mace- and bash it all into its beady little skull.
  • Upon returning to my fortress, I found items and dwarves scattered about (pseudo)randomly. Inside, I also spotted a few (friendly!) goblins chilling out with my dorfs in the dining area; I recruited a pair of them and set off again.
  • Arriving at a large human town some time later, I noted that I still had "Give in to Starvation" in place of the expected retirement option.
so assuming control of creatures no better than Darius adventure swap or my cage variation.
so the only way to retire these Assumed. Adventurers is to go into fort mode and abandon.
Though I wonder if saving between swaps keeps the game from going bonkers and crashing. oh if you Recruit any one they will become apart of your Civ. So before swapping to fort mode recruit every one there.
Title: Re: DFHack 0.5.5
Post by: peterix on March 10, 2011, 10:18:46 pm
Just pushed out a major revamp of dfliquids and some minor bugfix of dfvdig. Enjoy :)

See the new 'help' command output:
Code: [Select]
Modes:
m             - switch to magma
w             - switch to water
o             - make obsidian wall instead
of            - make obsidian floors
rs            - make a river source
f             - flow bits only
Set-Modes:
s+            - only add
s.            - set
s-            - only remove
Properties:
f+            - make the spawned liquid flow
f.            - don't change flow state (read state in flow mode)
f-            - make the spawned liquid static
0-7           - set liquid amount
Brush:
point         - single tile [p]
range         - block with cursor at bottom north-west [r]
block         - DF map block with cursor in it
column        - Column up through free space
Other:
q             - quit
help          - print this list of commands
empty line    - put liquid

Usage: point the DF cursor at a tile you want to modify
and use the commands available

I tested it, but that doesn't rule out minor bugs. It will be much easier to add new features to it now.
Title: Re: DFHack 0.5.5
Post by: Urist McFumbler on March 10, 2011, 10:53:36 pm
THANK YOU! THANK YOU! THANK YOU! THANK YOU! THANK YOU!
Title: Re: DFHack 0.5.5
Post by: BigD145 on March 10, 2011, 11:54:18 pm
River source?!   :'(
Title: Re: DFHack 0.5.5
Post by: peterix on March 11, 2011, 12:21:07 am
River source?!   :'(
An infinite source of water. You could call it a spring, but those aren't artificial like this thing :)
Title: Re: DFHack 0.5.5
Post by: Rumrusher on March 11, 2011, 12:50:00 am
River source?!   :'(
An infinite source of water. You could call it a spring, but those aren't artificial like this thing :)
Tweak had these back in 40d though I can only see slapping that on as means of building a hydro cannon for the front gate.
Title: Re: DFHack 0.5.5
Post by: Jeoshua on March 11, 2011, 01:10:55 am
You could also use it to turn those damnable cavern ponds into underground oceanic reservoirs
Title: Re: DFHack 0.5.4
Post by: baaleze on March 11, 2011, 04:10:50 am
Helloooo
Ah ah ah. I was writing my first post here about an error I got when trying to compile probe.cpp on linux. I was getting a link error. And I found the solution just before clicking the "Post" button. But I'm posting it anyway, so if anyone has the same error, at least he won't be looking for the solution for 1 hour, like I did (maybe I'm just stupid).
It was caused by the fact that I was compiling without the option : -ldfhack
There is no -ldfhack needed. All you have to do is build dfhack with cmake and make from the build folder, as described in the COMPILE document. I suspect you tried (and after an hour of applied masochism succeeded) to compile the indicidual tools. You don't have to do that - ever. Just copypaste a few commands from COMPILE and it does all the hard work for you.
Well, what I want in the end is to make my own tool using DFHack. So yes, I tried to compile a single tool, to see if I could. And I can now.
Title: Re: DFHack 0.5.5
Post by: Rumrusher on March 11, 2011, 04:18:14 am
You could also use it to turn those damnable cavern ponds into underground oceanic reservoirs
or a whirlpool that sucks any into the bottom.
Title: Re: DFHack 0.5.5
Post by: Truean on March 11, 2011, 04:26:43 am
Just pushed out a major revamp of dfliquids and some minor bugfix of dfvdig. Enjoy :)

See the new 'help' command output:
Code: [Select]
Modes:
m             - switch to magma
w             - switch to water
o             - make obsidian wall instead
of            - make obsidian floors
rs            - make a river source
f             - flow bits only
Set-Modes:
s+            - only add
s.            - set
s-            - only remove
Properties:
f+            - make the spawned liquid flow
f.            - don't change flow state (read state in flow mode)
f-            - make the spawned liquid static
0-7           - set liquid amount
Brush:
point         - single tile [p]
range         - block with cursor at bottom north-west [r]
block         - DF map block with cursor in it
column        - Column up through free space
Other:
q             - quit
help          - print this list of commands
empty line    - put liquid

Usage: point the DF cursor at a tile you want to modify
and use the commands available

I tested it, but that doesn't rule out minor bugs. It will be much easier to add new features to it now.

Awesome, thank you.

Can you use range with df liquids to directly mod in areas of obsidian walls/floors larger than one square? :)
Title: Re: DFHack 0.5.4
Post by: peterix on March 11, 2011, 04:40:18 am
Well, what I want in the end is to make my own tool using DFHack. So yes, I tried to compile a single tool, to see if I could. And I can now.
Then it's still easier to work within the dfhack build system.
But yeah, I see your point. I should make the 'making your own' part easier, or at least describe how to do so :)

Can you use range with df liquids to directly mod in areas of obsidian walls/floors larger than one square? :)
Any size you want really. I recommend keeping away from combining the multi z-level column and range brushes with the floor option though.

The current code allows adding any kind of procedural brush separately from the effects of it. I might tweak that even more and add some kind of 'selection' mechanism, but it's already quite flexible as it is now.
Title: Re: DFHack 0.5.5
Post by: Rumrusher on March 11, 2011, 12:34:21 pm
I wonder if designations would still work if you swap to adventure mode.
Title: Re: DFHack 0.5.5
Post by: peterix on March 11, 2011, 12:52:29 pm
I wonder if designations would still work if you swap to adventure mode.
The flags have different meaning depending on game mode AFAIK.
Title: Re: DFHack 0.5.5
Post by: Halnoth on March 11, 2011, 01:05:47 pm
If you got a king and became a capital wouldnt you make it so you can be away from your fortress however long you want in adv mode without everything scattering?
Title: Re: DFHack 0.5.5
Post by: Rumrusher on March 11, 2011, 01:17:12 pm
If you got a king and became a capital wouldnt you make it so you can be away from your fortress however long you want in adv mode without everything scattering?
that got answered by using Dfusion and or using Tweak and coating  the tiles with 14-blood.
the problem is that being away might end up crashing the game if you attempt to go back.
Title: Re: DFHack 0.5.5
Post by: myrkul on March 11, 2011, 03:09:39 pm
What would be awesome is if you could build up a fort to capitol stage, then, possess a dwarf, recruit 6 others, and head off into the wilderness, find a good site, and then switch back to fort mode and build a new fortress. The day you can do this, DF, in my mind, will be feature-complete.
Title: Re: DFHack 0.5.5
Post by: Jeoshua on March 11, 2011, 03:16:11 pm
Kinda like "Turing complete" in that you can simulate the system out of the system itself?
Title: Re: DFHack 0.5.5
Post by: myrkul on March 11, 2011, 03:26:31 pm
Well, DF is already turing complete. One could concievably make a copy of DF within the game, using fluid logic. It would run at 0 FPS, but it could be done. with a big enough embark. (probably 16x16x100 or so.)
Title: Re: DFHack 0.5.5
Post by: TolyK on March 11, 2011, 04:14:18 pm
Well, DF is already turing complete. One could concievably make a copy of DF within the game, using fluid logic. It would run at 0 FPS, but it could be done. with a big enough embark. (probably 16x16x100 or so.)
more like 16x16x10000 because there are LOTS of transistors in a single processor - this is possible, but try even writing a program, or even a UI for DF, and see how hard that is  :P
Title: Re: DFHack 0.5.5
Post by: utuki on March 11, 2011, 04:18:50 pm
i compiled windows version and had a problem: it needs dbghelp.h. file itself is easy to google but its normally part of pretty big windows sdk which hang during install for me. so you may want to list it in dependencies.
Title: Re: DFHack 0.5.5
Post by: Rumrusher on March 11, 2011, 05:38:00 pm
What would be awesome is if you could build up a fort to capitol stage, then, possess a dwarf, recruit 6 others, and head off into the wilderness, find a good site, and then switch back to fort mode and build a new fortress. The day you can do this, DF, in my mind, will be feature-complete.
well you could tempt to try to walk to another abandon fort and "Reclaim" though it might not work out as much.
Title: Re: DFHack 0.5.5
Post by: darthweder on March 11, 2011, 05:48:16 pm
I'm not sure if something is wrong with this region or it might be LNB but dfprospector says I don't have any marble on my embark but I just found some. 
Title: Re: DFHack 0.5.5
Post by: Captain Goatse on March 11, 2011, 06:09:21 pm
So, anybody upgraded the tool for 31.21? I downloaded the latest version and tried to read the readme, but it was filled with geacky stuff... I cannot tell a "compiler" from a broken wheelbarrow...
Title: Re: DFHack 0.5.5
Post by: Askot Bokbondeler on March 11, 2011, 07:04:15 pm
Well, DF is already turing complete. One could concievably make a copy of DF within the game, using fluid logic. It would run at 0 FPS, but it could be done. with a big enough embark. (probably 16x16x100 or so.)
more like 16x16x10000 because there are LOTS of transistors in a single processor - this is possible, but try even writing a program, or even a UI for DF, and see how hard that is  :P

i'd guess the numbers would actually be like more than a large region map
Title: Re: DFHack 0.5.4
Post by: Truean on March 11, 2011, 07:29:57 pm
Well, what I want in the end is to make my own tool using DFHack. So yes, I tried to compile a single tool, to see if I could. And I can now.
Then it's still easier to work within the dfhack build system.
But yeah, I see your point. I should make the 'making your own' part easier, or at least describe how to do so :)

Can you use range with df liquids to directly mod in areas of obsidian walls/floors larger than one square? :)
Any size you want really. I recommend keeping away from combining the multi z-level column and range brushes with the floor option though.

The current code allows adding any kind of procedural brush separately from the effects of it. I might tweak that even more and add some kind of 'selection' mechanism, but it's already quite flexible as it is now.

O sweet awesome, does that mean I can paint large areas of obsidian and then tell my dwarves to dig them out...? :D
Title: Re: DFHack 0.5.5
Post by: Jeoshua on March 11, 2011, 10:42:33 pm
Well, DF is already turing complete. One could concievably make a copy of DF within the game, using fluid logic. It would run at 0 FPS, but it could be done. with a big enough embark. (probably 16x16x100 or so.)
more like 16x16x10000 because there are LOTS of transistors in a single processor - this is possible, but try even writing a program, or even a UI for DF, and see how hard that is  :P

i'd guess the numbers would actually be like more than a large region map

48 tiles * 100 z-levels * 16 embark squares * 256 region tiles = 19,660,800 cubes in a large region.

Number of transistors in an AMD 64 = about 150,000,000.

So yeah.  While it it theoretically possible to use fluid logic to model anything you want, it's not exactly turing complete, since you'll never model a processor on it.

... maybe a 4044
Title: Re: DFHack 0.5.5
Post by: xtank5 on March 12, 2011, 01:58:20 am
I checked your math and...
Code: [Select]
(48*48)*100*(16*16)=58,982,400. This is cubes per largest embark.
58,982,400*(256*256)=3,865,470,566,400 this is cubes per largest region.
Methinks you forgot to square a few numbers.
Title: Re: DFHack 0.5.5
Post by: Mrhnhrm on March 12, 2011, 03:43:17 am
I'm not entirely sure whether my trouble is DFHack related, but I've been advised to seek help here. I've tried to build Stonesense r950 under Linux. Make fails like this:
Code: [Select]
[ 10%] Building CXX object CMakeFiles/stonesense.dir/MapLoading.cpp.o
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:215: error: ‘planecoord’ is not a member of ‘DFHack’
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:215: error: ‘planecoord’ is not a member of ‘DFHack’
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:215: error: template argument 1 is invalid
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:215: error: template argument 3 is invalid
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:215: error: template argument 4 is invalid
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp: In function ‘void ReadCellToSegment(DFHack::Context&, WorldSegment&, int, int, int, uint32_t, uint32_t, uint32_t, uint32_t, uint16_t, std::vector<DFHack::t_building, std::allocator<DFHack::t_building> >*, std::vector<DFHack::t_construction, std::allocator<DFHack::t_construction> >*, std::vector<std::vector<short unsigned int, std::allocator<short unsigned int> >, std::allocator<std::vector<short unsigned int, std::allocator<short unsigned int> > > >*, std::vector<DFHack::t_feature, std::allocator<DFHack::t_feature> >*, int*, DFHack::Maps*)’:
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:496: error: ‘planecoord’ is not a member of ‘DFHack’
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:496: error: expected ‘;’ before ‘pc’
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:497: error: ‘pc’ was not declared in this scope
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:499: error: ‘planecoord’ is not a member of ‘DFHack’
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:499: error: ‘planecoord’ is not a member of ‘DFHack’
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:499: error: template argument 1 is invalid
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:499: error: template argument 3 is invalid
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:499: error: template argument 4 is invalid
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:499: error: expected initializer before ‘it’
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:500: error: ‘it’ was not declared in this scope
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:500: error: request for member ‘find’ in ‘* local_features’, which is of non-class type ‘int’
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:501: error: request for member ‘end’ in ‘* local_features’, which is of non-class type ‘int’
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp: In function ‘WorldSegment* ReadMapSegment(DFHack::Context&, int, int, int, int, int, int)’:
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:589: warning: deprecated conversion from string constant to ‘char*’
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:599: warning: deprecated conversion from string constant to ‘char*’
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:608: warning: deprecated conversion from string constant to ‘char*’
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:632: warning: deprecated conversion from string constant to ‘char*’
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:645: warning: deprecated conversion from string constant to ‘char*’
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:729: warning: deprecated conversion from string constant to ‘char*’
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:759: warning: deprecated conversion from string constant to ‘char*’
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:777: error: ‘planecoord’ is not a member of ‘DFHack’
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:777: error: ‘planecoord’ is not a member of ‘DFHack’
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:777: error: template argument 1 is invalid
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:777: error: template argument 3 is invalid
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:777: error: template argument 4 is invalid
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:777: error: invalid type in declaration before ‘;’ token
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:778: error: no matching function for call to ‘DFHack::Maps::ReadLocalFeatures(int&)’
/usr/include/dfhack/modules/Maps.h:416: note: candidates are: bool DFHack::Maps::ReadLocalFeatures(std::map<DFHack::DFCoord, std::vector<DFHack::t_feature*, std::allocator<DFHack::t_feature*> >, std::less<DFHack::DFCoord>, std::allocator<std::pair<const DFHack::DFCoord, std::vector<DFHack::t_feature*, std::allocator<DFHack::t_feature*> > > > >&)
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp: In function ‘bool ConnectDFAPI(DFHack::Context*)’:
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:1090: warning: deprecated conversion from string constant to ‘char*’
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp: In function ‘void FollowCurrentDFWindow()’:
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:1174: warning: deprecated conversion from string constant to ‘char*’
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp: In function ‘void FollowCurrentDFCenter()’:
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:1206: warning: deprecated conversion from string constant to ‘char*’
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp: In function ‘void reloadDisplayedSegment()’:
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:1295: warning: deprecated conversion from string constant to ‘char*’
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:1296: warning: deprecated conversion from string constant to ‘char*’
make[2]: *** [CMakeFiles/stonesense.dir/MapLoading.cpp.o] Error 1
make[1]: *** [CMakeFiles/stonesense.dir/all] Error 2
make: *** [all] Error 2
I'd be thankful for some clues on how this can be corrected.
Title: Re: DFHack 0.5.5
Post by: peterix on March 12, 2011, 04:13:52 am
i compiled windows version and had a problem: it needs dbghelp.h. file itself is easy to google but its normally part of pretty big windows sdk which hang during install for me. so you may want to list it in dependencies.
Will be fixed soon.
I'm not entirely sure whether my trouble is DFHack related, but I've been advised to seek help here. I've tried to build Stonesense r950 under Linux. Make fails like this:
Code: [Select]
[ 10%] Building CXX object CMakeFiles/stonesense.dir/MapLoading.cpp.o
/home/mrhn/Games/dwarf fortress/stonesense/MapLoading.cpp:215: error: ‘planecoord’ is not a member of ‘DFHack’
I'd be thankful for some clues on how this can be corrected.
I've replaced planecoord with a different, more capable type. Small change in stonesense will be required.
So, anybody upgraded the tool for 31.21? I downloaded the latest version and tried to read the readme, but it was filled with geacky stuff... I cannot tell a "compiler" from a broken wheelbarrow...
Click the damn icons. They work. :)
Title: Re: DFHack 0.5.5
Post by: Captain Goatse on March 12, 2011, 06:27:59 am
Click the damn icons. They work. :)

Thanks, I just had to install the C++ to make it work.
Title: Re: DFHack 0.5.5
Post by: peterix on March 12, 2011, 06:35:09 am
Click the damn icons. They work. :)

Thanks, I just had to install the C++ to make it work.
OK. Readme needs a mention of the MSVC stuff. It will have it :)
Title: Re: DFHack 0.5.5
Post by: Rumrusher on March 12, 2011, 07:12:11 am
so I guess the only possible way to save in swap fort mode is by having Autosave be on for seasonal(or shorter) and be the lucky one to have the thing not die on you while you wait out the time.
Title: Re: DFHack 0.5.5
Post by: kulik on March 12, 2011, 11:02:03 am
So i switched to adventure and back to fortress and it worked, i have question thoug.
While in adventure mode one guy run off for no apparent reason. He rune off map so i lost him. I though that i could mark border of the embark zone as restricted areas but does the traffic zones work while in adventure mode?
Most of the activities like mining woodcutting seemed stopped while in adventure mode is that correct or its just that the turns in AM are much much shorter?
And one more thing, after i went back to fortress mode i somehow can't unreveal the site. :/

Oh, and: "Good job, guys, this adds another level to DF. I just assumed control of a hunter dog, hunted down a rabbit and then make a soup out of him in fortress mode. :D ...lots of fun. :D "
Title: Re: DFHack 0.5.5
Post by: darius on March 12, 2011, 11:13:14 am
So i switched to adventure and back to fortress and it worked, i have question thoug.
While in adventure mode one guy rune off for no apparent reason. He rune off map so i lost him. I though that i could mark border of the embark zone as restricted areas but does the traffic zones work while in adventure mode?
Most of the activities like mining woodcutting seemed stopped while in adventure mode is that correct or its just that the turns in AM are much much shorter?
1. Restricted areas don't work in fort mode (as blocking). They just make it very "costly" to pass over it. But if dwarf wants to pick up sock in that location he will. Even if it means pathing through restricted area. And i'm guessing it is ignored (or used for some other thing) in adventure mode.
2. Yes turns in adventure mode are seconds to minutes and fort mode they are days. But activities stop not because of that. It's probably because the fort mode AI is not running and because of that dwarves suddenly become dumb villagers and wander off. I suggest building a room with a burrow and locked door. That prob. would work.

Also few offsets:
Code: [Select]
0x12E0520+0x400000 --item vector
+0x64 from each item start ptr to coverings vector.
also material is very strange... it could be either one of normal materials (inorganic:type,amber,coal,etc) then comes the materials of race, and somehow in that system (8 bytes or so) also fits materials of specific legendary creature.
Title: Re: DFHack 0.5.5
Post by: kulik on March 12, 2011, 11:22:31 am
So i switched to adventure and back to fortress and it worked, i have question thoug.
While in adventure mode one guy rune off for no apparent reason. He rune off map so i lost him. I though that i could mark border of the embark zone as restricted areas but does the traffic zones work while in adventure mode?
Most of the activities like mining woodcutting seemed stopped while in adventure mode is that correct or its just that the turns in AM are much much shorter?
1. Restricted areas don't work in fort mode (as blocking). They just make it very "costly" to pass over it. But if dwarf wants to pick up sock in that location he will. Even if it means pathing through restricted area. And i'm guessing it is ignored (or used for some other thing) in adventure mode.
2. Yes turns in adventure mode are seconds to minutes and fort mode they are days. But activities stop not because of that. It's probably because the fort mode AI is not running and because of that dwarves suddenly become dumb villagers and wander off. I suggest building a room with a burrow and locked door. That prob. would work.

Ok, i see, thanks. Hmm, i thought that i could use the dfusion to save the site as a lair to save all the stupid souls that may run off the map but then again anything i would kill or done in AM would be overwritten. ...damn this sucks.  >:(
Title: Re: DFHack 0.5.5
Post by: Jeoshua on March 12, 2011, 11:28:05 am
It's probably because the fort mode AI is not running and because of that dwarves suddenly become dumb villagers and wander off. I suggest building a room with a burrow and locked door. That prob. would work.

After some minor and not exactly taxing science, I can conclusively say that Burrows do not work, but locked doors do.  Thieves can still pick the lock, however.  That shouldn't be a problem unless one is running Kobold Cave Clone or has hacked their dorfs (but who would give them this, I wonder)
Title: Re: DFHack 0.5.5
Post by: peterix on March 12, 2011, 11:56:54 am
Just... be careful guys. I'd hate it if you lost some awesome fort you worked on for ages :)
Title: Re: DFHack 0.5.5
Post by: Askot Bokbondeler on March 12, 2011, 12:08:06 pm
yes, it is mandatory to back up the saves, you WILL screw up everything, eventually
Title: Re: DFHack 0.5.5
Post by: Rumrusher on March 12, 2011, 05:33:10 pm
so if you go into adventure mode make sure to RECRUIT every one before swapping back. so that the game gives you control over them. also Lairs don't keep people in one room only hamlets do. still find it sucks that I can't just walk to the embark site and take it over with a band of trusty companions.
Title: Re: DFHack 0.5.5
Post by: gu1dry on March 13, 2011, 12:25:54 am
I just built DFHacks from the latest code on Github & thought I share, link (http://www.mediafire.com/?iaarg8i7630s1q4). If people would like me to continue sharing, just let me know & I will do.
Title: Re: DFHack 0.5.5
Post by: addictgamer on March 13, 2011, 03:38:56 am
Awesome work! I love the "riversource" addition to dfliquids.
I also like dfmode...hehehe...

So, I tried out the "kittens" stuff out of curiousity.

Start up DF.
Enter arena mode.
Create a creature.
Assume control of it.
Run dfmode.
Choose kittens! and kittens! (6,2) I think...
Now say "WTF"
Additional thing: Try changing the z levels with </>
Ya, never noticed that aboveground area either. And I never knew you could scroll offmap.

So, what exactly are these "kittens!" stuff?
Title: Re: DFHack 0.5.5
Post by: Rumrusher on March 13, 2011, 07:19:53 am
Awesome work! I love the "riversource" addition to dfliquids.
I also like dfmode...hehehe...

So, I tried out the "kittens" stuff out of curiousity.

Start up DF.
Enter arena mode.
Create a creature.
Assume control of it.
Run dfmode.
Choose kittens! and kittens! (6,2) I think...
Now say "WTF"
Additional thing: Try changing the z levels with </>
Ya, never noticed that aboveground area either. And I never knew you could scroll offmap.

So, what exactly are these "kittens!" stuff?
wait don't tell me you got the fort/arena frames with no menu you could get the same thing with arena mode  managing in adventure mode going to menu while being in adventure/assumed mode.
try doing this at night and you will see that the game seems to designate everything around the player.
edit:
WTF
Title: Re: DFHack 0.5.5
Post by: Mrhnhrm on March 13, 2011, 11:45:03 am
I've replaced planecoord with a different, more capable type. Small change in stonesense will be required.
Would you please provide a link to earlier DFHack sources which don't yet have this update? I really want to build Stonesense here, and its crew probably won't introduce necessary changes to make Stonesense compatible with latest DFHack's updates until the former's next release.
Thanks in advance.
Title: Re: DFHack 0.5.5
Post by: peterix on March 13, 2011, 01:42:00 pm
I've replaced planecoord with a different, more capable type. Small change in stonesense will be required.
Would you please provide a link to earlier DFHack sources which don't yet have this update? I really want to build Stonesense here, and its crew probably won't introduce necessary changes to make Stonesense compatible with latest DFHack's updates until the former's next release.
Thanks in advance.
Update both, it should work now.
Title: Re: DFHack 0.5.5
Post by: addictgamer on March 13, 2011, 02:57:46 pm
wait don't tell me you got the fort/arena frames with no menu you could get the same thing with arena mode  managing in adventure mode going to menu while being in adventure/assumed mode.
try doing this at night and you will see that the game seems to designate everything around the player.
edit:
WTF

Eh...I guess it's not directly related to "kittens!" then.

Hey look: http://www.youtube.com/watch?v=9ZfrA3rOeqs
Steps to recreate this:
1. Start up DF.
2. Enter the object testing arena.
3. Create a new creature.
4. Assume control of it.
5. Start up dfmode.
6. Change to adventurer mode, direct control (1,1)
7. Enter travel mode (shift + t) (You remember adventure mode controls, right? :P )
8. Travel around a few tiles.
9. Exit travel mode (shift + >)
10. Now look at the tiles that are blinking different colors.
Title: Re: DFHack 0.5.5
Post by: peterix on March 13, 2011, 03:28:53 pm
Eh...I guess it's not directly related to "kittens!" then.

Hey look: http://www.youtube.com/watch?v=9ZfrA3rOeqs (http://www.youtube.com/watch?v=9ZfrA3rOeqs)
Breaking things in unexpected ways :D
Title: Re: DFHack 0.5.5
Post by: Greiger on March 13, 2011, 03:33:09 pm
Huh that looks almost like what used to happen when you put wizards in fortress mode.

Except it's grassland instead of mountain so it's less "OMG RAVE PARTY!" and more "Huh look at that flashing rock."
Title: Cleaning too much
Post by: Slugman on March 13, 2011, 06:11:22 pm
I don't know whether it has been mentioned yet (didn't see anything related in the last few pages) but DF Cleanmap doesn't quite work like it should anymore - at least for me. It does still perform its function perfectly but a short while later some water tiles simply disappear (or rather turn to depth 1/7) and other become pressurized which leads to a drastically decreased framerate and as such to an early death for the fortress. Even if the water will probably fill up again, I suspect, that the water pressure remains nonetheless.  And the caverns look horrible anyway once you can see all the trees that were happily growing beneath the water surface. I'm a bit touchy about my beautiful underground lakes.

So... well... any idea what's causing this and maybe a way I can revert the whole thing before it happens? I just saved my last fortress after cleaning up the map which was a horribly stupid idea. Didn't have a problem with DF cleanmap when I was still playing the previous version of DF by the way (31.19?). But then again I only had 1 fortress before I discovered this tool set.
Title: Re: DFHack 0.5.5
Post by: gu1dry on March 13, 2011, 07:32:46 pm
I've replaced planecoord with a different, more capable type. Small change in stonesense will be required.
Would you please provide a link to earlier DFHack sources which don't yet have this update? I really want to build Stonesense here, and its crew probably won't introduce necessary changes to make Stonesense compatible with latest DFHack's updates until the former's next release.
Thanks in advance.
Update both, it should work now.
It isn't for me, but DFHacks builds fine by itself, http://pastebin.com/eeVbU2MU (http://pastebin.com/eeVbU2MU).
Title: Re: Cleaning too much
Post by: peterix on March 13, 2011, 08:08:52 pm
I don't know whether it has been mentioned yet (didn't see anything related in the last few pages) but DF Cleanmap doesn't quite work like it should anymore - at least for me.
One of the recent notable changes is that it clears some of the bits in the map tiles to get rid of broken arrows and bolts. Looks like that's done wrong. I'll remove the functionality and investigate.
It isn't for me, but DFHacks builds fine by itself, http://pastebin.com/eeVbU2MU (http://pastebin.com/eeVbU2MU).
I think you're trying to build it with a compiler the stonesense guys don't really test with. Maybe the allegro library stonesense includes isn't configured for your environment? Stonesense uses the system-installed version of allegro on linux, so that could be why I never ran into that problem. Try getting allegro for mingw32.
Title: Re: DFHack 0.5.5
Post by: Rumrusher on March 13, 2011, 11:55:11 pm
I just remember I had made a wagon code and a carry code for Dfusion if I could combine those two together I could make the wagon move thus a proper caravan when DFmode gets the adventure to fort mode kinks work out we maybe able to simulate the travel from a mountain home to a embark site.
Title: Re: DFHack 0.5.5
Post by: Jeoshua on March 14, 2011, 02:25:14 am
Yeah cleanmap deffinitely is acting strange.  I used it today to get rid of a blood stain from a caravan that came in the middle of a goblin seige, and... well..

This happened
Spoiler (click to show/hide)

On the plus side, the blood stains and arrows ARE gone...
Title: Re: DFHack 0.5.5
Post by: peterix on March 14, 2011, 03:55:09 am
Yeah cleanmap deffinitely is acting strange.  I used it today to get rid of a blood stain from a caravan that came in the middle of a goblin seige, and... well..
This happened
Hmm. I removed the bad arrow-cleaning code now.

/me hopes the damage wasn't too bad.
Title: Re: DFHack 0.5.7
Post by: Mrhnhrm on March 14, 2011, 10:37:49 am
Update both, it should work now.
Good job, Stonesense finally compiled alright for me. Now successfully running it will be a different story.

The compiled binary seems to start ok, its window displays something to the effect of "Trying to connect to DF", but nothing else happens. The stonesense.log file is flooded with
Code: [Select]
No Dwarf Fortress executable found
DFhack exeption: couldn't find a suitable process
message repeating thousand times over. DF 0.31.21 is up and running at this time. Or is the most recent version of DF not yet supported (or is it just the Linux version)?
I'd be grateful for some further insight into the matter.
Title: Re: DFHack 0.5.7
Post by: Rose on March 14, 2011, 10:46:44 am
in this case, it's probably from there being no offsets for .21 in linux at this time.

try .16 to be sure everything's working as it should.
Title: Re: DFHack 0.5.5
Post by: Jeoshua on March 15, 2011, 12:18:00 am
Yeah cleanmap deffinitely is acting strange.  I used it today to get rid of a blood stain from a caravan that came in the middle of a goblin seige, and... well..
This happened
Hmm. I removed the bad arrow-cleaning code now.

/me hopes the damage wasn't too bad.

Nah, I kinda like it.  I imagine the strange shifting terrain one of the reasons the dwarves sent out a party to investigate the area in the first place.  For the record those were savage, evil, and good all rolled into one stripped goodness.  Actually it may be due to the grass growing in a strange way, as I used dfcleanmap, THEN noticed this.  I'm not 100% that cleanmap was the cause, tho.
Title: Re: DFHack 0.5.7
Post by: freeformschooler on March 15, 2011, 11:24:49 am
So just so I'm clear on this, you can go from fort mode to direct control mode but not back again? Or is that only if you start out with adventure mode? Thanks for keeping this crazily up to date :D
Title: Re: DFHack 0.5.7
Post by: Terror_Incognito on March 15, 2011, 01:47:39 pm
Hi,
I'm having trouble with DFLiquids. Whenever I try to run it I get an error message saying that it could not find "msvcp100.dll". I downloaded the latest Lazy Newb Pack and got 0.5.4, and then downloaded 0.5.7 and I'm still getting the same message. Is there any way to fix this?
Title: Re: DFHack 0.5.7
Post by: kulik on March 15, 2011, 01:58:40 pm
So just so I'm clear on this, you can go from fort mode to direct control mode but not back again? Or is that only if you start out with adventure mode? Thanks for keeping this crazily up to date :D

From adventure to fortress it crashes. In fortress mode you can switch to adventure and back.
Title: Re: DFHack 0.5.7
Post by: peterix on March 15, 2011, 02:10:24 pm
Hi,
I'm having trouble with DFLiquids. Whenever I try to run it I get an error message saying that it could not find "msvcp100.dll". I downloaded the latest Lazy Newb Pack and got 0.5.4, and then downloaded 0.5.7 and I'm still getting the same message. Is there any way to fix this?
Read the first post, it tells you to download and install a certain Microsoft package. Do that.

I'm currently looking into how to bundle those files with the releases tho, so this won't be a requirement for future DFHack versions.
Title: Re: DFHack 0.5.7
Post by: Babylon on March 15, 2011, 11:50:51 pm
DFvdig keeps not working properly for me, it will claim that the stone i have the cursor over is not a vein stone.  It works about half the time, and the other half it tells me it is not a vein stone.  I've been using it on limonite, tetrahedrite, sphalerite, and misc gems and on all of them it works on some tiles and not on others.
Title: Re: DFHack 0.5.7
Post by: Terror_Incognito on March 16, 2011, 01:17:19 am
Thanks peterix, I love your work. Keep it up.
Title: Re: DFHack 0.5.7
Post by: peterix on March 16, 2011, 02:48:07 am
DFvdig keeps not working properly for me, it will claim that the stone i have the cursor over is not a vein stone.  It works about half the time, and the other half it tells me it is not a vein stone.  I've been using it on limonite, tetrahedrite, sphalerite, and misc gems and on all of them it works on some tiles and not on others.
This was a bug in one of the recent versions. Update, it should be working right in 0.5.7 :)
Title: Re: DFHack 0.5.7
Post by: Rumrusher on March 16, 2011, 03:35:22 am
using reveal first and releasing the creatures of hell should save someone the pain of the game crashing.
though it won't save them from the game not being able to save.
Title: Re: DFHack 0.5.7
Post by: Mrhnhrm on March 16, 2011, 11:47:35 am
try .16 to be sure everything's working as it should.
I tried that. Stonesense now crashes while trying to connect to DF. These error messages are dumped to console:
it's either something like this
Code: [Select]
pread failed: can't read 4 bytes at addres 2935888152
errno: 22
pread failed: can't read 4 bytes at addres 2935888152
errno: 22
pread failed: can't read 4 bytes at addres 2931077184
errno: 22
pread failed: can't read 4 bytes at addres 2934110584
errno: 22
pread failed: can't read 4 bytes at addres 2934045104
errno: 22
pread failed: can't read 4 bytes at addres 2934045104
errno: 22
pread failed: can't read 4 bytes at addres 2943104064
errno: 22
pread failed: can't read 4 bytes at addres 2997878812
errno: 22
terminate called after throwing an instance of 'DFHack::Error::MemoryAccessDenied'
  what():  SHM ACCESS DENIED
Aborted
or this
Code: [Select]
pread failed: can't read 8 bytes at addres 800
errno: 5
pread failed: can't read 12 bytes at addres 0
errno: 5
terminate called after throwing an instance of 'DFHack::Error::MemoryAccessDenied'
  what():  SHM ACCESS DENIED
Aborted
Can't seem to find any pattern about which errno will be given in which situation, sorry.
(I can't be completely sure, but in the latter case, aren't memory addresses that low used exclusively by the kernel?)

I've read somewhere around the forum that disabling kernel's virtual address space randomization (# echo 0 > /proc/sys/kernel/randomize_va_space) might help here, but it didn't for me.
Title: Re: DFHack 0.5.7
Post by: Jeoshua on March 16, 2011, 11:57:02 am
using reveal first and releasing the creatures of hell should save someone the pain of the game crashing.
though it won't save them from the game not being able to save.

I always use reveal, look at the bottom floor, see if hell is leaking, then if it's not I release the hounds of hell, so to speak.  Then if the FPS isn't too bad I continue on.  If the FPS IS really low, I open up Runesmith and genocide 1/2 hell's population.

It would be nice if we could unrelease hell.  Granted you hadn't actually penetrated into hell, might there be a way that you could unnotify the demons? In the interest of FPS and saving me from always intentionally (so not intentional btw) releasing hell when they're not actually released yet?
Title: Re: DFHack 0.5.7
Post by: Makbeth on March 16, 2011, 12:46:01 pm
using reveal first and releasing the creatures of hell should save someone the pain of the game crashing.
though it won't save them from the game not being able to save.

I always use reveal, look at the bottom floor, see if hell is leaking, then if it's not I release the hounds of hell, so to speak.  Then if the FPS isn't too bad I continue on.  If the FPS IS really low, I open up Runesmith and genocide 1/2 hell's population.

It would be nice if we could unrelease hell.  Granted you hadn't actually penetrated into hell, might there be a way that you could unnotify the demons? In the interest of FPS and saving me from always intentionally (so not intentional btw) releasing hell when they're not actually released yet?

Why not savescum after testing FPS and then genocide the demons?  You don't need to see them to delete them. 

"Despair, ye legions of Hell, for I shall reach down through the very earth to destroy thee, even as I spare mine eyes the offense of looking upon thy wretchedness.  Muahaha!"
Title: Re: DFHack 0.5.7
Post by: Langdon on March 16, 2011, 02:46:25 pm
Why not savescum after testing FPS and then genocide the demons?  You don't need to see them to delete them. 

Because the demon wave doesn't spawn until you get the "horrifying screams" message, apart from one or two random inhabitants.
Title: Re: DFHack 0.5.7
Post by: Dutchling on March 16, 2011, 04:15:21 pm
Does prospector saves the minerals/values on a txt file somewhere? Or can you copy the txt in the box you get if you run it? i see a lot of people pasting their prospector result on the forum I don;t think they just typed it all down...
Title: Re: DFHack 0.5.7
Post by: Grax on March 16, 2011, 04:16:47 pm
Does prospector saves the minerals/values on a txt file somewhere? Or can you copy the txt in the box you get if you run it? i see a lot of people pasting their prospector result on the forum I don;t think they just typed it all down...

Just type it like dfprospector.exe -ab >dfgdfgdg
Title: Re: DFHack 0.5.7
Post by: peterix on March 16, 2011, 05:46:14 pm
I tried that. Stonesense now crashes while trying to connect to DF. These error messages are dumped to console:
it's either something like this
Code: [Select]
pread failed: can't read 4 bytes at addres 2935888152
errno: 22
...
terminate called after throwing an instance of 'DFHack::Error::MemoryAccessDenied'
  what():  SHM ACCESS DENIED
Aborted
or this
Code: [Select]
pread failed: can't read 8 bytes at addres 800
errno: 5
pread failed: can't read 12 bytes at addres 0
errno: 5
terminate called after throwing an instance of 'DFHack::Error::MemoryAccessDenied'
  what():  SHM ACCESS DENIED
Aborted
Can't seem to find any pattern about which errno will be given in which situation, sorry.
(I can't be completely sure, but in the latter case, aren't memory addresses that low used exclusively by the kernel?)

I've read somewhere around the forum that disabling kernel's virtual address space randomization (# echo 0 > /proc/sys/kernel/randomize_va_space) might help here, but it didn't for me.
Maybe you need the other variables too. The best description of the problem can be found here:
http://www.bay12forums.com/smf/index.php?topic=65326.0 (http://www.bay12forums.com/smf/index.php?topic=65326.0)

Set both variables to 0 and you *should* be able to run DF without all the crud afterwards.

Anyway, do the base dfhack tools work? If they don't, can you give me more info about the specs of your system? Mainly the exact kernel and the amount of system memory. I'd also very much appreciate if you could run the dfincremental tool and give me the big list of numbers it prints out.
Title: Re: DFHack 0.5.7
Post by: Rumrusher on March 17, 2011, 01:25:00 am
well good news I found a way to go into fort mode with out using Arena mode in adventure mode.
If you swap to fort mode then go to the Esc menu you be able to save the game thus properly setting up the fort mode next reload the problem is that I can't do anything while in this mode except for stuff that doesn't unpause it can't hit Z and while I can designate buildings and maybe dig sites I can't do that.

so you can go into adventure mode(keeping your companions) doing the same "save while in the other game menu trick." wonder if abandoning a fort(adv mode swap to fort mode select abandon fort) as a retirable adventurer makes the area save to reclaim?
Title: Re: DFHack 0.5.7
Post by: Mrhnhrm on March 17, 2011, 01:38:40 am
The best description of the problem can be found here:
http://www.bay12forums.com/smf/index.php?topic=65326.0 (http://www.bay12forums.com/smf/index.php?topic=65326.0)
Evidently, my kernel doesn't have the interface described there. I'm running Gentoo Linux with a custom-configured Zen kernel; if you're interested, you may take a look at the config: http://pastebin.com/hsuE0x6E

Quote
Anyway, do the base dfhack tools work?
If I try running them before trying to run Stonesense, they don't:
Code: [Select]
terminate called after throwing an instance of 'DFHack::Error::MemoryXmlParse'
  what():  error 2: Failed to open file, at row 0 col 0
Aborted

But if I run Stonesense, let it crash, and then run DFHack tools, they seem to work. dfreveal obviously works fine. In fact, it does so regardless of the state of randomize_va_space variable. Can't say as much about other utils, maybe I'm just doing something wrong with them. They run, at least.

Quote
I'd also very much appreciate if you could run the dfincremental tool and give me the big list of numbers it prints out.
It's the least that I could do. http://pastebin.com/PbPHETTJ
Title: Re: DFHack 0.5.7
Post by: Rumrusher on March 17, 2011, 05:46:30 am
okay here's a few things about this.
one you save swapping is safer than arena swapping well safer that there less screwing up and getting every one killed still chance of crash because of.
two do not try to swap to fort mode out of a abandon area causes a crash, not only that abandoning there kills the adventurer.
three make sure to remove designation on everything or the men will go around trying to smooth sand or dig through the already dug walls.
four remember the adventurer/leader of the group and protect him/her so that if the site goes south you can just saveswap to adventure mode Pull the doomsday lever and walk over to the emergency fort until you feel save enough to reclaim.
five if you have a noble take time to design a death trap and pick up my CarryEX addon to Dfusion nothing says FUN than dragging the purple plump stuffer(and his/her family) and dropping him/her(and their family) into a spike pit or a lair of captured Goblins, Bandits,Zombie Goblins and Bandits.
Title: Re: DFHack 0.5.7
Post by: Dutchling on March 17, 2011, 06:05:01 am
Does prospector saves the minerals/values on a txt file somewhere? Or can you copy the txt in the box you get if you run it? i see a lot of people pasting their prospector result on the forum I don;t think they just typed it all down...

Just type it like dfprospector.exe -ab >dfgdfgdg

Is anything suposed to happen after I type that? Casue it just closes anyway and there is no txt file anywhere nor did copy something ???
Title: Re: DFHack 0.5.7
Post by: Rose on March 17, 2011, 06:59:02 am
actually, there's supposed to be a space after >, and a .txt is useful at the end.
Title: Re: DFHack 0.5.7
Post by: Grax on March 17, 2011, 08:42:09 am
actually, there's supposed to be a space after >, and a .txt is useful at the end.
No spaces neccessary, it works as is.
Title: Re: DFHack 0.5.7
Post by: peterix on March 17, 2011, 08:52:30 am
The best description of the problem can be found here:
http://www.bay12forums.com/smf/index.php?topic=65326.0 (http://www.bay12forums.com/smf/index.php?topic=65326.0)
Evidently, my kernel doesn't have the interface described there. I'm running Gentoo Linux with a custom-configured Zen kernel; if you're interested, you may take a look at the config: http://pastebin.com/hsuE0x6E (http://pastebin.com/hsuE0x6E)
I any of the tools run and work, the kernel is probably fine.

Quote
Anyway, do the base dfhack tools work?
If I try running them before trying to run Stonesense, they don't:
Code: [Select]
terminate called after throwing an instance of 'DFHack::Error::MemoryXmlParse'
  what():  error 2: Failed to open file, at row 0 col 0
Aborted
Well, what are you doing to the poor tools here? They can't find the memory xml file they need. Remember that they look for it in the current working directory by default. The search path is actually 'burned' into the dfhack library when you compile it. I assume you did set the MEMXML_DATA_PATH cmake variable to something sane and stable instead of '.' before installing dfhack? Stonesense can be then built using the system-global DFHack without much fuss (and its own copy of memory.xml is ignored). Looking at it now, I think I'll change this around a bit...

But if I run Stonesense, let it crash, and then run DFHack tools, they seem to work.
I have no idea. It just seems totally wrong... nothing I'd ever see happening on any system. Still looks like some search path chaos to me :)

Quote
I'd also very much appreciate if you could run the dfincremental tool and give me the big list of numbers it prints out.
It's the least that I could do. http://pastebin.com/PbPHETTJ (http://pastebin.com/PbPHETTJ)
Right. This seems fairly sane with one exception: the numbers should be really 32bit. Must be a dfhack bug introduced by some of the changes I merged recently.

I'm making some changes to the build system right now, so I'll see if I can make it a bit easier to work with.
Title: Re: DFHack 0.5.7
Post by: Askot Bokbondeler on March 17, 2011, 12:52:39 pm
okay here's a few things about this.
one you save swapping is safer than arena swapping well safer that there less screwing up and getting every one killed still chance of crash because of.
two do not try to swap to fort mode out of a abandon area causes a crash, not only that abandoning there kills the adventurer.
three make sure to remove designation on everything or the men will go around trying to smooth sand or dig through the already dug walls.
four remember the adventurer/leader of the group and protect him/her so that if the site goes south you can just saveswap to adventure mode Pull the doomsday lever and walk over to the emergency fort until you feel save enough to reclaim.
five if you have a noble take time to design a death trap and pick up my CarryEX addon to Dfusion nothing says FUN than dragging the purple plump stuffer(and his/her family) and dropping him/her(and their family) into a spike pit or a lair of captured Goblins, Bandits,Zombie Goblins and Bandits.

your wording is... confusing...
Title: Re: DFHack 0.5.7
Post by: Rumrusher on March 17, 2011, 02:54:33 pm
okay here's a few things about this.
one you save swapping is safer than arena swapping well safer that there less screwing up and getting every one killed still chance of crash because of.
two do not try to swap to fort mode out of a abandon area causes a crash, not only that abandoning there kills the adventurer.
three make sure to remove designation on everything or the men will go around trying to smooth sand or dig through the already dug walls.
four remember the adventurer/leader of the group and protect him/her so that if the site goes south you can just saveswap to adventure mode Pull the doomsday lever and walk over to the emergency fort until you feel save enough to reclaim.
five if you have a noble take time to design a death trap and pick up my CarryEX addon to Dfusion nothing says FUN than dragging the purple plump stuffer(and his/her family) and dropping him/her(and their family) into a spike pit or a lair of captured Goblins, Bandits,Zombie Goblins and Bandits.

your wording is... confusing...
sorry let me clear it up a little.
From what I know you can skip using arena mode all together if you just save in the mode you want to use and reload it (if your in 0,0 you can just change it to 1,1 and hit esc and save the next time you boot up the save it would be in a different mode.). Also this doesn't stop the game from crashing if you swap to a non-embark site. Swapping over from adventure mode straight to fort mode I notice the game seem to designate or hide most of the open areas to fix it have someone mine a tile.
the remember the adventurer sentence was from when I had killed the leader in a freak bonfire in a bag incident that would force me to add every one to as a companion. (you can swap between both modes with out needing to reselect an adventurer and in adventure mode you still have all your companions.)
ignore Five.

so far the game will kick you out at a certain date or time span. I guess it from either migrants that can't come it or a merchant group either way it seems to be fine if you go into adventure mode and sleep through the day or days the game will force abandon.

Title: Re: DFHack 0.5.7
Post by: Dutchling on March 17, 2011, 03:50:05 pm
actually, there's supposed to be a space after >, and a .txt is useful at the end.

Wait... where am I actually suposed to type this? Cause whatever I type dfprospector just closes and no files whatsoever appear ???
Title: Re: DFHack 0.5.7
Post by: Rose on March 17, 2011, 03:52:34 pm
open up a command window in the same folder as dfhack (if you have win7, hold shift and right click on the folder)

then you type in dfprospector.exe > output.txt
Title: Re: DFHack 0.5.7
Post by: Grax on March 17, 2011, 04:10:21 pm
okay here's a few things about this.
one you save swapping is safer than arena swapping well safer that there less screwing up and getting every one killed still chance of crash because of.
two do not try to swap to fort mode out of a abandon area causes a crash, not only that abandoning there kills the adventurer.
three make sure to remove designation on everything or the men will go around trying to smooth sand or dig through the already dug walls.
four remember the adventurer/leader of the group and protect him/her so that if the site goes south you can just saveswap to adventure mode Pull the doomsday lever and walk over to the emergency fort until you feel save enough to reclaim.
five if you have a noble take time to design a death trap and pick up my CarryEX addon to Dfusion nothing says FUN than dragging the purple plump stuffer(and his/her family) and dropping him/her(and their family) into a spike pit or a lair of captured Goblins, Bandits,Zombie Goblins and Bandits.

your wording is... confusing...
Its time to have a little pity for those whose word kung-fu is weak.
Title: Re: DFHack 0.5.7
Post by: Askot Bokbondeler on March 17, 2011, 06:51:01 pm
Its time to have a little pity for those whose word kung-fu is weak.

you mean this? (http://www.bay12forums.com/smf/index.php?topic=58809.msg2084105#msg2084105)

much better, by the way. thanks, rumrusher, nice finds
Title: Re: DFHack 0.5.7
Post by: Rumrusher on March 17, 2011, 07:46:20 pm
your welcome. It sucks how I guess we can't get migrants with the short time frame the game gives us unless we go out and recruit them.
Working on another way to get pass aquifers by using adventure mode reactions. If you use the Bonfire mod and a couple of fire proof bags you could burn the water away so you could dig a layer down. Though there a chance of losing a miner or an adventurer in attempting this at an one tile up/down stairwell so proceed with caution.

Title: Re: DFHack 0.5.7
Post by: Grax on March 18, 2011, 01:41:31 am
Its time to have a little pity for those whose word kung-fu is weak.

you mean this? (http://www.bay12forums.com/smf/index.php?topic=58809.msg2084105#msg2084105)

much better, by the way. thanks, rumrusher, nice finds
Nope. I meant for all of us foreigners whose native language differs from english.
Title: Re: DFHack 0.5.8
Post by: Mrhnhrm on March 18, 2011, 12:25:06 pm
I assume you did set the MEMXML_DATA_PATH cmake variable to something sane and stable instead of '.' before installing dfhack?
No, I was oblivious of its existence. However, I noticed that make install-ing an earlier version DFHack had copied Memory.xml to /usr/share or some subdirectory of it, which made me believe that DFHack-dependent tools will probably seek Memory.xml there. Unfortunately, I didn't notice that the more recent version of DFHack that's currently installed here doesn't automatically copy this file in the installation process. My bad.

Title: Re: DFHack 0.5.8
Post by: peterix on March 18, 2011, 03:06:01 pm
I assume you did set the MEMXML_DATA_PATH cmake variable to something sane and stable instead of '.' before installing dfhack?
No, I was oblivious of its existence. However, I noticed that make install-ing an earlier version DFHack had copied Memory.xml to /usr/share or some subdirectory of it, which made me believe that DFHack-dependent tools will probably seek Memory.xml there. Unfortunately, I didn't notice that the more recent version of DFHack that's currently installed here doesn't automatically copy this file in the installation process. My bad.
Well, I do use this variable because it's hard to know where the whole thing will end up when someone is packaging it. Say in archlinux, where the packaging script sets the install prefix to a temp directory. If I used the install path as a base for MEMXML_DATA_PATH, it would never be found after installing the package.

I made some changes to the whole build process that allow making portable packages. The default behavior is the same, but there are more options now.
Examples follow... (mostly starting in dfhack/build):
Spoiler (click to show/hide)
Title: Re: DFHack 0.5.8
Post by: _DivideByZero_ on March 18, 2011, 06:47:48 pm
What does "memory object not set: type offset key /string/MSVC/buffer" mean?
I get it whenever I run any of the tools. I'm running this on Wine with Ubuntu 10.10.

What makes no sense is that the 31.19 versions and earlier versions of dfhack worked just fine.
Title: Re: DFHack 0.5.8
Post by: peterix on March 18, 2011, 07:34:58 pm
What does "memory object not set: type offset key /string/MSVC/buffer" mean?
I get it whenever I run any of the tools. I'm running this on Wine with Ubuntu 10.10.
This means something is very broken. None of the recognized windows DF versions have this offset /unset/. What exactly is running inside wine? DF AND the tools? If so, what was the last dfhack version that worked for you?


Title: Re: DFHack 0.5.8
Post by: _DivideByZero_ on March 18, 2011, 10:28:47 pm
Whichever version worked for 31.19. I know for a fact that version 5.1 worked, I think versions 5.2 and 5.3 worked as well, but I'm not sure. Both DF and the tools are running in wine.
Title: Re: DFHack 0.5.8
Post by: cousac on March 19, 2011, 04:54:01 pm
I've run into a bit of a problem compiling. I'm on openSUSE 11.3

i've run cmake and then i tried to run make and this is what i get:

Code: [Select]
cousac@linux-zwvc:~/Downloads/peterix-dfhack-1cc74b3/build> make
[  1%] Building CXX object library/CMakeFiles/dfhack.dir/DFContext.cpp.o
/home/cousac/Downloads/peterix-dfhack-1cc74b3/library/DFContext.cpp:34:35: fatal error: private/ModuleFactory.h: No such file or directory
compilation terminated.
make[2]: *** [library/CMakeFiles/dfhack.dir/DFContext.cpp.o] Error 1
make[1]: *** [library/CMakeFiles/dfhack.dir/all] Error 2
make: *** [all] Error 2

dunno what to do. :(
Title: Re: DFHack 0.5.8
Post by: peterix on March 19, 2011, 05:41:10 pm
dunno what to do. :(
Already fixed. I forgot to push the file to github...
Title: Re: DFHack 0.5.8
Post by: cousac on March 19, 2011, 06:10:14 pm
dunno what to do. :(
Already fixed. I forgot to push the file to github...

you sir are a god :) now to build stone sense :p
Title: Re: DFHack 0.5.8
Post by: peterix on March 19, 2011, 08:49:47 pm
Whichever version worked for 31.19. I know for a fact that version 5.1 worked, I think versions 5.2 and 5.3 worked as well, but I'm not sure. Both DF and the tools are running in wine.
Ok. Please stop using DFHack inside wine, the fact that it even worked before was pure luck.

You can, however, use the linux dfhack with wine DF. And I just added an Ubuntu package generator to my build system, so you can grab those from the first post :)
Title: Re: DFHack 0.5.8
Post by: _DivideByZero_ on March 20, 2011, 02:04:01 pm
Yay, thanks!

EDIT:
How do i use the tools on linux? I try to run it from a terminal, but I get this error:
Code: [Select]
terminate called after throwing an instance of 'DFHack::Error::NoProcess'
  what():  couldn't find a suitable process
Aborted
Title: Re: DFHack 0.5.8
Post by: vityav on March 20, 2011, 03:16:01 pm
Yay, thanks!

EDIT:
How do i use the tools on linux? I try to run it from a terminal, but I get this error:
Code: [Select]
terminate called after throwing an instance of 'DFHack::Error::NoProcess'
  what():  couldn't find a suitable process
Aborted

When I used to get that error, it meant I hadn't started DF (and loaded a map) before running the tools. Trying now with an unsupported version (31.21 linux), it gives me that error too. Are either of those true for you?
Title: Re: DFHack 0.5.8
Post by: vityav on March 20, 2011, 03:28:27 pm
Current packages (0.5.8 for DF 31.xx):
Windows tools release (https://github.com/downloads/peterix/dfhack/dfhack-0.5.8-Windows-x86.zip)
Ubuntu 10.10 32bit (https://github.com/downloads/peterix/dfhack/dfhack_0.5.8-1_i386.deb)
Ubuntu 10.10 64bit (https://github.com/downloads/peterix/dfhack/dfhack_0.5.8-1_amd64.deb)

Does this mean there should exist memory offsets for 31.21 linux? I see none :(
Also, though I'm fairly inexperienced with memory hacking (read: simple scanning for numerical changes), it seems like I saw a quick guide you wrote on it and I'd be happy to help out if my fedora 14 x64 addresses would be of any use.
Title: Re: DFHack 0.5.8
Post by: peterix on March 20, 2011, 03:42:52 pm
Yay, thanks!

EDIT:
How do i use the tools on linux? I try to run it from a terminal, but I get this error:
Code: [Select]
terminate called after throwing an instance of 'DFHack::Error::NoProcess'
  what():  couldn't find a suitable process
Aborted
It should be possible to use them with both linux and wine DF. The wine DF versions are better supported, because the offsets are up to date (and should suffer less from weird linux kernel extensions).

Hmm... I haven't tested things much with ubuntu to be honest. Just made sure the packages install properly. Just running df 31.16 on my 10.10 i386 VM, things seem a little wonky. Reveal works, cursor position doesn't... weird. I can see automated testing on the horizon :P

Does this mean there should exist memory offsets for 31.21 linux? I see none :(
Also, though I'm fairly inexperienced with memory hacking (read: simple scanning for numerical changes), it seems like I saw a quick guide you wrote on it and I'd be happy to help out if my fedora 14 x64 addresses would be of any use.
It means nothing. The linux support is the same it was before. There are just some packages for Ubuntu. I was reworking the build system and figured adding support for building those automatically can't be that hard (I was wrong and spent a few hours bashing my head against a wall, but whatever ... ).

Help is always appreciated. I'm not familiar with fedora all that much, but it can't be too different. Make sure you grab some decent tools and use the git HEAD of dfhack.
As long as you stick to the linux stuff, you won't have to do much voodoo wizardry with debuggers :) Stop by in the irc channel (#dfhack on freenode).
Title: Re: DFHack 0.5.8
Post by: freeformschooler on March 20, 2011, 03:53:39 pm
Peterix I hate cross asking but I figured I would get a better response here. I remember that a couple of versions ago (maybe the version in which ghosts were introduced), making the current adventurer "ghostly" would give them godly walk-through-walls abilities. Now all it does is make them able to fly and other silly ghostly things. Am I doing something wrong, or has this been removed from DF in the first place, or was this a removed feature of DFusion?
Title: Re: DFHack 0.5.8
Post by: peterix on March 20, 2011, 04:02:45 pm
I remember that a couple of versions ago, making the current adventurer "ghostly" would give them godly walk-through-walls abilities. Now all it does is make them able to fly and other silly ghostly things.
My guess is Toady removed the walking through walls thing because it was causing a lot of lag from excessive pathfinding.
Title: Re: DFHack 0.5.8
Post by: freeformschooler on March 20, 2011, 04:06:42 pm
Ahh, thanks for that response. I had figured it was a debug feature left in but that WOULD make more sense, hehe :)
Title: Re: DFHack 0.5.8
Post by: Rumrusher on March 20, 2011, 06:36:31 pm
Ahh, thanks for that response. I had figured it was a debug feature left in but that WOULD make more sense, hehe :)

Wait pathing through walls was only done if you where naked something about having items on solidify you. I haven't checked out .21 version but yeah naked = no clip.
 edit. yeah it still works in .21
Title: Re: DFHack 0.5.8
Post by: cousac on March 20, 2011, 08:00:37 pm
Hey Mr. peterix

Question: When are you planning to make the CMakeList.txt for the python bindings? I'd very much like to use it to make a visualizer via Panda3d...
Title: Re: DFHack 0.5.8
Post by: peterix on March 21, 2011, 03:14:11 am
When are you planning to make the CMakeList.txt for the python bindings?
When the stars are right ... :D

Soon, I hope. It requires a bit of research into how python modules have to be installed (and testing).
Title: Re: DFHack 0.5.8
Post by: Uristocrat on March 21, 2011, 03:21:37 am
I remember that a couple of versions ago, making the current adventurer "ghostly" would give them godly walk-through-walls abilities. Now all it does is make them able to fly and other silly ghostly things.
My guess is Toady removed the walking through walls thing because it was causing a lot of lag from excessive pathfinding.

I honestly wonder why they were path finding, though.  If you can walk through everything, can't you just travel in a straight line?

Basically, something akin to:
if (u.pos.x < target.x) next.x++;
if (u.pos.x > target.x) next.x--;
if (u.pos.y < target.y) next.y++;
if (u.pos.y > target.y) next.y--;
if (u.pos.z < target.z) next.z++;
if (u.pos.z > target.z) next.z--;
u.pos = next;
Title: Re: DFHack 0.5.8
Post by: peterix on March 21, 2011, 03:43:41 am
I honestly wonder why they were path finding, though.  If you can walk through everything, can't you just travel in a straight line?
I don't know, this is just my guess :) Maybe to make them behave more like actual dwarves?
Title: Re: DFHack 0.5.8
Post by: Arekis on March 22, 2011, 02:30:09 am
Hey folks.  A DFHack newbie here.  I'm considering writing a little util for trading.  So, I'm trying to figure out some stuff with the item vector and I'm running into...  complexity.  From what I understand, the item definition is not complete.  Most of what I want is there, but there are two things missing: marked for trade and the value of an item.  Any advice on getting started/further along?  I seem to recall there were some memory tests someone did a while ago, but I can't find those pages.

On a marginally related topic, the latest version that seems to work with the items_vector definition is 31.16.  I get an exception telling me it is invalid when I run it with later ones (18, 21) or not set (14).  Does this mean that the items_vector value in the memory.xml is not correct for the other versions or am I just doing something wrong?
Title: Re: DFHack 0.5.8
Post by: peterix on March 22, 2011, 07:28:03 am
Hey folks.  A DFHack newbie here.  I'm considering writing a little util for trading.  So, I'm trying to figure out some stuff with the item vector and I'm running into...  complexity.  From what I understand, the item definition is not complete.  Most of what I want is there, but there are two things missing: marked for trade and the value of an item.  Any advice on getting started/further along?  I seem to recall there were some memory tests someone did a while ago, but I can't find those pages.
That's quite a task! See, item value depends on the raw values of the base item type and the value of the material. We have neither. They would have to be found I guess... unless there's also a value field inside the item objects too.

On a marginally related topic, the latest version that seems to work with the items_vector definition is 31.16.  I get an exception telling me it is invalid when I run it with later ones (18, 21) or not set (14).  Does this mean that the items_vector value in the memory.xml is not correct for the other versions or am I just doing something wrong?
No, you aren't doing anything wrong. Offsets marked as invalid are just... not valid. The items vectors should be easy enough to find and I can add those. I'm not entirely sure about the other values... they are offsets into the virtual method table of the item classes. The Items module reads their code and evaluates it to some extent. This isn't necessarily good or bad, but for it to be really useful, it would need to be able to interpret assembly much better, or we need a way to call the code directly (there are people working on this).

The 'not set' comes from version 31.13, where Toady changed the compiler. The 31.16 was the first stable version after that.
Title: Re: DFHack 0.5.8
Post by: Arekis on March 22, 2011, 11:47:02 am
Hey folks.  A DFHack newbie here.  I'm considering writing a little util for trading.  So, I'm trying to figure out some stuff with the item vector and I'm running into...  complexity.  From what I understand, the item definition is not complete.  Most of what I want is there, but there are two things missing: marked for trade and the value of an item.  Any advice on getting started/further along?  I seem to recall there were some memory tests someone did a while ago, but I can't find those pages.
That's quite a task! See, item value depends on the raw values of the base item type and the value of the material. We have neither. They would have to be found I guess... unless there's also a value field inside the item objects too.

That's what I was naively hoping for: to scrape through the data and find a value field.  For the "trading" toggle I was going to compare what the item data looks like before and after toggling that mark, that is assuming the flag is stored with the item.  If it's in another vector somewhere...
Title: Re: DFHack 0.5.8
Post by: Quietust on March 22, 2011, 12:17:53 pm
How to determine an item's value:

1. Determine the item's base value. The item type is returned by a function call. Use the item type to determine the base value (in most cases, it's 10).
1a. If the item is a type of weapon, armor, trap component, or tool, then you'll need to figure out how the game determines the item value. Good luck with that.
2. Determine the item's material value. The item's material is also returned by a function call. Once you have the material (and know whether it's a builtin, an inorganic, a creature, or a plant), then you can fetch the material object itself and grab the value from the appropriate offset. I'm not certain exactly where all of those material objects are located, but inorganics are known and builtins can be handled easily enough with a lookup table.
3. Determine the item's quality multiplier. The item's quality is also returned by a function call.
4. Multiply the results from steps 1-3 together to get the item's value.
5. Locate the item's decoration vector. I don't recall, but this is probably also returned by a function call. Iterate across all entries within it and repeat steps 2-3 to find the value of each decoration, then add them to the item's value.

For values returned by function calls, there are several ways of getting at the value:
1. Read the function pointers out of the object's VTABLE and examine the code they point at, then interpret the code to determine what they'll return. DFHack has "accessors" which do this, though I don't know if they still work with the current version.
2. Use the item's VTABLE pointer to determine its type, then use hardcoded lookup tables to get the relevant values/offsets for each item type. This would tie the utility to a very specific version of Dwarf Fortress on a single platform.
3. Inject code into Dwarf Fortress (as a separate thread) which calls the subroutine with the appropriate parameters and places the result at a predetermined address. I've actually used this method myself in a tool I wrote for Dwarf Fortress v0.23.130.23a (in the old 2D versions, designating items for Melting involved adding them to a vector rather than setting an item flag).
Title: Re: DFHack 0.5.8
Post by: LordBadger on March 22, 2011, 02:03:49 pm
I feel like this could be simple, but I just can't figure it out. I guess for around the last two versions of Dfhack any tool that asks Dwarf fortress to preform an action generates an error:
Spoiler (click to show/hide)
To some extent it's the same error every time, with tools that effect the game as it plays. The only tool that seems to work is Dfprospector, though I think that may be 'cause it does not wright anything into the game. So that's it, if the question has already been asked just give me a link. Also The readme has been read, C++ reinstalled, and the forums have been searched... In my frustration I may have overlooked something. Great set of tools though, and the addition of Deramp is just ducky, in fact it's the main reason I want to get everything working.

So I clean the house, have a soda and decide to trouble shoot some more. The issue I'm having has nothing to do with the tools... Something that should have been extremely clear to me from the error (Egg on my face) this is more of an issue my computer and C++ are having. I uninstall C++ (This is the version from the read me) and I still get the same errors making it look as if it had never been installed in the first place. Anyway my apologies, question retracted.
Title: Re: DFHack 0.5.8
Post by: danaris on March 22, 2011, 02:10:03 pm
What does "memory object not set: type offset key /string/MSVC/buffer" mean?
I get it whenever I run any of the tools. I'm running this on Wine with Ubuntu 10.10.
This means something is very broken. None of the recognized windows DF versions have this offset /unset/. What exactly is running inside wine? DF AND the tools? If so, what was the last dfhack version that worked for you?

I get the same thing under Wine on Mac OS X.  There's also a line above it that reads

Code: [Select]
fixme:heap:HeapSetInformation 0x0 1 0x0 0
I have DF running under Wine, works just fine as usual, and this happens when I try to run any of the dfhack tools under Wine as well (at least, I presume any of them; I haven't gone through and tried each one ;) ). 

Last version of dfhack that I tried to use was 0.5.1, as that was the version needed for DF 0.31.18, which was the last version of it I was running.  My experiences with it were mixed, but generally acceptable.  Specifically (in case you care):

- dfvdig worked pretty consistently, but would occasionally crash out
- dfprospector never gave me any troubles
- dfliquids worked about as often as dfvdig
- dfcleanmap and dfreveal never worked properly for me under Wine, so I just fired up my Windows virtual machine and ran them there.

...I would note that dfreveal would sometimes reveal a single world-tile's worth of area (so, 48x48 tiles, I think...didn't count) in the farthest northwest corner, at the bottommost z-levels, before it crashed.  Once it did that for about 4 z-levels up from the bottom before it crashed.

If there's any other information I can gather for you to troubleshoot this, I'd be more than glad to try :D
Title: Re: DFHack 0.5.8
Post by: peterix on March 22, 2011, 08:56:45 pm
How to determine an item's value:
There simply has to be a value cached somewhere. It can't do all this for every item every time the fortress value needs to be recalculated.
For values returned by function calls, there are several ways of getting at the value:
1. Read the function pointers out of the object's VTABLE and examine the code they point at, then interpret the code to determine what they'll return. DFHack has "accessors" which do this, though I don't know if they still work with the current version.
2. Use the item's VTABLE pointer to determine its type, then use hardcoded lookup tables to get the relevant values/offsets for each item type. This would tie the utility to a very specific version of Dwarf Fortress on a single platform.
3. Inject code into Dwarf Fortress (as a separate thread) which calls the subroutine with the appropriate parameters and places the result at a predetermined address. I've actually used this method myself in a tool I wrote for Dwarf Fortress v0.23.130.23a (in the old 2D versions, designating items for Melting involved adding them to a vector rather than setting an item flag).
All valid approaches. I like 2. in particular because it allows me to automate things and be lazy.
3. I would never do in a separate thread. That's just asking for trouble. If you go to the lengths of injecting code, do it properly and make it synchronized. DF has no idea your thread is there and you will get race conditions.

Anyway, I'll ask everyone involved just one thing: be lazy and think of the maintenance costs in the long run :)
Title: Re: DFHack 0.5.8
Post by: Quietust on March 23, 2011, 09:58:57 am
3. I would never do in a separate thread. That's just asking for trouble. If you go to the lengths of injecting code, do it properly and make it synchronized. DF has no idea your thread is there and you will get race conditions.

What method of synchronization would you recommend for such an old version of DF?

Some of my tools do become unstable at times, but it's mainly the ones that have to repeatedly probe the game's memory for updates - one of them periodically examines every item in the fortress and forbids them if they're carried by an invader (auto-forbid death drops is a marvelous feature I simply couldn't live without), and another repeatedly queries the "active screen" to see if I'm either looking at an item (on the screen that would show the item value, so I can [f]orbid/[c]hasm/[m]elt the item) or in the detailed view of the Stocks screen (so I can toggle forbid on the selected item just like chasm/melt), and the latter only seems to crash if it happens to query at the exact moment the screen changes, never when toggling Melt (which is the only part that actually injects code - querying the Melt flag just means iterating across the Melt vector and comparing item IDs).
Title: Re: DFHack 0.5.8
Post by: peterix on March 23, 2011, 12:16:42 pm
What method of synchronization would you recommend for such an old version of DF?
Hook some function that's called in a safe place. A system call, something. Set up something like a breakpoint if everything else fails. Something between two updates of the DF world. I haven't really messed around with the old versions, but this can be done comfortably with the new SDL versions. There's a 'pointless call' to SDL_NumJoysticks just for this purpose. I did use it in the SHM (shared memory) version of dfhack, but I scrapped that due to unfixable bugs. I still want to use it to synchronize properly though.

@all the wine dfhack users:
I'll try to cobble together a wine-friendly release :)
Title: Re: DFHack 0.5.8
Post by: danaris on March 23, 2011, 12:32:01 pm
@all the wine dfhack users:
I'll try to cobble together a wine-friendly release :)

Thanks! :)
Title: Re: DFHack 0.5.8
Post by: peterix on March 23, 2011, 03:06:29 pm
@all the wine dfhack users:
I'll try to cobble together a wine-friendly release :)

Thanks! :)
OK. Here goes: https://github.com/downloads/peterix/dfhack/dfhack-test-wine-x86.zip (https://github.com/downloads/peterix/dfhack/dfhack-test-wine-x86.zip)

This is basically what 0.5.9 will be, except for some extra tweaks. If it works for you, I'll release both this and the regular MS version. It's built with GCC on Windows, so it includes all the bits and pieces of the C/C++ libraries inside, instead of relying on the Microsoft stuff. Give it a try :) 
Title: Re: DFHack 0.5.8
Post by: danaris on March 23, 2011, 03:16:09 pm
OK. Here goes: https://github.com/downloads/peterix/dfhack/dfhack-test-wine-x86.zip (https://github.com/downloads/peterix/dfhack/dfhack-test-wine-x86.zip)

This is basically what 0.5.9 will be, except for some extra tweaks. If it works for you, I'll release both this and the regular MS version. It's built with GCC on Windows, so it includes all the bits and pieces of the C/C++ libraries inside, instead of relying on the Microsoft stuff. Give it a try :)

Same problem   :-\

Well, not exactly the same.  It still says "memory object not set: type offset key /string/MSVC/buffer", but the line about "HeapSetInformation" is gone.  This is with dfattachtest, dfvdig, and dfprospector.

If you want to build a copy with some debug output turned on, I'll be happy to report the output from any given tool.

I should note that I have the current version of DwarfTherapist running in Wine connected to DF and working happily.
Title: Re: DFHack 0.5.8
Post by: peterix on March 23, 2011, 03:42:24 pm
Same problem   :-\
Ok. This time I reinstalled the compiler (I had some very old version) and built with debug symbols turned on. It *should* be possible to use winedbg as a debugger and get some backtraces... maybe.

EDIT:
OK. This one works for me under wine. It's very slow, but works:
https://github.com/downloads/peterix/dfhack/dfhack-test3-wine-x86.zip (https://github.com/downloads/peterix/dfhack/dfhack-test3-wine-x86.zip)

It seems a bit strange still. I got a "memory object not set: type offset key /string/MSVC/buffer" right after trying to use winedbg... all I can say is that wine is a pile of hacks. One note about using multiple tools at the same time on linux (no idea about osx though): DON'T. The underlying platform can't do it, wine will only give you a pile of errors.

EDIT 2:
OK. I'll delay the release until this is confirmed at least semi-working. Btw, the 'suspend' part of DFHack doesn't work when you run it inside wine for whatever reason. This is probably why things were crashing randomly before... I never tested DFHack under wine and I'm not going to support it beyond a 'semi-working' state. Piling hacks on top of hacks is a bad idea.
Title: Re: DFHack 0.5.8
Post by: danaris on March 24, 2011, 01:27:01 pm
Frankly, so long as dfprospector and dfvdig work consistently, I'll be happy.  If dfreveal and dfcleanmap would work even 1/3 of the time as well, that would be brilliant.

For anything more, I can always fire up my Windows virtual machine and run it in there.

And if there's anything I can do in the way of testing on OS X to help you out, I'll be more than glad to :)
Title: Re: DFHack 0.5.8
Post by: Devstorm on March 24, 2011, 02:05:45 pm
Does DFHack work for the newest version (.22) yet? If not, could it be made to do so? Thank you.
Title: Re: DFHack 0.5.8
Post by: dagger on March 24, 2011, 02:08:16 pm
Does DFHack work for the newest version (.22) yet? If not, could it be made to do so? Thank you.

Dude, .22 just was released.....hope you are joking.  :o
Title: Re: DFHack 0.5.8
Post by: peterix on March 24, 2011, 02:14:00 pm
Frankly, so long as dfprospector and dfvdig work consistently, I'll be happy.  If dfreveal and dfcleanmap would work even 1/3 of the time as well, that would be brilliant.

For anything more, I can always fire up my Windows virtual machine and run it in there.

And if there's anything I can do in the way of testing on OS X to help you out, I'll be more than glad to :)
Please check the test3 package I made. It worked with wine on linux for me. Not entirely reliably, but worked.
Title: Re: DFHack 0.5.8
Post by: danaris on March 24, 2011, 02:23:31 pm
Frankly, so long as dfprospector and dfvdig work consistently, I'll be happy.  If dfreveal and dfcleanmap would work even 1/3 of the time as well, that would be brilliant.

For anything more, I can always fire up my Windows virtual machine and run it in there.

And if there's anything I can do in the way of testing on OS X to help you out, I'll be more than glad to :)
Please check the test3 package I made. It worked with wine on linux for me. Not entirely reliably, but worked.

I'm still getting the exact same "memory object not set" message.  It just sits there with that until I press "return", at which point it exits with status 1.

Later I'll try to run some tests with it under Wine in an actual (virtualized) Linux environment, see if that changes anything...
Title: Re: DFHack 0.5.8
Post by: Rumrusher on March 25, 2011, 01:50:53 pm
So far with testing I learn that if you don't have any migrants or king from the Mountain home you select your settlers to come from you can avoid the abandon/migrant timer and play around in fort mode as long as you like. During this I walk into playing the fort in the original size 1x1 and when I went back to adventure mode I couldn't leave the site because of said original size and had to sleep outside to escape.
though I think using Dfusion site changer on a fort to change it to a Mountain home might allow a quicker chance to re-test this.
I done this on .21 and there some things missing in the noble screen but if your leader from before still there you could remove is resident and slap them in as head military leader then add your Adventurer. some how I guess in the 1x1 form caused the cages to stay caged needs more work.
Title: Re: DFHack 0.5.8
Post by: Krelos on March 26, 2011, 10:57:25 am
Ok, so I used the liquids to spawn some lava to take out an early (1st winter) siege to allow one more migrant wave, right?

Well, they all died, and now there's an apparently permanent siege tag on the screen that never leaves. Other sieges have come and gone, but the tag stays and no caravans or migrants come.

Any solution other than starting over?
Title: Re: DFHack 0.5.8
Post by: Rumrusher on March 26, 2011, 11:12:40 am
Ok, so I used the liquids to spawn some lava to take out an early (1st winter) siege to allow one more migrant wave, right?

Well, they all died, and now there's an apparently permanent siege tag on the screen that never leaves. Other sieges have come and gone, but the tag stays and no caravans or migrants come.

Any solution other than starting over?
uhh I think reviving one of them and having them walk out might save you the trouble if not then boot up DFMODE and save change to adventure mode then save change back?
Title: Re: DFHack 0.5.8
Post by: Devstorm on March 26, 2011, 01:59:18 pm
.23 is out. While I know it may take a bit, is there any chance of getting DFHack updated soon? Thanks.
Title: Re: DFHack 0.5.8
Post by: Makbeth on March 26, 2011, 02:03:46 pm
.23 is out. While I know it may take a bit, is there any chance of getting DFHack updated soon? Thanks.

Nope.  No chance.  No chance at all.  Ever.  The last DFhack update was for .22.  Peterix won't be making any more.  In fact, he's not even reading this thread.  He's moved to a remote island in the south pacific to realize his lifelong dream of making fishbone bracelets.
Title: Re: DFHack 0.5.8
Post by: Devstorm on March 26, 2011, 02:06:08 pm
.23 is out. While I know it may take a bit, is there any chance of getting DFHack updated soon? Thanks.

Nope.  No chance.  No chance at all.  Ever.  The last DFhack update was for .22.  Peterix won't be making any more.  In fact, he's not even reading this thread.  He's moved to a remote island in the south pacific to realize his lifelong dream of making fishbone bracelets.

 :(
Title: Re: DFHack 0.5.8
Post by: Rumrusher on March 26, 2011, 03:00:31 pm
.23 is out. While I know it may take a bit, is there any chance of getting DFHack updated soon? Thanks.

Nope.  No chance.  No chance at all.  Ever.  The last DFhack update was for .22.  Peterix won't be making any more.  In fact, he's not even reading this thread.  He's moved to a remote island in the south pacific to realize his lifelong dream of making fishbone bracelets.
Peterix's Sea Accessories "Making Pearl necklaces since Toads started mass production."
Title: Re: DFHack 0.5.8
Post by: parlor_tricks on March 26, 2011, 03:19:16 pm
Hey, just posting to show my deep appreciation and thanks for your help. DF Hack has made this game more enjoyable, and drowned several unfortunate morons, as well as cleaned up their messes. Thank you.
Title: Re: DFHack 0.5.8
Post by: peterix on March 26, 2011, 03:54:26 pm
Nope.  No chance.  No chance at all.  Ever.  The last DFhack update was for .22.  Peterix won't be making any more.  In fact, he's not even reading this thread.  He's moved to a remote island in the south pacific to realize his lifelong dream of making fishbone bracelets.
Peterix's Sea Accessories "Making Pearl necklaces since Toads started mass production."
Hey, just posting to show my deep appreciation and thanks for your help. DF Hack has made this game more enjoyable, and drowned several unfortunate morons, as well as cleaned up their messes. Thank you.
You make it all worth it! Thank you :D

About 31.23: yes, I'll be looking at it very, very soon. Actually, I'd love to have a working release within a few hours. Let's hope there aren't too many changes in this one. I have 31.22 working and that should make the task easier.
Title: Re: DFHack 0.5.8
Post by: Dante on March 26, 2011, 04:41:16 pm
Peterix's Sea Accessories "Making Pearl necklaces since Toads started mass production."

 :(
Title: Re: DFHack 0.5.8
Post by: Urist Imiknorris on March 26, 2011, 06:32:34 pm
Posting to say that I didn't realize how useful and timesaving some of the tools are (esp. reveal, prospector, and vdig) until I realized that they were the only reason I'm still on 31.21. Thank you.
Title: Re: DFHack 0.5.9
Post by: peterix on March 26, 2011, 07:04:19 pm
Alright. Here it is. Everything seems to be OK. I added a few new tools, check the first post for details.

Have fun!
Title: Re: DFHack 0.5.9
Post by: Urist Imiknorris on March 26, 2011, 07:16:02 pm
dfderamp sounds very useful.
Title: Re: DFHack 0.5.9
Post by: Makbeth on March 26, 2011, 07:19:43 pm
Same-day release? 

That streamlining thing you've been working on must be good.  You're now faster than the graphics packs and therapist I think.
Title: Re: DFHack 0.5.9
Post by: Greiger on March 26, 2011, 07:29:37 pm
5 hours after somebody asked for compatibility with the newest release.  That's gotta be some kind of record.

Just 5 more hours faster peterix and you'll have a release before folks even get a chance to ask.
Title: Re: DFHack 0.5.9
Post by: Khift on March 26, 2011, 07:35:07 pm
5 hours after somebody asked for compatibility with the newest release.  That's gotta be some kind of record.

Just 5 more hours faster peterix and you'll have a release before folks even get a chance to ask.
If he keeps up this rate of improvement he'll be releasing DFHack before Toady releases the new build! We'll have to make Toady speed up so we can use our new DFHack!
Title: Re: DFHack 0.5.9
Post by: slink on March 26, 2011, 07:47:50 pm
Thank you so very much, peterix.   :) :) :)
Title: Re: DFHack 0.5.9
Post by: Urist Imiknorris on March 26, 2011, 07:48:58 pm
One quick note: dftubefill isn't in the readme.

EDIT: dflair either.
Title: Re: DFHack 0.5.9
Post by: peterix on March 26, 2011, 07:59:15 pm
Same-day release? 
That streamlining thing you've been working on must be good.  You're now faster than the graphics packs and therapist I think.
I never finished the streamlining. The memory search tools haven't changed much... I did streamline the release process though. It's not a total pain to do anymore :)

It's just that almost nothing changed between 31.22 and 31.23... and I had 31.22 figured out the same day it was released, because only little changed between that and 31.21/31.20.
Both 31.20 and 31.19 were huge in comparison, not only in the amount of changed offsets, but some of the world map structures changed and I had to add some code to handle that.
One quick note: dftubefill isn't in the readme.

EDIT: dflair either.
Forgot to update the readme... happens almost every time. Ideally, the readme and the build rules for tools would be generated out of the tool source files so I don't have to remember to do this every time. Well, next time :D
Title: Re: DFHack 0.5.9
Post by: Twobeard on March 26, 2011, 08:03:09 pm
You are a beautiful person peterix. Cheers
Title: Re: DFHack 0.5.9
Post by: Boes on March 26, 2011, 08:13:01 pm
Thank you very much for the update... this is what i was waiting on to start using 31.23/22
Title: Re: DFHack 0.5.9
Post by: Makbeth on March 26, 2011, 08:35:44 pm
DFtubefill?  Is that what it sounds like?

dammit, I just drooled all over my keyboard.

EDIT:

OMG it is!  HEhehehehehe!  Oh, you made my day, Peterix!

-----

For those wondering, dftubefill fills in all the hollow spoiler tubes in the embarked area.  I used it with the cursor on the hollow space, but it looks like that might not be necessary.

Glorious.

*goes off to see if he can generate a spire*
Title: Re: DFHack 0.5.9
Post by: Devstorm on March 26, 2011, 08:46:08 pm
Thank you! Thank you thank you!
Title: Re: DFHack 0.5.9
Post by: Cephas on March 26, 2011, 08:57:28 pm
When I click on the exe files for things like dfreveal, a terminal window pops up rapidly and then closes instantly. I am running windows 7 32 bit and DF 31.23.

Any tips?
Title: Re: DFHack 0.5.9
Post by: Greiger on March 26, 2011, 09:13:44 pm
There's a little trick I use to get it to not close immediately.

create a text file in the folder with the program yer trying to run.  In the text file type "[name of program you are trying to run].exe" then hit enter once, then type "pause".

Then save the file as "[anything].bat" (might need the save as all files on) replacing the .txt that text files usually have with the .bat.

If it worked it should change it's icon to something like the DFhack programs.  It is now what is called a batch file.  Then double click the new file you created.  It will run whatever program you had on the first line, and then pause the output til you hit a key.  Letting you see any error messages it may output.   It won't fix the program, but it often tells you what's wrong.

P.S. There's probably easier ways to do that.  But thats the way I learned how to do it years ago, and I never bothered to learn another method.
Title: Re: DFHack 0.5.9
Post by: Cephas on March 26, 2011, 09:18:27 pm
Did it. There is absolutely no output from dfreveal.exe

It isn't returning an error message, It's simply shutting off instantly. (Except when I use that .bat, where it does nothing, then waits.)
Title: Re: DFHack 0.5.9
Post by: Greiger on March 26, 2011, 09:21:55 pm
Hm, then it sounds you might need peterix or somebody who had it do that before to figure out exactly what is going on I'm afraid.  Sorry I didn't help much.  At the very least that might help others narrow down the issue.

EDIT: Just tried a little bit of troubleshooting on my own and it doesn't seem to be anything simple like a mismatched version because when I tried to run reveal with DF not running it stated that it can't find the suitable process and even paused the output by itself.  I can't seem to get it to do anything like the no output at all yer getting even when I'm trying.
Title: Re: DFHack 0.5.9
Post by: Cephas on March 26, 2011, 09:40:34 pm
Yeah. I know it's on my side, and I faintly remember having this problem before. However, I am not sure how it was resolved in the past. I've tried playing with administrator settings and whatnot, but nothing is making a difference.
Title: Re: DFHack 0.5.9
Post by: peterix on March 26, 2011, 11:07:45 pm
Yeah. I know it's on my side, and I faintly remember having this problem before. However, I am not sure how it was resolved in the past. I've tried playing with administrator settings and whatnot, but nothing is making a difference.
Windows has a really weird security setup... try putting dfhack into a different folder. I have everything in a share provided by VirtualBox and things seem to work.

Still, you should be getting some kind of error if the tools can't see DF. Maybe check the windows event logs? Run eventvwr.msc and look around.
Title: Re: DFHack 0.5.9
Post by: HammerDave on March 26, 2011, 11:14:57 pm
Running any of the .exe files directly can make the window disappear before it has a chance to show anything.

Try opening a command window (the black box icon with a C:| in it), change directory to your dfhack directory "cd c:\whatever" and type the name of the command.  Doing it this way the window will not close instantly, and you'll be able to see whatever error messages it might be leaving.

Your antivirus might think one or more dfhack programs is a malicious program.  It does, after all, read and write another process's memory.  Mine quarantined it a couple of times and I had to restore the files.
Title: Re: DFHack 0.5.9
Post by: Jeoshua on March 26, 2011, 11:33:12 pm
Your antivirus might think one or more dfhack programs is a malicious program.  It does, after all, read and write another process's memory.  Mine quarantined it a couple of times and I had to restore the files.

Oh I feel your pain.  Every new version of dfhack released changes it's files ever so slightly, therefore is recognized as a different program, therefore gets erased by Norton Antivirus as a "hack tool" that has like 5 users.  I usually just restore them the consider removing Norton's stupid self, but honestly... shouldn't there be a way to tell Norton "No, it's okay, I know it's safe"?
Title: Re: DFHack 0.5.9
Post by: Rose on March 26, 2011, 11:44:49 pm
There is a way, actually, it's called uninstalling Norton.
Title: Re: DFHack 0.5.9
Post by: Cephas on March 27, 2011, 12:59:23 am
Yeah. Wow.

So, the situation is as follows. The College network forces us to install certain security programs to keep their network from exploding and such. I found it annoying, and removed the functionality of the entire thing while still allowing the network to believe I had it.

Turns out, It got the better of me, and hid itself. However, as it's essentially gone, it couldn't complain about anything and simply smacked the processes down.

I've got that under control now, thanks for the suggestion to check anti-virus crap.
Title: Re: DFHack 0.5.9
Post by: Makbeth on March 27, 2011, 02:00:52 am
It hid itself?  What, like a rootkit?

I hope that's not the case.
Title: Re: DFHack 0.5.9
Post by: Grax on March 27, 2011, 02:19:40 am
Peterix thank you. Now i can play .23 with full force. ;-)

Till this moment there were only soil-layer fortress for 10 years. ;-)
Title: Re: DFHack 0.5.9
Post by: Rumrusher on March 27, 2011, 08:40:11 am
Peterix thank you. Now i can play .23 with full force. ;-)

Till this moment there were only soil-layer fortress for 10 years. ;-)
dang toady just came out with .24
best wait for .38 comes out before updating.
Title: Re: DFHack 0.5.9
Post by: Urist Imiknorris on March 27, 2011, 08:43:21 am
Ehh, the bugfixes aren't relevant enough to my fort to justify switching immediately. I can wait for DFHack.
Title: Re: DFHack 0.5.9
Post by: Grax on March 27, 2011, 09:01:58 am
Peterix thank you. Now i can play .23 with full force. ;-)

Till this moment there were only soil-layer fortress for 10 years. ;-)
dang toady just came out with .24
best wait for .38 comes out before updating.
.24 doesn't improve anything in gameplay, so i'm staying on .23
Title: Re: DFHack 0.5.10
Post by: peterix on March 27, 2011, 10:17:58 am
And 31.24 support is up. Nothing changed at all, but I updated the readme :)

Also, the Ubuntu downloads were broken and nobody told me. Github uses a flash uploader thing and doing more than one upload at the same time doesn't work it seems... This time I made sure they work.

I'm going to find the linux offsets for this one (the 31.22 - 31.24 range). Should be available within a few days.

Ok, I'll wait a bit instead. Toady seems to be in some kind of rapid-fire release mode :D
Title: Re: DFHack 0.5.10
Post by: Shandra on March 27, 2011, 06:13:19 pm
And 31.24 support is up. Nothing changed at all, but I updated the readme :)

Thanks nevertheless!
Title: Re: DFHack 0.5.10
Post by: Krelos on March 28, 2011, 03:52:25 pm
Looks like he may be done with the rapid releases for now.... Maybe.
Title: Re: DFHack 0.5.10
Post by: veok on March 28, 2011, 04:41:54 pm
Indeed. Though it seems that .24 and .25 are not DFHack compatible. DFHack gives me "could not find suitable process" in my .25 game.
Title: Re: DFHack 0.5.10
Post by: Jeoshua on March 28, 2011, 05:50:02 pm
I just had .24 working last night.  .25 probably isn't much different.  Are you sure you're using the newest version?
Title: Re: DFHack 0.5.10
Post by: veok on March 28, 2011, 05:56:42 pm
Freshly downloaded from the first page of this topic.
Title: Re: DFHack 0.5.10
Post by: Krelos on March 28, 2011, 06:14:46 pm
Aye, .25 is incompatible.

.24 worked for me, but not .25
Title: Re: DFHack 0.5.10
Post by: Andux on March 28, 2011, 06:25:34 pm
I just had .24 working last night.  .25 probably isn't much different.

Offsets seem to be the same this time around, but the md5 and timestamp (used to identify which set of offsets to use) change with each version.

Try adding this to your memory.xml (should go in just above the frustrated penguin):
Code: (memory.xml section for 0.31.25) [Select]
    <Version name="v0.31.25 SDL" os="windows" base="v0.31.24 SDL">
        <PETimeStamp value="0x4D90764F" />
        <MD5 value="6ada05fc94785b53efe6aa5728b3756b" />
    </Version>
Title: Re: DFHack 0.5.10
Post by: Gokajern on March 28, 2011, 06:36:47 pm
I just had .24 working last night.  .25 probably isn't much different.

Offsets seem to be the same this time around, but the md5 and timestamp (used to identify which set of offsets to use) change with each version.

Try adding this to your memory.xml (should go in just above the frustrated penguin):
Code: (memory.xml section for 0.31.25) [Select]
    <Version name="v0.31.25 SDL" os="windows" base="v0.31.24 SDL">
        <PETimeStamp value="0x4D90764F" />
        <MD5 value="6ada05fc94785b53efe6aa5728b3756b" />
    </Version>
Tried it, didn't work. Thanks anyhoo.
Title: Re: DFHack 0.5.10
Post by: hapes on March 28, 2011, 09:54:24 pm
Offsets seem to be the same this time around, but the md5 and timestamp (used to identify which set of offsets to use) change with each version.

Try adding this to your memory.xml (should go in just above the frustrated penguin):
Code: (memory.xml section for 0.31.25) [Select]
    <Version name="v0.31.25 SDL" os="windows" base="v0.31.24 SDL">
        <PETimeStamp value="0x4D90764F" />
        <MD5 value="6ada05fc94785b53efe6aa5728b3756b" />
    </Version>

We have a winner...for me, at least.
Title: Re: DFHack 0.5.10
Post by: Gokajern on March 28, 2011, 10:07:12 pm
... Well I simply copy pasted the lines on the memory.xml file, was there more to it?
Title: Re: DFHack 0.5.10
Post by: umiman on March 28, 2011, 10:51:27 pm
Yeah, I don't understand those instructions either.
Title: Re: DFHack 0.5.10
Post by: SalmonGod on March 28, 2011, 11:15:05 pm
Insert at line 2152
Title: Re: DFHack 0.5.10
Post by: Gokajern on March 28, 2011, 11:37:56 pm
The .xml file I have (that came with the download, from the first page) only has 2133 lines. Hmm... nevermind, turns out I was doing something unbearably stupid involving decompressing the files to the wrong folder... so anyway, copy-pasting those lines above the penguin makes it work for .25, I opened the file with wordpad btw.
Title: Re: DFHack 0.5.10
Post by: Krelos on March 28, 2011, 11:41:31 pm
If someone would be willing to upload a working XML.... that'd be really great. ;D
Title: Re: DFHack 0.5.10
Post by: SalmonGod on March 28, 2011, 11:56:40 pm
Try this (http://www.mediafire.com/file/rk6d27jnboeswxr/Memory.xml)
Title: Re: DFHack 0.5.10
Post by: umiman on March 29, 2011, 12:05:43 am
Awesome stuff. Cheers!
Title: Re: DFHack 0.5.10
Post by: Krelos on March 29, 2011, 12:16:50 am
Thanks much! Works, of course.


Ohh, and to anyone who doesn't know, this XML file will also make Runesmith work with the new version.
You just have to change it's name to 'Memory-ng.xml' and replace the old one in the Runesmith folder.
Title: Re: DFHack 0.5.10
Post by: Waladil on March 29, 2011, 04:57:26 am
Um... Problem?
When I run dfhack with .24, I'm getting one of two errors, depending on what I use.
Either "memory object not set: type offset key /string/MSVC/buffer" and I get that when I use attachtest, expbench, flows, lair, liquids, pause, position, prospector, reveal, suspend, unstuck, and vdig.
Anything else with "stop responding"

Using DF v.24 on a Windows 7 x64 (that MAY be the problem?) machine.

Did some more looking. I got the modified memory.xml from that guy a few posts ago, and that didn't work. Also, tried .25, also no go. Same problems for all (except that I was having other issues on .24 w/ therapist that have been resolved)
Title: Re: DFHack 0.5.10
Post by: lorb on March 29, 2011, 08:21:16 am
Some toolsare not working on my Debian machine .
I installed dfhack from the ubuntu32bit package which worked fine.
But some tools do not work, some do.
dfattachtest and dfsuspend work fine.
dfflows also works fine, and dfveinlook is properly working.

Errors i get from:
dfprospector: symbol lookup error: dfprospector: undefined symbol: _ZN6DFHack4Maps17ReadLocalFeaturesERSt3mapINS_10planecoordESt6vectorIPNS_9t_featureESaIS5_EESt4lessIS2_ESaISt4pairIKS2_S7_EEE
and:
dfliquids: symbol lookup error: dfliquids: undefined symbol: _ZN6DFHack7Context11getPositionEv

ideas? would be glad if someone could lead me to a diagnosis whats going wrong here
ps: i have limited skills in (c++) programming, if that helps

-edit: DF is version 31.19
Title: Re: DFHack 0.5.10
Post by: peterix on March 29, 2011, 09:34:16 am
Um... Problem?
When I run dfhack with .24, I'm getting one of two errors, depending on what I use.
Either "memory object not set: type offset key /string/MSVC/buffer" and I get that when I use attachtest, expbench, flows, lair, liquids, pause, position, prospector, reveal, suspend, unstuck, and vdig.
Anything else with "stop responding"

Using DF v.24 on a Windows 7 x64 (that MAY be the problem?) machine.

Did some more looking. I got the modified memory.xml from that guy a few posts ago, and that didn't work. Also, tried .25, also no go. Same problems for all (except that I was having other issues on .24 w/ therapist that have been resolved)
Interesting. I've only seen that happening for people running DFHack on wine/osx and wine/linux and blamed it on wine... I use the same version of Windows to build the thing, so that can't be the problem. I'll have to investigate this for real, but here's what I suspect: something is broken in the xml reader library I'm using.

ideas? would be glad if someone could lead me to a diagnosis whats going wrong here
Build system fail. Looks like it didn't pick up the changes properly and some parts didn't get rebuilt. The Ubuntu machines are VirtualBox VMs connecting a share with all my programming stuff from the host. Looks like there's something wrong with that vbox share, probably doesn't preserve some metadata or something like that.
Title: Re: DFHack 0.5.10
Post by: danaris on March 29, 2011, 09:35:51 am
Um... Problem?
When I run dfhack with .24, I'm getting one of two errors, depending on what I use.
Either "memory object not set: type offset key /string/MSVC/buffer" and I get that when I use attachtest, expbench, flows, lair, liquids, pause, position, prospector, reveal, suspend, unstuck, and vdig.
Anything else with "stop responding"

Using DF v.24 on a Windows 7 x64 (that MAY be the problem?) machine.

Did some more looking. I got the modified memory.xml from that guy a few posts ago, and that didn't work. Also, tried .25, also no go. Same problems for all (except that I was having other issues on .24 w/ therapist that have been resolved)
Interesting. I've only seen that happening for people running DFHack on wine/osx and wine/linux and blamed it on wine... I use the same version of Windows to build the thing, so that can't be the problem. I'll have to investigate this for real, but here's what I suspect: something is broken in the xml reader library I'm using.

You use 64-bit Windows?

I think my Wine is 64-bit (my machine certainly is), so if you're building on 32-bit, that could be (part of) the problem...
Title: Re: DFHack 0.5.10
Post by: EmperorJon on March 29, 2011, 01:06:09 pm
I'm just wondering, I ran reveal and closed the window without unrevealing, and now... if I reveal and unreveal I can't unreveal... so I'm stuck revealed? :(
Title: Re: DFHack 0.5.10
Post by: Grax on March 29, 2011, 01:11:18 pm
I'm just wondering, I ran reveal and closed the window without unrevealing, and now... if I reveal and unreveal I can't unreveal... so I'm stuck revealed? :(
Yes.
Title: Re: DFHack 0.5.10
Post by: EmperorJon on March 29, 2011, 01:13:11 pm
Nooo... ...oooooo

 :-[
Title: Re: DFHack 0.5.10
Post by: Grax on March 29, 2011, 01:23:32 pm
Nooo... ...oooooo

 :-[
This is the case when third party utilities just adds some unpredictable FUN.  ;D
Title: Re: DFHack 0.5.10
Post by: peterix on March 29, 2011, 02:06:41 pm
Nooo... ...oooooo
 :-[
This is the case when third party utilities just adds some unpredictable FUN.  ;D
Not unpredictable. The thing did its job exactly as it was told. Unfortunately, there's no magic 'fix it' button. I guess I could spend some time writing such a magical 'fix it' button, if I had the time.

But for now I'll replace "Close to keep the map revealed." with "Close to keep the map revealed FOREVER." in future versions of the reveal tool, just to make things clearer. It's a pity I can't make that red easily, because I'd definitely do that if I could. But that would involve me writing a cross-platform terminal output wrapper that can do that...
Title: Re: DFHack 0.5.10
Post by: Grax on March 29, 2011, 02:14:42 pm
Nooo... ...oooooo
 :-[
This is the case when third party utilities just adds some unpredictable FUN.  ;D
Not unpredictable. The thing did its job exactly as it was told.
I meant unpredictable for those who don't read manuals.

*but now i suddenly understand that i did the same facepalm long time ago when i used the revealer first time*  :D
Title: Re: DFHack 0.5.10
Post by: Quietust on March 29, 2011, 02:22:05 pm
Not unpredictable. The thing did its job exactly as it was told. Unfortunately, there's no magic 'fix it' button. I guess I could spend some time writing such a magical 'fix it' button, if I had the time.

I seem to recall that the old Dtil utility for 40d had an "unreveal" option, though I don't recall exactly how it worked - one possibility would be to unreveal the entire map, then pick a suitable "open" location (e.g. the top of the sky) and then flood-fill outward, stopping only at natural walls (excluding those made of ice) and solid floors (i.e. everything but down stairs, up/down stairs, and open space).
Title: Re: DFHack 0.5.10
Post by: thewonderidiot on March 29, 2011, 03:08:31 pm
Wouldn't really work with caverns and the magma sea. The real way to do it would just make dfreveal dump its previous revealed tile info to a file just to be safe.

EDIT: I guess we could also set unused occupancy flags on revealed tiles, assuming there are.
Title: Re: DFHack 0.5.10
Post by: Makbeth on March 29, 2011, 03:15:05 pm
Nooo... ...oooooo

 :-[

lol, there's one of these every month it seems.
Title: Re: DFHack 0.5.10
Post by: uristmcdorf on March 29, 2011, 04:36:56 pm
Dont know if that was asked (dont really want to read all those 72 pages) but here it is. When i create obsidian and dug it out afterwards i cant make anything out of those stones. Worked just fine in previous versions, is there a way around this?

And i i use created magma for dumping - it wont melt anything. Just noticed that too
Title: Re: DFHack 0.5.10
Post by: Cotes on March 29, 2011, 04:42:15 pm
Nooo... ...oooooo

 :-[
People, this is what saving is for.

And i i use created magma for dumping - it wont melt anything. Just noticed that too
Is temperature on? Are the items you try to melt magma-safe?
Title: Re: DFHack 0.5.10
Post by: uristmcdorf on March 29, 2011, 04:44:58 pm
And i i use created magma for dumping - it wont melt anything. Just noticed that too
Is temperature on? Are the items you try to melt magma-safe?
[/quote]

Yep, checked that

Thats actually the interesting thing - my dorfs die from created magma but dump items wont melt (talking about bones in before questions)
Title: Re: DFHack 0.5.10
Post by: peterix on March 29, 2011, 04:45:57 pm
Dont know if that was asked (dont really want to read all those 72 pages) but here it is. When i create obsidian and dug it out afterwards i cant make anything out of those stones. Worked just fine in previous versions, is there a way around this?
Details please, this tells me nothing.

What about normal magma-cast obsidian rocks? Go try it. If they don't work, it's a bug in DF or in some mod (if you use mods).
And i i use created magma for dumping - it wont melt anything. Just noticed that too

spawn it at least one z-level above and let it fall. The game doesn't update the temperatures magically.
Title: Re: DFHack 0.5.10
Post by: uristmcdorf on March 29, 2011, 04:58:24 pm
Well, what details you exactly need?
I`m using Ironhand preinstalled .24 version. And spawn obsidian from dfliquids using "o". Spawning magma and then using water over it dosnt work as well. I mean i do receive obsidian rocks after mining but cant use them for anything

Thought this might help - checked stone menu and cant find obsidian in it, dunno if this was before

Apparently my dorfs dont even "see" it as an object - they dont wanna dump it

And yea, normal obsidian walls leave usabale stone.
Actually i think i know the reason. They wont be usable untill you dug the normal obsidian, untill that dorfs wont use it apparently

P.S.
Sorry for messy updates
Title: Re: DFHack 0.5.10
Post by: BigD145 on March 29, 2011, 05:19:22 pm
If it's aboveground, you have to change 'o'rders to dump. If you are attempting to use the obsidian in anything other than a sword in the craftsman workshop, you won't be able to until you change obsidian to be a non-economic? stone.

dfhack is not likely at fault.
Title: Re: DFHack 0.5.10
Post by: peterix on March 29, 2011, 06:23:13 pm
It is behaving very strangely... I just did some testing and I'll do more for sure. Yes. Even embarking on top of a volcano does nothing. I eventually flooded the volcano and the obsidian I got from that worked. So, Toady must have added some kind of flag, similar to the magma furnaces? I'll do some testing with natural magma and spawned magma...

OK... wtf. Dwarves want to clean themselves in a pool of spawned magma. Something important is missing.

Not much difference between the volcano obsidian and spawned obsidian. the rocks don't show up in lists and the material isn't in the stones screen.

EDIT: nevermind: http://df.magmawiki.com/index.php/Obsidian#Bugs (http://df.magmawiki.com/index.php/Obsidian#Bugs) This is a good bug to fix using tools though.
Title: Re: DFHack 0.5.10
Post by: SirAaronIII on March 29, 2011, 06:28:18 pm
It has something to do with the [MAXEDGE] tag in the raws. Just take it out and obsidian should work.
Title: Re: DFHack 0.5.10
Post by: Krelos on March 29, 2011, 06:57:41 pm
Or create a reaction involving obsidian.
Title: Re: DFHack 0.5.10
Post by: HammerDave on March 29, 2011, 07:23:37 pm
Nooo... ...oooooo

 :-[

lol, there's one of these every month it seems.

I'm paranoid for just this reason -- save, copy the save, open and reveal the copy -- then play on the original.   ;D
Title: Re: DFHack 0.5.10
Post by: Rumrusher on March 29, 2011, 07:41:36 pm
Nooo... ...oooooo

 :-[

lol, there's one of these every month it seems.

I'm paranoid for just this reason -- save, copy the save, open and reveal the copy -- then play on the original.   ;D
Can't you just save reveal end screw up swap in Taskmaster do his super to kill DF.exe then bring DF back and reload the save.
Title: Re: DFHack 0.5.10
Post by: JanusTwoface on March 29, 2011, 07:45:34 pm
I'm paranoid for just this reason -- save, copy the save, open and reveal the copy -- then play on the original.   ;D
Can't you just save reveal end screw up swap in Taskmaster do his super to kill DF.exe then bring DF back and reload the save.
Essentially the same thing. Except not as amusingly paranoid. :)
Title: Re: DFHack 0.5.10
Post by: Makbeth on March 29, 2011, 07:49:23 pm
If I understand correctly, you're asking whether he can kill the process after a perma-reaveal.  He could, but he'd lose his unsaved progress.  His method is tedious but ensures he won't have to re-embark or repeat the last month.  I suppose copying the save is something he does just in case autosave sneaks up on him at the end of the season.  That happens a lot more than I wish it did.  You lose half a year of progress.  Copying save files is worth it.
Title: Re: DFHack 0.5.10
Post by: Andux on March 29, 2011, 07:58:56 pm
I'm just wondering, I ran reveal and closed the window without unrevealing, and now... if I reveal and unreveal I can't unreveal... so I'm stuck revealed? :(

You could try using Tweak (http://dffd.wimbli.com/file.php?id=3271) with For Each Tile (http://dffd.wimbli.com/file.php?id=404) to hide everything below a given Z-level.

Start For Each Tile from within Tweak and create a new operation set:
Code: (condition) [Select]
is_subterranean and (z < cursor_z)
Code: (operations) [Select]
hideThen loo[k] at a tile on the lowest level you want to keep revealed and run it.
Title: Re: DFHack 0.5.10
Post by: peregarrett on March 29, 2011, 11:42:54 pm
Dwarves want to clean themselves in a pool of spawned magma. Something important is missing.

Offtop, but have to sig.
Title: Re: DFHack 0.5.10
Post by: Dante on March 30, 2011, 02:02:37 am
Whoops nvm; should've read further.
Title: Re: DFHack 0.5.10
Post by: Cotes on March 30, 2011, 04:04:54 am
You save the game before doing something stupid and shut DF down with task manager when it goes wrong. Why is this so hard?
Title: Re: DFHack 0.5.10
Post by: Quietust on March 30, 2011, 08:36:33 am
Wouldn't really work with caverns and the magma sea. The real way to do it would just make dfreveal dump its previous revealed tile info to a file just to be safe.

Sure it would - if a cavern hasn't been discovered yet, then the flood-fill search won't reach it since solid stone will be in the way, but if it's been opened up, then you'll be able to see it. The only issue is that it would bypass the sight range checking that normally happens when you discover caverns.
Title: Re: DFHack 0.5.10
Post by: jabbamonkey on March 30, 2011, 09:09:42 am
Reveal doesn't work with the latest version...
Title: Re: DFHack 0.5.10
Post by: Nameless Archon on March 30, 2011, 10:25:59 am
Reveal doesn't work with the latest version...
Does on my install. Did you update the memory.xml (http://www.mediafire.com/file/rk6d27jnboeswxr/Memory.xml) file for DFHack? Without the correct MD5/offsets, it can't find the correct memory to modify...

(Please direct thanks for the link to SalmonGod. Thanks, SalmonGod!)
Title: Re: DFHack 0.5.10
Post by: peterix on March 30, 2011, 12:10:50 pm
Wouldn't really work with caverns and the magma sea. The real way to do it would just make dfreveal dump its previous revealed tile info to a file just to be safe.

Sure it would - if a cavern hasn't been discovered yet, then the flood-fill search won't reach it since solid stone will be in the way, but if it's been opened up, then you'll be able to see it. The only issue is that it would bypass the sight range checking that normally happens when you discover caverns.
Not necessarily. This can be done too...
Title: Re: DFHack 0.5.10
Post by: Amikron on March 30, 2011, 01:51:20 pm
Reveal doesn't work with the latest version...
Does on my install. Did you update the memory.xml (http://www.mediafire.com/file/rk6d27jnboeswxr/Memory.xml) file for DFHack? Without the correct MD5/offsets, it can't find the correct memory to modify...

(Please direct thanks for the link to SalmonGod. Thanks, SalmonGod!)

Anyone else able to post this mediafire is giving errors.  :-\
Title: Re: DFHack 0.5.10
Post by: peterix on March 30, 2011, 02:07:58 pm
Anyone else able to post this mediafire is giving errors.  :-\

https://github.com/peterix/dfhack/raw/e61a907da170931ce9f8102f6c140897ce971905/Memory.xml (https://github.com/peterix/dfhack/raw/e61a907da170931ce9f8102f6c140897ce971905/Memory.xml)
Title: Re: DFHack 0.5.10
Post by: Amikron on March 30, 2011, 02:24:18 pm
Why thank you!  :D
Title: Re: DFHack 0.5.10
Post by: peterix on March 30, 2011, 06:28:19 pm
OK, everyone running DFHack in wine (and all the Windows users looking for a pre-release), check this out: https://github.com/downloads/peterix/dfhack/dfhack-test.zip

I've reverted the xml reader library to an earlier version. You shouldn't be getting random weird xml/offset errors now. At least I hope it's fixed. The tests I did with linux+wine show some promise in that regard ;)
I also made DFHack stop ALL DF's threads instead of just the main one. DFHack on wine should be as safe as the other methods now. This means DF sounds will skip with something like stonesense active, but it's safer. Play music in something else if it bothers you. If too many people hate it, I might add a whitelist that lets the music stuff run. Fixing bugs has higher priority though.

So, all those osx and linux people, please test and tell me if it works for you now.

Oh, and this one has the few Memory.xml lines needed for 31.25. I haven't tested them thoroughly, and I'll do that before the real release. You've been warned ;)
Title: Re: DFHack 0.5.10
Post by: Rumrusher on March 30, 2011, 06:39:36 pm
OK, everyone running DFHack in wine (and all the Windows users looking for a pre-release), check this out: https://github.com/downloads/peterix/dfhack/dfhack-test.zip

I've reverted the xml reader library to an earlier version. You shouldn't be getting random weird xml/offset errors now. At least I hope it's fixed. The tests I did with linux+wine show some promise in that regard ;)
I also made DFHack stop ALL DF's threads instead of just the main one. DFHack on wine should be as safe as the other methods now. This means DF sounds will skip with something like stonesense active, but it's safer. Play music in something else if it bothers you. If too many people hate it, I might add a whitelist that lets the music stuff run. Fixing bugs has higher priority though.

So, all those osx and linux people, please test and tell me if it works for you now.

Oh, and this one has the few Memory.xml lines needed for 31.25. I haven't tested them thoroughly, and I'll do that before the real release. You've been warned ;)
wait so this only effects the wine folks right and not the folks who can run this normally?
Title: Re: DFHack 0.5.10
Post by: peterix on March 30, 2011, 06:43:55 pm
wait so this only effects the wine folks right and not the folks who can run this normally?
Everyone using dfhack windows builds. This is basically 0.5.11, unless I find some more horrible bugs :) The wine bugs are fixed, but this leads to some changes for the regular windows folks too.
Title: Re: DFHack 0.5.10
Post by: Waladil on March 30, 2011, 06:55:04 pm
I'm still getting the same error (memory object not set : type offset key /string/MSVC/buffer)
That's with 5.10 AND the new test one. Also, I went back to the old 5.4 because that's the only other thing I had on my system. Same thing. (I put a downloaded memory.xml file into that one. It failed the same way both before and after)
Title: Re: DFHack 0.5.10
Post by: peterix on March 30, 2011, 07:33:02 pm
I'm still getting the same error (memory object not set : type offset key /string/MSVC/buffer)
That's with 5.10 AND the new test one. Also, I went back to the old 5.4 because that's the only other thing I had on my system. Same thing. (I put a downloaded memory.xml file into that one. It failed the same way both before and after)
Well, now I'm out of ideas. Can you post what the output of dfdoffsets looks like?
Title: Re: DFHack 0.5.10
Post by: Rumrusher on March 30, 2011, 07:52:59 pm
wait so this only effects the wine folks right and not the folks who can run this normally?
Everyone using dfhack windows builds. This is basically 0.5.11, unless I find some more horrible bugs :) The wine bugs are fixed, but this leads to some changes for the regular windows folks too.
dang that sucks.
Title: Re: DFHack 0.5.10
Post by: peterix on March 30, 2011, 07:56:44 pm
dang that sucks.
What sucks? I don't see anything that sucks here. Just some simple precautions.
Title: Re: DFHack 0.5.10
Post by: Waladil on March 30, 2011, 08:24:55 pm
That one just sits there a bit then stops responding. IIRC the method there was to run a command prompt there and run it through that, right? Ok... yeah, it just freezes and throws me back to regular command prompt.
Want a screenshot? I took one.
Title: Re: DFHack 0.5.10
Post by: peterix on March 30, 2011, 10:03:25 pm
That one just sits there a bit then stops responding. IIRC the method there was to run a command prompt there and run it through that, right? Ok... yeah, it just freezes and throws me back to regular command prompt.
Want a screenshot? I took one.
Not really. I dug into the problem and I'm solving it right now. Found a whole lot of ugly things lurking in the code, unlikely to be triggered under normal conditions. I hope to have things working soon.
Title: Re: DFHack 0.5.10
Post by: Waladil on March 30, 2011, 10:09:47 pm
Huzzah! My current fort has been crippled due to a combination of bad luck, more bad luck, slow dwarves, bad pathfinding, and a healthy helping of additional bad luck. It is currently on hiatus, for lack of dfhack. I stand by to test any and all new ideas.

Don't take this as pressure please! I don't want you to think I'm pressuring you!
Title: Re: DFHack 0.5.10
Post by: peterix on March 30, 2011, 10:37:57 pm
Huzzah! My current fort has been crippled due to a combination of bad luck, more bad luck, slow dwarves, bad pathfinding, and a healthy helping of additional bad luck. It is currently on hiatus, for lack of dfhack. I stand by to test any and all new ideas.

Don't take this as pressure please! I don't want you to think I'm pressuring you!
This was a really nasty bug. Let's see how things go this time :)
https://github.com/downloads/peterix/dfhack/dfhack-test-OK.zip

Oh, and this version has real, hot magma. Originally, dfliquids spawned the magma very cool (room temperature). Now it's the proper 12000 degrees Urist :P
Title: Re: DFHack 0.5.10
Post by: Waladil on March 30, 2011, 10:43:51 pm
There we go! That one works!
Thank you very much! NOW TO KILL THOSE GOBLINS

Edit:
This is a wierd (minor) bug/feature/side effect. Dunno how long it's been around but I think it's new. Apparently, when spawning obsidian walls, any water at that spot will be turned to magma.
Title: Re: DFHack 0.5.10
Post by: peterix on March 30, 2011, 11:02:37 pm
This is a wierd (minor) bug/feature/side effect. Dunno how long it's been around but I think it's new. Apparently, when spawning obsidian walls, any water at that spot will be turned to magma.
Right... I'll get to that later. Just use the zero flow size to delete the water/magma in those cases. Make sure you don't do this on open terrain so you don't get pathfinding bugs.
In the next version, placing obsidian walls will remove any and all magma/water in place and reset the temperature.
Title: Re: DFHack 0.5.10
Post by: Rumrusher on March 31, 2011, 08:14:31 am
Oh here's a little small tibbit from using DFMODE that if you have non-fort companions they will follow you around like pets(with out the prone to rage and need to feed them). My adventuress Nil has 3 one being a dwarf male.
Title: Re: DFHack 0.5.10
Post by: Makbeth on March 31, 2011, 11:32:54 am
Wait a sec...

DFmode lets you play an adventurer in your fort.

You can horribly slaughter things as an adventurer.

There are nobles in my fort.

WHY HAVEN'T I USED THIS BEFORE?!
Title: Re: DFHack 0.5.10
Post by: Rumrusher on March 31, 2011, 01:56:22 pm
Wait a sec...

DFmode lets you play an adventurer in your fort.

You can horribly slaughter things as an adventurer.

There are nobles in my fort.

WHY HAVEN'T I USED THIS BEFORE?!
Because your tame animals will go insane and attack each other and any Companions will go to town on the creatures leading to clogged hallways and disorder. I just had 12 chicks(birds) jump a cow in the main stairway and I was just going to murder some monkeys. also I Killing a same civ member would just lead to a Civil war and a quick end to the fort. so the only safe way to kill them is to use Dfusion to carry them to a death trap and drop them into it or use Dfusion to swap to a non civ member creature and assassinate them hopefully you run out of there or you might have to make more than one slab/coffin.
oh and I almost close to having adventure babies with this so should I name it after?
Title: Re: DFHack 0.5.10
Post by: devek on March 31, 2011, 07:35:43 pm
Hey Peter, this isn't a big deal because I don't use dfhack anymore but I am still referencing it to double check my work.. is the others material offset right in dfhack?

It seems from my research that others isn't in a vector at all, but is a hard coded array that hasn't changed since as long as I have been using dwarf fortress. There doesn't appear to be a reason for there to be an offset for it.

#0 INORGANIC
#1 AMBER
#2 CORAL
#3 GLASS_GREEN
#4 GLASS_CLEAR
#5 GLASS_CRYSTAL
#6 WATER
#7 COAL
#8 POTASH
#9 ASH
#10 PEARLASH
#11 LYE
#12 MUD
#13 VOMIT
#14 SALT
#15 FILTH_B
#16 FILTH_Y
#17 UNKNOWN_SUBSTANCE
#18 GRIME
#19 CREATURE_1
Title: Re: DFHack 0.5.10
Post by: Rose on March 31, 2011, 07:51:21 pm
it goes all the way up to OVER NINE HUNDREEEEEEED!!!!!! actually.
Title: Re: DFHack 0.5.10
Post by: devek on March 31, 2011, 08:35:17 pm
Ya, 991 total materials in vanilla. I'm talking about other materials though :P
Title: Re: DFHack 0.5.10
Post by: peterix on March 31, 2011, 08:45:42 pm
Hey Peter, this isn't a big deal because I don't use dfhack anymore but I am still referencing it to double check my work.. is the others material offset right in dfhack?

It seems from my research that others isn't in a vector at all, but is a hard coded array that hasn't changed since as long as I have been using dwarf fortress. There doesn't appear to be a reason for there to be an offset for it.

...
Good question. I'll go check ;)
EDIT: seems borked for the latest versions. guess I'll go and fix that :) And yes, it's not a vector, but an array. Reading it from the game is still better than hardcoding your own array though. DFHack treats it as a zero-terminated array of pointers to the base materials.

Btw, why no dfhack?
Title: Re: DFHack 0.5.10
Post by: devek on March 31, 2011, 08:55:29 pm
Nothing personal, I like dfhack. It is just that my project only uses like 10 offsets, and most of them are dead easy to find. It is easier for my program to just find them at runtime then deal with the updating offset nonsense. It currently detects all that it needs without fail from .13 on.
Title: Re: DFHack 0.5.10
Post by: peterix on March 31, 2011, 09:06:07 pm
Nothing personal, I like dfhack. It is just that my project only uses like 10 offsets, and most of them are dead easy to find. It is easier for my program to just find them at runtime then deal with the updating offset nonsense. It currently detects all that it needs without fail from .13 on.
Care to share your methods? I'll always prefer some automation for the offset finding :)

EDIT: now the offsets should be OK in current git HEAD.
Title: Re: DFHack 0.5.10
Post by: Rumrusher on March 31, 2011, 09:21:26 pm
man I wonder what Toady going to do on the anniversary of 31.xx. I hope it's dumping a silly 3d mash up of SoA1 and SoA2 and call it Slaves of Armok 3: DwarfinminerQuarryCreation.
Title: Re: DFHack 0.5.10
Post by: devek on March 31, 2011, 09:29:27 pm
Don't laugh, its a work in progress and I have just got it to work, but it seems effective. I got gotos and shit lol. Also, the binary scan isn't randomly selected. It was carefully crafted by analyzing the usage of said pointers in the disassembled version and I am pretty confident they should always work. The vector scans kind of depend on certain things being the first in line, so modified raw will screw with it but I will address that later once I get an actual release out again.

I'll dump the whole source of my project when I am done. I figured out how to do everything I want to do now, so it shouldn't take too long.

Spoiler (click to show/hide)
Title: Re: DFHack 0.5.10
Post by: peterix on March 31, 2011, 09:44:17 pm
Don't laugh, its a work in progress and I have just got it to work, but it seems effective. I got gotos and shit lol.
I'll dump the whole source of my project when I am done. I figured out how to do everything I want to do now, so it shouldn't take too long.
Cool stuff, it gets the job done :) I'll try to integrate the parts I didn't have into the dfhack search tool.
Title: Re: DFHack 0.5.10
Post by: devek on March 31, 2011, 10:18:26 pm
You can also add a read class name to the vector scan and just viewing the output is informative when seeing which vectors are available. Or you can just use the latest version of my personal utility at http://dffd.wimbli.com/file.php?id=4100 which will just spit it out for you.

I still think other materials should be hardcoded(or at least used as a fallback when there are less than 20 entries), not only has it never changed afaik I don't think it can change. If it was more than 20 entries, I believe toady would have to recode almost every part of DF that used a material :P You know as well as I do that the material logic is kind of wonky.

Title: Re: DFHack 0.5.11
Post by: peterix on March 31, 2011, 11:38:06 pm
0.5.11 is up.
Apart form the trivial 31.25 support update, it's mostly bugfixes.
The Ubuntu deb files are hopefully good this time - I rebuilt them from scratch. DFHack should also run fine under wine now. It's a bit slower when run that way, but there's no way around that. The liquids tool got some love and should behave a bit better (setting liquid level to 0 also sets temperature to 10015 to avoid the heat trap problem, placing walls removes liquids).

And that's about it. Enjoy :)

EDIT: uploaded the windows debug build by mistake. fixed.
Title: Re: DFHack 0.5.11
Post by: Grax on March 31, 2011, 11:44:12 pm
setting liquid level to 0 also sets temperature to 10015 to avoid the heat trap problem
Aah, that was so beautiful way to get rid of cats... ;-)
Title: Re: DFHack 0.5.11
Post by: peterix on April 01, 2011, 12:10:57 am
setting liquid level to 0 also sets temperature to 10015 to avoid the heat trap problem
Aah, that was so beautiful way to get rid of cats... ;-)
Well, I'm sure it was... but all this temperature stuff was too easy to break and there was no simple way to get rid of magma. Temperature has a big problem in that it's invisible in the game for most tiles. Before I add temperature manipulation, I'd like to have a tool that can show a heat map :)
Title: Re: DFHack 0.5.11
Post by: lorb on April 01, 2011, 06:48:53 am
Still no luck with the *.deb package.
To make sure i start with a clean slate i purged dfhack and then installed from the new deb-package for 5.11.
dfprospector still gives me an error:
Code: [Select]
dfprospector: symbol lookup error: dfprospector: undefined symbol: _ZN6DFHack4Maps17ReadLocalFeaturesERSt3mapINS_10planecoordESt6vectorIPNS_9t_featureESaIS5_EESt4lessIS2_ESaISt4pairIKS2_S7_EEE

Just for fun i also downloaded the source and compiled it myself and that version runs without a problem:
Code: [Select]
/bin ./dfprospector
Maximal regionoffset seen: 0.
KUNZITE : 13
[...]

For clarification: i am running debian and not ubuntu but the package installs just fine. (It complains about not knowing kernel.yama.ptrace_scope but that should not hurt imho)
Title: Re: DFHack 0.5.11
Post by: peterix on April 01, 2011, 07:59:29 am
Still no luck with the *.deb package.
For clarification: i am running debian and not ubuntu but the package installs just fine.
Well, there's the problem, I think. The compiled package depends on some of the more basic libs in your system: libstdc++ and some gcc stuff. It's not ideal. Anyway, it shouldn't be hard to make your own package. I'll add a script that will setup everything for that :)
Title: Re: DFHack 0.5.11
Post by: danaris on April 01, 2011, 09:25:14 am
DFHack should also run fine under wine now.

Confirmed.  Thanks a lot, peterix! :D

Dfreveal still crashes, but I more or less expected that. (if you want, I can provide the Wine crashdump...)

EDIT: and so does dfcleanmap, just as it did before.

Quote
It's a bit slower when run that way, but there's no way around that.

Hey, I'm patient ;)
Title: Re: DFHack 0.5.11
Post by: Truean on April 01, 2011, 11:58:30 am
Thank you so much for adding a range to the dfliquids obsidian spawning. I used to spend game years and real weeks setting up complex castings. I hated it. Now I can finally have the fortress I want. :)
Title: Re: DFHack 0.5.11
Post by: InsanityPrelude on April 02, 2011, 12:27:49 pm
My firewall's popping up notifications about dfprospector trying to connect to literally everything running on my computer. Is that supposed to happen?
Title: Re: DFHack 0.5.11
Post by: peterix on April 02, 2011, 01:51:21 pm
My firewall's popping up notifications about dfprospector trying to connect to literally everything running on my computer. Is that supposed to happen?
Yes, it's doing its job. Whitelist the DFHack tools.
Title: Re: DFHack 0.5.11
Post by: ZCM on April 03, 2011, 02:39:51 am
I'm trying to write a tool to manipulate active labors using dfhack as a library, but it seems like reading current jobs (current_job.jobId) isn't working - they're all 0. What am I doing wrong? I've tested with 0.31.23 and 0.31.19.
Title: Re: DFHack 0.5.11
Post by: devek on April 03, 2011, 03:21:19 am
Have fun with that, lol.

I think what you are looking for is like.. creature.current_job.occupationPtr

I don't know if this helps you, but this code was valid during .12(and now is all commented out lol) for finding out which trees were designated to be cut down by a dwarf. I need to update it to (not suck) and work with newer versions of DF. Of course, now I am not sure what was commented out before I commented it all out.. but one of the two approaches in there worked haha. But as you see, even back then jobId isn't updated. You need to go find that yourself from looking at the actual job.

Spoiler (click to show/hide)
Title: Re: DFHack 0.5.11
Post by: ZCM on April 03, 2011, 11:37:56 am
Have fun with that, lol.

I think what you are looking for is like.. creature.current_job.occupationPtr
That's uniformly 0, too.

I was really hoping to not need to modify dfhack.... drat.

EDIT: I got it. The existing logic was mostly sound, but disabled. I reenabled it and changed the job id read from DWord to Word, and it works.
Title: Re: DFHack 0.5.11
Post by: jetex1911 on April 03, 2011, 11:53:58 am
The next thing for DF-Hack: Time Control.
Title: Re: DFHack 0.5.11
Post by: BigD145 on April 03, 2011, 01:14:13 pm
The next thing for DF-Hack: Time Control.

Suddenly SPRING!!

And then the Caravan Arc committed economic suicide.
Title: Re: DFHack 0.5.11
Post by: peterix on April 03, 2011, 02:29:00 pm
The next thing for DF-Hack: Time Control.
I tried, it's too buggy :)
That's uniformly 0, too.

I was really hoping to not need to modify dfhack.... drat.

EDIT: I got it. The existing logic was mostly sound, but disabled. I reenabled it and changed the job id read from DWord to Word, and it works.
Well, that stuff was disabled it seems. Wow. I completely missed it when I was last updating the creature module. Consider it fixed :) I'll do some testing and maybe add a dwarf job dump tool or something like that so these things can be easily tested in the future.
Title: Re: DFHack 0.5.11
Post by: ZCM on April 03, 2011, 03:47:28 pm
Well, that stuff was disabled it seems. Wow. I completely missed it when I was last updating the creature module. Consider it fixed :) I'll do some testing and maybe add a dwarf job dump tool or something like that so these things can be easily tested in the future.
Cool. Now I just need to figure out how to tell the difference between "No Job" and "On Break"... it appears the method Dwarf Therapist was using no longer works.
Title: Re: DFHack 0.5.11
Post by: notfood on April 03, 2011, 03:50:29 pm
Hello, I am new to DFHack, I can't seem to be able to run it under linux.

I keep getting this error while trying to use most tools:

Code: [Select]
terminate called after throwing an instance of 'DFHack::Error::InvalidMemoryDefinition'
  what():  memory object is INVALID: type address key /Maps/map_data
Aborted

I did a git pull and compiled it. I checked the Memory.xml file contains v0.31.25 linux.

What am I doing wrong?
Title: Re: DFHack 0.5.11
Post by: peterix on April 03, 2011, 04:02:05 pm
Hello, I am new to DFHack, I can't seem to be able to run it under linux.

I keep getting this error while trying to use most tools:

Code: [Select]
terminate called after throwing an instance of 'DFHack::Error::InvalidMemoryDefinition'
  what():  memory object is INVALID: type address key /Maps/map_data
Aborted

I did a git pull and compiled it. I checked the Memory.xml file contains v0.31.25 linux.

What am I doing wrong?
You're too fast :D

I'm working on full linux support and those entries are just placeholders so that the search tools can identify the running DF version. 0.31.22 is almost complete now and the rest will follow quickly after that.
Title: Re: DFHack 0.5.11
Post by: notfood on April 03, 2011, 04:53:43 pm
Oh, alright. Thanks.
Title: Re: DFHack 0.5.11
Post by: ZCM on April 03, 2011, 06:20:48 pm
Cool. Now I just need to figure out how to tell the difference between "No Job" and "On Break"... it appears the method Dwarf Therapist was using no longer works.
Apparently it does work, it just has the wrong offset in its memory layout file. :)

As of 0.31.23, the states vector is at dwarf+0x5A0. It's a vector of pointers to words; if any of the words are 0x11, the dwarf is on break. (I'm betting there's also some durations in there, and maybe some other stuff.)
Title: Re: DFHack 0.5.11
Post by: meowmix on April 03, 2011, 10:02:42 pm
when i spawn obsidian in midair it kind of just floats there, is there a way to make the obsidian fall to the ground?
Title: Re: DFHack 0.5.11
Post by: peterix on April 03, 2011, 11:08:04 pm
Oh, alright. Thanks.
Should be OK now.
when i spawn obsidian in midair it kind of just floats there, is there a way to make the obsidian fall to the ground?
Maybe. I don't know. The obsidian spawning thing is mainly meant to patch up holes in the magma sea in case it leaks into hell and causes FPS problems... at least that was the original purpose.
Title: Re: DFHack 0.5.11
Post by: Dante on April 03, 2011, 11:19:01 pm
If you then spawn water and magma adjacent / on top of floating obsidian, to make 'natural' obsidian, it collapses as normal.

I've noticed the obsidian-creating tool doesn't work more than a certain number of Z's above ground. Is this a bug?
Title: Re: DFHack 0.5.11
Post by: peterix on April 04, 2011, 12:01:18 am
If you then spawn water and magma adjacent / on top of floating obsidian, to make 'natural' obsidian, it collapses as normal.

I've noticed the obsidian-creating tool doesn't work more than a certain number of Z's above ground. Is this a bug?
There is no space there, it just doesn't exist. And sadly, there's no way to manipulate something that doesn't exist. Build a staircase to create more space :)
Title: Re: DFHack 0.5.11
Post by: Dante on April 04, 2011, 12:41:25 am
Ah, interesting. Thanks. So do flying creatures never path into that space / things not get flung by bridges into that space even though you can see it? Or does it assign reality to the new Z-level when a creature enters it, too?
Title: Re: DFHack 0.5.11
Post by: Rose on April 04, 2011, 12:50:42 am
this raises the question... is there a way to make it ignore the height limits when assigning reality?
Title: Re: DFHack 0.5.11
Post by: peterix on April 04, 2011, 01:12:58 am
Well, I'm sure the creatures can move in this non-initialized space. It's just that the game tries to save some memory by not tracking details of what's basically air. Same happened with map blocks deep underground in the 40d and older versions. They didn't exist until you tunneled into them.

Japa: that's a very bad idea. While the map blocks might not exist for parts of the map, the map still has fixed size. There's probably a way to fake it all, but I'm not doing that. It would be too much of a hack.
Title: Re: DFHack 0.5.11
Post by: devek on April 04, 2011, 01:24:19 am
Or you end up with that cotton candy map that crashes after consuming too much memory :P
Title: Re: DFHack 0.5.11
Post by: Daskinor on April 04, 2011, 05:03:28 am
Latest dfhack since commit "Linux 31.22 - 31.25 finished. Needs more testing, but should be good." from git compiled for linux in a 64 bit environment seems to work perfectly against 0.31.25 in linux now - prospector, clean, reveal, vdig etc are all fine! Brilliant work and much appreciated.
Title: Re: DFHack 0.5.12
Post by: peterix on April 04, 2011, 05:58:05 am
Ok, tagged a new release. This one should fix problems people were having with Runesmith when it gets rebuilt, adds all the missing offsets for 31.22-31.25 on linux and adds an engravings module. I can see some kind of engraving manipulation tool in the future :)

As always, enjoy :)
Title: Re: DFHack 0.5.12
Post by: Truean on April 04, 2011, 07:54:29 am
Ok, tagged a new release. This one should fix problems people were having with Runesmith when it gets rebuilt, adds all the missing offsets for 31.22-31.25 on linux and adds an engravings module. I can see some kind of engraving manipulation tool in the future :)

As always, enjoy :)

You have no idea how cool engraving manipulation would be, especially for me. Aside from the obvious:
http://www.wikihow.com/Build-a-Memory-Palace

For someone who uses memory palaces to memorize complex things, having a living memory palace with inhabitants would be mind blowingly awesome. This feature combined with your recent range feature for obsidian spawning would make you a god higher level deity in my mind. :)
Title: Re: DFHack 0.5.12
Post by: peterix on April 04, 2011, 08:32:48 am
Ok, tagged a new release. This one should fix problems people were having with Runesmith when it gets rebuilt, adds all the missing offsets for 31.22-31.25 on linux and adds an engravings module. I can see some kind of engraving manipulation tool in the future :)

As always, enjoy :)

You have no idea how cool engraving manipulation would be, especially for me. Aside from the obvious:
http://www.wikihow.com/Build-a-Memory-Palace

For someone who uses memory palaces to memorize complex things, having a living memory palace with inhabitants would be mind blowingly awesome. This feature combined with your recent range feature for obsidian spawning would make you a god higher level deity in my mind. :)
Wow. That's new to me :) There's a problem though - the level of manipulation is quite limited. I don't think it would be quite enough to store arbitrary information - not yet anyway. You might be better off using just plain DF notes. For those, hit N and place a note. You can give them colors, a symbol and a piece of text. I guess this isn't quite enough, because to see the notes, you must be in the 'note placing mode'...

Anyway, here's roughly what is known about engravings now:
Spoiler (click to show/hide)
Title: Re: DFHack 0.5.12
Post by: lorb on April 04, 2011, 09:57:05 am
It (5.12) is working on Debian 6.0 by installation from the ubuntu *.deb
*joy*
Title: Re: DFHack 0.5.12
Post by: ZCM on April 04, 2011, 12:59:24 pm
Here's my hacked-in state reading code, contributed in hopes it will be added to an upcoming version. Put it in Creatures::ReadCreature and add the necessary fields and goop to read the offset:

Spoiler (click to show/hide)

The state vector offset for 0.31.23 SDL (Windows) is 0x5A0, I haven't tried later versions yet.

I've figured out two states so far:
0x08 indicates an incoming migrant (with the gray 'X' flashing).
0x11 indicates a dwarf who is "On Break".
Title: Re: DFHack 0.5.12
Post by: Zwaryczuk on April 04, 2011, 01:47:13 pm
Would it be hard to develop a tool to work similar to DF liquid but instead was able to change the material properties of that tile. ie, change this Mudstone tile to (sand, clay, peat what have you) I know Df Liquids only is able to spawn and remove liquids, but just wondering if additional tinkering could make this possible.
Title: Re: DFHack 0.5.12
Post by: Jeoshua on April 04, 2011, 02:26:14 pm
ZCM, would it be possible to take that Dwarf who is on break and give him a happy thought if he goes back to work?
Title: Re: DFHack 0.5.12
Post by: ZCM on April 04, 2011, 02:35:00 pm
ZCM, would it be possible to take that Dwarf who is on break and give him a happy thought if he goes back to work?
I'm not sure what you're asking here. I haven't investigated the details of the states, beyond figuring out which states apply, but I suspect there's some sort of counter for how long the state will last. If that's the case, once a dwarf goes on break they will stay on break until it expires.
Title: Re: DFHack 0.5.12
Post by: Jeoshua on April 04, 2011, 02:36:28 pm
... unless the code checks the counter and decrements it without reguard for what it was last turn, I think.
Title: Re: DFHack 0.5.12
Post by: peterix on April 04, 2011, 02:43:09 pm
Would it be hard to develop a tool to work similar to DF liquid but instead was able to change the material properties of that tile. ie, change this Mudstone tile to (sand, clay, peat what have you) I know Df Liquids only is able to spawn and remove liquids, but just wondering if additional tinkering could make this possible.
That's very hard. You'd be changing this for entire geological layers for multiple world regions/whole biome. Or you'd have to steal vein objects from somewhere else and reuse them... Or adamantine veins... those are easiest to work with, but there's only a few in each map and you'd lose them. Or hell. There's only one hell and it can't be mined out. The tiles themselves have no material of their own really, with the single exception of obsidian and hardcoded things like ice.
It might be possible to change the geological layer along with the tiletype to get materials from a different layer. Or pick a different biome as a source of geological data...

It is possible to do destructive changes like remove materials. It's also possible to reshape veins in the blocks where they belong. 'Adamantine veins' and 'hell' can be reshaped and expanded entirely and their materials can be set to anything. Again, only one material per map feature. So, it's possible to turn all slade in hell into frozen elephant blood for example, but you can't set a single tile to a material you want.

It's rather complicated ~_~
Title: Re: DFHack 0.5.12
Post by: ZCM on April 04, 2011, 02:53:54 pm
How about changing the material of a construction?
Title: Re: DFHack 0.5.12
Post by: thewonderidiot on April 04, 2011, 03:17:36 pm
Well, there's not currently a Write method in the Constructions module, but the material type and index are just fields in the struct describing constructions, and they're read directly, so I see no reason why it wouldn't work once a Write function is added.

EDIT: Just as a side note, this wouldn't be able to add new constructions, only modify existing ones. It would also probably be safest to not let DF become unpaused at all between the Read()s and Write()s, just in case a deconstruction occurs.
Title: Re: DFHack 0.5.12
Post by: profit on April 04, 2011, 07:01:35 pm
I would like to make a rather large request.

Would it be possible to make a tool which removes ownership from all items in the fort?



Title: Re: DFHack 0.5.12
Post by: Quietust on April 05, 2011, 09:51:18 am
I would like to make a rather large request.

Would it be possible to make a tool which removes ownership from all items in the fort?
Back in 40d (and 23a), one of the item flags was "owned by a dwarf" (flag 0x00010000), and clearing that flag would permit other dwarves to pick up the item and stockpile it (or, better yet, dump it). Clearing this flag wouldn't cause the item to stop displaying as owned (that's stored in a vector elsewhere, along with information on where the object is contained, be it a creature or a container object), but it would permit another dwarf to claim it. I haven't checked lately in 0.31.xx, but all of this should still be the case.

[edit] I've just tested this in 0.31.25 and it works correctly.

As a side note, a bunch of the naked_itemflags values seem to be wrong - they're labeled as being correct in 40d, though I know for a fact that everything between "in_inventory" and "rotten" (and possibly several others) are off by 1.

Item flags:
Code: [Select]
0x00000001 - on ground
0x00000002 - tasked
0x00000004 - ?
0x00000008 - in inventory/container
0x00000010 - lost (artifact)
0x00000020 - part of building
0x00000040 - ?
0x00000080 - ?
0x00000100 - rotten
0x00000200 - ?
0x00000400 - ?
0x00000800 - ?
0x00001000 - ? (previously flagged artifacts)
0x00002000 - ?
0x00004000 - imported/foreign (in parentheses)
0x00008000 - ? (previously marked trade goods)
0x00010000 - owned by dwarf
0x00020000 - ?
0x00040000 - ?
0x00080000 - forbidden
0x00100000 - ?
0x00200000 - dump
0x00400000 - on fire
0x00800000 - melt
0x01000000 - hidden
0x02000000 - ?
0x04000000 - ?
0x08000000 - ?
0x10000000 - ?
0x20000000 - ?
0x40000000 - ?
0x80000000 - ?
Title: Re: DFHack 0.5.12
Post by: Truean on April 05, 2011, 12:00:53 pm
Ok, tagged a new release. This one should fix problems people were having with Runesmith when it gets rebuilt, adds all the missing offsets for 31.22-31.25 on linux and adds an engravings module. I can see some kind of engraving manipulation tool in the future :)

As always, enjoy :)

You have no idea how cool engraving manipulation would be, especially for me. Aside from the obvious:
http://www.wikihow.com/Build-a-Memory-Palace

For someone who uses memory palaces to memorize complex things, having a living memory palace with inhabitants would be mind blowingly awesome. This feature combined with your recent range feature for obsidian spawning would make you a god higher level deity in my mind. :)
Wow. That's new to me :) There's a problem though - the level of manipulation is quite limited. I don't think it would be quite enough to store arbitrary information - not yet anyway. You might be better off using just plain DF notes. For those, hit N and place a note. You can give them colors, a symbol and a piece of text. I guess this isn't quite enough, because to see the notes, you must be in the 'note placing mode'...

Anyway, here's roughly what is known about engravings now:
Spoiler (click to show/hide)

You know, using in game notes might not be a bad idea....

This is off topic and I apologize for that, but do you know how to make a smelter reaction to create a window?
Title: Re: DFHack 0.5.12
Post by: King Doom on April 05, 2011, 01:53:25 pm
I decided to make an obsidian tower of my own for my dwarves to build, I chose an 100% flat map in a frozen biome, but I can't seem to work out how the hell to get it to build obsidian above the ground floor. Is it even possible, and if so, what do I need to do?


Edit: worked it out for anyone who cares or didn't know already - the obsidian generator will only create obsidian on z-levels your dwarves can reach, so if you want a tower you need to make a staircase to the z-level one above where you want the top floor to be. It needs to be one z level higher than your tower so you can add a floor to the top of it.
Title: Re: DFHack 0.5.12
Post by: devek on April 05, 2011, 02:33:17 pm
For automation purposes...

The search string 8b 15 ? ? ? ? 8b 34 8a 85 f6 74 0f e8 is pretty bad ass. It works on all versions of DF/sdl for .13 on and result+2 is the job management pointer while result +21 is the pointer to the delete operator which you will need if you ever need to add memory allocation to dfhack. :) Due to the nature of the code there, I doubt toady will make any changes so it should be future proof.

I still haven't found a search string for items that I am 100% pleased with, but the one I showed you earlier (2b 35 ? ? ? ? 57 c1 fe 02 4e 78 20 bf) also works for every version .13 on, but I am not comfortable about it being future proof.

Those are the only 2 pointers foreman will ever need to operate at the moment, so I am done with that part of my code.
Title: Re: DFHack 0.5.12
Post by: Quietust on April 05, 2011, 03:08:58 pm
This is off topic and I apologize for that, but do you know how to make a smelter reaction to create a window?

[PRODUCT:100:1:WINDOW:NONE:GLASS_GREEN:NONE]
Title: Re: DFHack 0.5.12
Post by: profit on April 05, 2011, 04:01:53 pm
Spoiler (click to show/hide)

That is fairly awesome, and yes it would work for making me a lot happier... I have grown so tired of claimed item clutter that for some reason never seems to get moved into a room.
Title: Re: DFHack 0.5.12
Post by: Truean on April 05, 2011, 04:44:30 pm
This is off topic and I apologize for that, but do you know how to make a smelter reaction to create a window?

[PRODUCT:100:1:WINDOW:NONE:GLASS_GREEN:NONE]

Thank you very much.

I decided to make an obsidian tower of my own for my dwarves to build, I chose an 100% flat map in a frozen biome, but I can't seem to work out how the hell to get it to build obsidian above the ground floor. Is it even possible, and if so, what do I need to do?


Edit: worked it out for anyone who cares or didn't know already - the obsidian generator will only create obsidian on z-levels your dwarves can reach, so if you want a tower you need to make a staircase to the z-level one above where you want the top floor to be. It needs to be one z level higher than your tower so you can add a floor to the top of it.

IF you are hacking in obsidian through this mod, then you must deal with the pathfinding saver feature. To save memory, the game does not search for pathfinding in areas of the open sky z levels that have not been previously accessed by dwarves. It would be a waste of CPU. The game sort of "blocks out" those areas.

The solution is to have your dwarves climb up to those areas via up and down staircases. This will enable obsidian to spawn within a given number of squares around the area your dwarf climbed up to. Otherwise you will not be able to do what you want.

Too bad. Otherwise you could spawn an entire layer of obsidian up there and make a corresponding
Spoiler (click to show/hide)
to
Spoiler (click to show/hide)
Title: Re: DFHack 0.5.12
Post by: Rumrusher on April 05, 2011, 07:32:38 pm
wait so you have to build a up down stair case first before making a floor of obsidian? or just spawn a dwarf 30 zlevels high?
Title: Re: DFHack 0.5.12
Post by: Truean on April 05, 2011, 08:30:47 pm
wait so you have to build a up down stair case first before making a floor of obsidian? or just spawn a dwarf 30 zlevels high?

Never spawned a dwarf 30 levels high before.... For science?
Title: Re: DFHack 0.5.12
Post by: Rumrusher on April 05, 2011, 10:26:20 pm
wait so you have to build a up down stair case first before making a floor of obsidian? or just spawn a dwarf 30 zlevels high?

Never spawned a dwarf 30 levels high before.... For science?
well from past testing spawning a dwarf to deep into what I may call Space will leave that dwarf there until one teleport them out. So if you figure out how to build a space station in that black stuff and have the area lit so one could path through then go head.
Title: Re: DFHack 0.5.12
Post by: ChiliFriez on April 06, 2011, 09:46:31 am
Hey, just downloaded dfhack, .25 DF itself, Windows 7 OS. Every time I run one of the binaries (I extracted the folder onto my desktop, do I need to do something more?), it opens a cmd prompt window, then says it stopped responding, and promptly closes itself, without any visible changes to the map. Help? :D
Title: Re: DFHack 0.5.12
Post by: peterix on April 06, 2011, 11:04:20 am
Hey, just downloaded dfhack, .25 DF itself, Windows 7 OS. Every time I run one of the binaries (I extracted the folder onto my desktop, do I need to do something more?), it opens a cmd prompt window, then says it stopped responding, and promptly closes itself, without any visible changes to the map. Help? :D
It could be some weird security thing - that happened a few times before. Some anti-malware thing shooting it down before anything happens. It could be you extracted only part of DFHack and it can't find the offsets file. It could be malware blocking any kind of debugging attempts. Maybe DF and DFHack running in different security contexts ... or just a plain old crash bug I haven't seen before. I do test on Windows 7, that part should be OK. DFHack only works with the SDL DF versions, so check that you downloaded the right DF...

Well, I wish I knew.
Title: Re: DFHack 0.5.12
Post by: ChiliFriez on April 06, 2011, 11:23:40 am
I tried throwing the file into my actual DF folder, and it worked. So, if anyone else is having this problem, try that.
Title: Re: DFHack 0.5.12
Post by: peterix on April 06, 2011, 11:37:32 am
I tried throwing the file into my actual DF folder, and it worked. So, if anyone else is having this problem, try that.
So, it was a security context problem. Good to see it resolved :)
Title: Re: DFHack 0.5.12
Post by: wuphonsreach on April 06, 2011, 03:47:15 pm
Why does the Readme.html file in the dfhack directory not list the options for dfprospector?  Where are the command line options documented?  Am I going to have to go dig through source code?
Title: Re: DFHack 0.5.12
Post by: devek on April 06, 2011, 03:53:06 pm
On windows there is only one command line option that matters, -b to show base layers.
Title: Re: DFHack 0.5.12
Post by: notfood on April 06, 2011, 04:31:50 pm
I notice an issue under Linux, it happened to DwarfTherapist in the same way.

It appears that the tools are reading the save data instead of the variable memory.

When I load a map, all the tools work fine. It's enough for me to build something or dig into something and most tools will fail with memory read errors.

After embark no tool would work, I need to save and load the map for them to run without issue. Both problems are fixed by saving and reloading, just like in DwarfTherapist before it got fixed.

Reproducible: Always.
Version: latest git pull / df 0.31.25
Title: Re: DFHack 0.5.12
Post by: peterix on April 06, 2011, 06:27:45 pm
I notice an issue under Linux, it happened to DwarfTherapist in the same way.

It appears that the tools are reading the save data instead of the variable memory.

When I load a map, all the tools work fine. It's enough for me to build something or dig into something and most tools will fail with memory read errors.

After embark no tool would work, I need to save and load the map for them to run without issue. Both problems are fixed by saving and reloading, just like in DwarfTherapist before it got fixed.

Reproducible: Always.
Version: latest git pull / df 0.31.25
Well, can't reproduce the problem. Only thing I found is a bad creature vector or some name reading issue with demons... so that's a thing to fix for sure.

There is no 'save' version of the data. What kind of kernel are you running? I have things working with 64bit kernels for sure. There were some problems with 32bit in the past, where switching between PAE or non-PAE kernels fixed the problem.

Anyway, run the dfincremental tool and post the big list it prints somewhere. That should tell us at least something.
Title: Re: DFHack 0.5.12
Post by: fumphar on April 07, 2011, 02:48:20 am
How to build the DFHack examples (tools/examples/*.cpp)?

If I'm in the directory, cmake complains I should build the whole thing. But if I build the whole thing (according to the steps in COMPILE.rst), the examples are not built. Only the source files in tools/supported/*.cpp are compiled.

I just copied one source file over to tools/supported and added it to the CMakeLists.txt there. That worked so I'm fine, but would be nice to know...
Title: Re: DFHack 0.5.12
Post by: peterix on April 07, 2011, 03:03:06 am
How to build the DFHack examples (tools/examples/*.cpp)?

If I'm in the directory, cmake complains I should build the whole thing. But if I build the whole thing (according to the steps in COMPILE.rst), the examples are not built. Only the source files in tools/supported/*.cpp are compiled.

I just copied one source file over to tools/supported and added it to the CMakeLists.txt there. That worked so I'm fine, but would be nice to know...
1. they are more of a set of debug/development tools at this point. I might as well rename the directory to 'random' :)
2. There are build options for that. Read the COMPILE document better next time. If unsure, use ccmake or the cmake-gui program instead of plain cmake to see all the available options in a GUI.

PS: some of the options are too new and aren't documented. This is mostly the package generator/release stuff.
Title: Re: DFHack 0.5.12
Post by: fumphar on April 07, 2011, 03:57:47 am
2. There are build options for that. Read the COMPILE document better next time. If unsure, use ccmake or the cmake-gui program instead of plain cmake to see all the available options in a GUI.
Thanks, worked fine :-)

(Using: cmake .. -G"MinGW Makefiles" -DCMAKE_BUILD_TYPE:string=Release -DBUILD_DFHACK_EXAMPLES=ON)
Title: Re: DFHack 0.5.12
Post by: wuphonsreach on April 07, 2011, 02:28:15 pm
On windows there is only one command line option that matters, -b to show base layers.

It's a shame that there's not a way to give it an option to only list a range of layers.  This 3x3 embark supposedly has 27k Marble according to DFProspector, but when I use DFReveal, there's zero layers of marble above the SMR layer.

Something is wonky...
Title: Re: DFHack 0.5.12
Post by: Makbeth on April 08, 2011, 12:45:44 am
Is it identifying something else as marble, I wonder?  Maybe the addition of fire clay changed up the stone/soil/mineral IDs, and DFhack is using old ones? 

Of course, I have no idea what I'm talking about.  Just a wild guess.
Title: Re: DFHack 0.5.12
Post by: wuphonsreach on April 08, 2011, 04:59:52 am
Is it identifying something else as marble, I wonder?  Maybe the addition of fire clay changed up the stone/soil/mineral IDs, and DFhack is using old ones? 

Of course, I have no idea what I'm talking about.  Just a wild guess.

Fire clay would be a good guess.  I am in an embark with peat and I'm pretty sure that there is clay either up top or down in the caverns (I haven't done any clay industry yet).
Title: Re: DFHack 0.5.12
Post by: Quietust on April 08, 2011, 08:17:35 am
Is it identifying something else as marble, I wonder?  Maybe the addition of fire clay changed up the stone/soil/mineral IDs, and DFhack is using old ones? 

That shouldn't be the case, since DFHack fetches the material IDs directly from the game's memory.
Title: Re: DFHack 0.5.12
Post by: Jeoshua on April 08, 2011, 08:42:27 am
Is it identifying something else as marble, I wonder?  Maybe the addition of fire clay changed up the stone/soil/mineral IDs, and DFhack is using old ones? 

That shouldn't be the case, since DFHack fetches the material IDs directly from the game's memory.
In addition, it shows "Mithril" and other modded-in elements just fine
Title: Re: DFHack 0.5.12
Post by: peterix on April 08, 2011, 03:09:07 pm
Is it identifying something else as marble, I wonder?  Maybe the addition of fire clay changed up the stone/soil/mineral IDs, and DFhack is using old ones? 

That shouldn't be the case, since DFHack fetches the material IDs directly from the game's memory.
In addition, it shows "Mithril" and other modded-in elements just fine
The tool doesn't understand the semi-molten rock layers. My guess is that there's a lot of molten marble deep undergorund :D
Title: Re: DFHack 0.5.12
Post by: Patchy on April 08, 2011, 07:42:45 pm
I don't know how possible it is, but maybe someone could work on developing a tool to remove dwarf ownership of clothing items that are not put away in cabinets? Just thought I'd suggest it since it would seem like a fairly convenient tool to have around.
Title: Re: DFHack 0.5.12
Post by: Jacob/Lee on April 08, 2011, 07:59:41 pm
Is there a way to stop reveal if it happens to become frozen in reveal when I close the hack on complete accident?
Title: Re: DFHack 0.5.12
Post by: peterix on April 09, 2011, 12:13:26 am
I don't know how possible it is, but maybe someone could work on developing a tool to remove dwarf ownership of clothing items that are not put away in cabinets? Just thought I'd suggest it since it would seem like a fairly convenient tool to have around.
Well, that's a good idea and has been discussed before. I'll see what can be done.
Is there a way to stop reveal if it happens to become frozen in reveal when I close the hack on complete accident?
Ummm... what?
Title: Re: DFHack 0.5.12
Post by: xtank5 on April 09, 2011, 12:22:13 am
Is there a way to stop reveal if it happens to become frozen in reveal when I close the hack on complete accident?
Ummm... what?
I think what he means is: "is there a way to un-reveal the map if I closed the reveal utility before using it to un-reveal?"
Title: Re: DFHack 0.5.12
Post by: Jacob/Lee on April 09, 2011, 12:31:37 am
Is there a way to stop reveal if it happens to become frozen in reveal when I close the hack on complete accident?
Ummm... what?
(http://i611.photobucket.com/albums/tt194/sgtjacob1/Frozen.png)
This.

It is stuck like this.

Using the normal un-reveal didn't work, nor did exiting Dwarf Fortress and Abandon didn't even work.
Title: Re: DFHack 0.5.12
Post by: devek on April 09, 2011, 12:37:29 am
It always cracks me up when this happens to people, but I am a bad person.

Abandon usually works. But the real lesson is not to save with it screwed up hehe.
Title: Re: DFHack 0.5.12
Post by: Andux on April 09, 2011, 03:52:27 am
Is there a way to stop reveal if it happens to become frozen in reveal when I close the hack on complete accident?
You could try using Tweak (http://dffd.wimbli.com/file.php?id=3271) with For Each Tile (http://dffd.wimbli.com/file.php?id=404) to hide everything below a given Z-level.

Start For Each Tile from within Tweak and create a new operation set:
Code: (condition) [Select]
is_subterranean and (z < cursor_z)
Code: (operations) [Select]
hideThen loo[k] at a tile on the lowest level you want to keep revealed and run it.

Note that anything at or above that level will stay revealed.
Title: Re: DFHack 0.5.12
Post by: peterix on April 09, 2011, 08:20:34 am
Well, looks like this problem isn't going away. There will be a 'hide' tool.
Title: Re: DFHack 0.5.12
Post by: TolyK on April 09, 2011, 08:45:01 am
Well, looks like this problem isn't going away. There will be a 'hide' tool.
Merci.
(a.k.a. thanks!)
Title: Re: DFHack 0.5.12
Post by: notfood on April 09, 2011, 04:57:41 pm
I notice an issue under Linux, it happened to DwarfTherapist in the same way.

It appears that the tools are reading the save data instead of the variable memory.

When I load a map, all the tools work fine. It's enough for me to build something or dig into something and most tools will fail with memory read errors.

After embark no tool would work, I need to save and load the map for them to run without issue. Both problems are fixed by saving and reloading, just like in DwarfTherapist before it got fixed.

Reproducible: Always.
Version: latest git pull / df 0.31.25
Well, can't reproduce the problem. Only thing I found is a bad creature vector or some name reading issue with demons... so that's a thing to fix for sure.

There is no 'save' version of the data. What kind of kernel are you running? I have things working with 64bit kernels for sure. There were some problems with 32bit in the past, where switching between PAE or non-PAE kernels fixed the problem.

Anyway, run the dfincremental tool and post the big list it prints somewhere. That should tell us at least something.

Well...

I have tried a bit more.

vanilla dwarf fortress just unpacket, genned a pocket world with tiny history. Embarqued, pause.
This is the output of dfincremental:
http://pastebin.com/9RPhgAAi
All tools fail with this error, sample dfprospector:
Code: [Select]
pread failed: can't read 48 bytes at addres 2884956896
errno: 22
terminate called after throwing an instance of 'DFHack::Error::MemoryAccessDenied'
  what():  Invalid memory access @0xabf4f2e0
Aborted

Saved. Exited DF. Loaded map. Still paused. Same error as above.

Unpaused. Digged a few tiles, built a farm plot. Saved. Exited DF. Loaded map once again. Paused. All tools work fine as long as no new units appear in the map.
http://pastebin.com/u5Gvuup0
Sample of dfprospector:
Code: [Select]
Maximal regionoffset seen: 0.
MORION : 1
PRASE : 1
OPAL_CRYSTAL : 1
CARNELIAN : 1
GRAY CHALCEDONY : 1
GREEN JADE : 1
YELLOW JASPER : 2
MILK QUARTZ : 2
ALABASTER : 3
MOSS AGATE : 3
SCHORL : 4
CRYSTAL_ROCK : 9
LIGNITE : 9
GYPSUM : 17
LIMONITE : 28
HEMATITE : 30
TALC : 32
BAUXITE : 35
TETRAHEDRITE : 42
COAL_BITUMINOUS : 44
KAOLINITE : 49
MICROCLINE : 49
MAGNETITE : 66

Unpaused. Built some thing, while checking the tools were working, keep checking the unit list. The deers that spawned at the beginning left the map and horses appeared. Tools no longer work. Error is same as above, here is the dfincremental output:
http://pastebin.com/DqcTKj5Z

I hope this helps, it gets annoying having to reload every time a new unit makes it to the list. Thanks.
Title: Re: DFHack 0.5.12
Post by: peterix on April 10, 2011, 04:10:27 pm
I hope this helps, it gets annoying having to reload every time a new unit makes it to the list. Thanks.
Try the new version now.
It is stuck like this.
No more! Go and use the new unreveal tool :)

Alright. 0.5.13 released. It's mostly bugfixes, some of them for DFHack and some for DF (autoremoval of down-ramps by the deramp tool). There's the unreveal tool that can fix permarevealed forts to some extent (if you have a path to hell/magma/caverns, they will stay revealed) and possibly hide places that shouldn't be visible (you closed off the caverns with a wall? they will be hidden :D)
Title: Re: DFHack 0.5.12
Post by: devek on April 10, 2011, 04:19:27 pm
No more! Go and use the new unreveal tool :)

Nooooooooooooo!

It was funny when people ruined their fort permanently :/
Title: Re: DFHack 0.5.13
Post by: ral on April 10, 2011, 08:22:40 pm
Does dflair set the lair flag on tiles or toggle the lair flag on tiles?

I just created a fort for the express purpose of creating some adamantine equipment for adventure mode, and I tried to use dflair to stop stuff from scattering, but it looks like it happened anyway. I did run dflair more than once though....

Luckily most of the good stuff was in iron bins anyway.
Title: Re: DFHack 0.5.13
Post by: jaxad0127 on April 10, 2011, 10:47:05 pm
Does dflair set the lair flag on tiles or toggle the lair flag on tiles?

I just created a fort for the express purpose of creating some adamantine equipment for adventure mode, and I tried to use dflair to stop stuff from scattering, but it looks like it happened anyway. I did run dflair more than once though....

Luckily most of the good stuff was in iron bins anyway.
It sets it.
Title: Re: DFHack 0.5.13
Post by: Rafal99 on April 11, 2011, 07:17:38 am
Is there any way to read tiles on DF screen from memory using DFHack?
I don't mean the actual tile images but an info like:
"a tile on position (X,Y) is a tile number A, foreground color B, background color C".

I need something like this for a program I am working on.

If it is not possible then I will have to program it to make screenshot from DF window and then process the image in a really complex way to get the actual info... :/
Title: Re: DFHack 0.5.13
Post by: peterix on April 11, 2011, 07:52:05 am
Is there any way to read tiles on DF screen from memory using DFHack?
I don't mean the actual tile images but an info like:
"a tile on position (X,Y) is a tile number A, foreground color B, background color C".

I need something like this for a program I am working on.

If it is not possible then I will have to program it to make screenshot from DF window and then process the image in a really complex way to get the actual info... :/
It was there before and it's currently broken. I can look at it and get it fixed I guess :)
Title: Re: DFHack 0.5.13
Post by: TolyK on April 11, 2011, 08:01:55 am
Is there any way to read tiles on DF screen from memory using DFHack?
I don't mean the actual tile images but an info like:
"a tile on position (X,Y) is a tile number A, foreground color B, background color C".

I need something like this for a program I am working on.

If it is not possible then I will have to program it to make screenshot from DF window and then process the image in a really complex way to get the actual info... :/
It was there before and it's currently broken. I can look at it and get it fixed I guess :)
thanks! i'm also thinking of a project that would use this.
Title: Re: DFHack 0.5.13
Post by: Rafal99 on April 11, 2011, 09:06:19 am
Is there any way to read tiles on DF screen from memory using DFHack?
I don't mean the actual tile images but an info like:
"a tile on position (X,Y) is a tile number A, foreground color B, background color C".

I need something like this for a program I am working on.

If it is not possible then I will have to program it to make screenshot from DF window and then process the image in a really complex way to get the actual info... :/
It was there before and it's currently broken. I can look at it and get it fixed I guess :)

Thank you in advance!
I am working on some sort of macro program. It needs to read things like list of available building materials from screen so it can select the proper one.
Title: Re: DFHack 0.5.13
Post by: jaxad0127 on April 11, 2011, 09:18:43 am
You could use what DFHack has now and read the rest from raws. Just need to match up the raw names.

Is there anyway to get the loaded world's location in the file system? At least it's name? I'm writing a tool that will load it's raws in addition to what DFHack provides to provide more detail.
Title: Re: DFHack 0.5.12
Post by: notfood on April 11, 2011, 02:14:53 pm
I hope this helps, it gets annoying having to reload every time a new unit makes it to the list. Thanks.
Try the new version now.

Works like a charm, thanks!
Title: Re: DFHack 0.5.13
Post by: peterix on April 11, 2011, 03:51:06 pm
Thank you in advance!
I am working on some sort of macro program. It needs to read things like list of available building materials from screen so it can select the proper one.
This might take some time to update for the newer DF versions, but you might be able to already do this with some of the old ones. Both linux and windows DF 0.31.12 should work.
If you use these together:
Code: [Select]
bool Gui::getWindowSize (int32_t &width, int32_t &height)
bool Gui::getScreenTiles (int32_t width, int32_t height, t_screen screen[])
and provide a t_screen array of size
Code: [Select]
sizeof(t_screen)*width*height, you should get the screen contents.
Emphasis on should. I don't think anyone's been using this for quite some time... I'm not even sure if the layout of those things is still the same as it was then. It also had problems with black scanlines, because the reading wasn't synchronized with DF's screen repaints, so it might not be entirely trivial.

Guess we'll find out.

Works like a charm, thanks!
Don't thank me, I'm not the one who fixed it. It was a very bad and hard to spot problem related to linux large file support... I thought I had it fixed already so I didn't even check that part ~_~

Oh, and next version could have the items support back, along with the 'set pants on fire' type of tools.
Title: Re: DFHack 0.5.13
Post by: Greiger on April 11, 2011, 03:59:53 pm
So we will be able to make our legendary lier's pants burst into flames?  Awesome!   Perhaps the migrant lye makers too just for good measure, I mean, once you have one why would you need more?
Title: Re: DFHack 0.5.13
Post by: Rumrusher on April 11, 2011, 10:54:16 pm
I need to ask about Dflair does the function swap the site function to lair or does it search through all the tiles in the fort then turn on the flag to prevent scattering? hopefully it's the latter. because it doesn't work for me.
Title: Re: DFHack 0.5.13
Post by: jaxad0127 on April 12, 2011, 12:05:01 am
I need to ask about Dflair does the function swap the site function to lair or does it search through all the tiles in the fort then turn on the flag to prevent scattering? hopefully it's the latter. because it doesn't work for me.
Yes, it sets every tile on the map to lair.
Title: Re: DFHack 0.5.13
Post by: Corbine on April 12, 2011, 12:08:05 am
Any chance there will be a 'siege breaker' addition to DFHack to help end sieges if everything else fails?
Title: Re: DFHack 0.5.13
Post by: Rafal99 on April 12, 2011, 02:52:54 am
This might take some time to update for the newer DF versions, but you might be able to already do this with some of the old ones. Both linux and windows DF 0.31.12 should work.
If you use these together:
Code: [Select]
bool Gui::getWindowSize (int32_t &width, int32_t &height)
bool Gui::getScreenTiles (int32_t width, int32_t height, t_screen screen[])
and provide a t_screen array of size
Code: [Select]
sizeof(t_screen)*width*height, you should get the screen contents.
Emphasis on should. I don't think anyone's been using this for quite some time... I'm not even sure if the layout of those things is still the same as it was then. It also had problems with black scanlines, because the reading wasn't synchronized with DF's screen repaints, so it might not be entirely trivial.

Guess we'll find out.

Thanks for info, I will take a look at it.

I checked Baughn's graphics code (https://github.com/Baughn/Dwarf-Fortress--libgraphics-/blob/master/g_src/graphics.h) to see how the tiles are stored in DF.
They are a single array char[4*numberOfTiles]. For every tile [0 ] is tile character, [1] is foreground color, [2] is background color and [3] is whether the foreground is bright.
The graphicst class contains pointers to both the start and the end+1 of the tiles array (named "screen" and "screen_limit"). The struct itself ifs allocated in static memory.
I hope the code inside DF is similar. :)
I will play a little with CheatEngine to see.
Title: Re: DFHack 0.5.13
Post by: TolyK on April 12, 2011, 03:08:53 am
Any chance there will be a 'siege breaker' addition to DFHack to help end sieges if everything else fails?
just encase every invader in obsidian. then mine it out.
presto!
Title: Re: DFHack 0.5.13
Post by: Dante on April 12, 2011, 03:27:50 am
Any chance there will be a 'siege breaker' addition to DFHack to help end sieges if everything else fails?
just encase every invader in obsidian. then mine it out.
presto!
It might still be useful to have, in the cases where there's a 'stuck' invader due to the creature being falling when the game is saved. I assume that's still a bug.
Also problematic when the invaders are higher than the maximum level you can cast obsidian, of course.
Title: Re: DFHack 0.5.13
Post by: raoulxq on April 12, 2011, 04:17:41 am
Any chance there will be a 'siege breaker' addition to DFHack to help end sieges if everything else fails?
Use Runesmith, it has an option to kill every creature of a type on the map. You can also select a creature in Runesmith and activate the "dead" flag.
Title: Re: DFHack 0.5.13
Post by: raoulxq on April 12, 2011, 04:25:02 am
Question:

Is Creatures.current_job.active currently broken? I never seems to be set.

Same about Creatures.ReadJob(), does it work?
Title: Re: DFHack 0.5.13
Post by: Rafal99 on April 12, 2011, 05:25:25 am
I think I have hacked DF screen. :D
The values are aligned in exactly the same way as in Baughn's code.

Here are the offsets I got for DF 0.31.25 Windows SDL:
Code: [Select]
00B34D1C: screen
00B3508C: screen_limit
00B34D34: clipx[0]
00B34D38: clipx[1]
00B34D3C: clipy[0]
00B34D40: clipy[1]
00B3507C: dimx
00B35080: dimy
00B35084: mouse_x
00B35088: mouse_y

Explanation:

screen, screen_limit - pointers to start and end+1 of the tiles array. They constantly flip between 2 arrays, apparently they swap buffers.
The important thing is that the arrays are aligned vertically, it goes like: first column, second column etc.

clipx[0], clipx[1], clipy[0], clipy[1] - minimal and maximal coordinates of tiles. For standard 80x25 screen they will be 0, 24, 0, 79. They change when the screen is zoomed or resized.

dimx, dimy - size of view, for example 80, 25. They change when the screen is zoomed or resized.

mouse_x, mouse_y - coordinates of a tile which is currently pointed by the mouse cursor. Their value is FFFFFFFF when mouse is outside view.

I got all these with default values [PRINT_MODE:2D] and [SINGLE_BUFFER:NO].

Edit: Just tried with [PRINT_MODE:ACCUM_BUFFER] and [SINGLE_BUFFER:YES] and all offsets are the same. Even with single buffer the pointers swap between 2 arrays.
Title: Re: DFHack 0.5.13
Post by: Corbine on April 12, 2011, 06:17:55 am
Any chance there will be a 'siege breaker' addition to DFHack to help end sieges if everything else fails?
Use Runesmith, it has an option to kill every creature of a type on the map. You can also select a creature in Runesmith and activate the "dead" flag.

Already did that, siege still rocking on.  Current theory on how to get it to work is to remove the dead flag and kill all the goblins again, but I can bring back a few, but within a few seconds dwarf fortress will crash.

Oh well, might as well start a new world with a scenario of xenophobic dwarves and see how long I last. :D
Title: Re: DFHack 0.5.13
Post by: peterix on April 12, 2011, 06:49:26 am
Any chance there will be a 'siege breaker' addition to DFHack to help end sieges if everything else fails?
Use Runesmith, it has an option to kill every creature of a type on the map. You can also select a creature in Runesmith and activate the "dead" flag.

Already did that, siege still rocking on.  Current theory on how to get it to work is to remove the dead flag and kill all the goblins again, but I can bring back a few, but within a few seconds dwarf fortress will crash.

Oh well, might as well start a new world with a scenario of xenophobic dwarves and see how long I last. :D
It's possible to end a siege. I did it with 40d using some captured goblins - reset their invader flags and let them loose out of their cages. This fixes the siege when you recapture/kill the goblins. If you used any kind of drastic measure as setting the DEAD flag is, you made it only worse. Use magma next time.
The fort can be saved. I'll add tools for that eventually. Not now though, the process of finding the right offsets in this case is long and I don't have time for that.

Question:

Is Creatures.current_job.active currently broken? I never seems to be set.

Same about Creatures.ReadJob(), does it work?
Creatures.current_job.active should work. Actually, I just tested it with 31.25 on linux and it works nicely. I can see the jobs dwarves do. I'll check the windows version too.
Creatures.ReadJob() is not exactly related to the current job. It's meant for mood materials and it's missing the required offsets for the recent versions I think.

@Rafal99
Good job. It should be possible to work with that.
Title: Re: DFHack 0.5.13
Post by: Rafal99 on April 12, 2011, 07:16:43 am
@Rafal99
Good job. It should be possible to work with that.

Thanks!
Just tell me if you would want me to describe the steps to easily find these offsets.
Title: Re: DFHack 0.5.13
Post by: peterix on April 12, 2011, 07:21:05 am
@Rafal99
Good job. It should be possible to work with that.

Thanks!
Just tell me if you would want me to describe the steps to easily find these offsets.
That would be perfect.
Title: Re: DFHack 0.5.13
Post by: raoulxq on April 12, 2011, 07:56:27 am
Creatures.current_job.active should work. Actually, I just tested it with 31.25 on linux and it works nicely. I can see the jobs dwarves do. I'll check the windows version too.
current_job.active actually does work under Ubuntu 64bit, but not under Windows 7 for me.
Title: Re: DFHack 0.5.13
Post by: Rafal99 on April 12, 2011, 08:40:32 am
Just tell me if you would want me to describe the steps to easily find these offsets.
That would be perfect.

Ok here are the steps:
1. Edit your init to run DF at 80x25 windowed.
2. Download this save (http://dffd.wimbli.com/file.php?id=4203) and put it into your save folder. It is made in 0.31.01 so will run in any 0.31.xx version.
3. Run DF and load the save.
4. Press F1 and N (it will move your view to upper right corner of the map and make you see notes).

It should look like that: (look at the corner :D)

(http://i52.tinypic.com/2ikzcls.png)

5. Open Cheat Engine and connect to DF process.
6. Search for "Array of bytes" 480405014104050158040501 hexagonal.
7. You should get 2 addresses, choose one randomly.
8. Substract 68 hexagonal from that address to get the address of the start of the array. ( 68 hex = 104 dec = (25+1)*4 )
9. Add 1F40 hexagonal to the array start address to get array end address (1F40 hex = 8000 dec = 80*25*4 )
10. Now you have 2 adresses. Search for "4 bytes" values containing them. You will get adresses of screen and screen_limit pointers. Both will be in static memory. You may need to try a few times bacause the pointers swap between 2 tables and may temporarily point to the wrong one.
11. The other addresses are related to screen and screen_limit:
Code: [Select]
clipx[0] = screen + 24 bytes
clipx[1] = screen + 28 bytes
clipy[0] = screen + 32 bytes
clipy[1] = screen + 36 bytes
dimx = screen_limit - 16 bytes
dimy = screen_limit - 12 bytes
mouse_x = screen_limit - 8 bytes
mouse_y = screen_limit - 4 bytes

Ok that is all.

I got the offsets for 0.31.19 Windows SDL when preparing this post:
Code: [Select]
screen: 00B4AD1C
screen_limit: 00B4B08C
The other variables as above.
Title: Re: DFHack 0.5.13
Post by: peterix on April 12, 2011, 08:51:46 am
Ok that is all.
That is awesome. There's enough detail for automating it. Thank you :)
Creatures.current_job.active should work. Actually, I just tested it with 31.25 on linux and it works nicely. I can see the jobs dwarves do. I'll check the windows version too.
current_job.active actually does work under Ubuntu 64bit, but not under Windows 7 for me.
Ok, I'm sure this can be fixed quickly by looking at the offsets used by DT.

/me digs through the xml file
Title: Re: DFHack 0.5.13
Post by: Rafal99 on April 12, 2011, 10:22:23 am
I have found some more useful offsets:

Code: [Select]
6814F508: topY
6814F50C: leftX
6814F510: leftX
6814F514: topY
6814F518: rightX
6814F51C: bottomY

These are the screen coordinates of the DF window client area (they make rectangle that contains exactly all the tiles but no window frame).
When DF is switched to fullscreen the last four become FFFF8300 (which seems to be -32000 dec) while the first two stay with their last values.

They seem to be correct for all 0.31.XX Windows SDL versions (checked .12 .18 .19 .25).
But they didn't work for 0.31.01 (which is not SDL so no surprise).

Now finally I have all the offsets I may need. ;)
Title: Re: DFHack 0.5.13
Post by: Eldrick Tobin on April 12, 2011, 10:39:21 am
Any chance there will be a 'siege breaker' addition to DFHack to help end sieges if everything else fails?
Use Runesmith, it has an option to kill every creature of a type on the map. You can also select a creature in Runesmith and activate the "dead" flag.

Runesmith is a great way of MAKING the Siege tag stick:
Step One: A Vile force of Darkness has arrived!
Step Two: Kill all Goblins (Say with the nice Nuke Icon)

Result - Siege tag sticks around forever.

Dead tagging is great when you HAVE a Giant Cave Spider, but want the others gone... can't nuke... so individual dead tags for the win. I'd like "Bleeding out in 4 Urist Seconds" personally

Of course dfcleanoffmydwarves.exe is right up there with World Peace some days...

EDIT:

Of course when you misread 83 as 82 you miss others responses... So we shouldn't use "Dead". 'Left Map' is... wonky (works best on merchants who get lost trying to find your depot because they'd rather be at a party)... 'Killed' is sometimes ignored (ignored here being similar to setting happiness on a miserable dwarf)...

I've had magma crash my process... tried to burn out a 'dumb merchant', set fire to the map. Got migrants as the fire spread... boom. Hadn't saved since I'd plotted out the initial digging, so nothing to debug. Perhaps dfdropsyndromestone.exe targetted nearby enough. But that's my Populous itch talking.
Title: Re: DFHack 0.5.13
Post by: raoulxq on April 12, 2011, 11:53:26 am
Any chance there will be a 'siege breaker' addition to DFHack to help end sieges if everything else fails?
Use Runesmith, it has an option to kill every creature of a type on the map. You can also select a creature in Runesmith and activate the "dead" flag.

Runesmith is a great way of MAKING the Siege tag stick:
Step One: A Vile force of Darkness has arrived!
Step Two: Kill all Goblins (Say with the nice Nuke Icon)

Result - Siege tag sticks around forever.

Dead tagging is great when you HAVE a Giant Cave Spider, but want the others gone... can't nuke... so individual dead tags for the win. I'd like "Bleeding out in 4 Urist Seconds" personally

Of course dfcleanoffmydwarves.exe is right up there with World Peace some days...

EDIT:

Of course when you misread 83 as 82 you miss others responses... So we shouldn't use "Dead". 'Left Map' is... wonky (works best on merchants who get lost trying to find your depot because they'd rather be at a party)... 'Killed' is sometimes ignored (ignored here being similar to setting happiness on a miserable dwarf)...

I've had magma crash my process... tried to burn out a 'dumb merchant', set fire to the map. Got migrants as the fire spread... boom. Hadn't saved since I'd plotted out the initial digging, so nothing to debug. Perhaps dfdropsyndromestone.exe targetted nearby enough. But that's my Populous itch talking.

Ok, I didn't actually try that myself, never ended a siege with the nuke button yet... How about writing a routine that kills all but one of the goblins on the map? When the last one flees or is killed, the SIEGE tag might be deleted... I think I'm going to try that.

I wonder if the dead flag is enough or if we also need the kill flag ('killed by kill function').
Title: Re: DFHack 0.5.13
Post by: Eldrick Tobin on April 12, 2011, 02:54:15 pm
Any chance there will be a 'siege breaker' addition to DFHack to help end sieges if everything else fails?
Use Runesmith, it has an option to kill every creature of a type on the map. You can also select a creature in Runesmith and activate the "dead" flag.

Runesmith is a great way of MAKING the Siege tag stick:
Step One: A Vile force of Darkness has arrived!
Step Two: Kill all Goblins (Say with the nice Nuke Icon)

Result - Siege tag sticks around forever.

Dead tagging is great when you HAVE a Giant Cave Spider, but want the others gone... can't nuke... so individual dead tags for the win. I'd like "Bleeding out in 4 Urist Seconds" personally

Of course dfcleanoffmydwarves.exe is right up there with World Peace some days...

EDIT:

Of course when you misread 83 as 82 you miss others responses... So we shouldn't use "Dead". 'Left Map' is... wonky (works best on merchants who get lost trying to find your depot because they'd rather be at a party)... 'Killed' is sometimes ignored (ignored here being similar to setting happiness on a miserable dwarf)...

I've had magma crash my process... tried to burn out a 'dumb merchant', set fire to the map. Got migrants as the fire spread... boom. Hadn't saved since I'd plotted out the initial digging, so nothing to debug. Perhaps dfdropsyndromestone.exe targetted nearby enough. But that's my Populous itch talking.

Ok, I didn't actually try that myself, never ended a siege with the nuke button yet... How about writing a routine that kills all but one of the goblins on the map? When the last one flees or is killed, the SIEGE tag might be deleted... I think I'm going to try that.

I wonder if the dead flag is enough or if we also need the kill flag ('killed by kill function').

After extensive testing that just ate itself -.-;

Runesmith does not unset the following:
Active Invader (sets if they are just about the invade, as Currently Invading removes this one)
Hidden Ambusher (Just in Case, however it is still set when an Active Invader)
Hidden in Ambush (Just in Case, however it is still set when an Active Invader, until discovery)
Incoming (Sets if something is here yet... wave X of a siege here)
Invader -Fleeing/Leaving
Currently Invading

When it nukes something it basically just sets them to 'dead'. It does not also set them to 'killed'. Show dead will show everything (short of 'vanished'/'deleted' I'd suspect) so one CAN go through the intensive process to revive a broken siege. These particular flags are not visible at the same exact time so multiple passes -even through a narrow segment- are advised.

Problem I ran into (last thing before I mention something more DFHack related):
I set the Killed Flag (but not dead), and I got mortally wounded siegers that refused to just pift in Magma. Likely missing upper torsoes on examination.


And so... a dfremovesiege.exe might only have to zap a few flags to drop that big nasty SIEGE banner. Sadly any random buttock that has been cut off because someone was fishing next to the siegers and was surprised... will still be left by or in the water.
Title: Re: DFHack 0.5.13
Post by: cousac on April 12, 2011, 03:03:06 pm
Code: [Select]
cousac@linux-zwvc:/> dfattachtest
terminate called after throwing an instance of 'DFHack::Error::MemoryXmlParse'
  what():  error 2: Failed to open file, at row 0 col 0
Aborted

um, where did I go wrong? PS dwarf fortress  31.25 was running already and i am using openSUSE 11.3.

EDIT: whoops, pulled a rookie move. forgot to point the cmake to the memory.xml location...all fixed ignore this post.
Title: Re: DFHack 0.5.13
Post by: _DivideByZero_ on April 12, 2011, 06:28:14 pm
Oh by the way, it works with wine again. I can continue to play genesis.
Title: Re: DFHack 0.5.13
Post by: Rumrusher on April 12, 2011, 06:57:33 pm
I need to ask about Dflair does the function swap the site function to lair or does it search through all the tiles in the fort then turn on the flag to prevent scattering? hopefully it's the latter. because it doesn't work for me.
Yes, it sets every tile on the map to lair.
then that's what I feared. That sentence is really vague and confusing from the research on site changing using Dfusion. From what I got setting the site to Lair doesn't slap on The Store items flag on the site unless that's is what you mean in setting to lair(due to I guess lairs only have certain tiles allowed for the ability to store items like how you have to be inside the place to store, and that embarking over it kinda wipes that code out). unless you meant Dflair goes and checks off 14-blood on every tile in the site then I don't get why this utility is wonky compared to the other two which could do it.

Oh and in DFmode news coming back to a Multi race fort can lead to some hassles like re-running the friendship (Dfusion) command over again to untame the members of the fort.
Title: Re: DFHack 0.5.13
Post by: raoulxq on April 13, 2011, 07:41:12 am
Question:

Does anybody have an idea about how to find out if creatures are "known", i.e. show up when hitting the key u?

Also is there a flag if a creatures belongs to the player? Listing all dwarfs also lists merchants etc. I could explicitly exclude merchants though.

I've looked at Creatures.flags1 and Creatures.flags2, but there is nothing obvious there...
Title: Re: DFHack 0.5.13
Post by: Rumrusher on April 13, 2011, 09:05:30 pm
Oh found out that menu, managing(3,0) is reclaim mode. Though you do not want to swap over to this mode for it doesn't address the title of the site nor allow any old member of the site to be playable via removing the Is resident flag.
Title: Re: DFHack 0.5.13
Post by: jaxad0127 on April 13, 2011, 10:18:06 pm
Question:

Does anybody have an idea about how to find out if creatures are "known", i.e. show up when hitting the key u?

Also is there a flag if a creatures belongs to the player? Listing all dwarfs also lists merchants etc. I could explicitly exclude merchants though.

I've looked at Creatures.flags1 and Creatures.flags2, but there is nothing obvious there...
"Known": try this: are they in a visible square and do they not have the ambush flag set?
Owned: check civ against Dwarf civ and make sure the merchant and diplomat bits aren't set (to handle your civ's merchants/diplomats)

I may have forgotten some, but this is a start.

Edit: forgot about diplomats
Title: Re: DFHack 0.5.13
Post by: Quietust on April 14, 2011, 01:52:02 pm
Can DFHack determine whether contaminants are in solid or liquid form? If so, it'd be nice to have dfcleanmap clean up liquid WATER contaminants (which accumulate rapidly around farmer's workshops after milking animals into buckets previously filled with water) and liquid MUD contaminants (which are glitched and have no name, resulting from killing a forgotten beast made of MUD with [TISSUE_MAT_STATE:LIQUID]) while leaving behind snow and normal mud.
Title: Re: DFHack 0.5.13
Post by: Sutremaine on April 15, 2011, 12:27:27 am
How do you run the prospector with modifiers?
Title: Re: DFHack 0.5.13
Post by: Quietust on April 16, 2011, 09:03:59 pm
How do you run the prospector with modifiers?

You open a command prompt, change to the DFHack directory, then run "dfprospector -a", "dfprospector -b", or "dfprospector -ab".

On a side note, I've determined almost all of the offsets for material objects (specifically, everything defined on this page (http://df.magmawiki.com/index.php/DF2010:Material_definition_token), excluding Syndrome properties - this is how I constructed the "raws" for the builtin materials) - if anyone's interested, I'll post them here.
Title: Re: DFHack 0.5.13
Post by: Willfor on April 16, 2011, 11:03:37 pm
On a side note, I've determined almost all of the offsets for material objects (specifically, everything defined on this page (http://df.magmawiki.com/index.php/DF2010:Material_definition_token), excluding Syndrome properties - this is how I constructed the "raws" for the builtin materials) - if anyone's interested, I'll post them here.
Please do.
Title: Re: DFHack 0.5.13
Post by: Sutremaine on April 17, 2011, 02:46:14 am
You open a command prompt, change to the DFHack directory, then run "dfprospector -a", "dfprospector -b", or "dfprospector -ab".
Thanks, I thought you just typed the path in.

How does dfprospector find the mineral data? It claims there are 658 tiles of marble on the map, but I can't find them even after changing marble's colour to 3:6:1 and running reveal to look for it manually. When I moved the map up a little into the biome I believed contained all the missing marble, dfprospector reported 15000 tiles but the only marble visible was about 100 tiles worth on the very edge of the map.
Title: Re: DFHack 0.5.13
Post by: Askot Bokbondeler on April 19, 2011, 05:00:21 pm
that marble might be semi molten
Title: Re: DFHack 0.5.13
Post by: peterix on April 19, 2011, 05:33:30 pm
that marble might be semi molten
This is a solved problem now. It was processing a lot of stuff wrong. And I mean A LOT :P

Here's an example output from the current version:
Spoiler (click to show/hide)

The first section is a count of walls, by their 'main' material. Most of it is obvious, FEATSTONE is slade + adamantine and MAGMA is all the semi-molten rock. I'll be removing the 'show layers' or '-b' parameter as it's been obsoleted. Not showing hidden tiles will be the default on both platforms, Windows will have a batch script for showing all (something like 'prospector_all.bat'), linux users can still use the '-a' parameter.
Title: Re: DFHack 0.5.13
Post by: Sutremaine on April 19, 2011, 05:57:52 pm
that marble might be semi molten
This is a solved problem now. It was processing a lot of stuff wrong. And I mean A LOT :P
DF is being weird as well. I specified flux in my search and there was none in the biome map, and vaguely remembering something about 'flux in finder + no flux in biome = marble' I accepted the site. There appears to be no flux whatsoever, though I'll wait for the next version of reveal to recheck.
Title: Re: DFHack 0.5.13
Post by: raoulxq on April 21, 2011, 02:50:29 pm
Any chance there will be a 'siege breaker' addition to DFHack to help end sieges if everything else fails?
Use Runesmith, it has an option to kill every creature of a type on the map. You can also select a creature in Runesmith and activate the "dead" flag.

Runesmith is a great way of MAKING the Siege tag stick:
Step One: A Vile force of Darkness has arrived!
Step Two: Kill all Goblins (Say with the nice Nuke Icon)

Result - Siege tag sticks around forever.

Dead tagging is great when you HAVE a Giant Cave Spider, but want the others gone... can't nuke... so individual dead tags for the win. I'd like "Bleeding out in 4 Urist Seconds" personally

Of course dfcleanoffmydwarves.exe is right up there with World Peace some days...

EDIT:

Of course when you misread 83 as 82 you miss others responses... So we shouldn't use "Dead". 'Left Map' is... wonky (works best on merchants who get lost trying to find your depot because they'd rather be at a party)... 'Killed' is sometimes ignored (ignored here being similar to setting happiness on a miserable dwarf)...

I've had magma crash my process... tried to burn out a 'dumb merchant', set fire to the map. Got migrants as the fire spread... boom. Hadn't saved since I'd plotted out the initial digging, so nothing to debug. Perhaps dfdropsyndromestone.exe targetted nearby enough. But that's my Populous itch talking.

Ok, I didn't actually try that myself, never ended a siege with the nuke button yet... How about writing a routine that kills all but one of the goblins on the map? When the last one flees or is killed, the SIEGE tag might be deleted... I think I'm going to try that.

I wonder if the dead flag is enough or if we also need the kill flag ('killed by kill function').

After extensive testing that just ate itself -.-;

Runesmith does not unset the following:
Active Invader (sets if they are just about the invade, as Currently Invading removes this one)
Hidden Ambusher (Just in Case, however it is still set when an Active Invader)
Hidden in Ambush (Just in Case, however it is still set when an Active Invader, until discovery)
Incoming (Sets if something is here yet... wave X of a siege here)
Invader -Fleeing/Leaving
Currently Invading

When it nukes something it basically just sets them to 'dead'. It does not also set them to 'killed'. Show dead will show everything (short of 'vanished'/'deleted' I'd suspect) so one CAN go through the intensive process to revive a broken siege. These particular flags are not visible at the same exact time so multiple passes -even through a narrow segment- are advised.

Problem I ran into (last thing before I mention something more DFHack related):
I set the Killed Flag (but not dead), and I got mortally wounded siegers that refused to just pift in Magma. Likely missing upper torsoes on examination.


And so... a dfremovesiege.exe might only have to zap a few flags to drop that big nasty SIEGE banner. Sadly any random buttock that has been cut off because someone was fishing next to the siegers and was surprised... will still be left by or in the water.

I've played my castle since this discussion started and only just got my second siege... The first one was so quickly over, that I forgot to do some investigation. So, some observations:

When the siege started, the invaders had the following flags:

ID: 662, Troll, B�x, Standard, Job: No Job, Happiness: 100
Flag: Marauder
Flag: Can Swap
Flag: Active Invader
Flag: Invader Origin
Flag: Coward
Flag: Hidden Ambusher
Flag: Invades
Flag: Important Historical Figure
Flag: Calculated Nerves
Flag: Calculated Bodyparts
Flag: Important Historical Figure
Flag: Calculated Insulation
Flag: Vision Good
Flag: Breathing Good

ID: 663, Troll, Aslot, Standard, Job: No Job, Happiness: 100
Flag: Marauder
Flag: Can Swap
Flag: Active Invader
Flag: Invader Origin
Flag: Coward
Flag: Hidden Ambusher
Flag: Invades
Flag: Important Historical Figure
Flag: Calculated Nerves
Flag: Calculated Bodyparts
Flag: Important Historical Figure
Flag: Calculated Insulation
Flag: Vision Good
Flag: Breathing Good


After the battle turned (about 1/4 of them killed in the traps, all invaders begin to retreat), many of them lose their flag "Active Invader", plus many of them lose quite a couple of flags:

ID: 662, Troll, B�x, Standard, Job: No Job, Happiness: 100
Flag: Important Historical Figure
Flag: Vision Good
Flag: Breathing Good

ID: 663, Troll, Aslot, Standard, Job: No Job, Happiness: 100
Flag: Marauder
Flag: Can Swap
Flag: Invader Origin
Flag: Coward
Flag: Hidden Ambusher
Flag: Invades
Flag: Important Historical Figure
Flag: Calculated Nerves
Flag: Calculated Bodyparts
Flag: Important Historical Figure
Flag: Calculated Insulation
Flag: Vision Good
Flag: Breathing Good

I then simply killed all invaders, because I wanted to know what happens. I set the following flags (I used my own program, didn't click in Runesmith 1000 times):

f1.bits.dead = 1;
f2.bits.killed = 1;
f1.bits.active_invader = 0;   /* Active invader (for organized ones) */
f1.bits.hidden_ambusher = 0;  /* Active marauder/invader moving inward? */
f1.bits.hidden_in_ambush = 0;
f1.bits.invades = 0;          /* Marauder resident/invader moving in all the way */

The result was that they lost all their flags, except for the two that I had set:

ID: 662, Troll, B�x, Standard, Job: No Job, Happiness: 100
Flag: Dead
Flag: Killed by kill function

ID: 663, Troll, Aslot, Standard, Job: No Job, Happiness: 100
Flag: Dead
Flag: Killed by kill function

Most importantly though, the SIEGE tag stayed there, making my efforts meaningless.

I then tried to revive the two trolls, but without success. Removing the dead and kill flag did nothing, and they still showed up dead. After I set the invader/hidden/... flags, they even didn't show up on my map any more. They may well be hidden (well, I wanted them to be), so let's see.

Another funny thing to note is that they suddenly got some basic skills like Crutch-Walking, Shearing, Buildling Design and Would Dressing that they didn't have before. So I guess something just got messed up, I don't think they trained 'Crutch-Walking' and 'Wound Dressing' up.
Title: Re: DFHack 0.5.13
Post by: Greiger on April 21, 2011, 04:51:32 pm
In my own experience trolls don't follow the same rules as the goblin invaders.  When all goblins are in a straight run and the siege flag is gone, I always still had any trolls left around still trying to path into my fortress. They usually seem to path to some arbitrary location and then mill about. (So far It seems to be where the wagon was located, but need a bigger testbed to be sure.)  I have never seen a troll or ogre attempt to flee.

Gobs on the other hand happily run for their lives,  and sometimes even when the entire siege is in flight they still have the siege flag up until all goblins have left the map or died.  Trolls don't even seem to factor in to the siege flag with all the playing I have done.  But on the other hand  I haven't been using runesmith to kill anything.

I'm not saying your research is invalid.  That trolls still are affected in some way by a retreat call even when I never observe them fleeing interests me.  I'm just saying you may get more results on goblins.
Title: Re: DFHack 0.5.13
Post by: Steelweaver on April 23, 2011, 07:18:59 am
Guys, can u give a few tips in finding items vector? May be some offset where game load begins or so, i've been crawling the dump for weeks with no success, i have very little experience, so some advise could be usefull. Using IDA Pro.
Title: Re: DFHack 0.5.13
Post by: raunioilla on April 23, 2011, 11:49:10 am
I guess this is not the best place but I hate to register myself all over the internet, including hubs. I am trying to code my own tool but I ran into an error when building DFhack from unmodified source code. Fix'd it.

Code: [Select]
C:\peterix-dfhack-b2a47cf\library\DFProcess-windows.cpp:90:18: error: conflicting return type specified for 'virtual void<unnamed>::NormalProcess::writeSTLString(uint32_t, std::string)'
C:\peterix-dfhack-b2a47cf\library\include/dfhack/DFProcess.h:168:28: error:   overriding 'virtual size_t DFHack::Process::writeSTLString(uint32_t, std::string)'
mingw32-make[2]: *** [library/CMakeFiles/dfhack.dir/DFProcess-windows.cpp.obj] Error 1
mingw32-make[1]: *** [library/CMakeFiles/dfhack.dir/all] Error 2
mingw32-make: *** [all] Error 2

To make it work I just edited return type at \library\DFProcess-windows.cpp:90
size_tvoid writeSTLString(const uint32_t address, const std::string writeString){};

I am running mingw and cmake on win7 64bit. You might wanna fix it at hub for us windozers :D

Thx for awesome tool btw :)
Title: Re: DFHack 0.5.13
Post by: notfood on April 23, 2011, 06:51:02 pm
Current git doesn't build on Linux.

Fails with this error:
Spoiler (click to show/hide)
Title: Re: DFHack 0.5.13
Post by: peterix on April 23, 2011, 08:19:09 pm
Current git doesn't build on Linux.

Fails with this error:
...
It did with 4.5.2. Looks like it's handling builtin macros differently than your version. Should be fixed.
Code: [Select]
C:\peterix-dfhack-b2a47cf\library\DFProcess-windows.cpp:90:18: error: conflicting return type specified for 'virtual void<unnamed>::NormalProcess::writeSTLString(uint32_t, std::string)'I am running mingw and cmake on win7 64bit. You might wanna fix it at hub for us windozers :D
Should be fixed. Now it's calling the proper object. I'll add the code to make it actually do things later.
Guys, can u give a few tips in finding items vector? May be some offset where game load begins or so, i've been crawling the dump for weeks with no success, i have very little experience, so some advise could be usefull. Using IDA Pro.
Extremely shortened version:
dfincremental, 2-byte coord scan using the cursor on an item, backpointer scan to find the start of the object, number search (1 in the menu) on the address found, backpointer on all pointers found. It should end up in the static memory areas sooner or later. There are multiple item vectors, try to find the biggest one.
Title: Re: DFHack 0.5.13
Post by: notfood on April 23, 2011, 09:03:50 pm
Great, it works now. Thanks!
Title: Re: DFHack 0.5.13
Post by: Steelweaver on April 24, 2011, 05:30:01 am
Quote
Guys, can u give a few tips in finding items vector? May be some offset where game load begins or so, i've been crawling the dump for weeks with no success, i have very little experience, so some advise could be usefull. Using IDA Pro.
Extremely shortened version:
dfincremental, 2-byte coord scan using the cursor on an item, backpointer scan to find the start of the object, number search (1 in the menu) on the address found, backpointer on all pointers found. It should end up in the static memory areas sooner or later. There are multiple item vectors, try to find the biggest one.

Thank you very much. I ll try it.
Title: Re: DFHack 0.5.13
Post by: jaxad0127 on April 24, 2011, 11:27:33 am
I'm using the latest git under Linux, and I'm getting a bad value from GetDwarfCivId. It returns 283561576, but a quick look at the unit list shows 251 should be the right value. I'm also sometimes getting bad memory offsets when reading creatures. It usually doesn't work in one program I have, it always works in another, and a third was wonky until I changed it to use the read creatures in box method.
Title: Re: DFHack 0.5.13
Post by: Truean on April 24, 2011, 04:17:43 pm
Is there a way to make magma workshops appear in the build menu?
I hack spawned in Magma (of course) with DF liquids, but the option does not appear.
I know tweak utility used to have this feature; does/could DF Hack?

Thank you,
Truean
Title: Re: DFHack 0.5.13
Post by: Olith McHuman on April 25, 2011, 04:47:23 am
Using dfweather (from version 0.5.13 of dfhack) to make it rain or snow in .31.25 using Ubuntu 10.10 64-bit seems to set the current year to zero. Hilariously, dwarf fortress seems to handle this time change quite well.

Quote from: Engraving
Engraved on the wall is an exceptionally designed image of Cilob Plankrocks the dwarf and a steel shield by Mistem Sakzulkadol. Cilob Plankrocks is raising the steel shield. The artwork relates to the masterful steel shield created by the dwarf Cilob Plankrocks for The Gorge of Esteeming at Earthrend in a time before time.

Quote from: Dwarf Profile
He is negative one hundred ninety-one years old, born on the 12th of Hematite in the year 191.
Title: Re: DFHack 0.5.13
Post by: Greiger on April 25, 2011, 09:46:32 pm
Haha, well DF probably wouldn't be the game it is today if it wasn't for the game handling things that should never happen quite as gracefully as it does.

TRON style program 1: Ok so this mod totally just made something out of a materiel that does not exist.  What should I do?

TRON style program 2: Uh well, huh.  That's not supposed to happen, but nothing here seems to scream crash, and all the variables are somehow initialized.  Though I have no goddamn clue what's in them.  Lets just pretend it's normal.


*Dwarf wonders at strange glob of randomly changing color 'liquid' in the smelter*  *Dwarf pokes 'liquid'* dwarf freezes to death in an explosion of boiling liquid, dwarves turn into fire snakes, donkeys turn into antmen and cats explode spontaneously.*

TRON style program 2: ...huh...
Title: Re: DFHack 0.5.13
Post by: grendelfreak on April 25, 2011, 10:25:00 pm
On the DF wiki it says you can dig veins down Z levels using the "-x" option for dfvdig. Can anyone clarify how to do this please.
Title: Re: DFHack 0.5.13
Post by: raoulxq on April 26, 2011, 01:28:02 am
On the DF wiki it says you can dig veins down Z levels using the "-x" option for dfvdig. Can anyone clarify how to do this please.
Well, -x is an Command Line Option. Until someone less lazy than me explains that in more detail, you can try to google "open command prompt", "execute from command line" etc. It would be something like this:

Start->Run->cmd
cd \path\where\dfhack\installed
dfvdig -x
Title: Re: DFHack 0.5.13
Post by: devek on April 26, 2011, 01:30:55 am
I'm more lazy than you, and just click the dfXvdig.bat script which executes dfvdig with the -x option :)
Title: Re: DFHack 0.5.13
Post by: raoulxq on April 26, 2011, 01:42:50 am
Pah, there goes my attempt to give some people insight into the wonderful expressiveness of the command line... :-(
Title: Re: DFHack 0.5.13
Post by: daego on April 27, 2011, 04:02:53 pm
So I've dug through some of the dfhack item code and I don't see any explicit support for deleting items. Any pointers to get me started on adding this?
Title: Re: DFHack 0.5.13
Post by: peterix on April 27, 2011, 06:53:13 pm
So I've dug through some of the dfhack item code and I don't see any explicit support for deleting items. Any pointers to get me started on adding this?
Don't. Binary hell awaits you if you do. Messing with raw assembly, dependency on DF's code as opposed to its data types and fun with fooling allocators on multiple OSes. I'm not saying it's impossible to do from outside, but it's much harder than overwriting existing objects.

Anyway, you're very lucky! I just added a flag to the item flags structure that someone mentioned on the irc channel. It should make DF destroy the item by itself without further outside help. I named it garbage_collect. Needs testing, as I'm not sure if it removes the item from inventory of creatures, chests and other such things properly :)
Title: Re: DFHack 0.5.13
Post by: peterix on April 27, 2011, 07:03:38 pm
I'm using the latest git under Linux, and I'm getting a bad value from GetDwarfCivId. It returns 283561576, but a quick look at the unit list shows 251 should be the right value. I'm also sometimes getting bad memory offsets when reading creatures. It usually doesn't work in one program I have, it always works in another, and a third was wonky until I changed it to use the read creatures in box method.
Ok. First is a plain old bad offset. Noted :)
Second thing I don't really get. Can you be more specific? Is it one of the exceptions thrown by VersionInfo or real bad offset?
Is there a way to make magma workshops appear in the build menu?
Not yet. Patches are a planned feature. There is a (vague) design, but nobody to implement it... See: https://github.com/peterix/dfhack/issues/22
Using dfweather (from version 0.5.13 of dfhack) to make it rain or snow in .31.25 using Ubuntu 10.10 64-bit seems to set the current year to zero. Hilariously, dwarf fortress seems to handle this time change quite well.
Win and fail, at the same time :D I'll have to look at the related code in a disassembler to get the right offset I guess.

Anyway, offset bugs will be fixed when I get to it.

Oh, and someone sent me a tool that lets you teleport all items marked for dumping to the cursor. It will be in the next release ;)
Title: Re: DFHack 0.5.13
Post by: Sutremaine on April 27, 2011, 07:26:00 pm
Oh, and someone sent me a tool that lets you teleport all items marked for dumping to the cursor. It will be in the next release ;)
Oh wow, that's awesome. All that time spent clearing ambush junk from off the edge of the map...
Title: Re: DFHack 0.5.13
Post by: Jarhyn on April 27, 2011, 07:50:04 pm
you are a gentleman and a scholar. I'll be using such a tool to strip all my dwarves naked and dump their shitty tattering clothing into a magma pit.
Title: Re: DFHack 0.5.13
Post by: Aalto on April 27, 2011, 07:57:50 pm
Oh man, that works. So very awesome.
Title: Re: DFHack 0.5.13
Post by: Truean on April 28, 2011, 01:46:07 pm
Quote
Is there a way to make magma workshops appear in the build menu?
Not yet. Patches are a planned feature. There is a (vague) design, but nobody to implement it... See: https://github.com/peterix/dfhack/issues/22

Thank you very much for this. The consideration is appreciated along with your work in general. :)
Title: Re: DFHack 0.5.13
Post by: Rumrusher on April 28, 2011, 02:16:49 pm
I wonder if the reverse could happen and get dwarves to wear clothes even those 2 sizes too big.
Title: Re: DFHack 0.5.13
Post by: twalberg on April 28, 2011, 02:29:31 pm
Commit df9467 (Merged pull request #76 from tomprince/master.) breaks building for me. It added a couple cases in a switch statement in unreveal.cpp that reference #defines that don't exist.

Either it's dependent on something that didn't get committed, or it's just wrong. Looking at the code, I suspect the latter, as STREAM and STREAM_TOP aren't in the same enum as the rest of the tags referenced in that switch.
Title: Re: DFHack 0.5.13
Post by: Greiger on April 28, 2011, 04:45:16 pm
Oh, and someone sent me a tool that lets you teleport all items marked for dumping to the cursor. It will be in the next release ;)

Oh glorious day!  I can finally get rid of all those bolts that always end up in my moats without a complicated process of draining and refilling that takes longer than it takes for the greenskins to show up again and deposit more!

Here's a diamond as thanks!  

EDIT:failpost.
Title: Re: DFHack 0.5.13
Post by: jaxad0127 on April 28, 2011, 05:29:33 pm
Commit df9467 (Merged pull request #76 from tomprince/master.) breaks building for me. It added a couple cases in a switch statement in unreveal.cpp that reference #defines that don't exist.

Either it's dependent on something that didn't get committed, or it's just wrong. Looking at the code, I suspect the latter, as STREAM and STREAM_TOP aren't in the same enum as the rest of the tags referenced in that switch.
A fix has already been committed.
Title: Re: DFHack 0.5.13
Post by: Greiger on April 28, 2011, 06:20:08 pm
Hehe tried to compile just the cpp for the new autodump as a "I'm going to take a C++ class anyway, I might as well give this a shot" experience, failed miserably once it started asking for headers, then the headers asked for headers, and then I gave up.

C++ is more complex than it looks.   Anyway keep up the good work guys, and good luck!  :D
Title: Re: DFHack 0.5.13
Post by: jaxad0127 on April 29, 2011, 02:37:19 am
Hehe tried to compile just the cpp for the new autodump as a "I'm going to take a C++ class anyway, I might as well give this a shot" experience, failed miserably once it started asking for headers, then the headers asked for headers, and then I gave up.

C++ is more complex than it looks.   Anyway keep up the good work guys, and good luck!  :D
You rarely compile even slightly complex C++ programs that way. You usually use a build system. Read one of the COMPILE files included with DFHack for step-by-step instructions.
Title: Re: DFHack 0.5.13
Post by: Truean on April 29, 2011, 10:30:47 am
I've been spawning in lots of obsidian with the new obsidian spawning range option. It's been great, and has allowed the construction of obsidian towers etc without taking me months of real time I just don't have. Thank you again.

Question: Is it possible to spawn other solid materials besides obsidian using DF Hack, DF liquids?

I recall Tweak's Tile Editor could create a vast number of tiles, so it might be at least possible to do. Do you think you might consider adding this functionality in the future? If so, do you think it could create grass growing surfaces in mountain biomes when the surface layer of rock is stripped away by say, spawning an area of white sand and digging out the top while leaving the bottom "floor layer?"

The applications are limitless in both fortress and adventure mode. One could spawn an entire fortress while paused in either mode. Having your own adventure mode castle could be a reality! :D

Humbly asking,
Truean
Title: Re: DFHack 0.5.13
Post by: Eldrick Tobin on April 29, 2011, 10:53:58 am
If you're building RiverSources, is a size of 0 supposed to zap it out of existence? "Why do you ask? You should be very careful dropping those anywhere..." Built a pool, forgot a support pillar in it, and now I can't destroy the pillar conventionally. I suppose I could wall it off with Obsidian...

Is there any way to make a brook?
Title: Re: DFHack 0.5.13
Post by: Quietust on April 29, 2011, 12:46:02 pm
Question: Is it possible to spawn other solid materials besides obsidian using DF Hack, DF liquids?
The only "materials" a tile can be made of are "soil", "layer stone", "mineral" (a vein or cluster), "map feature" (raw adamantine or slade), ice, "lava stone" (i.e. obsidian), or "construction" (which requires an already existing item).
Title: Re: DFHack 0.5.13
Post by: Truean on April 29, 2011, 02:13:39 pm
Question: Is it possible to spawn other solid materials besides obsidian using DF Hack, DF liquids?
The only "materials" a tile can be made of are "soil", "layer stone", "mineral" (a vein or cluster), "map feature" (raw adamantine or slade), ice, "lava stone" (i.e. obsidian), or "construction" (which requires an already existing item).

http://df.magmawiki.com/index.php/User:Rick/Tweak/Tile_Edit

You could make almost any tile with that program in d40. Ice, native stone (whatever the stone layer was), up/downstairs/slope, floor, smoothed, rough whatever.
Title: Re: DFHack 0.5.13
Post by: Rumrusher on April 29, 2011, 02:47:30 pm
Question: Is it possible to spawn other solid materials besides obsidian using DF Hack, DF liquids?
The only "materials" a tile can be made of are "soil", "layer stone", "mineral" (a vein or cluster), "map feature" (raw adamantine or slade), ice, "lava stone" (i.e. obsidian), or "construction" (which requires an already existing item).

http://df.magmawiki.com/index.php/User:Rick/Tweak/Tile_Edit

You could make almost any tile with that program in d40. Ice, native stone (whatever the stone layer was), up/downstairs/slope, floor, smoothed, rough whatever.
yeah even in 31.xx you still could just not in the most recent version(or was that .25 modded I don't know still doesn't work for me)... unless andux fix that issue.
Title: Re: DFHack 0.5.13
Post by: Andux on April 29, 2011, 05:41:21 pm
yeah even in 31.xx you still could just not in the most recent version(or was that .25 modded I don't know still doesn't work for me)... unless andux fix that issue.

It works with .25 for me; but, yeah, if the exe itself is modded, that could definitely cause issues, since Tweak uses a hash of the whole executable to identify the version. What does it say in the log? There should be a line like:
Code: [Select]
   Verbose: Selected game with process ID 1234, hash is 6ada05fc94785b53efe6aa5728b3756b.If your hash is different, you could try making a copy of the 0.31.25_sdl entry in versions.xml with the new hash.
Title: Re: DFHack 0.5.13
Post by: Rumrusher on April 30, 2011, 12:17:26 pm
so does this mean I have to do this for every .25 conversion of dwarf fortress?
Title: Re: DFHack 0.5.13
Post by: jaxad0127 on April 30, 2011, 12:44:01 pm
DFHack can make those all fine. Just change the value used in the obsidian function.
Title: Re: DFHack 0.5.13
Post by: peterix on April 30, 2011, 01:24:03 pm
Question: Is it possible to spawn other solid materials besides obsidian using DF Hack, DF liquids?

I recall Tweak's Tile Editor could create a vast number of tiles, so it might be at least possible to do. Do you think you might consider adding this functionality in the future? If so, do you think it could create grass growing surfaces in mountain biomes when the surface layer of rock is stripped away by say, spawning an area of white sand and digging out the top while leaving the bottom "floor layer?"

DFHack can make those all fine. Just change the value used in the obsidian function.

Well, what is really required here is to have a sensible user interface for this. dfliquids is rather limited in that regard, and printing a 520 item long list into a terminal to choose a tiletype from isn't really any good IMHO. It's also true that placing tile types sometimes requires more than just setting the number, because you don't want to have magma inside a wall, or your dwarves 'stuck in geometry'.

My plan is to have a simple map editor, preferably written in Qt. For that, I'll need time and a way to not F up pathing by changing the map ;)
Title: Re: DFHack 0.5.13
Post by: jaxad0127 on April 30, 2011, 01:28:24 pm
Question: Is it possible to spawn other solid materials besides obsidian using DF Hack, DF liquids?

I recall Tweak's Tile Editor could create a vast number of tiles, so it might be at least possible to do. Do you think you might consider adding this functionality in the future? If so, do you think it could create grass growing surfaces in mountain biomes when the surface layer of rock is stripped away by say, spawning an area of white sand and digging out the top while leaving the bottom "floor layer?"

DFHack can make those all fine. Just change the value used in the obsidian function.

Well, what is really required here is to have a sensible user interface for this. dfliquids is rather limited in that regard, and printing a 520 item long list into a terminal to choose a tiletype from isn't really any good IMHO. It's also true that placing tile types sometimes requires more than just setting the number, because you don't want to have magma inside a wall, or your dwarves 'stuck in geometry'.

My plan is to have a simple map editor, preferably written in Qt. For that, I'll need time and a way to not F up pathing by changing the map ;)
I've been working on a Qt facade for DFHack, which will allow QML to use it.
Title: Re: DFHack 0.5.13
Post by: Rumrusher on April 30, 2011, 09:15:28 pm
Question: Is it possible to spawn other solid materials besides obsidian using DF Hack, DF liquids?

I recall Tweak's Tile Editor could create a vast number of tiles, so it might be at least possible to do. Do you think you might consider adding this functionality in the future? If so, do you think it could create grass growing surfaces in mountain biomes when the surface layer of rock is stripped away by say, spawning an area of white sand and digging out the top while leaving the bottom "floor layer?"

DFHack can make those all fine. Just change the value used in the obsidian function.

Well, what is really required here is to have a sensible user interface for this. dfliquids is rather limited in that regard, and printing a 520 item long list into a terminal to choose a tiletype from isn't really any good IMHO. It's also true that placing tile types sometimes requires more than just setting the number, because you don't want to have magma inside a wall, or your dwarves 'stuck in geometry'.

My plan is to have a simple map editor, preferably written in Qt. For that, I'll need time and a way to not F up pathing by changing the map ;)
I've been working on a Qt facade for DFHack, which will allow QML to use it.
didn't someone get close to making a brush tile editor?
Title: Re: DFHack 0.5.13
Post by: peterix on April 30, 2011, 09:30:49 pm
didn't someone get close to making a brush tile editor?
No idea. My guess is, that even if there is something like that, 'close' won't cut it. I'm better off making my own anyway. All the pieces needed for an editor are there already. Actually, just about anything (vdig, liquids, etc.) that uses MapCache is an editor. The terminal stuff fits what the tools do, but doesn't provide enough room for expansion :)
Title: Re: DFHack 0.5.13
Post by: Rumrusher on May 01, 2011, 03:04:22 am
yeah even in 31.xx you still could just not in the most recent version(or was that .25 modded I don't know still doesn't work for me)... unless andux fix that issue.

It works with .25 for me; but, yeah, if the exe itself is modded, that could definitely cause issues, since Tweak uses a hash of the whole executable to identify the version. What does it say in the log? There should be a line like:
Code: [Select]
   Verbose: Selected game with process ID 1234, hash is 6ada05fc94785b53efe6aa5728b3756b.If your hash is different, you could try making a copy of the 0.31.25_sdl entry in versions.xml with the new hash.
the error is this

Code: [Select]
Gibbed.DwarfFortress.Tweak.Win32Exception: error 299
   at Gibbed.DwarfFortress.Tweak.ProcessMemory.Read(UInt32 address, Byte[]& data, UInt32 size)
   at Gibbed.DwarfFortress.Tweak.ProcessMemory.ReadU32(UInt32 address)
   at Gibbed.DwarfFortress.Tools.TileEdit.Module.Run(ModuleMode mode, IVersion version, IMemory memory, ILogger log, String[] args)
   at Gibbed.DwarfFortress.Tweak.ModulePicker.onActivateModule(Object sender, EventArgs e)
   at System.Windows.Forms.ListView.OnItemActivate(EventArgs e)
   at System.Windows.Forms.ListView.WmReflectNotify(Message& m)
   at System.Windows.Forms.ListView.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
though my hash is the same.
Code: [Select]
<version name="0.31.25_sdl" hash="6ada05fc94785b53efe6aa5728b3756b" />
Title: Re: DFHack 0.5.13
Post by: Andux on May 01, 2011, 05:01:21 pm
Code: [Select]
Gibbed.DwarfFortress.Tweak.Win32Exception: error 299
[. . .]

Sounds like this error on Vista (http://cboard.cprogramming.com/windows-programming/98807-readprocessmemory-error.html#post757466); might be fixable...

OK, I put together a modified version of the Tweak executable (http://meepo.dnsalias.org/files/tweak_modified_exe.zip) which uses the value 0x00100E78* in place of PROCESS_ALL_ACCESS; if it works any better I'll put it in the next release.

*i.e., PROCESS_DUP_HANDLE | PROCESS_QUERY_INFORMATION | PROCESS_SET_INFORMATION | PROCESS_SUSPEND_RESUME | PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE | SYNCHRONIZE
Title: Re: DFHack 0.5.13
Post by: Rumrusher on May 01, 2011, 05:23:34 pm
oh I'm on win 7. edit: oh sorry.
Title: Re: DFHack 0.5.13
Post by: peterix on May 01, 2011, 05:41:01 pm
Guys, I have nothing against Tweak, but this isn't really dfhack-related.
Title: Re: DFHack 0.5.13
Post by: ral on May 01, 2011, 10:22:11 pm
I've been working on a Qt facade for DFHack, which will allow QML to use it.

This sounds cool. I just started messing with Qt and lua, and I didn't even know that QML existed. I was thinking of using SLB (simple lua bindings) to expose dfhack classes to lua and then provide some sort of way to create ui widgets from lua, but what you're talking about sounds better.

Can QML be used as a general purpose language and can you expose arbitrary C++ classes (like all the dfhack classes) to it?

I think creating some relatively easy way for people to write dfhack tools with a scripting language and a gui will greatly increase the number of tools out there.
Title: Re: DFHack 0.5.13
Post by: jaxad0127 on May 01, 2011, 10:58:46 pm
I've been working on a Qt facade for DFHack, which will allow QML to use it.

This sounds cool. I just started messing with Qt and lua, and I didn't even know that QML existed. I was thinking of using SLB (simple lua bindings) to expose dfhack classes to lua and then provide some sort of way to create ui widgets from lua, but what you're talking about sounds better.

Can QML be used as a general purpose language and can you expose arbitrary C++ classes (like all the dfhack classes) to it?

I think creating some relatively easy way for people to write dfhack tools with a scripting language and a gui will greatly increase the number of tools out there.
There looks to already be a(n atleast partial) python interface for it. Making classes available for QML takes some work.
Title: Re: DFHack 0.5.13
Post by: ral on May 01, 2011, 11:24:30 pm
Hmm... I don't totally get it all just from skimming the qml c++ binding docs for a few minutes, but it looks like you'd have to write QObject wrappers for all of the dfhack classes that you want to expose. I guess you then have to worry about translating return data from the dfhack methods into various QObjects.....

Basically, what I was thinking of is something like this: Some sort of app that loads one or more script plugins (each in it's own file) and presents a window with, say, one folder tab per plugin. Each plugin is a script in some scripting language (python, javascript-like such as QML, lua... I don't really care except that it should be as easy/familiar to as many people as possible) that declares some sort of user interface in some sort of initialization function ("add checkbox with label x", "add pushbutton with label y", etc.) preferably in the simplest terms possible. Then when someone clicks a tab, the plugin's ui is shown and ui widget events get dispatched to methods in the plugin script, etc, and those methods call dfhack class methods.

Assuming that QML implements enough of javascript and has enough support functions available, it sounds like this might be a good way to do things.... Lots of people know javascript and would be able to figure out how to write plugins fairly quickly.
Title: Re: DFHack 0.5.13
Post by: Quietust on May 01, 2011, 11:35:56 pm
Just located a potentially useful offset in version 0.31.25 - on my system (XP SP3) it's at 0x14F0AB8, and it's a vector that contains a byte for each plant and specifies (with the value 00 or 01) whether or not you are permitted to plant seeds for it in a farm plot. Might be nice for players frustrated by the inability to plant stuff that they created using reactions.
Title: Re: DFHack 0.5.13
Post by: devek on May 02, 2011, 02:11:01 am
I'm not going to write a detailed post, because I am kind of trashed but please don't use QML for what you guys are talking about.

I <3 qt, but please ask yourself when X became simpler than Y.
Title: Re: DFHack 0.5.13
Post by: jaxad0127 on May 02, 2011, 02:52:17 am
I'm not going to write a detailed post, because I am kind of trashed but please don't use QML for what you guys are talking about.

I <3 qt, but please ask yourself when X became simpler than Y.
This is a side project. QML will be supported for GUIs. I don't know what ral is on about.
Title: Re: DFHack 0.5.13
Post by: ral on May 02, 2011, 07:44:47 am
All I'm talking about is some sort of UI with the ability to load dfhack plugins written in some sort of scripting language. Doesn't sound like jaxad is really interested in the core concept of this so I will keep researching on my own....
Title: Re: DFHack 0.5.13
Post by: jaxad0127 on May 02, 2011, 10:08:46 am
All I'm talking about is some sort of UI with the ability to load dfhack plugins written in some sort of scripting language. Doesn't sound like jaxad is really interested in the core concept of this so I will keep researching on my own....
That's doable with Qt, but for now, I'm working on the facade.

EDIT: I think we're talking about different things here. Do you mean plugins to DFHack that add support for more offsets, etc, or more tools?
Title: Re: DFHack 0.5.13
Post by: ral on May 02, 2011, 02:31:42 pm
Just more tools.... For example, dfliquids written in a scripting language with something to specify a GUI for it. Scripting languages would seem totally unsuited to addressing anything directly in memory without some sort of abstraction on top of it.

Aside from the gui stuff, what makes me think that allowing dfhack tools to be written in scripting languages would be a good idea are things like dffusion and Dwarf Guidance Councilor (the developer of which doesn't know C++ and pretty much only knows php and javascript from what it sounds like).

I'll take a look at the python thing. I didn't manage to find that until you mentioned it.
Title: Re: DFHack 0.5.13
Post by: jaxad0127 on May 02, 2011, 04:11:45 pm
Just more tools.... For example, dfliquids written in a scripting language with something to specify a GUI for it. Scripting languages would seem totally unsuited to addressing anything directly in memory without some sort of abstraction on top of it.

Aside from the gui stuff, what makes me think that allowing dfhack tools to be written in scripting languages would be a good idea are things like dffusion and Dwarf Guidance Councilor (the developer of which doesn't know C++ and pretty much only knows php and javascript from what it sounds like).

I'll take a look at the python thing. I didn't manage to find that until you mentioned it.
QML will makes GUIs extremely simple. And not much overhead for just scripts. I'll look later into QScript bindings for DFHack, which will let you use Qt's javascript engine.
Title: Re: DFHack 0.5.13
Post by: devek on May 02, 2011, 04:32:28 pm
That is where you guys are confusing me...

QML is useful for layouts yes.. but qt creator has that covered. It isn't advised to go beyond that.

If you're just wanting to write at QT program that can call scripts that call dfhack, why not embed python? You don't need to worry about the dfhack python bindings, cpython interfaces with c/qt just fine in the same way that jython interfaces with java just fine. In fact, when it was starting to become popular one of the touted features was just that.
Title: Re: DFHack 0.5.13
Post by: ral on May 02, 2011, 04:40:21 pm
Just glancing at QtScript docs, it looks like you probably have to wrap everything in QObjects that translate data types, etc. If you need anyone to help with the grunt work of wrapping dfhack classes with QObjects that translate data types, etc, let me know when you get to that point. I don't know squat about Qt specifically, but I've done a bit of wrapping C for scripting languages so I'm familiar with what has to happen to make that possible.

Seems like some sort of template metaprogramming wrapper should be possible for some cases of this but I don't see any that anyone has developed, and I don't know squat about c++ metaprogramming at this point either.

devek: I'm not necessarily opposed to python either. Personally I like python and know it rather well.
Title: Re: DFHack 0.5.13
Post by: jaxad0127 on May 02, 2011, 05:17:08 pm
Just glancing at QtScript docs, it looks like you probably have to wrap everything in QObjects that translate data types, etc. If you need anyone to help with the grunt work of wrapping dfhack classes with QObjects that translate data types, etc, let me know when you get to that point. I don't know squat about Qt specifically, but I've done a bit of wrapping C for scripting languages so I'm familiar with what has to happen to make that possible.

Seems like some sort of template metaprogramming wrapper should be possible for some cases of this but I don't see any that anyone has developed, and I don't know squat about c++ metaprogramming at this point either.

devek: I'm not necessarily opposed to python either. Personally I like python and know it rather well.
I'm already working on that for the QML facade.
Title: Re: DFHack 0.5.13
Post by: Andux on May 04, 2011, 07:55:56 pm
Urist McAndux withdraws from society...
Urist McAndux has claimed a Code Monkey's Workshop.
Urist McAndux has begun a mysterious construction!
Urist McAndux, Code Monkey has created dfmarmot (http://dffd.wimbli.com/file.php?id=4326), a DFHack-based map tool!


Still needs a bit of work, but it's more or less usable now.


I had some trouble with Context_Resume -- after calling it, the next Maps_* function call always gave me an access violation -- Context_ForceResume seems to work fine, though. ???
Title: Re: DFHack 0.5.13
Post by: Dante on May 04, 2011, 11:27:50 pm
Nice, Andux. It's useful to have liquids + temperature functionality in one tool, for making ice walls. However, I did get one crash when I was changing the temperature of a patch of magma to 999 Urist. I don't know if that's a problem with dfmarmot, dfhack or df itself.
Title: Re: DFHack 0.5.13
Post by: Ethicalfive on May 05, 2011, 01:26:19 am
Quick question i'm hoping someone would be kind enough to answer, or even be pointed to other projects that may already do a similar thing.

Is it possible to read what the current menu in fortress mode is through dfhack?

For example, if I were to press 'd' and bring up the designations menu, is there a value that I can access through dfhack that tells me that menu is open?
Title: Re: DFHack 0.5.13
Post by: jaxad0127 on May 05, 2011, 02:05:29 am
Quick question i'm hoping someone would be kind enough to answer, or even be pointed to other projects that may already do a similar thing.

Is it possible to read what the current menu in fortress mode is through dfhack?

For example, if I were to press 'd' and bring up the designations menu, is there a value that I can access through dfhack that tells me that menu is open?
There is function to grab what is being drawn on the screen. You can parse that output.

EDIT: Looking at the GUI module again, there is a function to get the menu state. We don't have an enum for that yet, but you could make one.
Title: Re: DFHack 0.5.13
Post by: Ethicalfive on May 05, 2011, 04:45:56 am
Sweet, thanks for the quick and informative reply :D
Title: Re: DFHack 0.5.13
Post by: peterix on May 05, 2011, 08:41:15 am
Sweet, thanks for the quick and informative reply :D
Note that those things are currently broken/have missing offsets. There's work that needs to be done for it to be useful again. Research has been done (scroll up a few pages). All it needs is someone to fix it.
Title: Re: DFHack 0.5.13
Post by: peterix on May 05, 2011, 11:49:42 am
I had some trouble with Context_Resume -- after calling it, the next Maps_* function call always gave me an access violation -- Context_ForceResume seems to work fine, though. ???
Well, if you use that, you can cause bad stuff to happen if the user does have a second tool running - something like Dwarf Therapist for example. See, each thread on Windows has a counter that says how many times it was suspended, so that multiple things that need the thread to stop executing get the expected behavior - each suspends once and resumes once when they need. When the counter reaches zero again, the thread can run. What you're doing here is that you force the thread to resume. This can break other tools, because they assume DF isn't doing anything with its memory while they manipulate it.

The fact that you *aren't* getting a segfault/exception from ForceResume is due to a bug, and the fact you are getting a segfault//exception from Resume is possibly due to a second bug. I'll go and fix those now. See, the modules keep some data around - read in one big chunk when you call Start. This data is valid for as long as DF is suspended. Resuming makes the data invalid and possibly dangeorus to use. Resume wiped it out, ForceResume didn't. Now it will.

So, use Suspend and Resume, and Start all the modules you need after the Resume again. ForceResume is there for dfunstuck, which is for cleaning up after crashing/too soon closed tools.
Title: Re: DFHack 0.5.13
Post by: Quietust on May 06, 2011, 10:15:05 am
Very minor complaint: the <Jobs> list in memory.xml is full of errors since it was borrowed from a version of Dwarf Therapist where they were completely wrong. The current version of Therapist has a corrected list.
Title: Re: DFHack 0.5.13
Post by: Andux on May 07, 2011, 01:18:11 am
While using dfsuspend to test some wait-for-resume functionality in dfmarmot, I found that Context_isSuspended was not giving the results I expected; I think I have a fix, though:
Code: (in DFProcess-windows.cpp) [Select]
bool NormalProcess::isSuspended()
{
    DWORD SuspendTally = 0;
    for(int i = 0; i < threads.size(); i++)
    {
        SuspendTally += SuspendThread(threads[i]);
        ResumeThread(threads[i]);
    }
    return (SuspendTally > 0);
}
(Hopefully I got the C++ syntax right.)
That should detect when any program has suspended DF, and it doesn't touch the suspended flag, so resume() should still behave.
Title: Re: DFHack 0.5.13
Post by: Angel Of Death on May 07, 2011, 03:07:39 am
Can this kill ghosts?

I'm searching for a utility that can.
Title: Re: DFHack 0.5.13
Post by: jaxad0127 on May 07, 2011, 03:26:55 am
Can this kill ghosts?

I'm searching for a utility that can.
If you write a tool using it to do that. Runesmith uses DFHack for it's DF access, it should allow killing ghosts.
Title: Re: DFHack 0.5.13
Post by: Angel Of Death on May 07, 2011, 03:52:48 am
It dosen't.
Title: Re: DFHack 0.5.13
Post by: Greiger on May 07, 2011, 08:34:11 am
I had a ghost that didn't show up in the slab list and didn't have a corpse surviving.  I just opened up runesmith, found the ghost, and checked the dead flag.  No more ghost.
Title: Re: DFHack 0.5.13
Post by: ag on May 07, 2011, 11:41:29 am
Actually I've recently contributed fix-3708.cpp, which makes them engravable (given enough dead goblins). It only has the necessary offsets for the latest linux version, though.
Title: Re: DFHack 0.5.14
Post by: peterix on May 08, 2011, 05:27:10 am
Finally another release! This time with some nice new supported tools and improvements to old ones.

dfcleanowned
Removes the ownership flag from items. By default, owned food on the floor and rotten items are confistacted and dumped. It has some more options (see the README).
dfautodump
Dumps or destroys all the items marked for dumping (will leave alone items inside creature inventories, buildings and constructions).

The prospector tool got a rewrite and some major improvements to its output.

Aside from that, a lot of internal changes and bugfixes are included. Enjoy :)
Title: Re: DFHack 0.5.14
Post by: Greiger on May 08, 2011, 08:38:33 am
So what's the going price for a firstborn in this economy?  I'm willing to give you mine but I'm not sure that would be enough compensation.
Title: Re: DFHack 0.5.14
Post by: Vercingetorix on May 08, 2011, 10:08:24 am
This is incredible...the FPS increase from using dfconfiscate and autodump is remarkable.  I'd say it doubled.
Title: Re: DFHack 0.5.14
Post by: ag on May 08, 2011, 10:20:53 am
This is incredible...the FPS increase from using dfconfiscate and autodump is remarkable.  I'd say it doubled.

Out of curiosity, what exactly did you destroy?
Title: Re: DFHack 0.5.14
Post by: devek on May 08, 2011, 10:25:19 am
dfautodestroy works as advertised. a++

would destroy all the various goblin crap outside my fortress again.
Title: Re: DFHack 0.5.14
Post by: Makbeth on May 08, 2011, 10:43:22 am

dfautodump
Dumps or destroys all the items marked for dumping (will leave alone items inside creature inventories, buildings and constructions).


Oh, that is awesome.  No more waiting two years before my excavated stockpiles are fully usable. 

Title: Re: DFHack 0.5.14
Post by: profit on May 08, 2011, 11:04:25 am
dfcleanowned
Removes the ownership flag from items. By default, owned food on the floor and rotten items are confistacted and dumped. It has some more options (see the README).


OMFG!  YOU ARE MY HERO!!!!!!!!!!!!!!!

<3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3



*decides DFhack is now probably an essential utility on his list.
Title: Re: DFHack 0.5.12
Post by: Patchy on May 08, 2011, 05:11:02 pm
I don't know how possible it is, but maybe someone could work on developing a tool to remove dwarf ownership of clothing items that are not put away in cabinets? Just thought I'd suggest it since it would seem like a fairly convenient tool to have around.
Well, that's a good idea and has been discussed before. I'll see what can be done.

dfcleanowned
Removes the ownership flag from items. By default, owned food on the floor and rotten items are confistacted and dumped. It has some more options (see the README).

Thank you soooooooo much and love ya Peterix. Thats probably my new favorite tool.
Title: Re: DFHack 0.5.14
Post by: outofpractice on May 09, 2011, 06:39:56 pm
I'd just like to say that I am now in love with the creator(s) of DFHack.

DFAutodump is wonderful.
Thanks heaps.

(neat freak)
Title: Re: DFHack 0.5.14
Post by: Vercingetorix on May 09, 2011, 07:02:59 pm
Out of curiosity, what exactly did you destroy?

Owned food and clothes, corpses, and all the crap goblinite piling up outside.  It was claimed and marked for dumping but because there was so much there were a gigantic number of jobs outstanding.
Title: Re: DFHack 0.5.14
Post by: jaxad0127 on May 09, 2011, 08:45:58 pm
I've made available the work I've done on the facade I mentioned: https://github.com/jaxad0127/DFQt (https://github.com/jaxad0127/DFQt). I plan on mirror DFHack as closely as reasonable. I don't plan on exposing direct memory access through the facade, and I'll merge DFHack stuff when they cover the same topics (the Materials module's race and raceEx, for example.

Some notes on VersionInfo:[ul]


Everything I've done so far is QML accessible, and the project includes a QML plug-in. I'll add some example QML later.
Title: Re: DFHack 0.5.14
Post by: ral on May 09, 2011, 10:43:09 pm
Awesome, thanks! I am taking a look at it now....
Title: Re: DFHack 0.5.14
Post by: devek on May 09, 2011, 11:59:43 pm
Not really a bug, just expected..

I've been slaughtering elf caravans then using dfautodestroy to nuke all of the worthless stuff, which was fine until a 2 year old decided he would drink some of that elvaan sewer brew. He was stuck on the job and wouldn't move since the item he was trying to delete was gone.

It was easy to fix though, dumping water on his head caused him to forget about his job and find something else to drink.
Title: Re: DFHack 0.5.14
Post by: Makbeth on May 10, 2011, 11:57:39 am
I wonder if there's a way to clear jobs/tasks/activities then for certain dwarves and force them to pick a new task.  Would be useful for overzealous military dwarves, or soldiers/brokers who are drinking/sleeping/eating/doing any damned thing they can think of besides the time-sensitive task they are needed for like right-the-hell-now.
Title: Re: DFHack 0.5.14
Post by: Naryar on May 11, 2011, 08:59:14 am
Ohoho, dfautodestroy is looking good.

No more flooding my surface with magma with dfliquids to clean all the crap that comes with goblinite.
Title: Re: DFHack 0.5.14
Post by: zephyr_hound on May 11, 2011, 10:58:02 am
I am sitting here watching 21 accumulated years of XXlitterXX going down the magma chute. Thank you so much for dfcleanowned!
Title: Re: DFHack 0.5.14
Post by: Quietust on May 11, 2011, 04:09:51 pm
It would have been very useful to have dfcleanowned back in 40d for fortresses that had made use of coins.
In fact, at one point, I actually wrote a cleanowned-type tool for 0.23.130.23a (the old 2D version) in order to get rid of coins (since you have to mint them in order to get the bookkeeper and dungeon master), though I later found out that you can be tricky and mint them out of non-currency metals such as tin or bronze and still get said nobles to arrive.
Title: Re: DFHack 0.5.14
Post by: LoSboccacc on May 11, 2011, 04:19:17 pm
It would have been very useful to have dfcleanowned back in 40d for fortresses that had made use of coins.
In fact, at one point, I actually wrote a cleanowned-type tool for 0.23.130.23a (the old 2D version) in order to get rid of coins (since you have to mint them in order to get the bookkeeper and dungeon master), though I later found out that you can be tricky and mint them out of non-currency metals such as tin or bronze and still get said nobles to arrive.

no worries, it will be useful again when the inns cometh bringing travelers and their coins, zombies and their xxclothesxx and other countable amenities that will surely land squarely on the fps on the next releases.
Title: Re: DFHack 0.5.14
Post by: peterix on May 11, 2011, 06:30:07 pm
Just a small bit of info:
There will be support for item quantities/stack sizes in the next release. So, some kind of stats application is more than likely to show up... If I have the time, I'll certainly write one :]
Title: Re: DFHack 0.5.14
Post by: Necro910 on May 13, 2011, 08:57:51 pm
Where exactly do I place the file?

I have the feeling that it's somewhere really obvious and I'm completely missing the hint.
Title: Re: DFHack 0.5.14
Post by: peterix on May 13, 2011, 10:50:08 pm
Where exactly do I place the file?

I have the feeling that it's somewhere really obvious and I'm completely missing the hint.
What file?
Title: Re: DFHack 0.5.14
Post by: Necro910 on May 13, 2011, 10:58:25 pm
Where exactly do I place the file?

I have the feeling that it's somewhere really obvious and I'm completely missing the hint.
What file?
Where do I put DFhack.
Title: Re: DFHack 0.5.14
Post by: jaxad0127 on May 13, 2011, 11:09:31 pm
Where exactly do I place the file?

I have the feeling that it's somewhere really obvious and I'm completely missing the hint.
What file?
Where do I put DFhack.
Anywhere.
Title: Re: DFHack 0.5.14
Post by: Necro910 on May 13, 2011, 11:10:46 pm
Where exactly do I place the file?

I have the feeling that it's somewhere really obvious and I'm completely missing the hint.
What file?
Where do I put DFhack.
Anywhere.
When I try to open/run it, it says my computer doesn't know how. WTF?

EDIT: Does not work. It does not recognize the DEB format. I have no idea what to do.  :'(
Title: Re: DFHack 0.5.14
Post by: devek on May 13, 2011, 11:42:14 pm
Have you tried updating your .net runtime? :P
Title: Re: DFHack 0.5.14
Post by: Necro910 on May 13, 2011, 11:51:00 pm
Have you tried updating your .net runtime? :P
My wut?
Title: Re: DFHack 0.5.14
Post by: kaypy on May 14, 2011, 12:05:44 am
EDIT: Does not work. It does not recognize the DEB format. I have no idea what to do.  :'(
What distro of linux are you running? Or, if you aren't running linux, why not try the windows version?
Title: Re: DFHack 0.5.14
Post by: Necro910 on May 14, 2011, 12:26:50 am
EDIT: Does not work. It does not recognize the DEB format. I have no idea what to do.  :'(
What distro of linux are you running? Or, if you aren't running linux, why not try the windows version?
:-[

Wrong button. Sorry, false alarm everyone!
Title: Re: DFHack 0.5.14
Post by: peterix on May 14, 2011, 08:04:26 am
Ok. everyone makes mistakes :)

Btw, anyone running Ubuntu 11.04 here? I haven't had the time to install the new version yet, so I'd like to know if the 10.10 .deb files work for you.

Btw. I got a bit crazy today and started messing around with DF plants. Two new tools were created as a result:
Code: [Select]
immolate - can turn any plant under the cursor into ashes (default),
           all shrubs (-s), all trees (-t). It has a bonus 'set everything on fire' mode triggered by (-i).
grow     - make all live saplings grow into full trees instantly
It was all in the hopes I'll be able to figure out when the autumn coloration of leaves is active... haven't found that, but I think this stuff will make up for it :P
Title: Re: DFHack 0.5.14
Post by: purpl monstr on May 14, 2011, 07:16:23 pm
My computer wouldn't let me install.

Details:

Spoiler (click to show/hide)
Title: Re: DFHack 0.5.14
Post by: jaxad0127 on May 14, 2011, 07:22:43 pm
Where exactly do I place the file?

I have the feeling that it's somewhere really obvious and I'm completely missing the hint.
What file?
Where do I put DFhack.
Anywhere.
When I try to open/run it, it says my computer doesn't know how. WTF?

EDIT: Does not work. It does not recognize the DEB format. I have no idea what to do.  :'(
What is your OS/distro? DEB is used by Debian Linux and it's derivatives.
Title: Re: DFHack 0.5.14
Post by: peterix on May 14, 2011, 07:32:00 pm
My computer wouldn't let me install.

Details:
Code: [Select]
Lintian check results for /tmp/dfhack_0.5.14-1_ubuntu-10.10-amd64.deb:
E: dfhack: wrong-file-owner-uid-or-gid etc/ 1000/1000
....
Interesting problem... And looking at the install in my VM, I can see the problem too. I'll fix it for the next release.
Actually, scratch that. I'll make the packages now. They will be untested git HEAD though :)

I put the fixed deb packages on github. They are untested git HEAD:
32bit deb (https://github.com/downloads/peterix/dfhack/dfhack_0.5.15-dev1_ubuntu-10.10-i386.deb)
64bit deb (https://github.com/downloads/peterix/dfhack/dfhack_0.5.15-dev1_ubuntu-10.10-amd64.deb)
Title: Re: DFHack 0.5.14
Post by: Quietust on May 14, 2011, 07:59:43 pm
Would it be too much trouble to provide Windows builds that do not pause on exit? After all, there do exist Windows users who run programs from the command prompt rather than by double-clicking on icons...

grow - make all live saplings grow into full trees instantly
How about a tool to delete all trees that are surrounded by water/magma (or at least revert them to saplings)?

On a side note, my current fortress (originally from 0.31.16 or so) has suffered a bizarre ailment - all plant growth on the surface has ceased entirely. What was once a moist tropical broadleaf forest now resembles a red sand desert. I'm not sure if this happened as a result of upgrading to 0.31.25 or if one of the dfhack utilities broke surface plant growth. Underground plant growth is just as strong as ever, though...
Title: Re: DFHack 0.5.14
Post by: peterix on May 14, 2011, 08:05:45 pm
Would it be too much trouble to provide Windows builds that do not pause on exit? After all, there do exist Windows users who run programs from the command prompt rather than by double-clicking on icons...
It would be best to detect how the tool was run and react to that. If you know how, send me an example, and I'll use it for all the supported tools.
Title: Re: DFHack 0.5.14
Post by: devek on May 14, 2011, 08:26:53 pm
My google-fu is strong.

http://stackoverflow.com/questions/558776/detect-script-start-up-from-command-prompt-or-double-click-on-windows
Title: Re: DFHack 0.5.14
Post by: peterix on May 14, 2011, 11:14:10 pm
Right. It's in the code! I used a MS support article thing as the source of info in the end.

How about a tool to delete all trees that are surrounded by water/magma (or at least revert them to saplings)?
Quite possible. I can just make them turn into ash tiles for magma. Saplings, idk. I'll have to test that.
On a side note, my current fortress (originally from 0.31.16 or so) has suffered a bizarre ailment - all plant growth on the surface has ceased entirely. What was once a moist tropical broadleaf forest now resembles a red sand desert. I'm not sure if this happened as a result of upgrading to 0.31.25 or if one of the dfhack utilities broke surface plant growth. Underground plant growth is just as strong as ever, though...
Well, there isn't that much that could cause that in dfhack... did you use dflair?
Title: Re: DFHack 0.5.14
Post by: Truean on May 15, 2011, 12:53:37 am
I have to say the applications of the DF liquids program are huge. I've been spawning obsidian with the wonderful range function en mass and creating buildings. It is slow to add height, but workable once you make it so a dwarf can climb to a given z level in the sky (The game does not "read" sky squares unless a dwarf could conceivably access them for pathfinding/FPS purposes). Working on a very massive fort currently and some interesting things happen:

1.) When creating multiple z level high obsidian blocks to tunnel out for building.... If two z levels have obsidian spawned right on top of each other, the area type will remain "outside light" until you dig out the top z level area Thus you have to spawn, dig, spawn dig. Still worth it though :).

2.) Because of number one above and the walls tiles being stacked one right on top of the other, the wall's information will always read "outside light." This has no appreciable game effect other than shadowing

3.) it is very easy to be off a tad when casting en mass with range function on DF liquids. Use with caution. :)
Title: Re: DFHack 0.5.14
Post by: Quietust on May 15, 2011, 02:24:58 pm
On a side note, my current fortress (originally from 0.31.16 or so) has suffered a bizarre ailment - all plant growth on the surface has ceased entirely. What was once a moist tropical broadleaf forest now resembles a red sand desert. I'm not sure if this happened as a result of upgrading to 0.31.25 or if one of the dfhack utilities broke surface plant growth. Underground plant growth is just as strong as ever, though...
Well, there isn't that much that could cause that in dfhack... did you use dflair?

I did accidentally run dflair once (when trying to run dfliquids) but afterwards I edited the tool to clear the lair flag and reran it, but it didn't help.

I just went back and loaded a savegame backup from 9 years ago (which was played using 0.31.18) and placed a dirt road, and grass hasn't regrown there either. Maybe the bugfix in 0.31.21 "Made grass grow back properly in desert etc. areas (0.31.19 saves will get too much regrowth now)" accidentally made grass stop regrowing in even older saves...
Title: Re: DFHack 0.5.14
Post by: Mysterius on May 15, 2011, 03:04:02 pm
Hello peterix,

I've been using DFhack for monthes now without giving feedback, and i just wanted to thank you for the new autodump tool.
It really made my life easier !  :)
Title: Re: DFHack 0.5.14
Post by: Alem on May 17, 2011, 03:10:34 am
I am getting odd behavior out of my anti-virus, AVG. It is convinced several of the utilities are infected with trojans, but doesn't really give any information on it. I know it sometimes does this with some game patching utilities, convinced they are malware, so I thought I would just throw it out there.
Title: Re: DFHack 0.5.14
Post by: jaxad0127 on May 17, 2011, 04:27:41 am
I am getting odd behavior out of my anti-virus, AVG. It is convinced several of the utilities are infected with trojans, but doesn't really give any information on it. I know it sometimes does this with some game patching utilities, convinced they are malware, so I thought I would just throw it out there.
It probably would. Any tool that modifies another running program is likely to be flagged.
Title: Re: DFHack 0.5.14
Post by: profit on May 17, 2011, 04:30:53 am
I am getting odd behavior out of my anti-virus, AVG. It is convinced several of the utilities are infected with trojans, but doesn't really give any information on it. I know it sometimes does this with some game patching utilities, convinced they are malware, so I thought I would just throw it out there.

I would be more than a little concerned....

I run AVG and it has yet to flag any tool I have downloaded for dwarf fortress... Or complain about any tool or anything..  I use avg because it is fairly reliable and free, but the last false positive I saw with it was an installer from hypercat games... *I ran it sandboxed and I am fairly certain since it changed nothing it was a false positive*

Whatever it is flagging, either you have a detection turned on I don't, I have never used the tool, or it really is something.
Title: Re: DFHack 0.5.14
Post by: cephalo on May 17, 2011, 08:24:35 am
I am getting odd behavior out of my anti-virus, AVG. It is convinced several of the utilities are infected with trojans, but doesn't really give any information on it. I know it sometimes does this with some game patching utilities, convinced they are malware, so I thought I would just throw it out there.

I am getting this too now with the latest version of AVG. I've been using 5.14 since it came out, with no trouble until the latest version of AVG free.
Title: Re: DFHack 0.5.14
Post by: profit on May 17, 2011, 11:22:50 am
I am getting odd behavior out of my anti-virus, AVG. It is convinced several of the utilities are infected with trojans, but doesn't really give any information on it. I know it sometimes does this with some game patching utilities, convinced they are malware, so I thought I would just throw it out there.

I am getting this too now with the latest version of AVG. I've been using 5.14 since it came out, with no trouble until the latest version of AVG free.

Yeah, I just scanned them and I am getting it too now.

I submitted them to AVG for further testing.
Title: Re: DFHack 0.5.14
Post by: cryopyre on May 19, 2011, 12:10:13 am
I looked around for an answer to this, but couldn't find it. In dfprospector-all.bat I cannot see minerals because my cmd screen cuts off due to too many lines of text. How do I fix this? Sorry if it's been answered before, I just couldn't find it.
Title: Re: DFHack 0.5.14
Post by: peterix on May 19, 2011, 12:35:39 am
I looked around for an answer to this, but couldn't find it. In dfprospector-all.bat I cannot see minerals because my cmd screen cuts off due to too many lines of text. How do I fix this? Sorry if it's been answered before, I just couldn't find it.
There should be a scroll bar to the right. Also, clicking on the top-left icon will give you a menu that has the preferences screen as one option. You can set the size there (both current and default).

Also, stupid antivirus is stupid, as expected. If you don't trust stuff, you can grab the source and compile it yourself. All the tools are freely available. I do all builds on a windows 7 VM that has limited access to the network (no shady things).
Title: Re: DFHack 0.5.14
Post by: cryopyre on May 19, 2011, 12:51:26 am
Thank you very much. (For the record, I had to increase the buffer window size).
Title: Re: DFHack 0.5.14
Post by: Andux on May 19, 2011, 12:55:47 am
I looked around for an answer to this, but couldn't find it. In dfprospector-all.bat I cannot see minerals because my cmd screen cuts off due to too many lines of text. How do I fix this? Sorry if it's been answered before, I just couldn't find it.

You could also try redirecting the output to a file; just type dfprospector-all > whatever.txt in your cmd window and any output will go to whatever.txt.
Title: Re: DFHack 0.5.14
Post by: Kaos on May 19, 2011, 10:24:34 am
Is there any tutorial on how to use the dfhack.dll?? what can you do with it? the readme just have a collection of tools and a brief description of them, how are you suposed to make the calls?


If I want to get a list of all the creatures in the game and check their attributes/preferences, etc... what should I use??




Title: Re: DFHack 0.5.14
Post by: jaxad0127 on May 19, 2011, 11:41:10 am
Is there any tutorial on how to use the dfhack.dll?? what can you do with it? the readme just have a collection of tools and a brief description of them, how are you suposed to make the calls?


If I want to get a list of all the creatures in the game and check their attributes/preferences, etc... what should I use??
You should write a tool for that. There is a similar tool in the playground that you can modify. The dll contains the code for the DFHack library that the tools use.
Title: Re: DFHack 0.5.14
Post by: nomad_delta on May 19, 2011, 11:48:29 am
Prospector tool produces precise numbers with nice formatting, supports trees and shrubs. Only lists visible resources by default.ge :) [/size]

omg you're my hero!  I am gonna use the crap outa this.

--nomad_delta
Title: Re: DFHack 0.5.14
Post by: enjia2000 on May 19, 2011, 01:10:33 pm
dfstatus - A dfhack tool that gives you an out of game 'z' status window. Enjoy.

http://www.bay12forums.com/smf/index.php?topic=84960.0
Title: Re: DFHack 0.5.14
Post by: doomchild on May 19, 2011, 02:01:18 pm
dfstatus - A dfhack tool that gives you an out of game 'z' status window. Enjoy.

http://www.bay12forums.com/smf/index.php?topic=84960.0

Oh hell yes.  This is what I initially wanted to do with dfhack.  If you haven't submitted the code for this to the dfhack repo, you definitely should.
Title: Re: DFHack 0.5.14
Post by: Kaos on May 19, 2011, 03:55:39 pm
Is there any tutorial on how to use the dfhack.dll?? what can you do with it? the readme just have a collection of tools and a brief description of them, how are you suposed to make the calls?


If I want to get a list of all the creatures in the game and check their attributes/preferences, etc... what should I use??
You should write a tool for that. There is a similar tool in the playground that you can modify. The dll contains the code for the DFHack library that the tools use.
What does Therapist/Runesmith use to get their data??
Title: Re: DFHack 0.5.14
Post by: jaxad0127 on May 19, 2011, 04:04:56 pm
Is there any tutorial on how to use the dfhack.dll?? what can you do with it? the readme just have a collection of tools and a brief description of them, how are you suposed to make the calls?


If I want to get a list of all the creatures in the game and check their attributes/preferences, etc... what should I use??
You should write a tool for that. There is a similar tool in the playground that you can modify. The dll contains the code for the DFHack library that the tools use.
What does Therapist/Runesmith use to get their data??
Runesmith uses DFHack. Therapist does it itself.
Title: Re: DFHack 0.5.14
Post by: enjia2000 on May 19, 2011, 05:02:45 pm
Oh hell yes.  This is what I initially wanted to do with dfhack.  If you haven't submitted the code for this to the dfhack repo, you definitely should.

As soon as peter gets online in IRC i'll shoot him the pastebin for inclusion.
Title: Re: DFHack 0.5.14
Post by: Kaos on May 19, 2011, 05:40:08 pm
Is there any tutorial on how to use the dfhack.dll?? what can you do with it? the readme just have a collection of tools and a brief description of them, how are you suposed to make the calls?


If I want to get a list of all the creatures in the game and check their attributes/preferences, etc... what should I use??
You should write a tool for that. There is a similar tool in the playground that you can modify. The dll contains the code for the DFHack library that the tools use.
What does Therapist/Runesmith use to get their data??
Runesmith uses DFHack. Therapist does it itself.
I saw a thread about "Therapist dfhack" are they porting it to use the library??
Title: Re: DFHack 0.5.14
Post by: peterix on May 20, 2011, 09:11:39 am
I saw a thread about "Therapist dfhack" are they porting it to use the library??
Well, there /was/ one before, but it died because of people not being nice enough to each other... Is this new?
Title: Re: DFHack 0.5.14
Post by: profit on May 20, 2011, 11:25:10 am
I hope not, it would make Chmod spin if someone converted Dwarf Therapist to a cheat tool...

It is not in his vision statement and while I can see why people would want him or Dwarfengineer to merge it because their GUI is the best, for me, I would be saddened to see their vision perverted into something else.   

They wanted to make a management tool not a cheat tool.    I hope they keep it that way.
Title: Re: DFHack 0.5.14
Post by: JanusTwoface on May 20, 2011, 11:32:14 am
Using DFHack wouldn't by itself make DT any more of a cheat program.

It would just replace the current code for managing the memory editing with DFHack's. As it is, both need to find the new offsets separately on updates (although manual conversion is possible). It'd be nice to just have one memory.XML file though.

Of course the point is pretty much purely academic if there's not someone to do it.
Title: Re: DFHack 0.5.14
Post by: name on May 20, 2011, 02:58:21 pm
Is there any tutorial on how to use the dfhack.dll?? what can you do with it? the readme just have a collection of tools and a brief description of them, how are you suposed to make the calls?


If I want to get a list of all the creatures in the game and check their attributes/preferences, etc... what should I use??
You should write a tool for that. There is a similar tool in the playground that you can modify. The dll contains the code for the DFHack library that the tools use.
What does Therapist/Runesmith use to get their data??
Runesmith uses DFHack. Therapist does it itself.
I saw a thread about "Therapist dfhack" are they porting it to use the library??
What are you asking for help with?? If you need a reference for functions / structures, read the header files?? Or read the example code??
Title: Re: DFHack 0.5.14
Post by: peterix on May 20, 2011, 11:22:08 pm
Is there any tutorial on how to use the dfhack.dll?? what can you do with it? the readme just have a collection of tools and a brief description of them, how are you suposed to make the calls?


If I want to get a list of all the creatures in the game and check their attributes/preferences, etc... what should I use??
You should write a tool for that. There is a similar tool in the playground that you can modify. The dll contains the code for the DFHack library that the tools use.
What does Therapist/Runesmith use to get their data??
Runesmith uses DFHack. Therapist does it itself.
I saw a thread about "Therapist dfhack" are they porting it to use the library??
What are you asking for help with?? If you need a reference for functions / structures, read the header files?? Or read the example code??
Or build with doxygen installed and enabled in cmake. You'll get the docs from that.
Title: Re: DFHack 0.5.14
Post by: flieroflight on May 21, 2011, 09:48:09 am
ive got a problem where the only working command is the spawn magma command. it doesnt even accept '?' or 'help'
any ideas whats wrong?
Title: Re: DFHack 0.5.14
Post by: Rumrusher on May 21, 2011, 09:52:07 am
Have you tried typing "w"
Do you have experience with previous versions of DFhack?
Title: Re: DFHack 0.5.14
Post by: flieroflight on May 21, 2011, 10:02:48 am
Have you tried typing "w"
Do you have experience with previous versions of DFhack?
no first timer with it trying to solve an error that means missing out the walls on one area of my magma stack is spewing magma into the outside world
Title: Re: DFHack 0.5.14
Post by: flieroflight on May 21, 2011, 10:04:50 am
nope, still nothing with it, trying both "w"as you suggested and 'w'
Title: Re: DFHack 0.5.14
Post by: Quietust on May 21, 2011, 10:42:15 am
You don't actually type the quotation marks...
Title: Re: DFHack 0.5.14
Post by: flieroflight on May 21, 2011, 10:53:42 am
/facepalm
Title: Re: DFHack 0.5.14
Post by: Rumrusher on May 21, 2011, 12:35:18 pm

Code: [Select]
Example

You are in fort game mode (0 game mode), managing your fortress (0 control mode) and go into the Esc menu(in Dwarf fortress it's the place where you save the game), You switch to the Adventure game mode (1 game mode in DFmode) and switch to the managing(which is 0), then save the game. You just left a fortress to play as an adventurer. Leaving the site will count the site as abandon and kill off all pets and tamed. If you want to choose who you want to play as then pick up Dfusion and use either the Adv_tools Adventurer changer or the Tools version. Tools version saves you the hassle of stacked creatures which the pointer won't work on very well. While adventurer tools ?Change?  save you hassle for searching for a certain creature that you can plainly see.

Oh you can also return to the fort(the imput to do this is 0,0 or 0,1) if:
 Your adventurer is on the site,
The adventurer/fort members has the is resident flag off.
the adventurer could have the same civ, though this is only vital for making adventurers work at the fort.
 The adventurer on a previously active fort, other forts will work for a few in game days then DF boots you out of fort mode with a  the force abandon.

I take no responsibility of anything that happens as a result of using this tool :P

here my take on the DFmode example, langdon's retire fort trick would be a nice add on to the readme as well.
Title: Re: DFHack 0.5.14
Post by: Fredd on May 21, 2011, 03:10:01 pm
Anyone have a guess to why the latest version of DF Hack is not opening. Downloaded, unzipped fine. When I double click on one the the tools, a small screen flickers into existence for a short time, then nothing. Am using Vista
Title: Re: DFHack 0.5.14
Post by: name on May 21, 2011, 06:40:28 pm
Anyone have a guess to why the latest version of DF Hack is not opening. Downloaded, unzipped fine. When I double click on one the the tools, a small screen flickers into existence for a short time, then nothing. Am using Vista
It sounds like it's opening a command line window to run in and closing it when the program exits (either because it has gone wrong or because it has finished). To see any text it's producing, try running it from the command line: start->run->cmd. (See this link (http://www.sophos.com/support/knowledgebase/article/13195.html) for the basic commands "cd" and "dir". When at the appropriate folder, simply type the filename of the tool to run it). It should output some relevent text to the window, which will stay open.
Title: Re: DFHack 0.5.14
Post by: Fredd on May 21, 2011, 11:02:51 pm
Name, thanks for the effort.It did not work, but your help was appreciated
Title: Re: DFHack 0.5.14
Post by: Thundercraft on May 22, 2011, 12:04:38 am
Anyone have a guess to why the latest version of DF Hack is not opening. Downloaded, unzipped fine. When I double click on one the the tools, a small screen flickers into existence for a short time, then nothing. Am using Vista

Perhaps your anti-virus program is at fault? The reason I suggest this is because the last few pages of the Lazy Newb Pack thread (http://www.bay12forums.com/smf/index.php?topic=59026.945) contain reports of confused users who can't get LNP to download and/or install. It turns out that various anti-virus apps have very recently gotten aggressive in their hatred of memory editing tools like dfhack:
My Anti-virus pops up saying there is some viruses, is this just a flop or should I be worried?
yes, they are false positives.
It's due to DFhack tools being memory editing tools, so some antiviruses think they're viruses.
...after a couple hours of confusion it became apparent that the reason the pack was not downloading is because kaspersky *really* doesn't like DFhacks.
turning web antivirus off for a little while let me download the file correctly, but kaspersky still freaked out and deleted a bunch of files from the DFhacks folder.

Perhaps your anti-virus is intercepting DFhack before it can run?
Title: Re: DFHack 0.5.14
Post by: EmperorJon on May 22, 2011, 05:06:09 am
Can anyone give me a basic talk through how to use DF mode? I'm having problems getting combos that work... I just want to go from adventurer to arena to then go into a companion. Possible?
Title: Re: DFHack 0.5.14
Post by: Truean on May 22, 2011, 09:33:59 am
Can you essentially move your embark by switching to adventurer mode? If you switch back and forth, how do you know what area you'll end up with? [is curious]
Title: Re: DFHack 0.5.14
Post by: EmperorJon on May 22, 2011, 09:45:17 am
I didn't think of that! Science!
Title: Re: DFHack 0.5.14
Post by: name on May 22, 2011, 09:58:28 am
Name, thanks for the effort.It did not work, but your help was appreciated
Generally, the key to solving these things is the question determining how it failed. There's normally either error output to the terminal or a log somewhere (e.g. antivirus log). Though I'm sure it won't be long before they make it impossible to run non-commercial software anyway.
Title: Re: DFHack 0.5.14
Post by: Rumrusher on May 22, 2011, 10:52:56 am
Can anyone give me a basic talk through how to use DF mode? I'm having problems getting combos that work... I just want to go from adventurer to arena to then go into a companion. Possible?
uhh you could, but doing so stops you from saving the game. If you unpause in Arena mode you'll cause every one to be mark independent and be hostile towards one and another make the companion or your adventurer to flip out and murder the other. Your better off using Dfusion for swapping over to a companion.


Can you essentially move your embark by switching to adventurer mode? If you switch back and forth, how do you know what area you'll end up with? [is curious]
Crazy question by moving embark you mean moving the site area which then leads to the question could you access the same menu where you could choose where to embark again using DFmode and do so that you can edit the other forts?
so far what I know is how to save into a mode
Title: Re: DFHack 0.5.14
Post by: Truean on May 22, 2011, 01:01:48 pm
Can you essentially move your embark by switching to adventurer mode? If you switch back and forth, how do you know what area you'll end up with? [is curious]
Crazy question by moving embark you mean moving the site area which then leads to the question could you access the same menu where you could choose where to embark again using DFmode and do so that you can edit the other forts?
so far what I know is how to save into a mode
[/quote]

Kinda. I mean you switch from Fortress Mode to Adventurer Mode, then move around as an Adventurer to a different location. Then, you go back to Fortress Mode. See what I'm saying? When you switch from adventurer mode back to fort mode, how does the program know what the boundaries of the area are for fort mode?
Title: Re: DFHack 0.5.14
Post by: peterix on May 22, 2011, 02:10:04 pm
Kinda. I mean you switch from Fortress Mode to Adventurer Mode, then move around as an Adventurer to a different location. Then, you go back to Fortress Mode. See what I'm saying? When you switch from adventurer mode back to fort mode, how does the program know what the boundaries of the area are for fort mode?
It doesn't. There is no local site. I haven't tried this in a while, but I'd say it crashes :)
Title: Re: DFHack 0.5.14
Post by: Truean on May 22, 2011, 02:18:25 pm
Kinda. I mean you switch from Fortress Mode to Adventurer Mode, then move around as an Adventurer to a different location. Then, you go back to Fortress Mode. See what I'm saying? When you switch from adventurer mode back to fort mode, how does the program know what the boundaries of the area are for fort mode?
It doesn't. There is no local site. I haven't tried this in a while, but I'd say it crashes :)

Hum, interesting. So you can go from fort mode to adventurer mode but not back again then? :)
Title: Re: DFHack 0.5.14
Post by: peterix on May 22, 2011, 02:21:44 pm
Hum, interesting. So you can go from fort mode to adventurer mode but not back again then? :)
I guess if you are careful and return to the same site, it could work. It's like pulling random levers in the fortress control room...
Title: Re: DFHack 0.5.14
Post by: Rumrusher on May 22, 2011, 02:52:25 pm
so far places you can go into fort mode as an adventurer.
the recent embark: okay and safe given you remove the is resident tag and get the civ number right(may need Runesmith to help on that part)
old fortress: will kick you out if spend too long in fort mode but okay for a few in game days.
ANY WHERE: no won't work if you see in the save file where the name of the fort be "SITE" then the game will auto abandon and kill your character if you unpause.
using Dfusion to change the site to a players fort then playing that: should work but needs testing and someone interested in having someone test this.
the game does know the boundaries of the recent embark but only the recent embark and you can go interchange fort mode and adventure mode by saving into the game.

you could also retire a fort by playing as a dead character... or killing the playable character and ending the game while on site.
now I believe there more to this than blood sacrifice though killing one self and ending the game in adventure mode will bypass the abandon and will convert a fortress into a mountain home where the dwarves are free to talk about surroundings and allow the player to retire in the fortress.
Title: Re: DFHack 0.5.14
Post by: Andux on May 22, 2011, 03:27:46 pm
Can anyone give me a basic talk through how to use DF mode? I'm having problems getting combos that work... I just want to go from adventurer to arena to then go into a companion. Possible?
uhh you could, but doing so stops you from saving the game.

I found offsets for the boolean flag that controls saving (http://df.magmawiki.com/index.php/DF2010:Memory_hacking#SDL_versions) (for SDL versions 0.31.18 and up) a while back (http://www.bay12forums.com/smf/index.php?topic=58809.msg2058778#msg2058778), but it seems nobody noticed. :P

Maybe I should pimp out my avatar with, like, flames or explosions or something.

In other news, the unk1 bit of BlockFlags seems to control whether temperature effects (water freezing/boiling, grass/items/dwarves catching on fire, etc.) are calculated for that block.
Title: Re: DFHack 0.5.14
Post by: peterix on May 22, 2011, 03:49:20 pm
Can anyone give me a basic talk through how to use DF mode? I'm having problems getting combos that work... I just want to go from adventurer to arena to then go into a companion. Possible?
uhh you could, but doing so stops you from saving the game.

I found offsets for the boolean flag that controls saving (http://df.magmawiki.com/index.php/DF2010:Memory_hacking#SDL_versions) (for SDL versions 0.31.18 and up) a while back (http://www.bay12forums.com/smf/index.php?topic=58809.msg2058778#msg2058778), but it seems nobody noticed. :P

Maybe I should pimp out my avatar with, like, flames or explosions or something.

In other news, the unk1 bit of BlockFlags seems to control whether temperature effects (water freezing/boiling, grass/items/dwarves catching on fire, etc.) are calculated for that block.
The block flags structure is actually a lot different than previously thought. It's a variable length bit array. I would've used the STL bitset, or just plain structs. Toady rolled his own... and it's far from ideal. Still, it's broken enough to know how many bits are in the bit field precisely :)
Title: Re: DFHack 0.5.14
Post by: Rumrusher on May 22, 2011, 03:51:55 pm
hmm I must have skim that part.
Well still Arena mode still causes a small chance of everybody to go nuts and kill each other.
I wonder if saving into Arena mode would lead to getting the list of creatures back?
Title: Re: DFHack 0.5.14
Post by: Fredd on May 23, 2011, 12:15:10 am
Odditys of odditys. I had downloaded dfhack, and it would not work, as I stated above. Then loaded Lazynewb pack, and Hack worked. Vista must be posessed
Title: Re: DFHack 0.5.14
Post by: Acperience on May 25, 2011, 05:24:20 pm
Whenever I run dfprospector it goes ahead and lists every single unit of everything I have on the embark and the command line runs out of room so I can't scroll up to see what the actual mineral counts are.

Is there any way to have it not show everything?, just minerals. This is my first time using dfprospectoR.
Using Windows7
Title: Re: DFHack 0.5.14
Post by: DrKillPatient on May 25, 2011, 05:44:14 pm
DFprospector has been working fine until just now, and now it's giving me this:

pread failed: can't read 4 bytes at addres 0
errno: 5
terminate called after throwing an instance of 'DFHack::Error::MemoryAccessDenied'
  what():  Invalid memory access @0x0
Aborted

I'm fairly sure nothing's changed since I last made an attempt at prospecting. DFcleanmap doesn't give this error, but fails to do anything.
Title: Re: DFHack 0.5.14
Post by: Andux on May 25, 2011, 06:56:41 pm
Is there any way to have it not show everything?, just minerals.

Looks like you can run it with the -p option (which is not mentioned in the readme for some reason) to skip all the plants stuff. See also: this post about increasing the console buffer size (http://www.bay12forums.com/smf/index.php?topic=58809.msg2281459#msg2281459).

Actually, given the amount of stuff prospector puts out, it might be a good idea to change dfprospector-all.bat to something like
Code: [Select]
echo | dfprospector.exe -a > dfprospector_report.txt
@dfprospector_report.txt
That should automagically pop up the results in notepad (the "echo |" bit is a workaround for the "Press any key to finish." stuff).
Title: Re: DFHack 0.5.14
Post by: nanomars on May 25, 2011, 07:26:46 pm
not work on windows 7 - exit with fatal error
Title: Re: DFHack 0.5.14
Post by: Quietust on May 25, 2011, 08:37:48 pm
I've been noticing odd problems as well with dfprospector utterly failing to parse plant information, though the next release (pulled sources from git and made a build from them) should work properly.
Title: Re: DFHack 0.5.14
Post by: Acperience on May 26, 2011, 01:06:16 am
Is there any way to have it not show everything?, just minerals.

Looks like you can run it with the -p option (which is not mentioned in the readme for some reason) to skip all the plants stuff. See also: this post about increasing the console buffer size (http://www.bay12forums.com/smf/index.php?topic=58809.msg2281459#msg2281459).

Actually, given the amount of stuff prospector puts out, it might be a good idea to change dfprospector-all.bat to something like
Code: [Select]
echo | dfprospector.exe -a > dfprospector_report.txt
@dfprospector_report.txt
That should automagically pop up the results in notepad (the "echo |" bit is a workaround for the "Press any key to finish." stuff).

dfprospector-all crashes when I try your suggestion and also crashes with the -p suffix
I CAN scroll up when using dfprospector.exe, but the info goes beyond the buffer of the scrolling and even when I tried changing the buffer to an absurdly high number, the scroll length stays teh same.
Title: Re: DFHack 0.5.15
Post by: peterix on May 27, 2011, 02:39:30 am
Ok. Another release, again with more tools. I think it should fix some of the bugs (and hopefully not add new ones).
Mass tree destruction is totally possible with the dfimmolate tool and insta-growing saplings into trees with dfgrow.

Veinlook works on windows now... and I added the dfstatus tool: http://www.bay12forums.com/smf/index.php?topic=84960.0
Make sure you set up your cmd.exe to use a sensible buffer/window size when using those.
EDIT:
looks like I'll have to make a fix release. The item ownership removal tool doesn't work.


Should work OK now. It was just a missing offset. The tool actually removes the ownership links now, not just marks the items as 'not owned'. The required offset wasn't added to Windows DF versions.
Title: Re: DFHack 0.5.15
Post by: Grax on May 30, 2011, 12:28:58 pm
Ah, it's fuс king great.

Thank you, Peterix.
Title: Re: DFHack 0.5.15
Post by: Noir on May 31, 2011, 03:29:43 pm
I have this problem with autodump - where the autodumped items become invisible.
They are still there though: if I mass-reclaim their area they are picked up, if I atom-smash them I will get messages for destroyed masterwork items, ecc. - I simply cannot interact with them, they don't show up in the menu when I 'k' over them.

Is this a known problem, or it's just me?

EDIT: saving and reloading makes the items show up again. Mhhh....
Title: Re: DFHack 0.5.15
Post by: peterix on May 31, 2011, 05:33:27 pm
Is this a known problem, or it's just me?

EDIT: saving and reloading makes the items show up again. Mhhh....
Known, not really a problem. I don't mess around with some of the game's data structures. Items are stored globally, and locally for each 16x16 block. I don't move the enties from block to block, so to change the position fully, you need to reload the fort. Apart from not showing up in the menu, it doesn't seem to break anything... so, whatever.
Title: Re: DFHack 0.5.15
Post by: Eldrick Tobin on May 31, 2011, 06:27:00 pm
I have this problem with autodump - where the autodumped items become invisible.
They are still there though: if I mass-reclaim their area they are picked up, if I atom-smash them I will get messages for destroyed masterwork items, ecc. - I simply cannot interact with them, they don't show up in the menu when I 'k' over them.

Is this a known problem, or it's just me?

EDIT: saving and reloading makes the items show up again. Mhhh....

Yeah it's a known issue. The Local Item cache is pretty much in WTF state over the newly moved items.
Title: Re: DFHack 0.5.15
Post by: Dante on May 31, 2011, 07:08:45 pm
I tried to auto-dump the clothes and weapons from a hostile goblin. It made a clothing tile image appear at the target point, but when I saved and reloaded, they hadn't been changed. Is dumping from enemy inventories working for other people?
Title: Re: DFHack 0.5.15
Post by: Andux on May 31, 2011, 11:46:24 pm
While debugging my Pascal interface for DFHack, I found that the current offset for Materials/creature/tile_color is wrong; it should be 0xf8 for DF 0.31.22+.
Title: Re: DFHack 0.5.15
Post by: Noir on June 01, 2011, 03:19:51 am
I tried to auto-dump the clothes and weapons from a hostile goblin. It made a clothing tile image appear at the target point, but when I saved and reloaded, they hadn't been changed. Is dumping from enemy inventories working for other people?

Don't know, I always dumped items from the ground.
Title: Re: DFHack 0.5.15
Post by: Saiko Kila on June 01, 2011, 08:19:15 am
What does "flow forbid" status mean in dfprobe output? It's on some magma or water tiles, but I cannot make sense of it. Also a nitpicking, but dfprobe lists both liquids as "water", which may be slightly misleading.
Title: Re: DFHack 0.5.15
Post by: Rumrusher on June 01, 2011, 12:44:46 pm
Wait if the game could allow jumps across the map if one does the quantum leap exploit, could someone make it so the player could control where he warps to in the travel menu?
Title: Re: DFHack 0.5.15
Post by: peterix on June 01, 2011, 01:14:02 pm
I tried to auto-dump the clothes and weapons from a hostile goblin. It made a clothing tile image appear at the target point, but when I saved and reloaded, they hadn't been changed. Is dumping from enemy inventories working for other people?
I thought I explicitly disallowed that... looks like there was some error in my logic. Problem is, that those items are in creature inventories and the tool *can't* get them out of there. It should've done nothing.

What does "flow forbid" status mean in dfprobe output? It's on some magma or water tiles, but I cannot make sense of it. Also a nitpicking, but dfprobe lists both liquids as "water", which may be slightly misleading.
It should mean that the liquid at that position isn't updated by the game. Combined with the equivalent flag of map blocks, it can be used to stop water from flowing, or make it flow, if it ever gets stuck (a particularly funny bug I only managed to trigger once).

And it really shouldn't list both as water. That's weird.
Title: Re: DFHack 0.5.15
Post by: Dante on June 01, 2011, 06:07:58 pm
I tried to auto-dump the clothes and weapons from a hostile goblin. It made a clothing tile image appear at the target point, but when I saved and reloaded, they hadn't been changed. Is dumping from enemy inventories working for other people?
I thought I explicitly disallowed that... looks like there was some error in my logic. Problem is, that those items are in creature inventories and the tool *can't* get them out of there. It should've done nothing.

Okay, I tested it in as close to the original circumstances as possible and it did nothing, so maybe I got it confused with some other piece of clothing actually being dumped.
Title: Re: DFHack 0.5.15
Post by: Talanic on June 01, 2011, 07:14:01 pm
I'd like to say, "Good job!", and to see if it would be possible to make a particular utility.  Would it be possible to make a Reveal tool that ONLY reveals veins?  Or stone?
Title: Re: DFHack 0.5.15
Post by: Rumrusher on June 01, 2011, 07:23:27 pm
I'd like to say, "Good job!", and to see if it would be possible to make a particular utility.  Would it be possible to make a Reveal tool that ONLY reveals veins?  Or stone?
you mean DFdig?
Title: Re: DFHack 0.5.15
Post by: Talanic on June 01, 2011, 08:45:38 pm
No - rather, a mix of VDig and Reveal.  When you run this theoretical application, it reveals all veins on the map, without issuing a dig order or revealing any tiles that are open.   

Alternatively, the application might reveal all stone of all types on the map, but wouldn't reveal any tiles that were empty.  This would reveal the shape of the Caverns but not actually discover them. 
Title: Re: DFHack 0.5.15
Post by: peterix on June 01, 2011, 09:47:16 pm
No - rather, a mix of VDig and Reveal.  When you run this theoretical application, it reveals all veins on the map, without issuing a dig order or revealing any tiles that are open.   

Alternatively, the application might reveal all stone of all types on the map, but wouldn't reveal any tiles that were empty.  This would reveal the shape of the Caverns but not actually discover them.
That's a damn good idea.
Title: Re: DFHack 0.5.15
Post by: Andux on June 02, 2011, 12:56:38 am
What does "flow forbid" status mean in dfprobe output? It's on some magma or water tiles, but I cannot make sense of it. Also a nitpicking, but dfprobe lists both liquids as "water", which may be slightly misleading.
It should mean that the liquid at that position isn't updated by the game. Combined with the equivalent flag of map blocks, it can be used to stop water from flowing, or make it flow, if it ever gets stuck (a particularly funny bug I only managed to trigger once).

I've done some testing, and it looks like flow_forbid is normally set on tiles with at least 4/7 water*, or with magma of any depth. I haven't seen any effect on flow; that seems to depend entirely on the block flags. It looks like it has more to do with pathfinding/marking dangerous terrain.

*I've occasionally seen it set with less, but not consistently; there's probably a delay or something to help pathfinding deal with rapid fluctuations.
Title: Re: DFHack 0.5.15
Post by: Saiko Kila on June 02, 2011, 03:38:12 am
What does "flow forbid" status mean in dfprobe output? It's on some magma or water tiles, but I cannot make sense of it. Also a nitpicking, but dfprobe lists both liquids as "water", which may be slightly misleading.
It should mean that the liquid at that position isn't updated by the game. Combined with the equivalent flag of map blocks, it can be used to stop water from flowing, or make it flow, if it ever gets stuck (a particularly funny bug I only managed to trigger once).

I've done some testing, and it looks like flow_forbid is normally set on tiles with at least 4/7 water*, or with magma of any depth. I haven't seen any effect on flow; that seems to depend entirely on the block flags. It looks like it has more to do with pathfinding/marking dangerous terrain.

*I've occasionally seen it set with less, but not consistently; there's probably a delay or something to help pathfinding deal with rapid fluctuations.

Yes, I've seen it mostly on 4/7 or more too, but I've found two distinctive exceptions:
1) in my waterway connected to an artificial waterfall (so constantly on move, theoretically) there are tiles without that flag and with it, including 3/7.
2) in top layer of magma, where I removed most magma so all tiles are 2/7 or 3/7 they are all "flow forbid", despite fluctuating between 2/7 and 3/7. I have my pumps off (and had them off for months of game time), so it's natural fluctuation.

And about that water text thing I mean the text bolded in this excerpt from dfprobe output:
Quote
temperature1: 12000 U
temperature2: 12000 U
biome: 4
geolayer: 15
Layer material: 171 / DIORITE /
water: 3
flow forbid
biomestuffs: 0x1ec066c0
Title: Re: DFHack 0.5.15
Post by: Rose on June 02, 2011, 06:42:19 am
if flow_forbit prevents plathfinding, I'd assume it would always be there for magma, no?
Title: Re: DFHack 0.5.15
Post by: Saiko Kila on June 02, 2011, 06:59:57 am
if flow_forbit prevents plathfinding, I'd assume it would always be there for magma, no?

For magma yes, but why it is enabled for certain water tiles? I had a problem, described here http://www.bay12forums.com/smf/index.php?topic=85116.msg2290151#msg2290151 and in earlier posts in this thread. Now, thanks to dfprobe, I've found that these impassable 3/7 files are in fact "flow forbid". It mus be a bug, because normally water level 3/7 should be passable.

Additionally, when dwarves are caught in water (or magma) they can somehow path through these, though not always successfully...
Title: Re: DFHack 0.5.15
Post by: jaxad0127 on June 02, 2011, 01:58:46 pm
What does "flow forbid" status mean in dfprobe output? It's on some magma or water tiles, but I cannot make sense of it. Also a nitpicking, but dfprobe lists both liquids as "water", which may be slightly misleading.
It should mean that the liquid at that position isn't updated by the game. Combined with the equivalent flag of map blocks, it can be used to stop water from flowing, or make it flow, if it ever gets stuck (a particularly funny bug I only managed to trigger once).

I've done some testing, and it looks like flow_forbid is normally set on tiles with at least 4/7 water*, or with magma of any depth. I haven't seen any effect on flow; that seems to depend entirely on the block flags. It looks like it has more to do with pathfinding/marking dangerous terrain.

*I've occasionally seen it set with less, but not consistently; there's probably a delay or something to help pathfinding deal with rapid fluctuations.

Yes, I've seen it mostly on 4/7 or more too, but I've found two distinctive exceptions:
1) in my waterway connected to an artificial waterfall (so constantly on move, theoretically) there are tiles without that flag and with it, including 3/7.
2) in top layer of magma, where I removed most magma so all tiles are 2/7 or 3/7 they are all "flow forbid", despite fluctuating between 2/7 and 3/7. I have my pumps off (and had them off for months of game time), so it's natural fluctuation.

And about that water text thing I mean the text bolded in this excerpt from dfprobe output:
Quote
temperature1: 12000 U
temperature2: 12000 U
biome: 4
geolayer: 15
Layer material: 171 / DIORITE /
water: 3
flow forbid
biomestuffs: 0x1ec066c0
That should probably say liquid level.
Title: Re: DFHack 0.5.15
Post by: Quietust on June 02, 2011, 06:38:08 pm
No - rather, a mix of VDig and Reveal.  When you run this theoretical application, it reveals all veins on the map, without issuing a dig order or revealing any tiles that are open.   

Alternatively, the application might reveal all stone of all types on the map, but wouldn't reveal any tiles that were empty.  This would reveal the shape of the Caverns but not actually discover them.
That's a damn good idea.

You know what else would be nice? An option to reveal all tiles designated for digging so that they will not cancel due to wet/warm stone (e.g. when digging below a river/lake or above the magma sea).
Title: Re: DFHack 0.5.15
Post by: Rumrusher on June 02, 2011, 06:55:49 pm
so would using the object claim removal utility would free up friendly butchered bodies so creatures can use them?
Title: Re: DFHack 0.5.15
Post by: Thundercraft on June 02, 2011, 07:29:21 pm
I have a question about dfcleanowned:
The readme says it:
Quote
Removes the ownership flag from items.
By default, owned food on the floor and rotten items are confistacted and dumped.
Also,
Quote
-d            a dry run. combine with other options to see what will happen without it actually happening.

I tried dfcleanowned with the -d options and it reported "Found total of 6275 items." Since I only used -d by itself, I assum the dry run was for the default setting of "owned food on the floor and rotten items". However, this is a fairly new fort and I doubt that there could possibly be over 6 thousand rotten items and owned food on the floor... Am I misunderstanding something?

Also, a question about dfgrow:
Quote
Makes all saplings present on the map grow into trees (almost) instantly.
I assume that this makes all saplings on the entire map (i.e., all z-levels - even in caverns) grow into trees (or treecaps), correct? If so, perhaps it could be given an option so that it will only affect all saplings on a given z-level (or, perhaps, just what's visible on the game screen)?
Title: Re: DFHack 0.5.15
Post by: Greiger on June 02, 2011, 08:53:52 pm
Since folks are suggesting utilities how bout a cleanmap that only cleans tiles a variable distance from the cursor?  Like when Dwarves won't clean the buzzard blood scattered all over your surface fort but don't wanna get rid of that lovely 5 page long list of goblin and troll blood in front of your front gate.

Place the cursor near a bloodstatter you want cleaned, run Minicleanmap.exe -4 and all contaminants within 4 tiles of your cursor on that z level vanish!  Would be handy for controlled mud removal too, to clean up after that one little meeting hall waterfall mishap from 5 years ago without de-mudifying the caverns.
Title: Re: DFHack 0.5.15
Post by: Andux on June 02, 2011, 08:55:36 pm
Now, thanks to dfprobe, I've found that these impassable 3/7 files are in fact "flow forbid". It mus be a bug, because normally water level 3/7 should be passable.

I think the forbid flag is meant to be somewhat "sticky" to stop dwarves from trying to path through areas that are likely to pop back up to 4/7 while they're halfway through (not that it seems to help much); if it's been hanging around that long, I'd guess it's probably not unset unless the water drops to 2/7 or less.

You could try using Tile Edit to clear the flags manually (though it's called "has liquid" there). I'll see about adding a thingy to do that automatically in the next release of dfmarmot.

If so, perhaps it could be given an option so that it will only affect all saplings on a given z-level (or, perhaps, just what's visible on the game screen)?

You can already use dfmarmot to selectively change saplings into trees (though it doesn't set the plant's internal age counter like dfgrow does); just use the f operation set.
Title: Re: DFHack 0.5.15
Post by: Angel Of Death on June 03, 2011, 09:39:23 am
Where can I find Dfreveal?
Title: Re: DFHack 0.5.15
Post by: Saiko Kila on June 03, 2011, 12:35:19 pm
Now, thanks to dfprobe, I've found that these impassable 3/7 files are in fact "flow forbid". It mus be a bug, because normally water level 3/7 should be passable.

I think the forbid flag is meant to be somewhat "sticky" to stop dwarves from trying to path through areas that are likely to pop back up to 4/7 while they're halfway through (not that it seems to help much); if it's been hanging around that long, I'd guess it's probably not unset unless the water drops to 2/7 or less.

You could try using Tile Edit to clear the flags manually (though it's called "has liquid" there). I'll see about adding a thingy to do that automatically in the next release of dfmarmot.

Seems reasonable, though it probably isn't working reliably in all cases. Maybe "stagnant water" flag is also sticky, because I was unable to make non-stagnant wells, despite having them more than 3 z-levels deep. Stagnant tiles remain stagnant. I let it be for the moment  - I was unable to run Tile Edit with the current version of DF.
Title: Re: DFHack 0.5.15
Post by: Ghills on June 03, 2011, 06:57:51 pm
Where can I find Dfreveal?

Download the tools release linked in the first post in the thread. Extract it somewhere.  Make sure that DF is running and your game is up. I like to run the programs from the command line, but you can also run them by double-clicking on them.
Title: Re: DFHack 0.5.15
Post by: enjia2000 on June 04, 2011, 06:49:54 pm
Where can I find Dfreveal?

You can download lazy newb pack and run it. In the utilities tab you can find all the dfhack tools.
Title: Re: DFHack 0.5.15
Post by: ag on June 05, 2011, 08:28:33 am
Seems reasonable, though it probably isn't working reliably in all cases. Maybe "stagnant water" flag is also sticky, because I was unable to make non-stagnant wells, despite having them more than 3 z-levels deep. Stagnant tiles remain stagnant. I let it be for the moment  - I was unable to run Tile Edit with the current version of DF.

Some findings from my code reverse-engineering results some time ago:
1) flow_forbid for water is only immediately changed if the level is <3 or >3. There may be some other code that clears it for 3 after a time-out, or maybe not.
2) Stagnancy always spreads to neighboring tiles, like saltiness.
Title: Re: DFHack 0.5.15
Post by: Greiger on June 05, 2011, 08:43:51 am
That explains why my river is all stagnant despite full flow.  It intersects through a murky pool.

(http://www.img.ie/images/14347.jpg) (http://www.img.ie/)
Title: Re: DFHack 0.5.15
Post by: SecretAgentTripleZero on June 06, 2011, 06:40:12 pm
I'm wondering...would it be possible, in DFliquids, to replace the (o)bsidian option with another stone?
I think it would be, and I'd probably do it myself, except I'm not really sure what I would change it with, what I should change, or what I would change it to...
...IS this even possible? I don't see any reason why it wouldn't be, but then again I'm not exactly a fully-fledged programmer(as in, I just randomly absorbed some information about programming, and can somewhat read what some programs do, given the code, and I know that it is possible in some cases that replacing certain values with certain others (as in replace the value for obsidian wall w/ adamantine wall) can produce a desired effect).
...and for the record, what were the undocumented commands "starruby" and "darkhide" originally going to do, anyway?
(No, I didn't discover them myself, someone else posted them.)
Title: Re: DFHack 0.5.15
Post by: Truean on June 06, 2011, 09:33:51 pm
I'm wondering...would it be possible, in DFliquids, to replace the (o)bsidian option with another stone?
I think it would be, and I'd probably do it myself, except I'm not really sure what I would change it with, what I should change, or what I would change it to...
...IS this even possible? I don't see any reason why it wouldn't be, but then again I'm not exactly a fully-fledged programmer(as in, I just randomly absorbed some information about programming, and can somewhat read what some programs do, given the code, and I know that it is possible in some cases that replacing certain values with certain others (as in replace the value for obsidian wall w/ adamantine wall) can produce a desired effect).
...and for the record, what were the undocumented commands "starruby" and "darkhide" originally going to do, anyway?
(No, I didn't discover them myself, someone else posted them.)

I actually asked this before when I requested the range function. From what I understand it's possible but not a priority currently. It would take a fairly large amount of time to get all the offsets for the various types of stone as well as soils. Then you'd have to figure out a way to select which material you'd be putting in.... Otherwise you could totally make your own map and have it composed of just about anything.


[drools]
Title: Re: DFHack 0.5.15
Post by: jaxad0127 on June 06, 2011, 09:38:26 pm
I'm wondering...would it be possible, in DFliquids, to replace the (o)bsidian option with another stone?
I think it would be, and I'd probably do it myself, except I'm not really sure what I would change it with, what I should change, or what I would change it to...
...IS this even possible? I don't see any reason why it wouldn't be, but then again I'm not exactly a fully-fledged programmer(as in, I just randomly absorbed some information about programming, and can somewhat read what some programs do, given the code, and I know that it is possible in some cases that replacing certain values with certain others (as in replace the value for obsidian wall w/ adamantine wall) can produce a desired effect).
...and for the record, what were the undocumented commands "starruby" and "darkhide" originally going to do, anyway?
(No, I didn't discover them myself, someone else posted them.)

I actually asked this before when I requested the range function. From what I understand it's possible but not a priority currently. It would take a fairly large amount of time to get all the offsets for the various types of stone as well as soils. Then you'd have to figure out a way to select which material you'd be putting in.... Otherwise you could totally make your own map and have it composed of just about anything.


[drools]
It's harder than that. Only obsidian can be explicitly spawned. Everything else has to be part of a vein or layer. You can turn stuff into stone, but not select the stone yet. dftiletypes allows it (brush material to stone, brush shape to wall).
Title: Re: DFHack 0.5.15
Post by: Rumrusher on June 06, 2011, 10:19:42 pm
andux you said you found the file to bring back saving any news on finding out adventure retiring?
Title: Re: DFHack 0.5.15
Post by: Andux on June 08, 2011, 12:43:02 am
andux you said you found the file to bring back saving any news on finding out adventure retiring?

I haven't found what controls retiring yet; there doesn't seem to be a global "can retire" flag, so I suspect it's something in the creature data (maybe a site membership field that needs to be cleared?).
Title: Re: DFHack 0.5.15
Post by: Rumrusher on June 08, 2011, 01:02:22 am
andux you said you found the file to bring back saving any news on finding out adventure retiring?

I haven't found what controls retiring yet; there doesn't seem to be a global "can retire" flag, so I suspect it's something in the creature data (maybe a site membership field that needs to be cleared?).
weird for body swaping the civ members  don't allow such a thing or bodyswaping old adventurers I guess it's trigger by the mode it self and targets one creature at a time.
Title: Re: DFHack 0.5.15
Post by: Root Infinity on June 08, 2011, 06:15:13 am
Why doesn't DFLiquids reset the occupied flag when it removes liquids?

EDIT:
And for the DFAutoDump tool would it be possible to have a flag to only destroy items (stone) that haven't been built into something?
Title: Re: DFHack 0.5.15
Post by: peterix on June 08, 2011, 07:59:32 am
Why doesn't DFLiquids reset the occupied flag when it removes liquids?
Why? I see no relation between creatures and liquids.
EDIT:
And for the DFAutoDump tool would it be possible to have a flag to only destroy items (stone) that haven't been built into something?
That's the default AFAIK. Turning it off doesn't make sense.
Title: Re: DFHack 0.5.15
Post by: Naros on June 09, 2011, 11:21:08 pm
Is there any chance of a module for DFhack that does something like this:
http://df.magmawiki.com/index.php/Utility:For_Each_Tile

I'm basically just after the "replace all tiles of type X to type Y" functionality.
For example, I want all the granite on the map to be obsidian instead, and that gold to be platinum.

Though the conditions you could set for it, like limiting the action to "in viewport" or "on current level" would also be nice.

edit:
Just read about dfmarmot. Not sure to what extent it does what I want, but I'll check it out and will add it to the utility list on the wiki.
I should list it as a seperate utility, or a DFhack module?

(I'll also see about reorganizing and listing all the DFhack modules in a compact manner on the wiki)
Title: Re: DFHack 0.5.15
Post by: peterix on June 10, 2011, 08:11:09 am
Is there any chance of a module for DFhack that does something like this:
http://df.magmawiki.com/index.php/Utility:For_Each_Tile

I'm basically just after the "replace all tiles of type X to type Y" functionality.
For example, I want all the granite on the map to be obsidian instead, and that gold to be platinum.

Though the conditions you could set for it, like limiting the action to "in viewport" or "on current level" would also be nice.

edit:
Just read about dfmarmot. Not sure to what extent it does what I want, but I'll check it out and will add it to the utility list on the wiki.
I should list it as a seperate utility, or a DFhack module?

(I'll also see about reorganizing and listing all the DFhack modules in a compact manner on the wiki)
OK. Let's clear some things up first.
DFHack isn't Tweak. DFHack modules are only visible to developers and there is nothing the user would ever see of them save for some error messages when things break. Modules are parts of the DFHack API and they basically break it down into manageable chunks. What you're thinking about there are /tools/. Everything that uses DFHack and communicates with the user is a tool.

Anyway, I'm very unlikely to add anything like this to DFHack as a module - it just doesn't make sense. As a tool it would be fine, maybe with the filtering part shared with other tools. For this to happen, I'll have to figure out how to do GUI tools across platforms and get them to the users first...
Title: Re: DFHack 0.5.15
Post by: Naros on June 10, 2011, 01:22:32 pm
As a user, the exact nomenclature is of little consequence to me.
I mean no offence, and what you're doing is awesome and much appreciated, but people do tend to be a bit random when it comes to naming things. :)
Though I'll stick to your preferred names on the wiki, of course.

The dfliquids command line tool is easy to understand, and it works. Such a system would work for this tool as well. I think that would be much easier than trying to figure out a cross-platform GUI.
GUIs are handy, and I wouldn't say they're overrated, but they are a luxury that the majority of DF players can do without.
Title: Re: DFHack 0.5.15
Post by: peterix on June 10, 2011, 02:15:27 pm
As a user, the exact nomenclature is of little consequence to me.
Still, it's good to have an agreed upon way to call things. In case of Tweak, it made sense to talk about modules, because it was a single GUI tool that could be extended with those. In case of DFHack, for example there's the Items module, which allows you to to mess with the DF items. If I was the author of Tweak, I'd call the modules 'plugins'. Mainly because with modules, I expect them to be parts of a fixed system - parts without which it simply won't work, but still distinct parts. Plugins on the other hand are things you can add to some already existing system to extend it.

I won't rule out the possiblity of having a GUI tool that can be extended with plugins :D
The dfliquids command line tool is easy to understand, and it works. Such a system would work for this tool as well. I think that would be much easier than trying to figure out a cross-platform GUI.
GUIs are handy, and I wouldn't say they're overrated, but they are a luxury that the majority of DF players can do without.
dfliquids is very minimal when it comes to user interaction. To do anything more involved, I really need a GUI, even if it's something custom-made using curses (dfstatus and dfveinlook use that). Without using something like Qt or some extension of curses, I'd be reinventing the wheel by having to implement really basic things.

To be honest, I'm figuring out what to do next right now. I have no idea what it will be.
Title: Re: DFHack 0.5.15
Post by: Quietust on June 10, 2011, 02:18:53 pm
For changing tile types, the only situation in which you could change an individual tile to a specific material would be to create obsidian (or ice, but that would have its own issues). In every other situation, you can only modify multiple tiles at once, whether it be a mineral vein, gem cluster, or the entire layer.

It helps to read this table (http://df.magmawiki.com/index.php/DF2010:Tile_types_in_DF_memory) and understand how the game actually deals with tile types - walls can only be made of "lava stone" (i.e. obsidian), "map feature" (adamantine or slade, depending on the map feature), "layer stone" (e.g. granite, chalk, etc., depending on the biome/layer), "mineral" (large clusters, veins, small clusters, or individual tiles), or ice (which also needs to keep track of what was underneath, otherwise it melts and turns into glitchy "Unknown").

Without allocating new memory into the game (in such a way that doesn't result in a crash then the game itself tries to deallocate it), you cannot add new mineral veins or map features.
Title: Re: DFHack 0.5.15
Post by: peterix on June 10, 2011, 02:23:05 pm
Without allocating new memory into the game (in such a way that doesn't result in a crash then the game itself tries to deallocate it), you cannot add new mineral veins or map features.
You can sort of get by by stealing already existing objects. Like veins for example. Nobody will miss that microcline vein object #34411. It should be also possible to paint just about any type of rock by sacrificing an adamantine vein. It's kinda messy though.
Title: Re: DFHack 0.5.15
Post by: Truean on June 10, 2011, 07:21:05 pm
What I find interesting is everyone asking for various things when he does this for us for free and at the expense of his time.

A little history
All of the functionality people are asking for, there is a fundamental misunderstanding with this:

DFHACK was not primarily intended as a major end user program. Rather, I understand it was originally intended as a background program to allow OTHERS to make major end user programs, aka "Tools." DFHack was the foundation for those tools and still is the foundation for many, (Tweak, Stonesense, etc).

The current situation:
In short, Petrix is the one who enables OTHER to make neat tools. What is increasingly missing now is the OTHER PEOPLE part, other programmers. I don't believe Rick has updated Tweak, the stonesense development team is kind of burned out and most of the other tool making programmers have left the scene. In fact, Petrix has posted saying he might be so nice as to help with updating stonesense too.

Edit: Crap, my tags are screwed up and most of this appears bolded. I apologize for that.

My worry:
Most of our programmers and contributors are overburdened right now, and Petrix is taking on extra duties. This guy does some great stuff for us for really nothing. Let's not ask a whole bunch of him when he's already looking into doing some extra stuff like Stonesense.

Suggestion:
Other than giving this dude a freaking metal, we could consider a casting call for programmers to help with open source code tools and modules for DF. Currently we have Petrix, Deon, Japa, Immortal_Tokel, Nixer, Javathemutt and some others, but frankly I don't even think some of the people listed above have accounts anymore.

Bottom Line
If we as a community want additional features in mods/tools, we might have to think about HOW to get and maintain them, preferably without overburdening our already very nice code contributors.
Title: Re: DFHack 0.5.15
Post by: Naros on June 10, 2011, 07:46:38 pm
Truean, this is the DFHack thread. This is the place to ask for things, to see if someone wants to make a tool. This person does not have to be peterix.
Though drastically new features will require him to add additional support for something or other, and thus will give him some work to do either way.

In the end, it's a request, nothing more. If I get a 'no', I won't be offended and I doubt he or any tool makers will feel offended by the requests, as long as they are requests, not demands.
As for me, I haven't coded anything in ages, and I've only ever been a web-developer, so don't look at me!

Peterix, I'm probably being overly obvious but, Quietust suggestion of just changing the layer stone alone would already make me very happy.

Quote from: peterix
To be honest, I'm figuring out what to do next right now. I have no idea what it will be.

Whatever you decide, you'll have our gratitude. Not trying to be a suckup here, but hey, rock on dude. <3

P.S. I can't argue with your logic on naming things, so I won't. ^_^
Title: Re: DFHack 0.5.15
Post by: Truean on June 10, 2011, 09:11:37 pm
I'm not saying people are being unreasonable to request things, I'm focusing on how to get those requests without overburdening programmers.

My focus was on getting more talent into the pool from others.
Title: Re: DFHack 0.5.15
Post by: Rumrusher on June 10, 2011, 09:27:40 pm
I'm not saying people are being unreasonable to request things, I'm focusing on how to get those requests without overburdening programmers.

My focus was on getting more talent into the pool from others.
weird thing is about changing the type of stone was done in Dtil way back, Some thing about swapping a stone with another was lost during that time when 31. series came in.
Andux who works on tweak pops in some time to help, PM him or ask him directly in this thread on if he going to work on a Vein Changer utility?
Title: Re: DFHack 0.5.15
Post by: Truean on June 10, 2011, 09:43:08 pm
I'm not saying people are being unreasonable to request things, I'm focusing on how to get those requests without overburdening programmers.

My focus was on getting more talent into the pool from others.
weird thing is about changing the type of stone was done in Dtil way back, Some thing about swapping a stone with another was lost during that time when 31. series came in.
Andux who works on tweak pops in some time to help, PM him or ask him directly in this thread on if he going to work on a Vein Changer utility?

Actually, that's a good point. I had forgotten that Andux was dealing with Tweak. I don't think he's updated it for 31.XX though. I could be wrong. Although, if I remember correctly, the tile changing utility was difficult to use, because a.)you had to individually edit each and every tile by going into a submenu and typing in the four digit/character reference for each type of material, b.) you could only do it one square at a time, c.) it sometimes screwed up pathing, d.) you couldn't create individual ore stone tiles (Sidenote: I love DFLiquid's new range function for magma/water/obsidian casting).

That said, it would be wonderful if Andux would be so kind as to look into this.

Great comment.
Title: Re: DFHack 0.5.15
Post by: arclance on June 11, 2011, 12:28:36 am
The source on github is only up to 0.5.14. 
Any timeline on when the 0.5.15 source will be up?
dfstatus looks interesting I would like to check it out, but no source...
Title: Re: DFHack 0.5.15
Post by: Andux on June 11, 2011, 01:00:27 am
A vein changer would definitely be doable; I've already been working on a basic vein viewer for the next release of dfmarmot.

As for changing layer stone: As I understand it, the type of layer stone (or soil) you get is determined by the tile's biome and geolayer_index designations. I think biome might be an index into the block's biome_indices array; if so, one could create tiles of any arbitrary layer stone by inserting new data into an unused biome_indices slot. That may be horribly wrong, though; I'm still trying to make sense of this (http://www.bay12forums.com/smf/index.php?topic=608.msg253284#msg253284).
Title: Re: DFHack 0.5.15
Post by: peterix on June 11, 2011, 02:11:08 am
Well. I decided to experiment a bit... get crazy :)

Here are the problems currently plaguing DFHack:

So, what's the solution?

A crazy experiment.... just throwing stuff at a wall and seeing what sticks, Cave Johnson style... without the exploding lemons though. I'll have to figure things out as I go, because there's a lot of problems to solve not listed here.

I expect the new DF version to break quite a bit of stuff. I also expect it to be hilariously buggy. That should give me some time for working on core DFHack. And yes. I'm done with all the uni finals... so I actually have some time for all this. It will be fun :)

Expect explosions.
The source on github is only up to 0.5.14. 
Any timeline on when the 0.5.15 source will be up?
dfstatus looks interesting I would like to check it out, but no source...
It's there. I just forgot to make a named version. Take current git HEAD.
A vein changer would definitely be doable; I've already been working on a basic vein viewer for the next release of dfmarmot.

As for changing layer stone: As I understand it, the type of layer stone (or soil) you get is determined by the tile's biome and geolayer_index designations. I think biome might be an index into the block's biome_indices array; if so, one could create tiles of any arbitrary layer stone by inserting new data into an unused biome_indices slot. That may be horribly wrong, though; I'm still trying to make sense of this (http://www.bay12forums.com/smf/index.php?topic=608.msg253284#msg253284).
Don't, you don't have to. Reading DFHack sources is better. Look at the Maps module. It's a horribly convoluted scheme, but in the end, it's just this: tile biome is index into an array of numbers stored in the block. Those in turn determine the positional offset at which the real source of biome is, relative to the current region (where region = 16x16 embark squares). This offset can be from -1 to +1 in both X and Y coordinates. Geolayer index is then the index of the geological layer. So, all you can do is change the geology of a whole biome, or change the layer and biome of a tile to one present near the current region. There is no way around this... and the ASM code looked horrible because Toady uses signed integers where he shouldn't.

Oh, and a vein changer would be trivial. I can make one today.
Title: Re: DFHack 0.5.15
Post by: Rumrusher on June 11, 2011, 02:20:04 am
I'm not saying people are being unreasonable to request things, I'm focusing on how to get those requests without overburdening programmers.

My focus was on getting more talent into the pool from others.
weird thing is about changing the type of stone was done in Dtil way back, Some thing about swapping a stone with another was lost during that time when 31. series came in.
Andux who works on tweak pops in some time to help, PM him or ask him directly in this thread on if he going to work on a Vein Changer utility?

Actually, that's a good point. I had forgotten that Andux was dealing with Tweak. I don't think he's updated it for 31.XX though. I could be wrong. Although, if I remember correctly, the tile changing utility was difficult to use, because a.)you had to individually edit each and every tile by going into a submenu and typing in the four digit/character reference for each type of material, b.) you could only do it one square at a time, c.) it sometimes screwed up pathing, d.) you couldn't create individual ore stone tiles (Sidenote: I love DFLiquid's new range function for magma/water/obsidian casting).

That said, it would be wonderful if Andux would be so kind as to look into this.

Great comment.
He updated it to 31.xx, I only got it to work for 31.21 on a Xp pc before the whole thing stop responding on my Win 7 pc. I used it mainly for quick adventure mode fixes and was the key to what is now a staple for non scatter items.
Warning - while you were typing a new reply has been posted. You may wish to review your post.

Quote
I will move all of DFHack *into* DF itself - this should solve 1., because the data access will be direct (and unprotected, putting greater emphassis on testing).
Does this mean we have to place a Dfhack folder inside all DF folders or you need to do this once on one and DFhack can be access through any other copies of the same version of Dwarf fortress?
Title: Re: DFHack 0.5.15
Post by: Greiger on June 11, 2011, 08:54:34 am
That's....that's even possible?  I didn't know you could merge a program into another program without being able to change the source of the second program, am I just horribly misinformed?  Or do you have Toady assisting with it or something?

Anyway that sounds pretty awesome.  Hope that's easier than it all sounds peterix, we'd hate to lose you to a failed mood. :)   *assigns war dogs just in case*
Title: Re: DFHack 0.5.15
Post by: narhiril on June 11, 2011, 09:04:42 am
I'd just like to say dfcleanowned is the best thing I've ever used.  Ever.  At least, until the next release :)
Title: Re: DFHack 0.5.15
Post by: Artanis00 on June 11, 2011, 09:23:58 am
[W]e'd hate to lose you to a failed mood. :)   *assigns war dogs just in case*

That's a hilarious mental image.

Peterix cancels DFHack: too insane
Peterix begins throwing a tantrum!
www.bay12forums.com cancels request: interrupted by Peterix
Peterix drives a truck through www.bay12forums.com's security holes, breaking Apache and corrupting the database! The severed config file sails off in an arc!

note: I have no knowledge of www.bay12forums.com security holes, nor whether or not one could drive a truck through the alleged security holes.
Title: Re: DFHack 0.5.15
Post by: Greiger on June 11, 2011, 09:40:19 am
Even should he just go melancholy the whole forum might tantrum spiral,  I mean for the short time he was banned chained in the jail during 'that which shall not be named' there was a pretty strong effect.
Title: Re: DFHack 0.5.15
Post by: profit on June 11, 2011, 10:19:39 am
That's....that's even possible?  I didn't know you could merge a program into another program without being able to change the source of the second program, am I just horribly misinformed?  Or do you have Toady assisting with it or something?

Anyway that sounds pretty awesome.  Hope that's easier than it all sounds peterix, we'd hate to lose you to a failed mood. :)   *assigns war dogs just in case*

It is possible, just not as Petrix thinks. 

You have to lay out the two exe's assembly code, change the ones references so they do not conflict with the other. Then add jmp instructions inside the code after the first one initializes to hit up the next one..   

I have honestly never seen this done on such a scale before.

hackers use loaders grafted onto protected exe's sometimes to change some bytes at runtime in order to defeat copy protections and to create trainers... however this is really a whole other ball of wax and will require excellent assembly skills on Petrix's part (not that he does not already have decent ones as shown with his memory editing and reading)

I suppose if he stole the source to dwarf fortress somehow or maybe dissembled the exe (it has been done) he might be able to recompile with his changes. 

Either way, it is a lot of work as far as I know.
Title: Re: DFHack 0.5.15
Post by: Justiceface on June 11, 2011, 10:40:01 am
I'd really like to get this working in Linux.  I'm running Lucid and apparently my edition of libncursesw5 isn't enough to make DFHack happy.  Is there a version that runs on Lucid?
Title: Re: DFHack 0.5.15
Post by: peterix on June 11, 2011, 11:02:50 am
That's....that's even possible?  I didn't know you could merge a program into another program without being able to change the source of the second program, am I just horribly misinformed?  Or do you have Toady assisting with it or something?

Anyway that sounds pretty awesome.  Hope that's easier than it all sounds peterix, we'd hate to lose you to a failed mood. :)   *assigns war dogs just in case*

It is possible, just not as Petrix thinks. 

You have to lay out the two exe's assembly code, change the ones references so they do not conflict with the other. Then add jmp instructions inside the code after the first one initializes to hit up the next one..   

I have honestly never seen this done on such a scale before.

hackers use loaders grafted onto protected exe's sometimes to change some bytes at runtime in order to defeat copy protections and to create trainers... however this is really a whole other ball of wax and will require excellent assembly skills on Petrix's part (not that he does not already have decent ones as shown with his memory editing and reading)

I suppose if he stole the source to dwarf fortress somehow or maybe dissembled the exe (it has been done) he might be able to recompile with his changes. 

Either way, it is a lot of work as far as I know.
Sorry, but I'm not trying to change what DF does, just add more stuff to it. I can do this with no silly assembly, the source, or any of that crud :P All I really need is a bunch of C calls to hook. Ideally one that's called when DF starts, one when it shuts down (just to be nice and clean up after myself), and one when it's done with a simulation frame. I have that, so all that I need is a plain old C++ compiler. The OS-provided dynamic linker will do all the hard work. Library wrappers FTW.
I'd really like to get this working in Linux.  I'm running Lucid and apparently my edition of libncursesw5 isn't enough to make DFHack happy.  Is there a version that runs on Lucid?
You need that only for dfstatus and dfveinlook AFAIK. Rest should work. Just grab the 10.10 package.
Title: Re: DFHack 0.5.15
Post by: Justiceface on June 11, 2011, 11:41:14 am
Quote
I'd really like to get this working in Linux.  I'm running Lucid and apparently my edition of libncursesw5 isn't enough to make DFHack happy.  Is there a version that runs on Lucid?
You need that only for dfstatus and dfveinlook AFAIK. Rest should work. Just grab the 10.10 package.
It won't even install.  I opened the .deb in GDebi and get this:
Quote
Error: Dependency is not satisfiable: libncursesw5 (>=5.7+20100313)
I have the latest version of ncurses available to me on Lucid.  I tried to force a different version to install, but Synaptic doesn't allow that either (option greyed out).
Title: Re: DFHack 0.5.15
Post by: peterix on June 11, 2011, 12:17:17 pm
I have the latest version of ncurses available to me on Lucid.  I tried to force a different version to install, but Synaptic doesn't allow that either (option greyed out).
OK. Guess I don't know which ubuntu is lucid. Anyway, you can build your own package :)
Here's how:
Start with fresh dfhack sources.
Code: [Select]
mkdir -p build/ubuntu && cd build/ubuntu
ccmake ../..
This will show some 'stuff'. Hit 'c' for configure, then set up all the pieces to look like this:
Code: [Select]
BUILD_DFHACK_C_BINDINGS         *ON                                           
 BUILD_DFHACK_DEVEL              *ON                                           
 BUILD_DFHACK_DOXYGEN            *OFF                                         
 BUILD_DFHACK_EXAMPLES           *OFF                                         
 BUILD_DFHACK_LIBRARY            *ON                                           
 BUILD_DFHACK_PLAYGROUND         *OFF                                         
 BUILD_DFHACK_PYTHON_BINDINGS    *OFF                                         
 BUILD_DFHACK_SUPPORTED          *ON                                           
 CMAKE_BUILD_TYPE                *Release                                     
 CMAKE_INSTALL_PREFIX            */usr                                         
 DFHACK_INSTALL                  *ubuntu-10.10                                 
 MEMXML_DATA_PATH                */usr/share/dfhack                           
 X11_LIBRARY                     */usr/lib/libX11.so                         
Hit 'c' and 'g' for generate, then run:
Code: [Select]
fakeroot make package
You'll end up with a deb package for your ubuntu version. You might have to install ccmake/cmake, fakeroot and a whole pile of different -dev packages tho. See the COMPILE file for details on that.
Title: Re: DFHack 0.5.15
Post by: arclance on June 11, 2011, 01:21:10 pm
The source on github is only up to 0.5.14. 
Any timeline on when the 0.5.15 source will be up?
dfstatus looks interesting I would like to check it out, but no source...
It's there. I just forgot to make a named version. Take current git HEAD.
How would I do that?  I have had no luck trying to figure it out.
Title: Re: DFHack 0.5.15
Post by: peterix on June 11, 2011, 02:18:58 pm
The source on github is only up to 0.5.14. 
Any timeline on when the 0.5.15 source will be up?
dfstatus looks interesting I would like to check it out, but no source...
It's there. I just forgot to make a named version. Take current git HEAD.
How would I do that?  I have had no luck trying to figure it out.
https://github.com/peterix/dfhack -> downloads -> download zip/tar.gz1 ... it's right there.
Title: Re: DFHack 0.5.15
Post by: arclance on June 11, 2011, 03:04:41 pm
https://github.com/peterix/dfhack -> downloads -> download zip/tar.gz1 ... it's right there.
I tried that before and got this.
Spoiler (click to show/hide)
When I compile I get the 0.5.14 executables.  The new ones like dfstatus are not built.
Title: Re: DFHack 0.5.15
Post by: peterix on June 11, 2011, 03:46:48 pm
When I compile I get the 0.5.14 executables.  The new ones like dfstatus are not built.
OK. I added the version tag, so it should be fine now. I thought it would give you the current stuff... looks like I was wrong :)
Title: Re: DFHack 0.5.15
Post by: daego on June 11, 2011, 11:42:26 pm
I'm using World::ReadCurrentMonth and ReadCurrentDay, but I'm getting really bizarre results in Windows/31.25 SDL.

My fort is currently Year 357 Month 1 Day 14, but the above functions (and via `dfposition`) yield Year 357 Month 0 Day 2 (Tick 1619).

After some playing around, I can see that the math in World.cpp doesn't seem to work out. Tick 1018 = month 1 day 9, tick = 1204 month = 1 day 11, tick = 1457 month = 1 day = 13.

Could tick be from the time the game was last loaded?
Title: Re: DFHack 0.5.15
Post by: Quietust on June 12, 2011, 11:49:02 am
It sounds like the date function used in dfposition is using 1200 ticks per day instead of 120 (and failing to start the month at 1 instead of 0) - if I take 1619 and divide it by 120 (ticks per day), I get ~13.5, which would match "month 1 day 14".
Title: Re: DFHack 0.5.15
Post by: trainerblu on June 12, 2011, 12:51:57 pm
When I try to run dfautodump I get the error: "memory object is INVALID: type address key /Items/items_vector". I... have no idea what to do.
I'm running DF v0.31.21 on Windows 7 32-bit.
Title: Re: DFHack 0.5.15
Post by: peterix on June 12, 2011, 01:35:04 pm
It sounds like the date function used in dfposition is using 1200 ticks per day instead of 120 (and failing to start the month at 1 instead of 0) - if I take 1619 and divide it by 120 (ticks per day), I get ~13.5, which would match "month 1 day 14".
Bad offset AFAIK. Only thing using this is stonesense, for calculating which color to use for dwarf hair. Anyone willing to mess with some offsets, go ahead :)
When I try to run dfautodump I get the error: "memory object is INVALID: type address key /Items/items_vector". I... have no idea what to do.
I'm running DF v0.31.21 on Windows 7 32-bit.
Items are supported from 31.22 forward. Full and tested support is only for 31.25.
Title: Re: DFHack 0.5.15
Post by: peterix on June 12, 2011, 04:58:44 pm
THE MONSTER LIVES!

http://www.youtube.com/watch?v=MKF8SxXc7lk
Title: Re: DFHack 0.5.15
Post by: Naros on June 13, 2011, 12:14:11 pm
:o

Let us hope you can keep the beast under control!
Title: Re: DFHack 0.5.15
Post by: profit on June 13, 2011, 02:10:54 pm
THE MONSTER LIVES!

http://www.youtube.com/watch?v=MKF8SxXc7lk

Ok, I am officially impressed.  Not that the hack tools were not pretty awesome before... Awesome enough to make it to my "Must have" section in my mods.. 

But that is really something else.
Title: Re: DFHack 0.5.15
Post by: Hypotheses on June 14, 2011, 03:23:23 am
Hola.  This is my first time using this toolkit - dfprospector specifically.  When I run the .bat file the resulting .txt only has one line:

GetConsoleScreenBufferInfo failed: 6

I'm running .25 w/ Ironhand and therapist in the background, and I paused the game before doing anything else.  What am I missing here?

[edit:]  It seems DF crashed when I ran the prospector.  Half an hour later, I gave up waiting and hard closed the game.  Thankfully I'm not losing more than a crappy artifact.
Title: Re: DFHack 0.5.15
Post by: Grax on June 14, 2011, 06:06:49 am
Just encountered that TUBEFILL doesn't work as it intended.

The story:
1. Run DF, start/load game.
2. Run DFTUBEFILL.
3. Dig the blues in a place that were empty tunnel in the blues tunnel before TUBEFILL (reveal/unreveal to check at start).

4. Fcking PROFIT!

(http://gyazo.com/e8d5a194d139cd99a450b8c12024ceff.png)
Title: Re: DFHack 0.5.15
Post by: peterix on June 14, 2011, 06:21:49 am
Hola.  This is my first time using this toolkit - dfprospector specifically.  When I run the .bat file the resulting .txt only has one line:

GetConsoleScreenBufferInfo failed: 6

I'm running .25 w/ Ironhand and therapist in the background, and I paused the game before doing anything else.  What am I missing here?

[edit:]  It seems DF crashed when I ran the prospector.  Half an hour later, I gave up waiting and hard closed the game.  Thankfully I'm not losing more than a crappy artifact.
You probably didn't give the tool itself enough time. It can take up to a minute depending on the size of your embark. Closing the tool before it could finish left DF stopped, looking like it's 'crashed'. Next time this happens, run 'dfunstuck' - DF isn't running, but it's otherwise fine.

4. Fcking PROFIT!
Yep. It just fills all holes that were adamantine with walls again. Make sure your dwarves don't get stuck in the walls ;)
Title: Re: DFHack 0.5.15
Post by: danaris on June 14, 2011, 07:42:43 am
4. Fcking PROFIT!
Yep. It just fills all holes that were adamantine with walls again. Make sure your dwarves don't get stuck in the walls ;)

Um...I don't think that was the problem.

I think the problem was that it doesn't prevent the demons from spawning.  They just all spawn inside a single tile of adamantine.

This sorta defeats the purpose.
Title: Re: DFHack 0.5.15
Post by: Grax on June 14, 2011, 07:58:48 am
Yep. It just fills all holes that were adamantine with walls again. Make sure your dwarves don't get stuck in the walls ;)
But the "readme" tells me not to fear the clowns!  ;D

Fills all the 'candy stores' with 'delicious candy'. No need to fear the clowns. Don't use if you haven't seen the hidden fun stuff yet ;)

They all spawn around the single digged tile that were empty before, but without tubefill they spawns on the slade floor at lowest zlevel.
That is the strange thing.
Title: Re: DFHack 0.5.15
Post by: peterix on June 14, 2011, 08:57:15 am
Oh. !!FUN!! indeed. I'll have to check this out.

Windows part works now: http://www.youtube.com/watch?v=w4mZu8w4gXc
Title: Re: DFHack 0.5.15
Post by: strich on June 16, 2011, 12:16:52 am
Does this mean we won't be wasting time copying memory data between two processes in future, and can access data directly?
Title: Re: DFHack 0.5.15
Post by: peterix on June 16, 2011, 05:12:34 am
Does this mean we won't be wasting time copying memory data between two processes in future, and can access data directly?
Yes.
Title: Re: DFHack 0.5.15
Post by: peterix on June 16, 2011, 07:28:42 pm
Ok, this is a test release (codename Rainbow Kittens!). It's the base DF 31.25 with DFHack added to it. Just run the exe as you would normally, you'll get the DFHack console next to the normal DF window. There's no support for plugins or external tools yet and the only (real) tool that works is reveal. Anyway, enjoy. This is a taste of things to come ;)

https://github.com/downloads/peterix/dfhack/dfhack_31_25_win.zip
Title: Re: DFHack 0.5.15
Post by: MystRunner on June 16, 2011, 10:40:24 pm
I recently tried to use DF Hack in particular the dfprospector and dfreveal tools. the dfprospector crashed both times i tried to use it and the dfreveal said couldn't find a suitable process. I was using both of these tools on a running fort as I was trying to locate my flux material which I hadn't had any luck finding so far. Is there something I am doing wrong.

version of DF used DF2010 (latest release w/Mayday)
Title: Re: DFHack 0.5.15
Post by: Quietust on June 16, 2011, 10:42:04 pm
version of DF used DF2010 (latest release w/Mayday)
What's the actual version number displayed at the bottom-right corner on the title screen? When you choose "About DF", does it say that it uses SDL?
Title: Re: DFHack 0.5.15
Post by: MystRunner on June 16, 2011, 10:44:40 pm
31.25
Title: Re: DFHack 0.5.15
Post by: MystRunner on June 16, 2011, 10:51:29 pm
I did get dfgrow to work but I don't know why I'm having problems with with dfprospector and dfreveal.
Title: Re: DFHack 0.5.15
Post by: strich on June 16, 2011, 11:28:35 pm
Ok, this is a test release (codename Rainbow Kittens!). It's the base DF 31.25 with DFHack added to it. Just run the exe as you would normally, you'll get the DFHack console next to the normal DF window. There's no support for plugins or external tools yet and the only (real) tool that works is reveal. Anyway, enjoy. This is a taste of things to come ;)

https://github.com/downloads/peterix/dfhack/dfhack_31_25_win.zip
Just gave it a crack. Works fine. Nice job so far. This is all part of the DFAPI branch is it?
Title: Re: DFHack 0.5.15
Post by: Quietust on June 17, 2011, 08:29:24 am
31.25

You mean "0.31.25".
Also, you didn't say whether you were using the SDL or Legacy version...
Title: Re: DFHack 0.5.15
Post by: MystRunner on June 17, 2011, 03:24:53 pm
31.25

You mean "0.31.25".
Also, you didn't say whether you were using the SDL or Legacy version...

I'm not to sure what you mean by SDL or Legacy?
Title: Re: DFHack 0.5.15
Post by: Quietust on June 17, 2011, 04:50:14 pm
I'm not to sure what you mean by SDL or Legacy?
Read my original question again:
When you choose "About DF", does it say that it uses SDL?
Title: Re: DFHack 0.5.15
Post by: MystRunner on June 17, 2011, 10:00:13 pm
I'm not to sure what you mean by SDL or Legacy?
Read my original question again:
When you choose "About DF", does it say that it uses SDL?

Oh! SDL.
Title: Re: DFHack 0.5.15
Post by: NecroRebel on June 18, 2011, 05:44:44 am
Would it be possible to make a tool to check what animals are available on your map and, ideally, in what numbers? As I understand it, there are specific populations of non-undead animals that can enter your map from each biome, so I'd think that it would be possible to check that through memory hacking. You can get the populations of the whole world if you export a local image, but that doesn't tell you what is available on your map  :(

In the Sea Serpent Farming thread, there was briefly a question about whether or not the actual creatures that enter your map are pregenerated or if it was just the number of creatures that was definite. If the gender and attributes of the animals are determined beforehand, it would be nice to be able to get that checked, too. I think such a tool would just be helpful for anyone who wanted to make an exotic creature ranch, as they'd be able to immediately tell whether their embark had a breeding pair of that creature.
Title: Re: DFHack 0.5.15
Post by: jaxad0127 on June 18, 2011, 11:56:22 am
Would it be possible to make a tool to check what animals are available on your map and, ideally, in what numbers? As I understand it, there are specific populations of non-undead animals that can enter your map from each biome, so I'd think that it would be possible to check that through memory hacking. You can get the populations of the whole world if you export a local image, but that doesn't tell you what is available on your map  :(

In the Sea Serpent Farming thread, there was briefly a question about whether or not the actual creatures that enter your map are pregenerated or if it was just the number of creatures that was definite. If the gender and attributes of the animals are determined beforehand, it would be nice to be able to get that checked, too. I think such a tool would just be helpful for anyone who wanted to make an exotic creature ranch, as they'd be able to immediately tell whether their embark had a breeding pair of that creature.
It would be easy to list what is currently on the map. But predicting what could be? I doubt we know where that is in memory.
Title: Re: DFHack 0.5.15
Post by: Rose on June 18, 2011, 12:07:38 pm
that's actually possible to find out, it just requires a long time on the fort, testing things.
Title: Re: DFHack 0.5.15
Post by: NecroRebel on June 18, 2011, 01:19:43 pm
that's actually possible to find out, it just requires a long time on the fort, testing things.
Good to know, though I really have little idea how memory hacking like this is actually done and so I wasn't sure how much work it would actually entail. Given that, AFAIK, we don't actually know how exactly the animal migration numbers actually function, it would probably be pretty tough. Still, possibly a suggestion of a tool for future versions, right?
Title: Re: DFHack 0.5.15
Post by: Rose on June 18, 2011, 01:43:09 pm
here's what it involves:

First, do a search for all the numbers in the DF memory.

then, wait for some critters to spawn, say.. 5 groundhogs.

then, you find which number is reduced by 5.

then wait for more groundhogs to appear.

keep going and you might just find out which number is being used for the number of available groundhogs. now you have to find out what refers to that number.
Title: Re: DFHack 0.5.15
Post by: NecroRebel on June 18, 2011, 01:57:20 pm
here's what it involves:

First, do a search for all the numbers in the DF memory.

then, wait for some critters to spawn, say.. 5 groundhogs.

then, you find which number is reduced by 5.

then wait for more groundhogs to appear.

keep going and you might just find out which number is being used for the number of available groundhogs. now you have to find out what refers to that number.
...I'm hoping there's a way to generalize once you've got the memory positions for a few species instead of having to figure out each creature's memory position individually. Having to do each species one by one would be terrible  :(

Anyway, I'll leave it up to someone who actually knows what they're doing to decide if this is possible and worth the effort. Thanks for the information.
Title: Re: DFHack 0.5.15
Post by: Root Infinity on June 18, 2011, 03:36:46 pm
Would it be possibly to do a "reset" function? It would iterate through the entire map (obviously slow) recalculating tempature, passibility, and (possibly) aboveground status.
Title: Re: DFHack 0.5.15
Post by: Greiger on June 18, 2011, 05:14:05 pm
About the number of animals on the map thing, wouldn't it be possible to find that information in an uncompressed save?  Or is that stuff too complex to even begin finding useful stuff? (Other than FB and titan raws of course)
Title: Re: DFHack 0.5.15
Post by: Root Infinity on June 18, 2011, 06:53:01 pm
About the number of animals on the map thing, wouldn't it be possible to find that information in an uncompressed save?  Or is that stuff too complex to even begin finding useful stuff? (Other than FB and titan raws of course)

Hmm... Does anyone have any information about the saves (Assuming uncompressed for now...)? It would be interesting to go through them with a hex editor and a file comparer (Copy save. Change nothing, leaving game paused. Save. Anything changed? What about if you just change the view? What changed? Et cetera...) but I really don't want to duplicate any work already done (if any).
Title: Re: DFHack 0.5.15
Post by: Andux on June 18, 2011, 08:12:10 pm
Hmm... Does anyone have any information about the saves (Assuming uncompressed for now...)?

I've mainly looked at WORLD.DAT files (worlds with no active adventurer/fort), but yeah (http://df.magmawiki.com/index.php/User:Andux/Format_research).
Title: Re: DFHack 0.5.15
Post by: daego on June 19, 2011, 06:18:51 pm
I dropped the new tick offset from https://github.com/peterix/dfhack/commit/b29871cb8c3d428925f001a379441c2ba21cd840 to the master branch locally. I can confirm the offset changes (just by dumping out
Code: [Select]
d>tick_offset) but via my tools or dfposition, I don't see "Tick" ever changing from 0. I know it's not from the return 0 fall-through case.

Am I just really bad at this? I don't necessarily see other changes on the dfapi branch that would impact the offset...
Title: Re: DFHack 0.5.15
Post by: Root Infinity on June 19, 2011, 06:41:47 pm
Hmm... Does anyone have any information about the saves (Assuming uncompressed for now...)?

I've mainly looked at WORLD.DAT files (worlds with no active adventurer/fort), but yeah (http://df.magmawiki.com/index.php/User:Andux/Format_research).

Nice job so far!

You seem to have taken an entirely different approach than I would have. Interesting...
Title: Re: DFHack 0.5.15
Post by: peterix on June 19, 2011, 09:48:32 pm
Right. I have a very basic plugin system in place now working on both Windows and Linux. It's a start I guess.

And here's a current binary build for Linux. Just extract to a linux 31.25 directory and run 'dfhack' from a terminal. The terminal will be transformed into a DFHack console.
https://github.com/downloads/peterix/dfhack/dfhack-kittens.tar.gz

To have full support for plugin development, I'll have to add a few things to the build system... I want to have a binary SDK people can just download and build things on top of.

Stay tuned :D

EDIT: prospector plugin. Just drop it in. http://dethware.org/prospector.plug.so

Am I just really bad at this? I don't necessarily see other changes on the dfapi branch that would impact the offset...
Well, no idea. The offset is only for Windows... and I haven't really bothered to test it to be honest. It mainly affects dwarf beard color in stonesense...
Title: Re: DFHack 0.5.15
Post by: daego on June 19, 2011, 10:06:16 pm
I'm using Windows; no biggie. I had a status-like plugin using it that graphed and tracked the status of resources over time: http://i.imgur.com/8Tsys.png -- I swapped the graphs for random data for now but the figures are correct as far as I can tell.
Title: Re: DFHack 0.5.15
Post by: peterix on June 19, 2011, 10:14:50 pm
I'm using Windows; no biggie. I had a status-like plugin using it that graphed and tracked the status of resources over time: http://i.imgur.com/8Tsys.png -- I swapped the graphs for random data for now but the figures are correct as far as I can tell.
Looks pretty cool. Hmm. Maybe some offset hunting is in order :D
Title: Re: DFHack 0.5.15
Post by: Artanis00 on June 20, 2011, 02:11:55 am
To have full support for plugin development, I'll have to add a few things to the build system... I want to have a binary SDK people can just download and build things on top of.

Personally, I'd like to see support for plugins that are distributed by source instead of compiled binaries. Python, for example; and instead of an SDK, dfhack stuff would be in a package supplied by the plugin system.

I'm not really keen on people distributing binaries. Seems like it would be too easy to slip something nasty in.
Title: Re: DFHack 0.5.15
Post by: Rose on June 20, 2011, 02:14:20 am
To have full support for plugin development, I'll have to add a few things to the build system... I want to have a binary SDK people can just download and build things on top of.

Personally, I'd like to see support for plugins that are distributed by source instead of compiled binaries. Python, for example; and instead of an SDK, dfhack stuff would be in a package supplied by the plugin system.

I'm not really keen on people distributing binaries. Seems like it would be too easy to slip something nasty in.

I am not writing stonesense in python.

Hell.

No.
Title: Re: DFHack 0.5.15
Post by: peterix on June 20, 2011, 03:26:14 am
To have full support for plugin development, I'll have to add a few things to the build system... I want to have a binary SDK people can just download and build things on top of.

Personally, I'd like to see support for plugins that are distributed by source instead of compiled binaries. Python, for example; and instead of an SDK, dfhack stuff would be in a package supplied by the plugin system.

I'm not really keen on people distributing binaries. Seems like it would be too easy to slip something nasty in.
Well, rejoice! Before, I was getting in sideways and telling people to disable their rabid antivirus programs and poorly designed OS protections. Now I'll be distributing binaries that don't have to 'break in', so to speak. This is a massive improvement. And it's damn fast in comparison with other alternatives.

I can see how this could be used by some nasty person to do bad things, sure... but they could do it before and they'll be able to do it no matter how I change DFHack. The key thing is to *NOT* download binaries from someone you don't trust. I give you source code of everything I release. Read it. Compile it. You don't need the binaries, those are just for convenience.
Title: Re: DFHack 0.5.15
Post by: Rumrusher on June 20, 2011, 04:18:02 am
I want to know because it's not really clear to me, does new DFhack can attach to other DF programs if its in one DF folder or do I need to copy and paste the same DFhack to the others to get it to work?
Title: Re: DFHack 0.5.15
Post by: Artanis00 on June 20, 2011, 04:18:49 am
Well, rejoice! Before, I was getting in sideways and telling people to disable their rabid antivirus programs and poorly designed OS protections. Now I'll be distributing binaries that don't have to 'break in', so to speak. This is a massive improvement. And it's damn fast in comparison with other alternatives.

I can see how this could be used by some nasty person to do bad things, sure... but they could do it before and they'll be able to do it no matter how I change DFHack. The key thing is to *NOT* download binaries from someone you don't trust. I give you source code of everything I release. Read it. Compile it. You don't need the binaries, those are just for convenience.

Oh, I trust you. It's just all these other people.

I am well aware that malicious stuff could be distributed before, since we've been posting tools for a while here in various forms, just keep in mind that since DFHack is changing to a plugin system, it'll be easier and more common to grab executable binaries from (hopefully) the forum or DFFD and have DF|DFHack (an already trusted executable) run them. Like you say, ideally people will avoid downloading and running untrusted code, but only a cursory glance at the history of computer security will show that that is not going to happen.

I am also aware that a plugin in an interpreted language can be malicious, but at least it has to be distributed by source code, and is thus easily examined, and some quick searching suggests it shouldn't be too hard to sandbox the interpreter (PyPy, for example (http://codespeak.net/pypy/dist/pypy/doc/sandbox.html)).

I guess I'm trying to say, while you are building this, think about how it might also be secured.

I am not writing stonesense in python.

Hell.

No.

I wasn't saying exclusive. Just, don't stop plugins support at C/C++. Clearly, graphics intensive applications need a language with more and better graphics support. Python can do it, but I certainly agree with your sentiment on that!

On the other hand, something like Therapist could probably be handled in Python or another interpreted language with little trouble.
Title: Re: DFHack 0.5.15
Post by: peterix on June 20, 2011, 10:36:57 am
I wasn't saying exclusive. Just, don't stop plugins support at C/C++. Clearly, graphics intensive applications need a language with more and better graphics support. Python can do it, but I certainly agree with your sentiment on that!
Well, the plan is to create an external API based on the Google Protocol Buffers library. This allows describing the interface itself and then generates the required code for various languages. The data transport would have to be handled using some (local) IPC method. Then all you'd need is implement the IPC bits, let the compiler generate the protocol bits for you and be 'done' with the thing. Less maintenance for everyone is the key here. The performance could be on par with the old dfhack... maybe a bit better in some cases.

The DFHack parts won't live inside a plugin. They are tightly integrated with DF and at the same time, I'll be slowly reducing them to simple headers which don't really make sense in a plugin. What's left is the core parts - SDL wrappers, support code for the plugin system, the terminal window thing and the offset file parser. I'm thinking about turning the parser into a header generator - make it create the basic structures for you.
Title: Re: DFHack 0.5.15
Post by: doomchild on June 20, 2011, 11:42:04 am
I wasn't saying exclusive. Just, don't stop plugins support at C/C++. Clearly, graphics intensive applications need a language with more and better graphics support. Python can do it, but I certainly agree with your sentiment on that!
Well, the plan is to create an external API based on the Google Protocol Buffers library. This allows describing the interface itself and then generates the required code for various languages. The data transport would have to be handled using some (local) IPC method. Then all you'd need is implement the IPC bits, let the compiler generate the protocol bits for you and be 'done' with the thing. Less maintenance for everyone is the key here. The performance could be on par with the old dfhack... maybe a bit better in some cases.

I'm definitely looking forward to this.
Title: Re: DFHack 0.5.15
Post by: Root Infinity on June 20, 2011, 01:42:51 pm
Why does it say "Cannot get map info!" when I try to use DFImmolate?

More info:
Title: Re: DFHack 0.5.15
Post by: peterix on June 20, 2011, 02:09:03 pm
Why does it say "Cannot get map info!" when I try to use DFImmolate?

More info:
  • DF 0.31.25 Windows (XP)
  • Loo(k)ing at the (palm) tree I want to remove
OK. The attach part apparently worked, but it failed while trying to init the map. Do other tools work for you? Do you have some form of antivirus active?
Title: Re: DFHack 0.5.15
Post by: 0x517A5D on June 20, 2011, 02:10:00 pm
Ok, this is a test release (codename Rainbow Kittens!). It's the base DF 31.25 with DFHack added to it. Just run the exe as you would normally, you'll get the DFHack console next to the normal DF window. There's no support for plugins or external tools yet and the only (real) tool that works is reveal. Anyway, enjoy. This is a taste of things to come ;)

So you're not injecting a DLL using CreateRemoteThread() ?  Nor something sneaky like SetWindowsHookEx().

You're actually replacing one of the DLLs that DF loads, using DF's normal calls into that DLL to do your hooks, and then thunking chaining the call to the real DLL ?

And, I suspect, you're using the SDL.DLL because DF calls it every frame, and DF is not in the middle of simulation when that call is made.

I would not have thought of this.

Hmm.  Then every DFHack tool will be compiled into the special DLL ?  Or will there be an interprocess communication API using, say, shared memory?
Title: Re: DFHack 0.5.15
Post by: Root Infinity on June 20, 2011, 02:10:50 pm
Why does it say "Cannot get map info!" when I try to use DFImmolate?

More info:
  • DF 0.31.25 Windows (XP)
  • Loo(k)ing at the (palm) tree I want to remove
OK. The attach part apparently worked, but it failed while trying to init the map. Do other tools work for you? Do you have some form of antivirus active?

All the other tools I've tried work fine, and AVG, which reported activity, but I have an exception for the folder I have DFHack in.
Title: Re: DFHack 0.5.15
Post by: peterix on June 20, 2011, 02:53:50 pm
So you're not injecting a DLL using CreateRemoteThread() ?  Nor something sneaky like SetWindowsHookEx().

Hmm.  Then every DFHack tool will be compiled into the special DLL ?  Or will there be an interprocess communication API using, say, shared memory?
That's not cross-platform. I'd rather avoid anything like this, because it might be locked down, or otherwise limited.

The tools will be plugins, I already ported some of them.

And yes, something like that. Shared memory is similar enough between Windows and Linux... and I assume OSX has it too. At least someone tried to port DFHack to OSX using that.

I already experimented with replacing SDL and making DF talk over shared memory. It didn't end well, because DFHack was still outside DF. It normally reads tiny variables from big, sparse structures and this is sort-of OK while accessing the memory using the OS debugging APIs. It's not so good when you use a proper IPC lock together with synchronous, one at a time calls over shared memory. So I used this custom spinlock, which made it about 50x - 100x faster. On a dual core processor. While nothing else was running. And it only worked with Intel chips.

I scrapped that and this is kind of a reboot, with proper design ;) It will take some time to implement the SHM API, because this time, I'd like to get it right.
Title: Re: DFHack 0.5.15
Post by: jaxad0127 on June 20, 2011, 06:41:22 pm
Just to note, it will be possible to make DFHack accessible from remote systems as wall as the local computer, but you'll have to work to make that possible (no easy security holes here!).

I am also aware that a plugin in an interpreted language can be malicious, but at least it has to be distributed by source code, and is thus easily examined, and some quick searching suggests it shouldn't be too hard to sandbox the interpreter (PyPy, for example (http://codespeak.net/pypy/dist/pypy/doc/sandbox.html)).
Python, at least, can be distributed in a compiled form too.
Title: Re: DFHack 0.5.15
Post by: Artanis00 on June 20, 2011, 06:55:16 pm
Just to note, it will be possible to make DFHack accessible from remote systems as wall as the local computer, but you'll have to work to make that possible (no easy security holes here!).

I am also aware that a plugin in an interpreted language can be malicious, but at least it has to be distributed by source code, and is thus easily examined, and some quick searching suggests it shouldn't be too hard to sandbox the interpreter (PyPy, for example (http://codespeak.net/pypy/dist/pypy/doc/sandbox.html)).
Python, at least, can be distributed in a compiled form too.

I'm not in a position to double check at the moment, but I believe there is a switch that disables loading bytecode that doesn't have a corresponding source file.

[edit: nothing presents itself. It may be that no-one has thought this might be useful yet.]
Title: Re: DFHack 0.5.15
Post by: peterix on June 23, 2011, 05:08:39 am
All the other tools I've tried work fine, and AVG, which reported activity, but I have an exception for the folder I have DFHack in.
OK. I looked at it and I see no obvious error. The tool works too... So, no idea. I'll put together a build of prospector for the new plugin-based DFHack, for you to try. This should rule out interference from the OS.
Title: Re: DFHack 0.5.15
Post by: Root Infinity on June 23, 2011, 12:37:26 pm
All the other tools I've tried work fine, and AVG, which reported activity, but I have an exception for the folder I have DFHack in.
OK. I looked at it and I see no obvious error. The tool works too... So, no idea. I'll put together a build of prospector for the new plugin-based DFHack, for you to try. This should rule out interference from the OS.

It gets weirder... It's Windows XP (family computer), and it works fine when run from an Admin command prompt, but not when it's run from Windows Explorer as Admin. Huh...

At least I found a way to get it to work... Thank you for your time, Peterix!
Title: Re: DFHack 0.5.15
Post by: Quietust on June 23, 2011, 08:56:10 pm
Maybe there's some current-working-directory oddness or lack of environment variables messing it up?
Title: Re: DFHack 0.5.15
Post by: peterix on June 23, 2011, 09:47:18 pm
Maybe there's some current-working-directory oddness or lack of environment variables messing it up?
Well, must be something weird with Windows. When all the other tools work as they should, and prospector being able to read the PE header from DF's memory (so the base offset must be good), but not the map pointer... it's really weird. Microsoft is good at keeping the APIs quite stable, but there are differences. Must be one of them. I unfortunately can't test with XP. My XP VM is unrecoverably broken, I lost the disk image and MSDNAA won't let me redownload it.
Title: Re: DFHack 0.5.15
Post by: Khym Chanur on July 05, 2011, 04:05:56 am
Trying to compile from the latest tarball () on Linux gives:

Code: [Select]
Scanning dependencies of target dfveinlook
[ 87%] Building CXX object tools/supported/CMakeFiles/dfveinlook.dir/veinlook.cpp.o
/home/matt/temp/peterix-dfhack-da2fb1c/tools/supported/veinlook.cpp: In function ‘void puttile(int, int, int, int)’:
/home/matt/temp/peterix-dfhack-da2fb1c/tools/supported/veinlook.cpp:103: error: ‘mvwaddwstr’ was not declared in this scope

Commenting out all instances of mvwaddwstr() made it compile.



I'm trying to figure out how to use dfincremental to determine:

1) Where and how the game stores info on wild beehives and ant colonies.
2) Where and how the game stores info on site-wide population counts (like how many turtles are left to fish before extinction)

Any advice?
Title: Re: DFHack 0.5.15
Post by: peterix on July 05, 2011, 06:44:10 am
Trying to compile from the latest tarball () on Linux gives:

Code: [Select]
Scanning dependencies of target dfveinlook
[ 87%] Building CXX object tools/supported/CMakeFiles/dfveinlook.dir/veinlook.cpp.o
/home/matt/temp/peterix-dfhack-da2fb1c/tools/supported/veinlook.cpp: In function ‘void puttile(int, int, int, int)’:
/home/matt/temp/peterix-dfhack-da2fb1c/tools/supported/veinlook.cpp:103: error: ‘mvwaddwstr’ was not declared in this scope

Commenting out all instances of mvwaddwstr() made it compile.
More curses weirdness. Good thing I'm removing that bag of fail in the new dfhack... Anyway, this is a wide-character ncurses function. You need that library (and its -dev packages where applicable). Real problem here is that every distro packages these librariesslightly differently. Any solution to this problem will depend on what packages you have installed and how weird is ncurses in your distro.

I'm trying to figure out how to use dfincremental to determine:

1) Where and how the game stores info on wild beehives and ant colonies.
2) Where and how the game stores info on site-wide population counts (like how many turtles are left to fish before extinction)

Any advice?
Yes, first and foremost, get some decent tool for viewing process memory. Edb will do (evan's debugger), and will let you edit memory contents too. It's a bit sparse feature-wise compared to the windows equivalents, but it works... unlike most other things.

1) Should be quite manageable with the coord search, followed by backpointer search on the address(es) found. I already found those a few times, but never added the support into dfhack, mostly because anthills were just a flavor thing... might be interesting with the bees though :)

2) This is a bit tougher. The tool doesn't have number search for unknown values with relative increments/decrements between searches - only exact values. Shouldn't be too hard to add some kind of naive algorithm doing this, but the memory requirements with the current design (or non-design?) might be steep.
The information is also probably stored in some very non-obvious data structure (see Maps and the things that hang off the world-data address - mainly geology and local/global features. Some of it might overlap, and if you can backpointer search to it, you can save some effort.).

About the tool in general:
At first you are asked which memory regions to search. This is entered in a '##-##' format. For example '1-4' would search in regions 1-4. Make sure you include DF's static data and the heaps(mostly unnamed regions with read/write access that don't belong to any library). Omitting the DF code can remove some false positives when doing backpointer scan.

Then, pick what you want to do. Just about everything should work on linux, so that's fine. Most of the searches will ask for variable sizes, and increments between addresses to check. Most will also let you search, adjust things in DF, search again for new values, etc. (incremental search).

The backpointer scan starts with an address you give it and walks back from it, searching for pointers in the whole memory. It follows the path of those pointers... endlessly. It can be a bit slow, so make sure you build in Release mode. It also loves to go into endless goose chases across the whole DF memory. Unfortunately, I didnt include any way to stop it while it's running, so you'll have to CTRL+C out of the whole thing. Sometimes you'll have to combine it with a plain old number value search to get all the pointers to an address.

The coord search uses the position of DF's cursor to search for addresses, where the same position is stored. You can't use it to find the cursor, but placing the cursor over something you want to find, you can repeat the search incrementally. Works best with moving things obviously... and make sure there's nobody standing over the anthill or something.


If you have any further questions, check out the IRC channel. I'm around most of the time ;)
Title: Re: DFHack 0.5.15
Post by: Khym Chanur on July 05, 2011, 07:24:43 am
2) This is a bit tougher. The tool doesn't have number search for unknown values with relative increments/decrements between searches - only exact values. Shouldn't be too hard to add some kind of naive algorithm doing this, but the memory requirements with the current design (or non-design?) might be steep.

I suppose I could, for example, for deer make it have [POPULATION_NUMBER:250:250] and when 3 deer show up search for 247.

Quote
About the tool in general:
At first you are asked which memory regions to search. This is entered in a '##-##' format. For example '1-4' would search in regions 1-4. Make sure you include DF's static data and the heaps(mostly unnamed regions with read/write access that don't belong to any library). Omitting the DF code can remove some false positives when doing backpointer scan.

Sometimes between libraries there's a memory segment which doesn't belong to libraries.  Is it just the memory up to the first library that's important?

Quote
The coord search uses the position of DF's cursor to search for addresses, where the same position is stored. You can't use it to find the cursor, but placing the cursor over something you want to find, you can repeat the search incrementally. Works best with moving things obviously... and make sure there's nobody standing over the anthill or something.

I tried that and got something like this:

Spoiler (click to show/hide)

So, first, there's the error.  Second, if there hadn't been an error, would the second time I hit enter have searched on from 0x14d0fd74 to try to find a second match?[/code]
Title: Re: DFHack 0.5.15
Post by: peterix on July 05, 2011, 08:03:27 am
Sometimes between libraries there's a memory segment which doesn't belong to libraries.  Is it just the memory up to the first library that's important?
Yes. It does belong to the library. Only it's the non-static memory bits allocated by the library AFAIK. Most of them can be safely ignored. libgraphics could be a very different deal, but it's unrelated to what you search for :)
I tried that and got something like this:

Spoiler (click to show/hide)

So, first, there's the error.  Second, if there hadn't been an error, would the second time I hit enter have searched on from 0x14d0fd74 to try to find a second match?[/code]
This kind of search finds all the matches. The incremental part is related to incrementally reducing the search space, not walking some list of values one by one.

The error comes from a different source. My guess is, that you hit the linux limit of only one debugger attached to a process. When you do a search with the tool, it attaches, does the search and detaches again to accomodate running other tools. Edb isn't that nice about it and will just hog the process. Same with gdb and just about any other linux debugger.

Sometimes I get this urge to go into the kernel and rewrite the debugging API from scratch, and then make my own, actually *GOOD* debugger... The current API is riddled with terrible corner cases, bad design (Seriously, where's the threading support?) and black magic (It's something nobody seems to want to touch.) :<
Title: Re: DFHack 0.5.15
Post by: Khym Chanur on July 05, 2011, 10:04:04 am
About dfincremental's coord search, it always gives the exact same address, which I'm guessing is the game's memory location of the cursor.  If so, what use is the coord search?

The error comes from a different source. My guess is, that you hit the linux limit of only one debugger attached to a process.

Don't think it's that, since the only debugging process I have running is dfincremental.  If I'm doing a coord search, the error always happens just once per dfincremental session, usually on the first lookup, sometimes on a second lookup; after that, no errors.
Title: Re: DFHack 0.5.15
Post by: peterix on July 05, 2011, 01:18:08 pm
About dfincremental's coord search, it always gives the exact same address, which I'm guessing is the game's memory location of the cursor.  If so, what use is the coord search?

The error comes from a different source. My guess is, that you hit the linux limit of only one debugger attached to a process.

Don't think it's that, since the only debugging process I have running is dfincremental.  If I'm doing a coord search, the error always happens just once per dfincremental session, usually on the first lookup, sometimes on a second lookup; after that, no errors.
Hmm. Can you pastebin / post the list of all the memory regions you get? This seems quite strange.
Title: Re: DFHack 0.5.15
Post by: Khym Chanur on July 05, 2011, 03:05:17 pm
Pastebin of memory regions (http://pastebin.com/9uBZU4yv)
Title: Re: DFHack 0.5.15
Post by: peterix on July 05, 2011, 05:13:20 pm
Hmm... So, the thing that failed to read would be the heap. That's probably why you can't find anything. Looks like a bug, I'll have to investigate.
Title: Re: DFHack 0.5.15
Post by: Khym Chanur on July 09, 2011, 12:03:37 am
I tried adding access to the value, wall-tile and mined-out-tile for inorganic materials, but get t_maglossInorganic to compile properly was too much trouble.  So, for 0.31.25 Linux, here's the offsets (so my snooping around isn't a total waste):

* Value: offset 380, double word
* Wall tile: offset 524, single byte
* Mined out tile: offset 542, single byte

Offsets are decimal, not hexidecimal.



I noticed when looking in DF's memory via edb that the memory for the inorganic materials has junk data in it, I'm guessing because DF doesn't zero out newly allocated memory.  Is there any way to fix that, to make the real memory values clearer?
Title: Re: DFHack 0.5.15
Post by: Khym Chanur on July 10, 2011, 09:59:55 pm
Okay, I've found the memory locations of some wild colonies, and doing a backpointers search on each pointer gives nearly the same address, so it looks like there's a vector of pointers to colonies.  However, if I give a colony pointer to the "pointer vector by address of an object" function, I get 584,357 results, which doesn't sound right.  If I give an address is what I think is the middle of the pointer vector to "vector by address in its array", it gives thousands of results.

So, how do I use dfincremental to find the address of the vector?
Title: Re: DFHack 0.5.15
Post by: Khym Chanur on July 10, 2011, 11:49:46 pm
Also, if I make code to read and change wild colonies, should it be lumped with the creatures code, or should I put it in a new module?
Title: Re: DFHack 0.5.15
Post by: peterix on July 11, 2011, 04:40:58 am
Well, there should be a pointer to the start of that array of pointers. This is actually at the place where the vector itself is. So, just use the backpointer scan to find the beginning of that array. There's a chance that the pointer it jumps to next will be the vector, but to be safe, you can just feed the start of the array into the basic number search and get more pointers, if there are more pointers :)

And no, the creature stuff is tangled enough already I think. Better put it in a separate file.
Title: Re: DFHack 0.5.15
Post by: Aerval on July 24, 2011, 07:12:07 am
I am just playing a bit with dfliquids and used it to somehow "paint" a dwarven city in df with help of an ahk-script.
Spoiler (click to show/hide)
Could it be possible for dfliquids to paint other stones than obsidian or maybe at least somethings like ramps or fortifications (like in arena mode)?
Title: Re: DFHack 0.5.15
Post by: Rumrusher on July 24, 2011, 07:31:29 am
Could Dfhack take the designs of a players fort and map it to the other city sites designs so that if you visit a dark fortress the place will be model after a fort you work on before?
Though I guess first we need to know what tile spawns creatures first so we could paint in those tiles.
Title: Re: DFHack 0.5.15
Post by: Rose on July 24, 2011, 07:55:29 am
Aerval, obsidian ramps and fortifications are possible, but not other materials.
Title: Re: DFHack 0.5.15
Post by: danaris on July 24, 2011, 08:58:52 am
Could it be possible for dfliquids to paint other stones than obsidian or maybe at least somethings like ramps or fortifications (like in arena mode)?

Is there a FAQ somewhere that this could be added to?

Because it seems like every other week or so someone comes in and asks this question, and the answer is always the same...
Title: Re: DFHack 0.5.15
Post by: Aerval on July 24, 2011, 09:21:40 am
Aerval, obsidian ramps and fortifications are possible, but not other materials.
Thanks Japa

Is there a FAQ somewhere that this could be added to?

Because it seems like every other week or so someone comes in and asks this question, and the answer is always the same...
Sorry, have to agree with you. This was rather easy to find :(. Sorry again

Title: Re: DFHack 0.5.15
Post by: jaxad0127 on July 24, 2011, 03:32:31 pm
I am just playing a bit with dfliquids and used it to somehow "paint" a dwarven city in df with help of an ahk-script.
Spoiler (click to show/hide)
Could it be possible for dfliquids to paint other stones than obsidian or maybe at least somethings like ramps or fortifications (like in arena mode)?
You can paint stone and soil. You can't choose the type, yet.
Title: Re: DFHack 0.5.15
Post by: peterix on July 24, 2011, 04:21:26 pm
I am just playing a bit with dfliquids and used it to somehow "paint" a dwarven city in df with help of an ahk-script.
Spoiler (click to show/hide)
Could it be possible for dfliquids to paint other stones than obsidian or maybe at least somethings like ramps or fortifications (like in arena mode)?
You can paint stone and soil. You can't choose the type, yet.
Really, the tool doesn't allow that. So you can't. But it should be possible to paint the locally available stone and soil types... and just about anything if using veins. I'm just about to rewrite the tool as a dfapi plugin, so I might as well add that :)
Title: Re: DFHack 0.5.15
Post by: Rumrusher on July 24, 2011, 04:52:56 pm
peterix I have question for you, could someone inject a fortress model as a replacement for a non player site?
so that modders could go a step deeper with their total conversions and folks can get goblins and elves in their adventure mode.
Title: Re: DFHack 0.5.15
Post by: jaxad0127 on July 25, 2011, 01:05:28 am
I am just playing a bit with dfliquids and used it to somehow "paint" a dwarven city in df with help of an ahk-script.
Spoiler (click to show/hide)
Could it be possible for dfliquids to paint other stones than obsidian or maybe at least somethings like ramps or fortifications (like in arena mode)?
You can paint stone and soil. You can't choose the type, yet.
Really, the tool doesn't allow that. So you can't. But it should be possible to paint the locally available stone and soil types... and just about anything if using veins. I'm just about to rewrite the tool as a dfapi plugin, so I might as well add that :)
The other tool (DFTileTypes) does. I was also stating (again!) DFHack's current limits.
Title: Re: DFHack 0.5.15
Post by: Kruor on July 27, 2011, 09:58:51 am
< Total noob question inbound.

Mkay so with the complete lack of installation/use instructions ive just had to make it up as i go along.

Im using windows version btw.

Installed it just to the exe directory. Run the liquid.exe one after ive already loaded up my Fortress and... ? What ? Nothing happens. I can set water and do all the commands in the Command screen thing but have no idea how to actually make something happen with it in my game.

Am i missing something? Perhaps some actual instructions could have been included instead of JUST an overview of the various tools. I would have thought this would have been step one in releasing the tool package to the public to cater to all knowledge levels.

And the one (or two?) vids on youtube that claim to explain how to do things dont actually explain anything. They just show someone doing exactly what ive done except they get the command thing trackign cursor position, etc. No mention of how to enable that, how to place water, etc.

Sadface
Title: Re: DFHack 0.5.15
Post by: Savolainen5 on July 27, 2011, 10:16:16 am
< Total noob question inbound.

Mkay so with the complete lack of installation/use instructions ive just had to make it up as i go along.

Im using windows version btw.

Installed it just to the exe directory. Run the liquid.exe one after ive already loaded up my Fortress and... ? What ? Nothing happens. I can set water and do all the commands in the Command screen thing but have no idea how to actually make something happen with it in my game.

Am i missing something? Perhaps some actual instructions could have been included instead of JUST an overview of the various tools. I would have thought this would have been step one in releasing the tool package to the public to cater to all knowledge levels.

And the one (or two?) vids on youtube that claim to explain how to do things dont actually explain anything. They just show someone doing exactly what ive done except they get the command thing trackign cursor position, etc. No mention of how to enable that, how to place water, etc.

Sadface

You have to go into Loo(k) Around mode and put your cursor at the top left of the rectangle of water you will make.  So if you make a 2x2 rectangle of liquid, under the cursor will be the top-left square with water in it, if that makes sense.

Now, to use it, you just select what substance you want: (m)agma, (w)ater, (o)bsidian wall.  If you type help, you'll get a detailed explanation of the different things you can do to modify what you're trying to do.
Title: Re: DFHack 0.5.15
Post by: UltraValican on July 27, 2011, 12:34:40 pm
I am just playing a bit with dfliquids and used it to somehow "paint" a dwarven city in df with help of an ahk-script.
Spoiler (click to show/hide)
Could it be possible for dfliquids to paint other stones than obsidian or maybe at least somethings like ramps or fortifications (like in arena mode)?
You can paint stone and soil. You can't choose the type, yet.
Really, the tool doesn't allow that. So you can't. But it should be possible to paint the locally available stone and soil types... and just about anything if using veins. I'm just about to rewrite the tool as a dfapi plugin, so I might as well add that :)
The other tool (DFTileTypes) does. I was also stating (again!) DFHack's current limits.
How do I use this wonderful tool?(dftiletypes)
Title: Re: DFHack 0.5.15
Post by: jaxad0127 on July 27, 2011, 11:00:13 pm
(snip large comment tree)

The other tool (DFTileTypes) does. I was also stating (again!) DFHack's current limits.
How do I use this wonderful tool?(dftiletypes)
It has a similar interface to dfliquids, but a ton more options, and filtering.

You can set a paint, which is what the brush (same as dfliquid's options) will paint in your fortress.
You can set a filter, which restricts the tiles that will be changed.

Both take shape (WALL, FLOOR, etc), material (STONE, SOIL, OBSIDIAN, etc), and special (you'll normally not need to change this, but it's here for completeness; this can do ). Help will list all the available options ("help shape", for example). All options are case insensitive.

So, for example, you can change all soil floors into stone walls in a 10x10 area if you set the filter to material STONE and shape WALL, and the brush to material STONE and shape WALL.

Note that STONE means the base layer. The other stones tiles (and gems) are material VEIN. OBSIDIAN is volcano and magma pool walls and cooled magma, not obsidian layers (that's type STONE as obsidian is a base layer type). Making adamantine (material FEATSTONE) isn't guaranteed to work. I'd just use the tool to refill mined adamantine (or use dftubefill, but you can't control that one).

Most of the special types are values we think are used for mining's stages, but I don't know if they've been tested, so standard warnings apply.

Don't forget that ramps need both top (RAMP_TOP) and bottom (RAMP). The material of the top needs to be AIR or it won't be usable.

This tool might look limited in what it can do (can't change layer types or vein materials), but it's the best of what DFHack can reasonably do right now.
Title: Re: DFHack 0.5.15
Post by: Aerval on July 28, 2011, 02:49:13 am
thanks jaxad0127, now i understand dftiletypes. The clue is that you have to type "filter material soil" and not just "filter soil". Might be named in the help.
Very nice tool :D.
Title: Re: DFHack 0.5.15
Post by: Rumrusher on July 28, 2011, 05:23:45 am
This tool reminds me of a dfhack remake of tweak's tile editor which sadly still can't get to work on my pc.
Title: Re: DFHack 0.5.15
Post by: peterix on July 28, 2011, 02:10:51 pm
This tool reminds me of a dfhack remake of tweak's tile editor which sadly still can't get to work on my pc.
As part of the big rewrite of everything I'm working on, the tool will be merged with the liquids tool featurewise and rewritten pretty much completely. Probably won't get into the first dfapi release, but I'm working on it.

A lot of people like to paint circles. So I'll be adding that to it, along with a few other shapes.... and arbitrary shapes loaded from csv files possibly.
Title: Re: DFHack 0.5.15
Post by: DrKillPatient on July 28, 2011, 08:28:32 pm
How can the source be built for a 64-bit OS? I get
Quote
/usr/bin/ld: i386:x86-64 architecture of input file '/usr/lib/gcc/x86_64-unknown-linux-gnu.4.6.1/crtbeginS.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file '/usr/lib/gcc/x86_64-unknown-linux-gnu.4.6.1/crtendS.o' is incompatible with i386 output
when I try to compile on Arch x64, and I suspect the differing architectures are the problem here.
Title: Re: DFHack 0.5.15
Post by: jaxad0127 on July 29, 2011, 12:49:38 am
How can the source be built for a 64-bit OS? I get
Quote
/usr/bin/ld: i386:x86-64 architecture of input file '/usr/lib/gcc/x86_64-unknown-linux-gnu.4.6.1/crtbeginS.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file '/usr/lib/gcc/x86_64-unknown-linux-gnu.4.6.1/crtendS.o' is incompatible with i386 output
when I try to compile on Arch x64, and I suspect the differing architectures are the problem here.
Make sure the appropriate multilib packages are installed.
Title: Re: DFHack 0.5.15
Post by: peterix on July 29, 2011, 05:54:43 am
How can the source be built for a 64-bit OS? I get
Quote
/usr/bin/ld: i386:x86-64 architecture of input file '/usr/lib/gcc/x86_64-unknown-linux-gnu.4.6.1/crtbeginS.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file '/usr/lib/gcc/x86_64-unknown-linux-gnu.4.6.1/crtendS.o' is incompatible with i386 output
when I try to compile on Arch x64, and I suspect the differing architectures are the problem here.
Actually, the stuff you're building there is the not-yet-finished rewrite. The docs are out of sync with the code a lot and it's missing some of the tools. I don't mind testers, but if you want the old-style dfhack, grab the 0.5.15 tarball.

If you want to stick with this, you'll have to set up the CMAKE_INSTALL_PATH to your DF folder and 'make install' it. Then just run DF from the terminal using the dfhack script... the new dfhack runs as part of DF and hijacks the terminal window for its own terminal/console. You can run various commands from there :)
Title: Re: DFHack 0.5.15
Post by: DrKillPatient on July 29, 2011, 12:06:50 pm
That compiles (cd build, cmake, make, sudo make install), but now I get
Quote
terminate called after throwing an instance of DFHack::Error::MemoryXmlParse
what() :error 2: failed to open file at row 0 col 0
Aborted
when I run any tools. I have a feeling that this is because it can't find the memory.xml-- I've checked in /usr/share and there's acually no dfhack folder. DFhack seems to have installed to /usr/local, so it's in /usr/local/share instead. Should I just move the file to /usr/share, or did I do something wrong with the install; and in that case should I reinstall it some other way?
Title: Re: DFHack 0.5.15
Post by: peterix on July 29, 2011, 01:22:05 pm
That compiles (cd build, cmake, make, sudo make install), but now I get
Quote
terminate called after throwing an instance of DFHack::Error::MemoryXmlParse
what() :error 2: failed to open file at row 0 col 0
Aborted
when I run any tools. I have a feeling that this is because it can't find the memory.xml-- I've checked in /usr/share and there's acually no dfhack folder. DFhack seems to have installed to /usr/local, so it's in /usr/local/share instead. Should I just move the file to /usr/share, or did I do something wrong with the install; and in that case should I reinstall it some other way?
The tools can't find memory.xml. At this point, it would be probably best to remove the dfhack stuff from /usr/local and try again.

Anyway, seems like you grabbed the old dfhack and didn't read the docs. Read the COMPILE file at least:
https://github.com/peterix/dfhack/blob/0.5.15/COMPILE.rst#here-s-how-you-build-dfhack

To install, you need to set up a few variables. Otherwise it's just fine to build the thing and run tools from the resulting bin/ directory.


Title: Re: DFHack 0.5.15
Post by: DrKillPatient on July 29, 2011, 02:56:55 pm
Oh, I didn't just do 'cmake', I just summarized the process in the post above. I did the full install into the system, copied exactly from the compile readme:
Quote
cd build
cmake -DCMAKE_BUILD_TYPE:string=Release \ -DCMAKE_INSTALL_PREFIX=/usr \ -DMEMXML_DATA_PATH:path=/usr/share/dfhack ..
make
make install
But the output even said that it installed into /local, even though I set it up with the variables you mentioned.
Title: Re: DFHack 0.5.15
Post by: peterix on July 29, 2011, 04:31:17 pm
Well, that's weird. Never saw that happen before.
Anyway, all that's needed is to put the memory.xml into the place where it's expected. MEMXML_DATA_PATH is pretty much baked into the library (and the tools can obviously find it), so put the file there and it should work.
Title: Re: DFHack 0.5.15
Post by: DrKillPatient on July 29, 2011, 07:34:05 pm
This is becoming strange. The files are in the right place now, but it's still giving me that error. Here's the output of when I recompiled it and installed (removed everything I could find from the last install before that), it says it's placing memory.xml in /usr/share/dfhack, and I can confirm that it's there... but for some reason it can't be found still. Any idea what's wrong?
Spoiler (click to show/hide)
Title: Re: DFHack 0.5.15
Post by: robolee on July 30, 2011, 06:49:54 pm
I can't get it to compile:
(http://i.cubeupload.com/qMoDMZ.png)

But maybe it's because you're working on it still, do you have a link to the last "stable" source? Or perhaps it would be best to wait for the next version?

Also since I'm posting this is what I plan to make:
Spoiler (click to show/hide)
Title: Re: DFHack 0.5.15
Post by: peterix on July 30, 2011, 07:16:11 pm
I can't get it to compile:
(http://i.cubeupload.com/qMoDMZ.png)
It is impossible to use MinGW to compile dfhack on Windows (one of the reasons being that MinGW can't produce a library that would be binary-compatible with DF). You have to use MSVC 2010.

The latest stable source is pretty much obsolete by now. I'll keep it around until I'm sure people can use the new stuff, but basing anything new on it would be silly. It just can't do some of the more interesting things.

This is becoming strange. The files are in the right place now, but it's still giving me that error. Here's the output of when I recompiled it and installed (removed everything I could find from the last install before that), it says it's placing memory.xml in /usr/share/dfhack, and I can confirm that it's there... but for some reason it can't be found still. Any idea what's wrong?
Unfortunately, no. Try the portable build - running things from build/bin directly.
Title: Re: DFHack 0.5.15
Post by: robolee on July 30, 2011, 07:39:29 pm
taken from the compile.html file:
" I build dfhack using mingw."

You might want to change that.

Can't you just PM me a compiled version? Or do you mean the library now only supports visual c++ because I don't really fancy changing?
Title: Re: DFHack 0.5.15
Post by: peterix on July 30, 2011, 08:18:05 pm
taken from the compile.html file:
" I build dfhack using mingw."

You might want to change that.

Can't you just PM me a compiled version? Or do you mean the library now only supports visual c++ because I don't really fancy changing?
I guess so... although for any kind of development, you still need MSVC 2010. Even the Express version works. The docs are outdated, I know. I'll see what I can do about that.
Title: Re: DFHack 0.5.15
Post by: Pymous on August 01, 2011, 04:14:03 am
Hello all,
I want to prevent any migrants to come (even the first two waves) so I wonder if it is possible to insta-kill dwarves when they come using this utility?
Thank you.
Title: Re: DFHack 0.5.15
Post by: Rose on August 01, 2011, 05:52:09 am
No, but you can make a utility yourself using this library that insta kills dwarves.

This isn't actually a utility, per se.
Title: Re: DFHack 0.5.15
Post by: narhiril on August 01, 2011, 10:42:27 am
No, but you can make a utility yourself using this library that insta kills dwarves.

This isn't actually a utility, per se.

It's more of a drawbridge :)
Title: Re: DFHack 0.5.15
Post by: robolee on August 01, 2011, 11:24:45 am
I believe you can set [POPULATION_CAP:7] and [BABY_CHILD_CAP:0:0] to stop migrants.

I hate the MSVC IDE, so regardless of the features it has I'd rather use my preferred IDE (plus it's pure bullshit that users of MSVC apps have to have the visual c distributable), so unfortunately it seems I can't use the DFHack library. However I read up and written my own process attacher and attached to the DF program and been able to read memory... But the memory addresses from your memory.xml file don't seem to be producing the right results (pause seems to be constantly 2 and not changing and some seem random whilst many don't seem to work), can you give me any tips?
Title: Re: DFHack 0.5.15
Post by: peterix on August 01, 2011, 01:24:02 pm
I believe you can set [POPULATION_CAP:7] and [BABY_CHILD_CAP:0:0] to stop migrants.

I hate the MSVC IDE, so regardless of the features it has I'd rather use my preferred IDE (plus it's pure bullshit that users of MSVC apps have to have the visual c distributable), so unfortunately it seems I can't use the DFHack library. However I read up and written my own process attacher and attached to the DF program and been able to read memory... But the memory addresses from your memory.xml file don't seem to be producing the right results (pause seems to be constantly 2 and not changing and some seem random whilst many don't seem to work), can you give me any tips?
Yes, MSVC is bad indeed :D You can use MSVC just as a compiler and use your own IDE or editor instead. That's what I'm doing anyway - write code with KDevelop and compile with gcc on linux and MSVC 10 on Windows. The redist stuff is packaged with DF itself, so the users already have it.

And rewriting dfhack? Please, don't. If you have to hack into things, fork the 'legacy (https://github.com/peterix/dfhack/tree/legacy)' dfhack branch on github. That's the one that still hacks into things and can be compiled in anything. I'd advise against that though. Hacking in sideways into DF introduces many subtle problems (that can bite you in the *** later).
Title: Re: DFHack 0.5.15
Post by: robolee on August 01, 2011, 05:34:56 pm
I'm not rewriting dfhack, I'm just doing the stuff myself (didn't actually take anything from your code, though I did admittedly look for a bit but couldn't find the relevant code so I turned to google).

What do you mean "Hacking in sideways"? What are you doing differently?
Title: Re: DFHack 0.5.15
Post by: Rose on August 01, 2011, 05:42:23 pm
Nowadays, we're using DLL injection to make DF load up the DFhack DLL itself. DF is built using MSVC 2010, which is why DFhack needs to use it too.

this method is far neater than the sideways hacking that was done before, and is far faster, and bypasses all the OS security stuff.
Title: Re: DFHack 0.5.15
Post by: grebote on August 03, 2011, 10:38:57 pm
I tried posting this in the Stonesense megathread, but got response as of yet. Thought I'd post it here too since it seems that it might be at least partly a DFhack issue.

So when I start Stonesense I can get past the installation screen (where you press F9), but then the program crashes at that point (it says "Connecting to DF..." for about 20 seconds before crashing.)

Checking out the dump file, i get the following:

Code: [Select]
Stonesense launched
Using allegro version 5.0.0 r1
No Dwarf Fortress executable found
DFhack exeption: memory object not set: type offset key /string/MSVC/buffer
No Dwarf Fortress executable found
DFhack exeption: memory object not set: type offset key /string/MSVC/buffer
...(repeated for many lines)

I am using the SDL version of DF 31.25 on Windows 7 64-bit (with all recent updates). I have tried updating the Memory.xml file in the OP to no success. I do have a fortress loaded when I open the program. I have tried it while logged on as the administrator. Other than the xml file, I have not changed anything since DLing it from the LNP. Someone had this problem many pages ago but it didn't appear to be solved, and it sounds like I am not the only one with this problem. Anyway I'd like to be able to use this program since it looks awesome and a ton of work has gone into it.

If anyone has a work-around I'd love to hear about it!
Title: Re: DFHack 0.5.15
Post by: peterix on August 04, 2011, 12:52:37 pm
If anyone has a work-around I'd love to hear about it!
Right. The error looks like a corrupted memory.xml file more than anything else. So, make sure you download the file, not open it with a browser and then save. It could be that you downloaded a newer file. I'm making some big changes to dfhack (and stonesense), so the new files might not even be compatible.

This is the latest compatible memory file: https://raw.github.com/peterix/dfhack/legacy/Memory.xml
Title: Re: DFHack 0.5.15
Post by: grebote on August 04, 2011, 06:22:26 pm
Hmm, that didn't work either. Same problem. I DL'ed it to the DFhack directory (which didn't work), then copied it to the Stonesense directory (No go).

I get a similar error when I run dfunstuck.exe too:

Code: [Select]
memory object not set: type offset key /string/MSVC/buffer
Anyway, if your making changes to the programs, it looks like my best bet is to wait for those unless the fix is obvious, which it doesn't appear to be. Thanks for trying and I'll look forward to the changes.
Title: Re: DFHack 0.5.15
Post by: peterix on August 04, 2011, 07:16:05 pm
Hmm, that didn't work either. Same problem. I DL'ed it to the DFhack directory (which didn't work), then copied it to the Stonesense directory (No go).

I get a similar error when I run dfunstuck.exe too:

Code: [Select]
memory object not set: type offset key /string/MSVC/buffer
Anyway, if your making changes to the programs, it looks like my best bet is to wait for those unless the fix is obvious, which it doesn't appear to be. Thanks for trying and I'll look forward to the changes.
Are you running the legacy version of DF by chance? That won't work with DFHack.
Title: Re: DFHack 0.5.15
Post by: grebote on August 04, 2011, 07:33:59 pm
I'm running 31.25, the lastest version.
Title: Re: DFHack 0.5.15
Post by: jaxad0127 on August 05, 2011, 12:50:07 am
I'm running 31.25, the lastest version.
SDL?
Title: Re: DFHack 0.5.15
Post by: grebote on August 05, 2011, 07:03:57 am
Yes, I'm running the SDL version as well.
Title: Re: DFHack 0.5.15
Post by: peterix on August 06, 2011, 01:13:38 pm
grebote:
Well, I have no idea what's going on in there. I'm fairly close to a dfhack/stonesense release that should fix a lot of those silly errors. So, the best thing right now would be to wait a bit for that.
Title: Re: DFHack 0.5.15
Post by: grebote on August 06, 2011, 07:47:27 pm
Sounds good Peterix, I'm looking forward to it!
Title: Re: DFHack 0.5.15
Post by: Sentenza on August 08, 2011, 08:47:42 pm
Hi there.

I'm a Dabbling AutoIt coder (similar to AHK), and I've managed to get a code working that implements http://df.magmawiki.com/index.php/DF2010:Exploratory_mining#Diagonal_every_5 on an entire layer, but it takes... oh, about half an hour or so :P

I started looking for tools to do this a *bit* quicker, and tried out your dfvdig.exe, and found that while it does something so much more complicated (designating only a particular vein), it does it instantly, so I would assume laying out an exploratory dig grid would take it mere seconds, if it were meant to do so.

At any rate, my question is two fold: Is there a way to do what I'm looking for with dfvdig.exe? And if not, would you consider implementing this feature?

Oh, and no matter what, kudos, great work!

Kind regards,
Sentenza
Title: Re: DFHack 0.5.15
Post by: jaxad0127 on August 08, 2011, 09:54:32 pm
Hi there.

I'm a Dabbling AutoIt coder (similar to AHK), and I've managed to get a code working that implements http://df.magmawiki.com/index.php/DF2010:Exploratory_mining#Diagonal_every_5 on an entire layer, but it takes... oh, about half an hour or so :P

I started looking for tools to do this a *bit* quicker, and tried out your dfvdig.exe, and found that while it does something so much more complicated (designating only a particular vein), it does it instantly, so I would assume laying out an exploratory dig grid would take it mere seconds, if it were meant to do so.

At any rate, my question is two fold: Is there a way to do what I'm looking for with dfvdig.exe? And if not, would you consider implementing this feature?

Oh, and no matter what, kudos, great work!

Kind regards,
Sentenza
Would be easy to recode.
Title: Re: DFHack 0.5.15
Post by: peterix on August 09, 2011, 04:48:15 am
Hi there.

I'm a Dabbling AutoIt coder (similar to AHK), and I've managed to get a code working that implements http://df.magmawiki.com/index.php/DF2010:Exploratory_mining#Diagonal_every_5 on an entire layer, but it takes... oh, about half an hour or so :P

I started looking for tools to do this a *bit* quicker, and tried out your dfvdig.exe, and found that while it does something so much more complicated (designating only a particular vein), it does it instantly, so I would assume laying out an exploratory dig grid would take it mere seconds, if it were meant to do so.

At any rate, my question is two fold: Is there a way to do what I'm looking for with dfvdig.exe? And if not, would you consider implementing this feature?
Would be easy to recode.
Not with vdig, because it's based on floodfills, but it would be fairly easy to do any of the digging patterns from that page. Even the one with the ramps going through multiple z-levels.
Title: Re: DFHack 0.5.15
Post by: Sentenza on August 09, 2011, 08:03:40 am
Would be easy to recode.
Not with vdig, because it's based on floodfills, but it would be fairly easy to do any of the digging patterns from that page. Even the one with the ramps going through multiple z-levels.

Fairly easy, you say? :P

Do you mean that I should get working, and I'll manage it-fairly-easy, or that next time you have time and Urist McPrissyPants isn't demanding your attention you'll whip it together in an hour or so-faily-easy?

Edit: So far I've looked at the code, and I kinda get the idea with the MCache->setDesignation, but all the flood.stuff and the fact that I know no C++ whatsoever makes me think you didn't intend for me to get this to work.

Oh, and when I build I get a set of .exp, .lib, .pdb, .plug.dll, .plug.ilk and .plug.pdb files, not .exe's, so I couldn't even get anywhere if I could get a code together that might work...

Are there some more in depth/detailed build instructions somewhere, aimed at non professional coders?
Title: Re: DFHack 0.5.15
Post by: peterix on August 09, 2011, 02:05:28 pm
Do you mean that I should get working, and I'll manage it-fairly-easy, or that next time you have time and Urist McPrissyPants isn't demanding your attention you'll whip it together in an hour or so-faily-easy?

Edit: So far I've looked at the code, and I kinda get the idea with the MCache->setDesignation, but all the flood.stuff and the fact that I know no C++ whatsoever makes me think you didn't intend for me to get this to work.
Well, you decide :)
Oh, and when I build I get a set of .exp, .lib, .pdb, .plug.dll, .plug.ilk and .plug.pdb files, not .exe's, so I couldn't even get anywhere if I could get a code together that might work...

Are there some more in depth/detailed build instructions somewhere, aimed at non professional coders?
You already have something built, so that's cool :)

Anyway, the new dfhack I've been working on has no executable binaries, because it adds plugins to DF instead. If you follow the COMPILE doc (https://github.com/peterix/dfhack/blob/master/COMPILE.rst), you should end up with dfhack installed in a DF folder and it will add a new window to DF when you run it. Look at the README (https://github.com/peterix/dfhack/blob/master/README.rst) for some info on how to use it. I'm very close to a release with this, basically polishing things and adding help options.
Title: Re: DFHack 0.5.15
Post by: Sentenza on August 09, 2011, 05:10:39 pm
Do you mean that I should get working, and I'll manage it-fairly-easy, or that next time you have time and Urist McPrissyPants isn't demanding your attention you'll whip it together in an hour or so-faily-easy?

Edit: So far I've looked at the code, and I kinda get the idea with the MCache->setDesignation, but all the flood.stuff and the fact that I know no C++ whatsoever makes me think you didn't intend for me to get this to work.
Well, you decide :)
Oh, and when I build I get a set of .exp, .lib, .pdb, .plug.dll, .plug.ilk and .plug.pdb files, not .exe's, so I couldn't even get anywhere if I could get a code together that might work...

Are there some more in depth/detailed build instructions somewhere, aimed at non professional coders?
You already have something built, so that's cool :)

Anyway, the new dfhack I've been working on has no executable binaries, because it adds plugins to DF instead. If you follow the COMPILE doc (https://github.com/peterix/dfhack/blob/master/COMPILE.rst), you should end up with dfhack installed in a DF folder and it will add a new window to DF when you run it. Look at the README (https://github.com/peterix/dfhack/blob/master/README.rst) for some info on how to use it. I'm very close to a release with this, basically polishing things and adding help options.

I kinda missed the "into DF Folder" thing :)

But I can't get anything done in c++, syntax errors and stuff, I even fail at getting a for loop done properly.

I give up, too frustrating, and Urist McNoblePants has an appointment, with a blind cave troll...

At any rate, thanks a lot for everything, I'm looking forward to your work :P
Title: Re: DFHack 0.5.15
Post by: umphy on August 10, 2011, 02:31:41 am
It would be awesome if you could write a tool that allows one to place vegetation for parks and gardens on constructed tiles, or on obsidian tiles created with DFLiquids.  I can't get trees and grass to grow up on top of my obsidian tower :(

Anyway thanks for all your work, using DFhack to speed things up and do things I always wanted to in DF has totally revitalized my enjoyment of the game.  Especially magma forges and river sources for tons of cool waterfalls.  Cheers man.
Title: Re: DFHack 0.5.15
Post by: Carnes on August 11, 2011, 04:10:24 am
Peterix, i'm loving your DFHack so far.  But i am spooked by your upcoming release.  Will it be difficult to port old programs using DFHack to your new modular system?

I'm using DFHack in linux to grab all the dwarves from DF with DFTerm2 on it.  The dwarves are shoved into php for a "Dwarf Therapist" like application used through the web browser.  This way DFTerm2 players can all share a therapist-like view. 

I've read through the changes to the compile and readme docs.  But i haven't had time to play with your latest modular version.  Since my DF is executed by DFTerm2 and running in TEXT mode, will the DFHack console interfere with anything?  I like the idea of giving the DFTerm2 players access to DFHack utilities through putty (or whatever client they are using) but i'd like to continue executing utilities remotely.. as stand alone executables.  Right now PHP runs the DFHack utilities and pipes the output (after some formatting) to the browser.  This is what it looks like:
Spoiler (click to show/hide)

What is your advice?  Thank you for your great work :)
Title: Re: DFHack 0.5.15
Post by: Rose on August 11, 2011, 05:02:28 am
as far as I know, DFhack is configured to not mess up the console when running DF in text mode.
Title: Re: DFHack 0.5.15
Post by: peterix on August 11, 2011, 09:08:14 am
Peterix, i'm loving your DFHack so far.  But i am spooked by your upcoming release.  Will it be difficult to port old programs using DFHack to your new modular system?

I'm using DFHack in linux to grab all the dwarves from DF with DFTerm2 on it.  The dwarves are shoved into php for a "Dwarf Therapist" like application used through the web browser.  This way DFTerm2 players can all share a therapist-like view. 

I've read through the changes to the compile and readme docs.  But i haven't had time to play with your latest modular version.  Since my DF is executed by DFTerm2 and running in TEXT mode, will the DFHack console interfere with anything?  I like the idea of giving the DFTerm2 players access to DFHack utilities through putty (or whatever client they are using) but i'd like to continue executing utilities remotely.. as stand alone executables.  Right now PHP runs the DFHack utilities and pipes the output (after some formatting) to the browser.  This is what it looks like:
Spoiler (click to show/hide)

What is your advice?  Thank you for your great work :)
That's some really awesome stuff I wish I knew about earlier! I'd certainly include support for it in the design. Can I get the code from somewhere to mess with it a bit?

Right now the console detects if DF runs in TEXT mode and doesn't take over. The only way to interact with dfhack then is to use the hotkeys (only F1-F8 due to the limitations of TEXT mode).
Title: Re: DFHack 0.5.15
Post by: Carnes on August 11, 2011, 09:00:35 pm
Even eight hotkeys is great.  It's no problem to send you the utility.  I'll admit i designed it tailored to my setup but it won't be hard to pull out hardcoded stuff and make a config file.  I'll work on that as the project continues.. it's still pretty early and rough. 

I used your creaturedump.cpp example and modified it so that it only output dwarves based on argv flags.  I have yet to dive much into DFHack internal stuff.  The most i've done is convert some cerr into cout in DFProcess-linux.cpp because php doesn't deal well with it.  Even redirecting error output to standard output wasn't working quite right in php.

After this utility i'm going to make a dwarf visualizer of sorts.  Using your DFHack, i'd like to extract all the physical characteristics and descriptions of a dwarf and render him/her from a pile of pre-drawn dwarf parts (php has some great image manipulation tools).  Then dress the dwarf up with whatever wonderful socks and weapons they have in their inventory.  Their current job/action could also be part of the rendering.. eating/drinking/sleeping.  The images will be rendered in realtime from data pulled from the community fort.  So if you were to put the image into your blog, homepage, or whatever.. your dwarf should change (like losing limbs and eyes) as the game is played via DFTerm2 by other people.  Then i'd like to put some statistics and story telling elements on top of that.. like who they've killed.. a list of all engravings, statues, and items that mention their name.  This way when you dwarf yourself in game.. you'll have almost like an avatar or "status report" of your guy.

Anyways, i love your work.  It has opened up many many doors.  I hope that more people will develop using your great library in the months/years to come.  When the Therapist/Analyst utility is done-ish, i'll send you the DFHack utility code and php files.  After all, my work could not exist without yours :)
Title: Re: DFHack 0.5.15 (legacy)
Post by: peterix on August 14, 2011, 08:08:51 pm
Hello everyone!

I finally got to release the new DFHack, hopefully without too many bugs. See the new thread for further info. (http://www.bay12forums.com/smf/index.php?topic=91166.0)

From now on, this thread is meant for the legacy branch of DFHack only.
Title: Re: DFHack 0.5.15 (legacy)
Post by: Kofthefens on December 04, 2011, 06:05:09 pm
I feel like a noob, but how do you use DF hack. More specifically, how do you use the clean function?
Title: Re: DFHack 0.5.15 (legacy)
Post by: Sentenza on December 04, 2011, 08:30:25 pm
This is the thread you want: http://www.bay12forums.com/smf/index.php?topic=91166.0
Title: Re: DFHack 0.5.15 (legacy)
Post by: shadus on March 08, 2012, 10:48:30 pm
I noted there was a release of the memory.xml for 34.01 in legacy, any chance we could get an update for that to 34.05?
Title: Re: DFHack 0.5.15 (legacy)
Post by: Girlinhat on March 08, 2012, 11:12:33 pm
Just out of curiosity, why are you after legacy instead of current?

Either way, if legacy isn't being maintained as aggressively, you might only get a legacy update when Toady stops releasing bugfixes and the releases settle down.
Title: Re: DFHack 0.5.15 (legacy)
Post by: peterix on March 08, 2012, 11:18:24 pm
I noted there was a release of the memory.xml for 34.01 in legacy, any chance we could get an update for that to 34.05?
That's very unlikely to happen. 34.01 was added only so that the incremental memory search tool runs.

Actually it would be interesting, because some of the other tools still depend on memory.xml.... but I wouldn't be releasing new legacy releases. Just the file so things like runesmith can continue to work.
Title: Re: DFHack 0.5.15 (legacy)
Post by: shadus on March 09, 2012, 01:18:17 am
@peterix - That's understandable since it's legacy.  The memory.xml definitely be a huge help for things like runesmith, I know in his application thread the author said he's busy doing a dissertation and doesn't have time to work on finding the offsets at the moment, it would be neat if there was an easy way to export a memory.xml from the live version of dfhack so it wouldn't have to be done separately every update.  "This is what I know of memory offsets, dump it to a legacy compatible format" kinda thing.  Even if it wasn't perfect it'd be a good starting point.

@Girlinhat - Actually, I was spending a few hours tinkering with trying to get runesmith to work and I noticed there was an updated memory.xml (34.01) in the legacy branch, so figured I'd ask about it.  Generally no harm in asking, I greatly appreciate what all these guys do from toady all the way down the line to all the big and little apps and mods that make the game more interesting and diverse.  I actually wish I knew enough to contribute myself, but I'm a sysadmin not a programmer... I understand how to dig through a file and change the values to modify things and how to poke memory address locations to change the values of things in memory, but I'm at a bit of a loss on how to get from a memory or file location address to an offset that most save game editors/applications use.  (Eg: I know enough to be dangerous and frustrate myself, but not quite enough to be useful.)
Title: Re: DFHack 0.5.15 (legacy)
Post by: Aaarrgh! on March 31, 2013, 12:36:02 pm
Posted here by mistake, sorry!