Replace dfhack.internal.getBase with getRebaseDelta.

Also, when printing found offsets, subtract the delta.
develop
Alexander Gavrilov 2012-06-19 18:48:22 +04:00
parent 50dff56899
commit 50bd758876
2 changed files with 5 additions and 4 deletions

@ -1172,9 +1172,9 @@ and are only documented here for completeness:
Returns the pre-extracted vtable address ``name``, or *nil*.
* ``dfhack.internal.getBase()``
* ``dfhack.internal.getRebaseDelta()``
Returns the base address of the process.
Returns the ASLR rebase offset of the DF executable.
* ``dfhack.internal.getMemRanges()``

@ -1036,10 +1036,10 @@ static void *checkaddr(lua_State *L, int idx, bool allow_null = false)
return rv;
}
static uint32_t getBase() { return Core::getInstance().p->getBase(); }
static uint32_t getRebaseDelta() { return Core::getInstance().vinfo->getRebaseDelta(); }
static const LuaWrapper::FunctionReg dfhack_internal_module[] = {
WRAP(getBase),
WRAP(getRebaseDelta),
{ NULL, NULL }
};
@ -1074,6 +1074,7 @@ static int internal_setAddress(lua_State *L)
}
// Print via printerr, so that it is definitely logged to stderr.log.
addr -= Core::getInstance().vinfo->getRebaseDelta();
std::string msg = stl_sprintf("<global-address name='%s' value='0x%x'/>", name.c_str(), addr);
dfhack_printerr(L, msg);