some mockery with linux offset finding to test if it's working

develop
Warmist 2011-08-09 00:21:10 +03:00
parent 056fd51e96
commit eb097fc625
2 changed files with 13 additions and 8 deletions

@ -11,15 +11,15 @@ function GetTextRegion()
-- print(string.format("%d %s->%s",k,tostring(k2),tostring(v2))) -- print(string.format("%d %s->%s",k,tostring(k2),tostring(v2)))
--end --end
--local num --local num
--num=0 --flgs=""
--if(v["read"])then num=num+1 end --if(v["read"])then flgs=flgs..'r' end
--if(v["write"])then num=num+10 end --if(v["write"])then flgs=flgs..'w' end
--if(v["execute"]) then num=num+100 end --if(v["execute"]) then flgs=flgs..'e' end
--if num>=100 then --if num>=100 then
--print(string.format("%d %x->%x %s %d",k,v["start"],v["end"],v.name or "",num)) --print(string.format("%d %x->%x %s %s",k,v["start"],v["end"],v.name or "",flgs))
--end --end
local pos=string.find(v.name,".text") or string.find(v.name,"libs/Dwarf_Fortress") local pos=string.find(v.name,".text") or string.find(v.name,"libs/Dwarf_Fortress")
if(pos~=nil) then if(pos~=nil) and v["execute"] then
return v; return v;
end end
end end

@ -1,7 +1,12 @@
function f_dwarves() function f_dwarves()
pos=offsets.find(0,0x24,0x14,0x07,0,0,0,0xeb,0x08,0x8d) --search pattern --pos_=offsets.findall(0,0x07,0,0,0) --search pattern
--for _,v in pairs(pos_) do
-- print(string.format("Possible hit:%x",v))
--end
pos=offsets.find(0,0x07,0,0,0) --search pattern
print(string.format("Start dwarf position:%x",pos))
if pos~=0 then if pos~=0 then
return pos+2-offsets.base(); return pos+2-offsets.base();
else else
@ -317,4 +322,4 @@ function f_materials()
end end
return 0 return 0
end end
offsets.new("Materials",f_materials) offsets.new("Materials",f_materials)