Code Monkey home page Code Monkey logo

dfhack's Introduction

DFHack Readme

Build Status Documentation Status License Discord

DFHack is a Dwarf Fortress memory access library, distributed with scripts and plugins implementing a wide variety of useful functions and tools.

The full documentation is available online here. If you have DFHack installed, it is also accessible as raw text in the hack/docs folder. If you're an end-user, modder, or interested in contributing to DFHack -- go read those docs.

If the docs are unclear or you need more help, please check out our support page for ways to contact the DFHack developers.

dfhack's People

Contributors

ab9rf avatar alexanderfast avatar angavrilov avatar benlubar avatar bumber64 avatar cppcooper avatar dfhack-urist avatar doomchild avatar eswald avatar expwnent avatar falconne avatar jjyg avatar lethosor avatar myk002 avatar patriklundell avatar peridexiserrant avatar peterix avatar pre-commit-ci[bot] avatar quietust avatar ramblurr avatar rh73 avatar robob27 avatar rosarymala avatar shevernitskiy avatar suokko avatar tachytaenius avatar taxiservice avatar thewonderidiot avatar vallode avatar warmist avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dfhack's Issues

The Windows Process class needs better memory region enumeration

See 'pants':
void SHMProcess::getMemRanges( vector<t_memrange> & ranges )
{
t_memrange temp;
uint32_t base = d->memdescriptor->getBase();
temp.start = base + 0x1000; // more fakery.
temp.end = base + readDWord(base+readDWord(base+0x3C)+0x50)-1; // yay for magic.
temp.read = 1;
temp.write = 1;
temp.execute = 0; // fake
strcpy(temp.name,"pants");
ranges.push_back(temp);
}

Create a generic patcher with XML defined patches

In an XML file will be patches for different versions of DF and different purposes. Tools will be able to enumerate and apply the patches.

This can use hexsearch and possibly some minimal GUI (just plain terminal app or ncurses). Someone could then write the patches or apps that use them. Converting the other apps that already exist is also a possibility - embark anywhere, setting number of dwarfs on embark, nano fort, stuff like that.

SHM needs a 'debug' mode

Give the SHM a 'debug' mode, where all memory accesses are checked against the real layout of DF's memory. Encourage devs to use it for debugging. It's probably impossible to rule out all possiblilities for failure, but getting a bit closer can't hurt.
Using the 'debug' mode will obviously lead to some substantial performance hit. The user should be notified when he uses such a 'debug' mode SHM library.

Create SHM module for testing throughput

What the title says. Make it vary the message size. Both message numbers and and amount of transferred data should be tracked.

Basically:

  1. client memcpys a message to the buffer
  2. server memcpys it out and back in.
  3. client reads the message and verifies that it's the same as the one sent in the first step
  4. repeat to filter out noise.

Then we can determine the impact of other running processes, compare single core vs. multi core, etc.

fix veins

Veins have a vptr as the first DWORD. This should be used to detect their type.

This is best seen on maps with a glacier or just about any ice. Aside from the standard vein, there's a another one that stores tile IDs for tiles that have been replaced by ice walls (guessing here, but it's probably not far from the truth). When the ice melts, the ice wall ID is then replaced by the content of this 'tile ID vein'.

dfelf-b-gone

``it automatically dumps a column of 7/7 magma on any elves on map''

I approve.

ContextManager features!

It should be able to CREATE a Context.
This means spawning a DF instance as specified by the 'user'. Provide certain degree of automation -- loading of fortresses, adventure mode, pushing input.

Also: forceful Process/Context termination and management of saves.

Another thing could be the ability to specify the type of Contexts/Processes to prefer. Say, prefer normal Processes over SHM processes. This could be good for debugging, because normal Processes can't make DF segfault from accessing invalid memory.

ReadCreature -- Custom Profession -- null offset

So, trying to write a tool to walk the list of creatures, all 990 of them- in my save, anyway. There seem to be a lot of problems, but I guess I'll create issues for them one-at-a-time. My guess with this one is that, when there isn't a custom profession, a null pointer gets set, but readSTLString doesn't check the offset it finds, it just tries to read.

GNU gdb (GDB) 7.1-debian
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/pdbogen/tmp/dfhack/output/dfdd...done.
(gdb) break /home/pdbogen/tmp/dfhack/library/DFProcess-linux.cpp:557 if offset==0
No source file named /home/pdbogen/tmp/dfhack/library/DFProcess-linux.cpp.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (/home/pdbogen/tmp/dfhack/library/DFProcess-linux.cpp:557 if offset==0) pending.
(gdb) run
Starting program: /home/pdbogen/tmp/dfhack/output/dfdd 
[Thread debugging using libthread_db enabled]
990 creatures, apparently.

