MCPcopy Create free account
hub / github.com/DFHack/dfhack / internal_getMemRanges

Function internal_getMemRanges

library/LuaApi.cpp:3797–3831  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3795}
3796
3797static int internal_getMemRanges(lua_State *L)
3798{
3799 vector<DFHack::t_memrange> ranges;
3800 Core::getInstance().p->getMemRanges(ranges);
3801
3802 lua_newtable(L);
3803
3804 for(size_t i = 0; i < ranges.size(); i++)
3805 {
3806 lua_newtable(L);
3807 if (ranges[i].base) {
3808 lua_pushinteger(L, (uintptr_t)ranges[i].base);
3809 lua_setfield(L, -2, "base_addr");
3810 }
3811 lua_pushinteger(L, (uintptr_t)ranges[i].start);
3812 lua_setfield(L, -2, "start_addr");
3813 lua_pushinteger(L, (uintptr_t)ranges[i].end);
3814 lua_setfield(L, -2, "end_addr");
3815 lua_pushstring(L, ranges[i].name);
3816 lua_setfield(L, -2, "name");
3817 lua_pushboolean(L, ranges[i].read);
3818 lua_setfield(L, -2, "read");
3819 lua_pushboolean(L, ranges[i].write);
3820 lua_setfield(L, -2, "write");
3821 lua_pushboolean(L, ranges[i].execute);
3822 lua_setfield(L, -2, "execute");
3823 lua_pushboolean(L, ranges[i].shared);
3824 lua_setfield(L, -2, "shared");
3825 lua_pushboolean(L, ranges[i].valid);
3826 lua_setfield(L, -2, "valid");
3827 lua_rawseti(L, -2, i+1);
3828 }
3829
3830 return 1;
3831}
3832
3833static int internal_patchMemory(lua_State *L)
3834{

Callers

nothing calls this directly

Calls 7

lua_pushintegerFunction · 0.85
lua_setfieldFunction · 0.85
lua_pushstringFunction · 0.85
lua_pushbooleanFunction · 0.85
lua_rawsetiFunction · 0.85
getMemRangesMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected