Signed-off-by: Warmist <Warmist@gmail.com>
@ -25,7 +25,7 @@ public:
DEF_LUNE(Hexsearch);
};
void RegisterHexsearch(lua::state &st);//TODO remake into OO oriented thing
void RegisterHexsearch(lua::state &st);
}
@ -13,7 +13,7 @@ end
dofile("dfusion/common.lua")
print("Unlocking Df .text section...")
unlockDF()
--unlockDF()
print("Done unlock")
text=GetTextRegion()
h=hexsearch(text.start,text["end"],0x73,0x02,0x8b,0xce,0x53,0x6a,0x01,0x6a,0x06)
@ -1,7 +1,7 @@
#include "hexsearch.h"
Hexsearch::Hexsearch(const SearchArgType &args,uint64_t startpos,uint64_t endpos):args_(args),pos_(startpos_),startpos_(startpos),endpos_(endpos)
Hexsearch::Hexsearch(const SearchArgType &args,uint64_t startpos,uint64_t endpos):args_(args),pos_(startpos),startpos_(startpos),endpos_(endpos)
{
@ -36,7 +36,7 @@ uint64_t Hexsearch::FindNext() //TODO rewrite using Boyer-Moore algorithm
pos_+=args_.size();
delete [] buf;
return pos_;
return pos_-args_.size();
pos_++;
@ -24,9 +24,9 @@ lua::Hexsearch::Hexsearch(lua_State *L,int id):tblid(id)
lua::state st(L);
uint64_t start,end;
::Hexsearch::SearchArgType args;
start=st.as<uint32_t>(2);
start=st.as<uint32_t>(1);
end=st.as<uint32_t>(3);
end=st.as<uint32_t>(2);
for(int i=4;i<st.gettop();i++)
for(int i=3;i<=st.gettop();i++)
args.push_back(st.as<int>(i));