Breakpoint 1, DFHack::NormalProcess::readSTLString (this=0x8098880, offset=0, buffer=0xbfffe4d1 "", bufcapacity=128) at /home/pdbogen/tmp/dfhack/library/DFProcess-linux.cpp:557
557     read(offset - sizeof(_Rep_base),sizeof(_Rep_base),(uint8_t *)&header);
(gdb) print offset
$1 = 0
(gdb) continue
Continuing.
pread failed: can't read 0xc bytes at address 0xfffffff4
errno: 16
terminate called after throwing an instance of 'DFHack::Error::MemoryAccessDenied'
  what():  SHM ACCESS DENIED

Program received signal SIGABRT, Aborted.
0xb7fe2424 in __kernel_vsyscall ()
(gdb) 

"press a key to continue" prevents scripting

i'd really like to remove that, so i can i.e. run a script that calls dfcleanmap in a loop...
i dont think thats needed at all, it's like those annoying "do you really want to quit [Yes/no]" nag screens...
what do you think ?

Memory.xml rework

This is multiple issues in one.

  1. Add support for grouping of related addresses/offsets/values in the Entries -- DONE
  2. Add a Meta entry that normal entries are based upon. This contains mostly meta-data for the actual entries. There's a tendency towards this already, so let's make it official. Addresses, Offsets and Hexvalues should have descriptions. -- DONE
  3. Create a GUI tool to make working with the Memory.xml file(s) effective.
  4. All tags should be able to have dependencies on other tags.
    All tags should be able to use hexsearch strings. Those should be used mostly in meta entries.
    For example:
0x123456

Reveal and Dfvdig don't work

The reveal utility does not work at all, either to reveal or unreveal. dfvdig does not recognize any tile as being a vein.
however the prospector works consistantly

0.4.0.5 windows tool pack messed up

ive tried to redownload 3 times and it it seems that:

downloaded tool pack: dfattachtest, dfcleanmap, dfexpbench, dfflows, dfliquids, dfprobe, dfprospector, dfreveal, dfsuspend, dfunstuck, dfvdig.

html page only has the following: dfcleanmap, dfexpbench, dfflows, dfliquids, dfposition, dfprospector, dfreveal, dfsuspend, dfunstuck, dfvdig

download page at bay12forums: dfattachtest, dfcleanmap, dfexpbench, dfflows, dfposition, dfprobe, dfprospector, dfreveal, dfsuspend, dfunstuck, dfvdig, dfdoffsets

tool pack missing: dfposition, dfdoffsets

html page missing: dfattachtest, dfoffsets

download page at bay12forums missing: dfliquids

why did that happen?

Error handling is BAD

The way to handle DF crashes, invalid memory accesses and the like should be well defined.
Also define how each error and change of state of the Process class affects the modules and vice versa.

Communicate the errors properly to the client app.

Prevent segfaults from using bad modules. Possibly: On failure, bad modules are marked as such. Use smart pointers for cleanup?

Possible further Memory.xml improvements

All tags should be able to have dependencies on other tags.
All tags should be able to use hexsearch strings. Those should be used mostly in meta entries.
For example:

0x123456

Or possibly:
[20:42:28] <jj``> the 4 should be more like

0.2.0 release blockers

Linux (testing 40d16)

dfdigger always designates 10 tiles and ignores the input
dfitemdesignator has problems with some item types:
Items with badly assigned materials:
item_corpsepiece : 1
item_fish : 1
item_remains : 4

Windows

dfmaterial test seems to be locking up without a loaded map
dfincremental crashes?
SDL.dll shouldn't be built with mingw and debug builds

pread() failure: can't read 0x30 bytes at address 0xa87f1178

I get an error trying to use tools that read the map.

I've tried to use dfvdig, dfreveal, dfprospector and they all output:

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

Attempted using the 0.5.0.0 release as well as the latest in git.

I'm on openSuSE 11.3 using DF 0.31.13

40d10

Currently we don't support this version at all, which is strange, because we have every other version up to d17. From what I can tell most of the offsets are the same as d11 on windows and linux, so it shouldn't be difficult to add. That way we would have all versions from d9 on.

SHM modules!

The old creature module needs updating to support the new DF2010 creatures.
Reflect the other modules in the SHM, extend maps and creatures to allow passing multiple objects in one message, whole vectors possibly.

Vector and String addresses on windows

Right now we address vectors and strings based on the 'start' of the object, so we include 4 bytes for the allocator. It might be better to just address them starting at the actual data, the pointer to the start of the vector, or the string data directly. As it is now I have to remember to subtract 4 from all the addresses, then DFHack just adds the 4 back in. It would take some editing of the current addresses, but if it is acceptable to you guys I will do it, I think it would save us some hassle, as well as invalid addresses because I forgot to subtract 4 :)

Incremental search tool needs to refresh the segment list

Right now, the list of selected segments is determined at the start of the program. Using the feature of replacing the DF instance between searches can lead to crashes if a segment of uncertain length and position is used (like the heap).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.