Fixes for DfHack::Process foolery.

develop
Warmist 2012-03-11 14:59:32 +02:00
parent 237d7b433a
commit 081aee1363
5 changed files with 8 additions and 16 deletions

@ -46,7 +46,7 @@ DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand>
lua::state st=lua::glua::Get();
//maybe remake it to run automaticaly
lua::RegisterConsole(st);
lua::RegisterProcess(st,c->p);
lua::RegisterProcess(st);
lua::RegisterHexsearch(st);
lua::RegisterMisc(st);
lua::RegisterVersionInfo(st);

@ -8,6 +8,6 @@
namespace lua
{
void RegisterProcess(lua::state &st,DFHack::Process *p);
void RegisterProcess(lua::state &st);
}
#endif

@ -19,9 +19,9 @@ function GetTextRegion()
ranges__=Process.getMemRanges()
--print("Ranges:"..#ranges__)
for k,v in pairs(ranges__) do
--for k2,v2 in pairs(v) do
-- print(string.format("%d %s->%s",k,tostring(k2),tostring(v2)))
--end
for k2,v2 in pairs(v) do
--print(string.format("%d %s->%s",k,tostring(k2),tostring(v2)))
end
--local num
--flgs=""
--if(v["read"])then flgs=flgs..'r' end

@ -40,7 +40,7 @@ function parseTree(t)
end
function parseTreeGlobals(t)
local glob={}
print("Parsing global-objects")
--print("Parsing global-objects")
for k,v in ipairs(t) do
if v.xarg~=nil and v.label=="ld:global-object" then
local name=v.xarg["name"];

@ -2,12 +2,7 @@
static DFHack::Process* GetProcessPtr(lua::state &st)
{
int t=st.gettop();
st.getglobal("Process");
st.getfield("__pointer");
DFHack::Process* c=static_cast<DFHack::Process*>(lua_touserdata(st,-1));
st.settop(t);
return c;
return DFHack::Core::getInstance().p;
}
static int lua_Process_readDWord(lua_State *S)
@ -275,7 +270,7 @@ const luaL_Reg lua_process_func[]=
{NULL,NULL}
};
#undef PROC_FUNC
void lua::RegisterProcess(lua::state &st,DFHack::Process *p)
void lua::RegisterProcess(lua::state &st)
{
st.getglobal("Process");
if(st.is<lua::nil>())
@ -284,9 +279,6 @@ void lua::RegisterProcess(lua::state &st,DFHack::Process *p)
st.newtable();
}
st.pushlightuserdata(p);
st.setfield("__pointer");
lua::RegFunctionsLocal(st, lua_process_func);
st.setglobal("Process");