#define LIB "/data/app-lib/com.xhtt.app.fzjh-1/libcocos2dlua.so"
void
* (*old_luaL_loadbuffer)(
void
* L,
const
char
* buff,
size_t
size,
const
char
* name);
void
* new_luaL_loadbuffer(
void
* L,
const
char
* buff,
size_t
size,
const
char
* name)
{
// 这里加入保存 buff 到内存卡的代码
void
* ret = old_luaL_loadbuffer(L, buff, size, name);
return
ret;
}
MSInitialize {
MSImageRef ref = MSGetImageByName(LIB);
void
*sym_luaL_loadbuffer= MSFindSymbol(ref,
"luaL_loadbuffer"
);
MSHookFunction(sym_luaL_loadbuffer, (
void
*)&new_luaL_loadbuffer, (
void
**)&old_luaL_loadbuffer);
};
请发表评论