Fixes for lua5.2

develop
Warmist 2012-03-31 12:12:16 +03:00
parent 9384f0c842
commit 5a90e71c87
3 changed files with 9 additions and 6 deletions

@ -14,9 +14,9 @@ function analyzeF(off)
return pos return pos
end end
end end
function minEx(...) function minEx(list)
local imin=arg[1] local imin=list[1]
for _,v in ipairs(arg) do for _,v in ipairs(list) do
if imin> v and v~=0 then if imin> v and v~=0 then
imin=v imin=v
end end

@ -11,8 +11,7 @@ function friendship_in.patch()
pos3=offsets.find(pos+7,0xa1,DWORD_,crace) -- mov eax,[ptr] pos3=offsets.find(pos+7,0xa1,DWORD_,crace) -- mov eax,[ptr]
pos4=offsets.find(pos+7,0x66,0x8b,ANYBYTE,DWORD_,crace) -- mov ANYREG,[ptr] pos4=offsets.find(pos+7,0x66,0x8b,ANYBYTE,DWORD_,crace) -- mov ANYREG,[ptr]
--pos5=offsets.find(pos+7,0x66,0x8b,0x15,DWORD_,crace) -- mov dx,[ptr] --pos5=offsets.find(pos+7,0x66,0x8b,0x15,DWORD_,crace) -- mov dx,[ptr]
pos=minEx{pos1,pos2,pos3,pos4}
pos=minEx(pos1,pos2,pos3,pos4)
if pos ~=0 then if pos ~=0 then
hits[i]=pos hits[i]=pos
i=i+1 i=i+1
@ -28,7 +27,7 @@ function friendship_in.patch()
--TODO read offset from memory.xml --TODO read offset from memory.xml
pos1=offsets.find(myp,0x39,ANYBYTE,0x8c,00,00,00) -- compare [reg+08c] (creature race) with any reg pos1=offsets.find(myp,0x39,ANYBYTE,0x8c,00,00,00) -- compare [reg+08c] (creature race) with any reg
pos2=offsets.find(myp,0x3b,ANYBYTE,0x8c,00,00,00) -- compare any reg with [reg+08c] (creature race) pos2=offsets.find(myp,0x3b,ANYBYTE,0x8c,00,00,00) -- compare any reg with [reg+08c] (creature race)
pos=minEx(pos1,pos2) pos=minEx{pos1,pos2}
if pos ~=0 then if pos ~=0 then
if(pos-p>250) then if(pos-p>250) then

@ -14,6 +14,10 @@ function dofile_silent(filename) --safer dofile, with traceback, no file not fou
f,perr=loadfile(filename) f,perr=loadfile(filename)
if f~=nil then if f~=nil then
return xpcall(f,err) return xpcall(f,err)
else
if(string.sub(perr,1,11)~="cannot open") then --ugly hack
print(perr)
end
end end
end end
function loadall(t1) --loads all non interactive plugin parts, so that later they could be used function loadall(t1) --loads all non interactive plugin parts, so that later they could be used