Пример #1
0
    // Use this for initialization
    void Start()
    {
        //MethodInfo target = typeof(UnityEngine.Debug).GetMethod("LogError", new Type[] { typeof(object) });
        //MethodInfo replace = typeof(Test).GetMethod("LogError");
        //MethodInfo proxy = typeof(Test).GetMethod("LogErrorProxy");

        //UnityEngine.Debug.LogError("hello world");
        //CSharpMethodHooker hooker = new CSharpMethodHooker(target, replace, proxy);
        //hooker.Install();
        //UnityEngine.Debug.LogError("hello world");
        //hooker.Uninstall();
        //UnityEngine.Debug.LogError("hello world");

        //target = typeof(Debug).GetMethod("LogError");
        //replace = typeof(Test).GetMethod("LogErrorNative");

        //luaL_newstate();

        int i = -2;

        byte[] offset_bytes = BitConverter.GetBytes(i);
        foreach (var item in offset_bytes)
        {
            Debug.Log(item);
        }

        var l = luaL_newstate();

        Debug.Log(l);
        nativeHooker = new NativeMethodHooker("/data/app/com.amumu.test-1/lib/arm/libtolua.so", "lua_newstate", (LuaNewStateDelegate)lua_newstate_hooked);
        try
        {
            //originCall = (LuaNewStateDelegate)nativeHooker.GetProxy<LuaNewStateDelegate>();
            //l = luaL_newstate();
        }
        catch (Exception e)
        {
            Debug.LogError(e.Message);
        }
    }
Пример #2
0
        private static Delegate BindNative <T>(string funName, Delegate replace)
        {
            NativeMethodHooker result = NativeMethodHooker.HookNative(LUADLL, funName, replace);

            return(result.GetProxy <T>());
        }